-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.php
More file actions
59 lines (55 loc) · 1.81 KB
/
go.php
File metadata and controls
59 lines (55 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_MyConn = "localhost";
$database_MyConn = "test";
$username_MyConn = "root";
$password_MyConn = "";
$MyConn = mysql_pconnect($hostname_MyConn, $username_MyConn, $password_MyConn) or trigger_error(mysql_error(),E_USER_ERROR);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$colname_rsShortURL = "-1";
if (isset($_GET['ID'])) {
$colname_rsShortURL = $_GET['ID'];
}
mysql_select_db($database_MyConn, $MyConn);
$query_rsShortURL = sprintf("SELECT * FROM tblShortURLs WHERE FKeyID = %s", GetSQLValueString($colname_rsShortURL, "int"));
$rsShortURL = mysql_query($query_rsShortURL, $MyConn) or die(mysql_error());
$row_rsShortURL = mysql_fetch_assoc($rsShortURL);
$totalRows_rsShortURL = mysql_num_rows($rsShortURL);
if ($totalRows_rsShortURL > 0){
header("Location:".$row_rsShortURL["FURL"]);
}
else{
header("Location:http://blog.karlwang.com");
}
?>