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 = "[email protected]";$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? Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/ Share on other sites More sharing options...
jwk811 Posted November 24, 2006 Share Posted November 24, 2006 what line is this error focused on? Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/#findComment-129333 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. Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/#findComment-129336 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] Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/#findComment-129347 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 = "[email protected]";$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] Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/#findComment-129348 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? Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/#findComment-129361 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. Link to comment https://forums.phpfreaks.com/topic/28277-email-activation-error/#findComment-129369 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.