Php error... :/ again.. HELP?
-
heres the error... Parse error: syntax error, unexpected '}' in /home/keola212/public_html/pers_reg.php on line 78 <?php require_once("database.php"); if(isset($_POST['action'])&& $_POST[ ' action ' ]== "check"){ $email = mysql_real_escape_string(strip_tags($_PO… ' email ' ])); $username = mysql_real_escape_string(strip_tags($_PO… ' username ' ])); if(strpos($email,"@")!==false){ $check_email= explode("@",email); echo 3; exit(); } } else { echo 3; exit(); } $email_query = mysql_query("SELECT id FROM 'MEMBER_INFO' WHERE email='$email' LIMIT 1"); if(mysql_num_rows($email_query)==1){ echo 1; exit(); } else { $userame_query = mysql_query("SELECT username FROM 'MEMBER_INFO' WHERE username=' $username ' LIMIT 1"); if(mysql_num_rows($username_query)==1){ echo 2; exit(); } else { echo 0; exit(); } } if (isset($_post['action']) && $_POST['action'] == "register"){ $firstname = mysql_real_escape_string(strip_tags($_PO… $lastname = mysql_real_escape_string(strip_tags($_PO… $email = mysql_real_escape_string(strip_tags($_PO… $username = mysql_real_escape_string(strip_tags($_PO… $password = mysql_real_escape_string(strip_tags($_PO… $sex = mysql_real_escape_string(strip_tags($_PO… $activation_code = md5($username.$password); $reg_query = "INSERT INTO `MEMBER_INFO` (`firstname`,`lastname`,` username `,` password `,`email`,`activation_code`,`gender`) VALUES ('.ucfirst(strtolower($firstname)).','.u… ".$email." ',' ".$username. " ', '.md5($password).',' " .$activation_code. " ')"; mysql_query($reg_query) or die("error:".$reg_query ."<br>".mysql_error()); if($reg_query){ $new_userid = mysql_insert_id(); $to = $email; $from = "[email protected]"; $subject = "activate your account"; $message = "<h3> welcome to astral magick!".ucfirst(strtolower($firstname))… <p>To activate your account please click the link be low! I shall see you on the other side of the viel!! <a herf='http://www.astral-magick.com?id=$n… http://www.astral-magick.com?id=%24new_userid&activate=%24activation_code </a></p> <p>once your account has been activated you may join the fight at anytime! <strong>Email:</strong>$email<br/> <strong>password:</strong>$password</p… <p> Thanks for registering my fellow astral.. we shall meet again soon..</p>"; $headers='MIME-Version: 1.0'."\r\n"; $headers='Content-type: text/html; charset=iso-8859-1'."\r\n"; $headers='From: $from\r\nReply-To$from'; mail($to,$subject,$message,$headers); echo 1; exit(); } else { echo 0; header('location: login.php') } } ?> even if I get rid of one it still says that error now, if I get rid of both on the end I get this error! Parse error: syntax error, unexpected $end in /home/keola212/public_html/pers_reg.php on line 80
-
Answer:
1. Learn to indent your code properly, the old fashion if you can't do better: if (cond) { ...something } else { ... if (cond2) ...{ ...... something else ...} } Don't use if (cond) { ... } Brackets are not vertically aligned and tabbing is not clear. You can't cope with that. If you did align them, you would know WHY and WHERE you have missing brackets (as well as why you have "unexpected $end"). 2. That is NOT the way to send an HTML message: you need to set-up boundaries and an alternate. 3. You cannot use "header()" after ANY kind of "echo". 4. email='$email' => php does NOT parse variables in single quotes. You are not searching for an email VALUE, you are searching for an email that is equal to the VARIABLE name, $email. 5. `,` username `, ... You have spaces between the field name and the single quotes. Incorrect. 6. "id" is a keyword: it must be enclosed in single reverse quotes. Before sending offensive comments, you should learn the basics of clean programming. You are still very far from that: you have been a week on this "login"...
Keola M at Yahoo! Answers Visit the source
Other answers
Where is your closing ; after the header command?
Colinc
Related Q & A:
- How to solve the “Your search cannot be completed because of a service error” error in Search Center?Best solution by SharePoint
- How to store data in php and get data from php?Best solution by Stack Overflow
- How to fix error printer Canon PIXMA iP1000 error msg The waste in absorber is full. Ink counter i reset?Best solution by Yahoo! Answers
- Why do I get the error "A network error occured while connecting to the server?Best solution by Yahoo! Answers
- Can't delete name off messenger address list, error code 40402,need help pls?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.