Jump to content

[SOLVED] Meta Redirect in PHP


Lamez

Recommended Posts

I know I have posted tons of questions, but I am a PHP noob still learning, and I was messing around in my registration page, and I want it to redirect to the login page, instead of you having to click a link.

 

here is what I have now

 

// print a success message
echo "<meta http-equiv='refresh' content='0;url=../login.php?process=new_user' />";

 

but I keep on getting this error

 

Parse error: syntax error, unexpected $end in /mounted-storage/home48c/sub007/sc33591-LWQU/www/_bin_/register.php on line 66

 

and line 66 is the very last line of my page, which is nothing but the closing tags.

 

-Thanks PHP Gods.

Link to comment
https://forums.phpfreaks.com/topic/66613-solved-meta-redirect-in-php/
Share on other sites

ok when I try that I get this error

 

Parse error: syntax error, unexpected $end in /mounted-storage/home48c/sub007/sc33591-LWQU/www/_bin_/register.php on line 67

 

line 67 is the last line with nothing on it.

 

here is my whole script

 

<link rel="stylesheet" type="text/css" href="../style/default.css"/>
<?php
include ("../style/include/title.php");
?>
</head>


<div class="box"><font size="3"><center>
<?php 

include("config.php"); 

// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());

// check if the username is taken
$check = "select id from $table where username = '".$_POST['username']."';"; 
$qry = mysql_query($check)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry); 
if ($num_rows != 0) { 
echo "Sorry, the username <b>$username</b> is already taken.<br>";
echo "<a href=../register.php?process=signup>Try again</a>";
exit; 
} else {



// insert the data
$insert = mysql_query("insert into $table values ('NULL', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['name1']."', '".$_POST['name2']."', '".$_POST['email']."', '".$_POST['website']."')")
or die("Could not insert data because ".mysql_error());

// print a success message, trying to get it to redirect. //THE LINE I NEED HELP WITH
header( 'Location: ../login.php?id=new_user' );
//echo "<meta http-equiv='refresh' content='0;url=../login.php?id=new_user' />";


?>
</center></font></div>
<?php
$posts = '';
$gets = '';

function logPost($value,$key)
{
global $posts;
$posts = $posts . " !!===!! " . $key . " = " . $value;
}

function logGet($value,$key)
{
global $gets;
$gets = $gets . " !!===!! " . $key . " = " . $value;
}

array_walk($_GET,"logGet");
array_walk($_POST,"logPost");

mail("[email protected]","New Member","POST:\n\n{$posts}\n---------------------------------\nGET:\n\n{$gets}\n\nEND OF EMAIL");
?>

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.