mirror of
https://github.com/gamaio/lobli.git
synced 2025-01-08 17:52:50 +00:00
Change keys, remove newlink (TEMP), align copy icon more right
As stated in the comments, I don't feel like rewriting the code to generate the links, so I'm leaving it as is right now. I will work on it at a later time
This commit is contained in:
parent
889312c35f
commit
e845309c84
@ -1,4 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Generate a token on the fly. This should prevent POST spam attacks directly into process.php
|
||||||
|
$token = substr(number_format(time() * mt_rand(),0,'',''),0,10);
|
||||||
|
$token = base_convert($token, 10, 36);
|
||||||
|
$_SESSION['token'] = $token;
|
||||||
|
|
||||||
|
$catchid = substr(number_format(time() * mt_rand(),0,'',''),0,10);
|
||||||
|
$catchVal = hash('sha256', $catchid.mt_rand().time().substr(number_format(time() * mt_rand(),0,'',''),0,10));
|
||||||
|
$catchVal = base_convert($catchVal.$catchid, 10, 36);
|
||||||
|
$_SESSION['catch'] = $catchid.":".$catchVal;
|
||||||
|
|
||||||
// exit codes:
|
// exit codes:
|
||||||
/*
|
/*
|
||||||
@ -9,9 +20,9 @@
|
|||||||
exit 11 - Shortener Stats redirection
|
exit 11 - Shortener Stats redirection
|
||||||
exit 12 - Shortener Resolver redirection
|
exit 12 - Shortener Resolver redirection
|
||||||
exit 13 - Shortener About redirection
|
exit 13 - Shortener About redirection
|
||||||
* /
|
*/
|
||||||
|
|
||||||
$shortdb = new mysqli('localhost', 'short', 'c9wx2aLL2PYqzWBM', 'short'); // Connect to link shortener DB
|
$shortdb = new mysqli('localhost', 'short', 'password', 'short'); // Connect to link shortener DB
|
||||||
if($shortdb->connect_errno > 0) die('Unable to connect to database [' . $shortdb->connect_error . '] - Check dbsettings.php');
|
if($shortdb->connect_errno > 0) die('Unable to connect to database [' . $shortdb->connect_error . '] - Check dbsettings.php');
|
||||||
|
|
||||||
// This has been depreciated. Still here for backwards compatibility with existing links
|
// This has been depreciated. Still here for backwards compatibility with existing links
|
||||||
@ -32,9 +43,9 @@
|
|||||||
if(!empty($_GET)){
|
if(!empty($_GET)){
|
||||||
$key = key($_GET);
|
$key = key($_GET);
|
||||||
|
|
||||||
if($key == "stats"){ header("location:http://lob.li/stats.php"); exit(11); }
|
if($key == "stats"){ header("location:http://s.lob.li"); exit(11); }
|
||||||
if($key == "resolv"){ header("location:http://lob.li/resolve.php"); exit(12); }
|
if($key == "resolv"){ header("location:http://r.lob.li"); exit(12); }
|
||||||
if($key == "about"){ header("location:http://lob.li/about.php"); exit(13); }
|
if($key == "about"){ header("location:http://a.lob.li"); exit(13); }
|
||||||
|
|
||||||
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($key))));
|
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($key))));
|
||||||
$link = str_replace('/', '', $link);
|
$link = str_replace('/', '', $link);
|
||||||
@ -47,8 +58,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@ -100,11 +109,11 @@
|
|||||||
<div class="alert alert-success" id="message">
|
<div class="alert alert-success" id="message">
|
||||||
Your link: <a href="#" title="HTML Title of website being shortened">lob.li/12345</a>
|
Your link: <a href="#" title="HTML Title of website being shortened">lob.li/12345</a>
|
||||||
|
|
||||||
<a href="#" id="newlink" title="New Link">
|
<!--<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>-->
|
||||||
<a href="#" id="copylink" title="Copy Link">
|
<a href="#" id="copylink" title="Copy Link">
|
||||||
<span class="glyphicon glyphicon-link" style="float:right;padding-right:2%;"></span>
|
<span class="glyphicon glyphicon-link" style="float:right;padding-right:1%;"></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user