Skip to content

Instantly share code, notes, and snippets.

View kbrmedia's full-sized avatar
🤓
Working on a cool new project

GemPixel kbrmedia

🤓
Working on a cool new project
View GitHub Profile
@kbrmedia
kbrmedia / Shortener.API.Function.php
Last active December 5, 2018 00:27
Sample shortener API Function
<?php
define("SHORTENER_URL", "http://yoursite.com");
define("SHORTENER_KEY", "123456789");
/**** Sample PHP Function ***/
function shorten($url, $custom = "", $format = "json") {
$api_url = SHORTENER_URL."/api/?key=".SHORTENER_KEY;
$api_url .= "&url=".urlencode(filter_var($url, FILTER_SANITIZE_URL));
if(!empty($custom)){
@kbrmedia
kbrmedia / stats.txt
Created November 13, 2018 03:23
Statistics data for a short URL
GET http://yourwebsite.com/api/details
@kbrmedia
kbrmedia / users.txt
Created November 13, 2018 03:26
All of your Short URLs
GET http://yourwebsite.com/api/urls
@kbrmedia
kbrmedia / user.list.php
Last active January 31, 2019 19:45
User List for Premium URL Shortener
<?php
// Get users list who have their profile set to public
$users = $this->db->get("user", ["public" => "1"], ["limit"=>(($this->page-1)*$this->limit).", {$this->limit}","count"=>TRUE]);
// Generate Pagination
if(($this->db->rowCount%$this->limit)<>0) {
$max=floor($this->db->rowCount/$this->limit)+1;
} else {
$max=floor($this->db->rowCount/$this->limit);
}
@kbrmedia
kbrmedia / qr.code.md
Last active March 4, 2019 16:42
QR Code Blocked in Some Countries

Open the file includes/Short.class.php and go to line 1061 to find the code below

$api_url = "http://chart.apis.google.com/chart?chs=$size&chld=L|0&choe=UTF-8&cht=qr&chl=".urlencode((!empty($url->domain) ? $url->domain : $this->config["url"])."/{$this->action}?source=qr");	

Right after that line add

header("Location: $api_url");
exit;

That is it

@kbrmedia
kbrmedia / fix.md
Last active April 22, 2020 00:02
Splash Page Fix Premium URL Shortener

To fix the issue, open the file includes/User.class.php go to line 1673 to find

if(($width < 500 && $height < 500) || ($width/$height) != 1)	return Main::redirect("user/splash/create",array("danger",e("Avatar must be either a 100x100 PNG or a JPEG (Max 300KB).")));	

and replace that by

if(($width &gt; 500 &amp;&amp; $height &gt; 500) || ($width/$height) != 1)	return Main::redirect("user/splash/create",array("danger",e("Avatar must be either a 100x100 PNG or a JPEG (Max 300KB).")));