kernelgpf Posted December 20, 2006 Share Posted December 20, 2006 Basically, when a user visits a page, the DB logs the users last viewed page. When the user logs on, I want it to take them to the page they were last looking at.. this code seems to just refresh the page over and over again, not take them to the URL specified.. this is the top of my index.php file.[code]<?phpsession_start();if($_SESSION['id']){include "config.php";$sid=$_SESSION['id'];$query=mysql_query("select viewingpage from users where id='$sid'");$row=mysql_fetch_array($query);if(empty($row[viewingpage])){$row[viewingpage]="/userarea.php";}print "<META HTTP-EQUIV=\"Refresh\" Content=0; URL=\"http://www.dragon-dynasty.com$row[viewingpage]\">";exit; }?>[/code]..help? Quote Link to comment Share on other sites More sharing options...
kernelgpf Posted December 20, 2006 Author Share Posted December 20, 2006 bump. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted December 20, 2006 Share Posted December 20, 2006 you could just use $_SERVER['HTTP_RERFERER'];but try this:[code=php:0]print "<META HTTP-EQUIV=\"Refresh\" Content=0; URL=\"http://www.dragon-dynasty.com".$row['viewingpage']."\">";[/code]you should always use ' and ' in arrays and dont use them inside talking marks.like this:[code=php:0]echo "Hello there $row['username']";[/code]Hope thats what your after though... Otherwise use HTTP_REFERER... Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted December 21, 2006 Share Posted December 21, 2006 instead of writing the refresh via meta tags use..header('Location: ' . $last_url );You can take teh opportunity to build the $last_url page based on teh info you extract from the data you stored.The header must come before you output any html or whitespace. 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.