I have script that will generate and store a link to a variable from different words entered by the user,and then display the link on the screen But i want the user to redirect to the new link as soon as the link is processed for egs-lets take tinyurl script If we give a link and a tag-it will generate the new tiny url on the screen.What i want is to redirect the user to that page as soon as the url is processed.Imagine that user don't want to see the link Pls help
hi <? //$extra contains the url which is showing on screen $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); header("Location: http://$host$uri/$extra"); exit; ?>
No i can't I will give the link http://www.softwarepudding.com/search/ enter the search word and see-it will say " Click Here to Search For your search word" I want to redirect the user instantly to the link Source code of index.php <?php define('mysql_hostname', 'localhost'); define('mysql_username', 'software_root'); define('mysql_password', 'ent12347'); define('mysql_database', 'software_url'); ob_start('relink'); $click = "Click Here to Search For "; $search = "http://www.mysearchfunds.com/dosearch.asp?cid=11924&q="; $root = "http://$_SERVER[HTTP_HOST]" . ereg_replace('/$', '', dirname($_SERVER['PHP_SELF'])) . '/'; $action = $_GET['action'] ? $_GET['action'] : ($_POST['action'] ? $_POST['action'] : ''); $connection = @mysql_connect(mysql_hostname, mysql_username, mysql_password) && @mysql_select_db(mysql_database) || die('<code>' . mysql_error() . '</code>'); switch ($action) { case 'generate_url': $parsed = @parse_url($_POST['url']); if ($parsed && strlen($_POST['url'])) { if (eregi('^[a-z0-9-]+$', $_POST['tag'])) { $tag = $_POST['tag']; $sql = "SELECT * FROM `urls` WHERE `url_tag` = '$tag' OR `url_id` = '$tag'"; $q = mysql_query($sql); $n = mysql_fetch_assoc($q); if ($n) { $cancel = true; } } if (!$cancel) { $url = ($parsed['scheme'] ? 'ftp://' : '') . (get_magic_quotes_gpc() ? mysql_real_escape_string(stripslashes($_POST['url'])) : mysql_real_escape_string($_POST['url'])); $sql = "INSERT INTO `urls` (`url_location`, `url_tag`) VALUES ('$url', '$_POST[tag]')"; $q = mysql_query($sql); $id = mysql_insert_id(); $result = '<a href="' . $search . $url . '">' . $click . $url . '</a>'; } else { $result = '<a href="' . $search . $url . '">' . $click . $url . '</a>'; } } if ((bool) $_POST['javascript']) { header('Content-Type: text/plain'); die($result); } break; case 'redirect': if (is_numeric($_GET['id']) || eregi('^[a-z0-9-]+$', $_GET['tag'])) { if (!$_GET['tag']) { $sql = "SELECT * FROM `urls` WHERE `url_id` = $_GET[id]"; } else { $sql = "SELECT * FROM `urls` WHERE `url_tag` = '$_GET[tag]'"; } $q = mysql_query($sql); $r = mysql_fetch_assoc($q); header("Location: $r[url_location]"); exit; } else { header("Location: $root"); exit; } break; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Get Paid To Search" /> <meta name="keywords" content="Paid to search" /><title>Pay Per Search-Get Paid to Search</title><link href="/css/main.css" rel="stylesheet" /><link href="/img/favicon.png" rel="shortcut icon" /><script language="javascript" type="text/javascript"> root = '<?php echo ereg_replace('/$', '', $root); ?>'; </script> <script language="javascript" type="text/javascript" src="/js/main.js"></script> </head> <body> <div id="header"> <h1><a href="/" title="Get Paid to Search">Paid To Search</a></h1> </div><br> <form method="post" action="/" id="form"> <input type="hidden" name="action" value="generate_url" /> <h3><label for="url">Type the word to be searched and press "ENTER"</label></h3> <input type="text" name="url" id="url" class="input" /> <div id="result"><?php echo $result ? $result : ''; ?></div> </form> <div id="footer"> <br><br><a href="http://www.softwarepudding.com/search/join.php">Join"Paid To Search" and Make Money</a> </div> </body> </html> <?php function relink ($buffer) { global $root; return preg_replace('#(href|src|action)="/#i', '\\1="' . $root, $buffer); } ?> Code (markup):
its not printing anything buddy you said its printing the url I see an error page cannot be displayed Regards alex