-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test coverage for incoming links counter
Relates to #9
- Loading branch information
Showing
2 changed files
with
65 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,27 @@ | ||
<?php | ||
error_reporting(E_ALL); | ||
|
||
/* Includes importeren */ | ||
include('Includes/connect.php'); | ||
include('Includes/slashes.php'); | ||
|
||
/* Verbinding met de database maken */ | ||
connectDB(); | ||
|
||
/* Controleren of er een id is meegegeven */ | ||
if(isset($_GET['id'])) | ||
{ | ||
$sQuery = "UPDATE links SET outcomming=outcomming+1 WHERE linkid='" . add($_GET['id']) . "';"; | ||
if(mysql_query($sQuery)) | ||
{ | ||
$sQuery = "SELECT url FROM links WHERE linkid='" . add($_GET['id']) . "';"; | ||
if($cResult = mysql_query($sQuery)) | ||
{ | ||
$aData = mysql_fetch_assoc($cResult); | ||
header('Location: ' . $aData['url']); | ||
} | ||
else | ||
{ | ||
header('HTTP/1.0 404'); | ||
} | ||
} | ||
else | ||
{ | ||
header('HTTP/1.0 404'); | ||
} | ||
} | ||
else | ||
{ | ||
header('HTTP/1.0 404'); | ||
} | ||
?> | ||
<?php | ||
error_reporting(E_ALL & ~E_DEPRECATED); | ||
|
||
/* Includes importeren */ | ||
include_once('Includes/connect.php'); | ||
include_once('Includes/slashes.php'); | ||
|
||
/* Verbinding met de database maken */ | ||
connectDB(); | ||
|
||
/* Controleren of er een id is meegegeven */ | ||
if (isset($_GET['id'])) { | ||
$sQuery = "UPDATE links SET outcomming=outcomming+1 WHERE linkid='" . add($_GET['id']) . "';"; | ||
if (mysql_query($sQuery)) { | ||
$sQuery = "SELECT url FROM links WHERE linkid='" . add($_GET['id']) . "';"; | ||
if ($cResult = mysql_query($sQuery)) { | ||
$aData = mysql_fetch_assoc($cResult); | ||
header('Location: ' . $aData['url']); | ||
} else { | ||
header('HTTP/1.0 404'); | ||
} | ||
} else { | ||
header('HTTP/1.0 404'); | ||
} | ||
} else { | ||
header('HTTP/1.0 404'); | ||
} |