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: 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' ); } ?> PHP: Thanks in advance
head ( 'location: index.htm' ); should be header ( 'location: index.htm' ); also why are you md5 hashing the username?
^ What he said, but also you might want to consider strtolower() when hashing things like a secret question, it's annoying when the answer is something like 'Digital point' and you're guessing 'Digital Point', also consider using a salt when making a password hash Dan