1
0
mirror of https://github.com/gamaio/lobli.git synced 2024-12-22 19:52:40 +00:00

Add forgotten semicolon on line 52.

I was wondering why my script had suddenly stopped working and thought it was
    a Redis problem.
Turns out that I was getting PHP parse errors and didn't check the logs
This commit is contained in:
alopexc0de 2014-07-22 13:08:15 -04:00
parent c02e6d6f28
commit 9cabd24d19
No known key found for this signature in database
GPG Key ID: 48E847F18074C953

View File

@ -19,7 +19,7 @@
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($link)))); $link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($link))));
$link = str_replace('/', '', $link); $link = str_replace('/', '', $link);
$sql = "SELECT * FROM `tracking` WHERE `id` = '$link' LIMIT 1;"; // Testing to see if the link has been visited before $sql = "SELECT * FROM `tracking` WHERE `id` = '$link' LIMIT 1;"; // Testing to see if the link has been visited before
if($result = $shortdb->query($sql)){ if($result = $shortdb->query($sql)){
if($row = $result->fetch_assoc()){ if($row = $result->fetch_assoc()){
$sql = "UPDATE `tracking` SET `clicks` = `clicks` + 1 WHERE `id` = '$link'"; // Yes it has, increment clicks by 1 $sql = "UPDATE `tracking` SET `clicks` = `clicks` + 1 WHERE `id` = '$link'"; // Yes it has, increment clicks by 1
@ -41,7 +41,7 @@
// Try to find it in the redis db first, if not there, add it // Try to find it in the redis db first, if not there, add it
$short = $redis->get($link); $short = $redis->get($link);
if (!$short) { if (!$short || $short == null) {
$sql = "SELECT * FROM `links` WHERE `shortlink` = '$link' LIMIT 1;"; $sql = "SELECT * FROM `links` WHERE `shortlink` = '$link' LIMIT 1;";
if($result = $shortdb->query($sql)){ if($result = $shortdb->query($sql)){
if($row = $result->fetch_assoc()){ if($row = $result->fetch_assoc()){
@ -49,12 +49,16 @@
$redis->set($link, $llink); $redis->set($link, $llink);
echo $llink echo $llink;
//header("location:$link"); //header("location:$link");
exit(5); // Stop script execution to save on resources exit(5); // Stop script execution to save on resources
} }
} }
}else{
echo $short;
exit(5);
}
} }
// exit codes: // exit codes: