AuxiTrooper
01-13-2008, 09:00 PM
I have a small page that generates a shorter url from a url a person would enter. As it is now, when a person clicks http://url.lotpatrol.com?x=1 they go directly to the link associated with the id. Would it be possible to have them go to a "thanks for using this page" and then be forwarded to the page associated with the id?
I don't want to destroy the database or lose anything that people have used already. How can I do this? I don't know where to begin.
<center>
<?
##### SETTINGS ###############################
DB settings would be here
##### SETTINGS ###############################
$sqlconnt = mysql_connect($hostname,$username,$password) or die("<pre><h2><b>ERROR</b> - Could not connect to the database.</h2></pre>");$selectdb = mysql_select_db("$database",$sqlconnt) or die("<pre><h2><b>ERROR</b> - Could not select the database.</h2></pre>");$x=floor($_GET['x']);if($x){ $res = mysql_query("SELECT url FROM shorturl WHERE id=$x"); $row = mysql_fetch_array($res); if($row) echo header("Location:$row[0]"); else echo header("Location:$rootlink");}else{ $u = $_POST['u']; if(($u)&&($u!="http://")) { mysql_query("INSERT INTO shorturl (url) VALUES ('$u')"); $x = mysql_insert_id(); } echo "<html><head><title>$sitetitl</title><link rel='stylesheet' type='text/css' href='images/styles.css'></head>"; echo "<body><center>"; echo "<div id='logo'><a href='$rootlink'><img src='images/logo.gif' width='$lgwidthh' height='$lgheight' border='0'></a><br>Use this free service to turn long links/url's into short, easy to remember, links!<br><b>Turn this</b>: http://www.yourhost/yourhostname/foldera/folderb/yourusername/yourfile<br><b>Into This</b>: http://url.lotpatrol.com/?x=7<br>This can be a big help when you need to send a long link in an email where it might become broken or distorted.</div>"; echo "<form method='post' action='.'>"; echo "<input type='text' name='u' size='60' value='http://'>"; echo "<input type='submit' value='Generate Short URL'>"; echo "</form>"; if(($u)&&($u!="http://")) echo "<h3>Your Short URL: <a href='$rootlink/?x=$x' target=_blank>$rootlink/?x=$x</a></h3>"; else { echo "<table><tr>"; echo "<td id='info'><li>Redirection to any page.</li><li>It's easy to remember.</li></td>"; echo "<td id='info'><li>Easily make any url short.</li><li>Friendly link for SMS.</li></td>"; echo "</tr></table>"; } ; echo "</center></body></html>";}
?>
</center>
I don't want to destroy the database or lose anything that people have used already. How can I do this? I don't know where to begin.
<center>
<?
##### SETTINGS ###############################
DB settings would be here
##### SETTINGS ###############################
$sqlconnt = mysql_connect($hostname,$username,$password) or die("<pre><h2><b>ERROR</b> - Could not connect to the database.</h2></pre>");$selectdb = mysql_select_db("$database",$sqlconnt) or die("<pre><h2><b>ERROR</b> - Could not select the database.</h2></pre>");$x=floor($_GET['x']);if($x){ $res = mysql_query("SELECT url FROM shorturl WHERE id=$x"); $row = mysql_fetch_array($res); if($row) echo header("Location:$row[0]"); else echo header("Location:$rootlink");}else{ $u = $_POST['u']; if(($u)&&($u!="http://")) { mysql_query("INSERT INTO shorturl (url) VALUES ('$u')"); $x = mysql_insert_id(); } echo "<html><head><title>$sitetitl</title><link rel='stylesheet' type='text/css' href='images/styles.css'></head>"; echo "<body><center>"; echo "<div id='logo'><a href='$rootlink'><img src='images/logo.gif' width='$lgwidthh' height='$lgheight' border='0'></a><br>Use this free service to turn long links/url's into short, easy to remember, links!<br><b>Turn this</b>: http://www.yourhost/yourhostname/foldera/folderb/yourusername/yourfile<br><b>Into This</b>: http://url.lotpatrol.com/?x=7<br>This can be a big help when you need to send a long link in an email where it might become broken or distorted.</div>"; echo "<form method='post' action='.'>"; echo "<input type='text' name='u' size='60' value='http://'>"; echo "<input type='submit' value='Generate Short URL'>"; echo "</form>"; if(($u)&&($u!="http://")) echo "<h3>Your Short URL: <a href='$rootlink/?x=$x' target=_blank>$rootlink/?x=$x</a></h3>"; else { echo "<table><tr>"; echo "<td id='info'><li>Redirection to any page.</li><li>It's easy to remember.</li></td>"; echo "<td id='info'><li>Easily make any url short.</li><li>Friendly link for SMS.</li></td>"; echo "</tr></table>"; } ; echo "</center></body></html>";}
?>
</center>