nrodes
Nov 9th 2008, 12:04 pm
I've been making a a login script and I'm working on the registration page. I'm not that great with php at all and I've just been teaching myself. I'm getting an error that I don't understand. Could somebody help?
Error:
Fatal error: Call to undefined function head() in C:\Program Files\Abyss Web Server\htdocs\forum\login\register.php on line 38
Scriopt:
<?php
//get form info
$firstname=$_POST["firstname"];
$lastname=$_POST["lastname"];
$username=$_POST["username"];
$password=$_POST["password"];
$confirmpassword=$_POST["confirmpassword"];
$emailaddress=$_POST["emailaddress"];
$secretquestion=$_POST["secretquestion"];
$secretanswer=$_POST["secretanswer"];
//make variables some encrypt
$cpass = md5($password);
$cconfirmpass = md5($confirmpassword);
$cuser = md5($username);
$csecretanswer = md5($secretanswer);
$file = "users/" . $username . ".php";
$data = "<?php $cpass=" . $cpass . "; $cuser=" . $cuser . "; $firstname=" . $firstname . "; $lastname=" . $lastname . "; $secretquestion=" . $secretquestion . "; $csecretanswer=" . $csecretanswer . " ?>";
//make sure all info is ok
if ($password!=$confirmpassword)
{
echo 'Your passwords do not match. <A HREF="javascript:history.go(-1)">Try Again</A><br>'; exit(0);
}
elseif (file_exists($file))
{
echo 'Username is in use. <A HREF="javascript:history.go(-1)">Try Again</A><br>'; exit(0);
}
else
{
//make users file and redirect
$handle = fopen($file, 'w');
fwrite($handle, $data);
fclose($handle);
head ( 'location: index.htm' );
}
?>
Thanks in advance :)
Error:
Fatal error: Call to undefined function head() in C:\Program Files\Abyss Web Server\htdocs\forum\login\register.php on line 38
Scriopt:
<?php
//get form info
$firstname=$_POST["firstname"];
$lastname=$_POST["lastname"];
$username=$_POST["username"];
$password=$_POST["password"];
$confirmpassword=$_POST["confirmpassword"];
$emailaddress=$_POST["emailaddress"];
$secretquestion=$_POST["secretquestion"];
$secretanswer=$_POST["secretanswer"];
//make variables some encrypt
$cpass = md5($password);
$cconfirmpass = md5($confirmpassword);
$cuser = md5($username);
$csecretanswer = md5($secretanswer);
$file = "users/" . $username . ".php";
$data = "<?php $cpass=" . $cpass . "; $cuser=" . $cuser . "; $firstname=" . $firstname . "; $lastname=" . $lastname . "; $secretquestion=" . $secretquestion . "; $csecretanswer=" . $csecretanswer . " ?>";
//make sure all info is ok
if ($password!=$confirmpassword)
{
echo 'Your passwords do not match. <A HREF="javascript:history.go(-1)">Try Again</A><br>'; exit(0);
}
elseif (file_exists($file))
{
echo 'Username is in use. <A HREF="javascript:history.go(-1)">Try Again</A><br>'; exit(0);
}
else
{
//make users file and redirect
$handle = fopen($file, 'w');
fwrite($handle, $data);
fclose($handle);
head ( 'location: index.htm' );
}
?>
Thanks in advance :)