markspec87 Posted November 23, 2006 Share Posted November 23, 2006 [code]<?php include("config.php");mysql_select_db($dbname)or die ("Could not select database because ".mysql_error());// check if the username is taken$check = "select id from users 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, that username $username is already taken.<br>";echo "<a href=/signup.php>Try again</a>";exit; } else {$t= time();// insert the data$insert = mysql_query("insert into users values ('".$_POST['username']."','".$_POST['password']."','','1', '".$_POST['avatar']."', '".$_POST['email']."', '0','$t', '".$_POST['age']."', '".$_POST['location']."', '".$_POST['clan']."', '".$_POST['website']."', '".$_POST['about']."')")or die("Could not insert data because ".mysql_error());$url='http://www.mysite.com/activate.php?hash='.md5($_POST['password']).’&stamp=’.base64_encode($t);$to = $_POST['email'];$subject = "Account Activation";$message = "Hello! This is a simple email message.";$from = "webmaster@clan.com";$headers = "From: $from";mail($to,$subject,$message,$headers);echo "Your user account has been created!<br>"; echo "An activation email has been sent to " .$_POST['email']. "<BR>"; }?>[/code]This is my complete signup / email ativation page and it throws the error:[quote]Parse error: syntax error, unexpected '=' in ....[/quote]any ideas? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted November 24, 2006 Share Posted November 24, 2006 what line is this error focused on? Quote Link to comment Share on other sites More sharing options...
ataria Posted November 24, 2006 Share Posted November 24, 2006 if ($num_rows != 0) { not sure about that line...I would just do '($num_rows > 0)I may be incorrect, though. Quote Link to comment Share on other sites More sharing options...
markspec87 Posted November 24, 2006 Author Share Posted November 24, 2006 Sorry for missing that[quote]Parse error: syntax error, unexpected '=' in /home/..... on line 28[/quote] Quote Link to comment Share on other sites More sharing options...
Philip Posted November 24, 2006 Share Posted November 24, 2006 [code]<?php$url='http://www.mysite.com/activate.php?hash='.md5($_POST['password']).’&stamp=’.base64_encode($t);?>[/code]Look at ’&stamp=’ (on line 27) - use normal single quotesFixed:[code]<?php include("config.php");mysql_select_db($dbname)or die ("Could not select database because ".mysql_error());// check if the username is taken$check = "select id from users 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, that username $username is already taken.<br>";echo "<a href=/signup.php>Try again</a>";exit; } else {$t= time();// insert the data$insert = mysql_query("insert into users values ('".$_POST['username']."','".$_POST['password']."','','1', '".$_POST['avatar']."', '".$_POST['email']."', '0','$t', '".$_POST['age']."', '".$_POST['location']."', '".$_POST['clan']."', '".$_POST['website']."', '".$_POST['about']."')")or die("Could not insert data because ".mysql_error());$url='http://www.mysite.com/activate.php?hash='.md5($_POST['password']).'&stamp='.base64_encode($t);$to = $_POST['email'];$subject = "Account Activation";$message = "Hello! This is a simple email message.";$from = "webmaster@clan.com";$headers = "From: $from";mail($to,$subject,$message,$headers);echo "Your user account has been created!<br>"; echo "An activation email has been sent to " .$_POST['email']. "<BR>"; }?>[/code] Quote Link to comment Share on other sites More sharing options...
markspec87 Posted November 24, 2006 Author Share Posted November 24, 2006 Thanks :)however when i complete the form now and it loads this page it always says:[quote]Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.[/quote]is this related? or just bad timing? Quote Link to comment Share on other sites More sharing options...
marcus Posted November 24, 2006 Share Posted November 24, 2006 That's an apache error. Usually if your code is like cgi or pl. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.