solidusjoe Posted June 28, 2007 Share Posted June 28, 2007 let's try this again, my previous topic went unsolved for some time now. Basically what I am trying to do is create a page that will redirect a user to another page. however this page has to use a variable from the mysql database to know what url to send the person to, and the url of this redirection page has to carry their specific user id number as well as an id number for the site they are being sent to. Broken down, by theory it should work like this: 1. User number 123 clicks on a link to a website on one of my pages, that is supposed to direct them to the site associated with the site id 456. 2. the link would look like mysite.com/out.php?user=123&site=456 3. The out.php page would read in the url associated with id 456 and then redirect the user to that url. I hope someone can help me out because I am very stuck and this is one of the most crucial points of my project. I will also be needing to use a session ID to make sure the user is clicking on links with their own unique user id. Can someone please help me solve this problem? I'm really new to php, but I need to be able to do this. Thank you very much in advance. Quote Link to comment Share on other sites More sharing options...
chigley Posted June 28, 2007 Share Posted June 28, 2007 I don't fully understand you, but give this a try: <?php session_start(); $user = intval($_GET["user"]); $site = intval($_GET["site"]); if($_SESSION["userid"] != $user) { die("Invalid user ID"); } $query = mysql_query("SELECT url FROM table WHERE userid = {$user} AND siteid = {$site}") or die(mysql_error()); list($url) = mysql_fetch_row($query); header("Location: {$url}"); ?> Quote Link to comment Share on other sites More sharing options...
solidusjoe Posted June 28, 2007 Author Share Posted June 28, 2007 You've definitley have me going in the right direction now. Thank you for your help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.