Jump to content

Help with META tag?


kernelgpf

Recommended Posts

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]<?php
session_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?
Link to comment
https://forums.phpfreaks.com/topic/31413-help-with-meta-tag/
Share on other sites

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...
Link to comment
https://forums.phpfreaks.com/topic/31413-help-with-meta-tag/#findComment-145520
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/31413-help-with-meta-tag/#findComment-145561
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.