Skippy
02-18-2010, 04:30 PM
I'm currently trying to return a link from the database, then insert this link into another table of the database then redirect to the link.
Here is my code so far:
<?php
session_start();
require ("connect.php");
require("functions.php");
if(!isset($_SESSION['status'])){
die('You need to <a href="login.php">login</a> before you can access the members area!');
}else{
$link = mysql_real_escape_string($_GET['link']);
$title = mysql_real_escape_string($_GET['title']);
mysql_query("INSERT into pending (`userID`, `username`, `offerID`, `offername`, `value`, `status`, `ip`, `date`) VALUES('0', '0', '0', '$title', '0', '0', '0', '0')") or die(mysql_error());
}
header( 'Location: {$_GET['link']}' ) ;
exit;
?>
When a user goes to http://www.mysite.com/redirect.php?target=http://link.com&title=nuhnbhui it inserts the title into the database. The problem I have is redirecting. I get an error:
Parse error: syntax error, unexpected T_STRING in /home/shuffled/public_html/RedPrint/ISS/demo/redirect.php on line 16
Line 16 is header( 'Location: {$_GET['link']}' ) ;
What am I doing wrong?
Thanks.
Here is my code so far:
<?php
session_start();
require ("connect.php");
require("functions.php");
if(!isset($_SESSION['status'])){
die('You need to <a href="login.php">login</a> before you can access the members area!');
}else{
$link = mysql_real_escape_string($_GET['link']);
$title = mysql_real_escape_string($_GET['title']);
mysql_query("INSERT into pending (`userID`, `username`, `offerID`, `offername`, `value`, `status`, `ip`, `date`) VALUES('0', '0', '0', '$title', '0', '0', '0', '0')") or die(mysql_error());
}
header( 'Location: {$_GET['link']}' ) ;
exit;
?>
When a user goes to http://www.mysite.com/redirect.php?target=http://link.com&title=nuhnbhui it inserts the title into the database. The problem I have is redirecting. I get an error:
Parse error: syntax error, unexpected T_STRING in /home/shuffled/public_html/RedPrint/ISS/demo/redirect.php on line 16
Line 16 is header( 'Location: {$_GET['link']}' ) ;
What am I doing wrong?
Thanks.