1
0
mirror of https://github.com/gamaio/lobli.git synced 2025-01-08 17:52:50 +00:00

Linux move weirdness

I can't remember if I changed anything in this file, but it should be working last I checked
This commit is contained in:
alopexc0de 2014-07-04 17:31:52 -04:00
parent ab4010b41f
commit 1d6a2a569c

View File

@ -1,109 +1,109 @@
<?php <?php
session_start(); session_start();
$catches = explode(":", $_SESSION['catch']); $catches = explode(":", $_SESSION['catch']);
$catchid = $catches[0]; $catchid = $catches[0];
$catchVal = $catches[1]; $catchVal = $catches[1];
$seperator = ""; // Chosen because it looks like a smiling face $seperator = ""; // Chosen because it looks like a smiling face
// Returns will be in the structure: Message code / seperator / extra data and will be formatted client side // Returns will be in the structure: Message code / seperator / extra data and will be formatted client side
/* /*
Message codes: Message codes:
0 - Successful shorten 0 - Successful shorten
1 - Existing link found 1 - Existing link found
2 - Dead link 2 - Dead link
3 - Database Error 3 - Database Error
4 - Sanitize failed 4 - Sanitize failed
5 - Successful lob.li link resolve 5 - Successful lob.li link resolve
6 - Successful lookup of non-lob.li link 6 - Successful lookup of non-lob.li link
7 - Unsuccessful lookup of non-lob.li link 7 - Unsuccessful lookup of non-lob.li link
*/ */
$short = ""; $short = "";
$link = ""; $link = "";
$error = ""; $error = "";
$title = ""; $title = "";
$messages = array( $messages = array(
" "
<div class=\"alert alert-success\" id=\"success\"> <div class=\"alert alert-success\" id=\"success\">
Your link: <a href=\"http://lob.li/$short\" title=\"$title\" target=\"lobli.$short\">lob.li/$short</a> Your link: <a href=\"http://lob.li/$short\" title=\"$title\" target=\"lobli.$short\">lob.li/$short</a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\"> <a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\">
<!--<a href=\"#\" id=\"newlink\" title=\"New Link\"> This would require changing how I generate links, and I don't feel like doing it right now - 6/22/12 1:21am EST <!--<a href=\"#\" id=\"newlink\" title=\"New Link\"> This would require changing how I generate links, and I don't feel like doing it right now - 6/22/12 1:21am EST
<span class=\"glyphicon glyphicon-refresh\" style=\"float:right;\"></span> <span class=\"glyphicon glyphicon-refresh\" style=\"float:right;\"></span>
</a>--> </a>-->
<span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span> <span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span>
</a> </a>
</div> </div>
", ",
" "
<div class=\"alert alert-warning\" id=\"warning\"> <div class=\"alert alert-warning\" id=\"warning\">
Existing link: <a href=\"http://lob.li/$short\" title=\"$title\" target=\"lobli.$short\">lob.li/$short</a> Existing link: <a href=\"http://lob.li/$short\" title=\"$title\" target=\"lobli.$short\">lob.li/$short</a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\"> <a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\">
<span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span> <span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span>
</a> </a>
</div> </div>
", ",
" "
<div class=\"alert alert-danger\" id=\"danger\"> <div class=\"alert alert-danger\" id=\"danger\">
ERROR! - Your link: <a href=\"$link\" target=\"$link\">$link</a> didn't resolve to a website. <br />Please check your link and try again. ERROR! - Your link: <a href=\"$link\" target=\"$link\">$link</a> didn't resolve to a website. <br />Please check your link and try again.
</div> </div>
", ",
" "
<div class=\"alert alert-danger\" id=\"danger\"> <div class=\"alert alert-danger\" id=\"danger\">
ERROR! - Well this is embarrassing... This never happens, but I appear to have suffered a database error. <br />Here's what I know: $error ERROR! - Well this is embarrassing... This never happens, but I appear to have suffered a database error. <br />Here's what I know: $error
</div> </div>
", ",
" "
<div class=\"alert alert-danger\" id=\"danger\"> <div class=\"alert alert-danger\" id=\"danger\">
ERROR! - The sanitize function seems to have failed. This shouldn't happen, maybe <a href=\"mailto:c0de@unps.us\">c0de</a> forgot a semi-colon somewhere or something. ERROR! - The sanitize function seems to have failed. This shouldn't happen, maybe <a href=\"mailto:c0de@unps.us\">c0de</a> forgot a semi-colon somewhere or something.
</div> </div>
", ",
" "
<div class=\"alert alert-success\" id=\"success\"> <div class=\"alert alert-success\" id=\"success\">
Your Resolved link: <a href=\"$link\" title=\"$title\"> Your Resolved link: <a href=\"$link\" title=\"$title\">
<span class=\"longlink\">$link</span></a> <span class=\"longlink\">$link</span></a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('$link');\"> <a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('$link');\">
<span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span> <span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span>
</a> </a>
</div> </div>
", ",
" "
<div class=\"alert alert-warning\" id=\"warning\"> <div class=\"alert alert-warning\" id=\"warning\">
Your link: <a href=\"$link\" title=\"$title\"> Your link: <a href=\"$link\" title=\"$title\">
<span class=\"longlink2\">$link</span></a> is not a lob.li link.<br> However we found that it has been shortened. <a href=\"http://lob.li/$short\" title=\"$title\">lob.li/$short</a> <span class=\"longlink2\">$link</span></a> is not a lob.li link.<br> However we found that it has been shortened. <a href=\"http://lob.li/$short\" title=\"$title\">lob.li/$short</a>
<a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\"> <a href=\"#\" id=\"copylink\" title=\"Copy Link\" onclick=\"copyToClipboard('http://lob.li/$short');\">
<span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span> <span class=\"glyphicon glyphicon-link\" style=\"float:right;padding-right:1%;\"></span>
</a> </a>
</div> </div>
", ",
" "
<div class=\"alert alert-warning\" id=\"warning\"> <div class=\"alert alert-warning\" id=\"warning\">
Your link: <a href=\"$link\" title=\"$title\"> Your link: <a href=\"$link\" title=\"$title\">
<span class=\"longlink\">$link</span></a> is not a lob.li link and has not been shortened. <span class=\"longlink\">$link</span></a> is not a lob.li link and has not been shortened.
</div> </div>
" "
); );
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){ if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
die("<div id=\"danger\" class=\"alert alert-danger\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://lob.li\">lob.li</a>.</div>"); die("<div id=\"danger\" class=\"alert alert-danger\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://lob.li\">lob.li</a>.</div>");
} }
require('Include/PHP/functions.php'); require('Include/PHP/functions.php');
if(!empty($_POST['link'])){ if(!empty($_POST['link'])){
$short = sanitize($_POST['link']); $short = sanitize($_POST['link']);
if(strpos($short, "http://") === false && strpos($short, "https://") === false){ if(strpos($short, "http://") === false && strpos($short, "https://") === false){
$short = "http://$short"; $short = "http://$short";
} }
echo shorten($shortdb, $short, $seperator); echo shorten($shortdb, $short, $seperator);
//foreach($messages as $message){ //foreach($messages as $message){
// echo $message; // echo $message;
//} //}
}else{ die("<div id=\"danger\" class=\"alert alert-danger\">I can't do my job if I'm not given a link to work on...</div>"); } }else{ die("<div id=\"danger\" class=\"alert alert-danger\">I can't do my job if I'm not given a link to work on...</div>"); }
?> ?>