From b34e2db558dc80e99d1d7451934aef11009f8d98 Mon Sep 17 00:00:00 2001 From: Arctic Code Date: Wed, 25 Dec 2013 20:54:37 -0600 Subject: [PATCH] Include more mobile friendly version Basically exactly the same, but it scales better with almost everything stripped out --- mobile/index.php | 101 +++++++++++++++++++++++++++++++++++++++++++++ mobile/navbar.php | 54 ++++++++++++++++++++++++ mobile/process.php | 59 ++++++++++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 mobile/index.php create mode 100644 mobile/navbar.php create mode 100644 mobile/process.php diff --git a/mobile/index.php b/mobile/index.php new file mode 100644 index 0000000..6f35546 --- /dev/null +++ b/mobile/index.php @@ -0,0 +1,101 @@ +real_escape_string(strtolower(stripslashes(strip_tags($_GET['l'])))); + $sql = "SELECT * FROM `links` WHERE `shortlink` = '$link' LIMIT 1;"; + if($result = $shortdb->query($sql)){ + if($row = $result->fetch_assoc()){ + $link = $row['link']; + header("location:$link"); + } + } + } + + if(isset($_GET['newbg'])){ + echo ""; + } + + function userpic($email){ + $default = "http://fox.gy/fCDIjceUvkk.png"; + $size = 20; + $grav_url = "http://www.gravatar.com/avatar/".md5(strtolower(trim($email)))."?d=".urlencode($default)."&s=".$size; + return $grav_url; + } +?> + + + + UnPS Link Shortener + + + + + + + + + + + + + + + + +
+ + +
+
+

Please give me a link to shorten...

+ + + + + +
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/mobile/navbar.php b/mobile/navbar.php new file mode 100644 index 0000000..65c2027 --- /dev/null +++ b/mobile/navbar.php @@ -0,0 +1,54 @@ +"); + } + + require('api/api.backend.php'); + require('api/dbsettings.php'); + + $key = '9a211e90b0a0570ed33e47428231e702af47b6f54fb347960f661184e063a1d0'; // KEEP THIS PRIVATE! This is the only thing that authenticates the application + + function sanitize($input){ + if ($input == null) die("
Sanatize() - No Input Provided, Aborting
"); + include('api/dbsettings.php'); + $output = strip_tags($input); + $output = stripslashes($output); + $output = $apidb->real_escape_string($output); + return $output; + } + + $unpsAPI = new api(); + + if(!empty($_POST['link']) && !empty($_POST['linkmod'])){ + switch ($_POST['linkmod']){ + case "shorten": + $short = sanitize($_POST['link']); + if(strpos($short, "http://") === false && strpos($short, "https://") === false){ + $short = "http://$short"; + } + echo $unpsAPI->shorten($apidb, $key, $shortdb, $short); + break; + case "dellink": + if(empty($_POST['password'])) die("
Something went wrong somewhere, but there's no password here
"); + $link = sanitize($_POST['link']); + $password = sanitize($_POST['password']); + $link = explode("=", $link); + if(count($link) != 2){ + die("
I'm sorry, but something went wrong... did you paste the whole link?
"); + } + $link = $link[1]; + echo $unpsAPI->delShort($apidb, $key, $shortdb, $link, $password); + break; + case "replink": + if(empty($_POST['report-details'])) die("
Something went wrong somewhere, but I can't find the reason for reporting this link
"); + $link = sanitize($_POST['link']); + $details = sanitize($_POST['report-details']); + echo $unpsAPI->reportLink($apidb, $key, $shortdb, $link, $details); + break; + default: + die("
I don't know what you want to do... [-Check linkmod-]
"); + } + }else{ die("
I can't do my job if I'm not given a link to work on...
"); } + +?> \ No newline at end of file