Hi Guys i am receiving this message . Parse error: syntax error, unexpected '{' in /home/mardan/public_html/login/confirm.php on line 20 ------------- could you check my code , i have no idea why this given me. Thanks <?php require_once('db.php'); include('function'); if($_GET['ID']!= '' && numeric ($_GET['ID']) == TRUE && strlen ($_GET['key'])== 32 && alpha_numeric ($_GET['key']== TRUE ) //20 line is coming here// { $query = mysql_query("SELECT ID,Random_key,Active FROM users WHERE ID ='" mysql_real_escape_string($_GET['ID'])."'"); if(mysql_num_rows($query)==1) { $row=mysql_fetch_assoc($query); if($row['Active']==1) { $error='This member is already active !'; } elseif($row['Random_key']!=$_GET['key']) { $error='The Confirmation key that was generated for this member does not match with our entered '; } else { $update =mysql_query("UPDATE users SET Active=1 WHERE ID ='".mysql_real_escape_string($row['ID'])."'") or die (mysql_error()); $msg = 'Congratulations ! You just confirmed your membership </br> <p>This script automatically redirects to Login page.</p></br> <p>If you are not redirected to another page within 15 seconds, then please <a href="http://www.mardan.org.uk/login">click here</a>.</p>! '; } } else { $error = 'User not found !'; } } else { $error = 'Invalid data provided !'; } if(isset($error)) { echo $error; } else { echo $msg; } ?> reply must
if($_GET['ID']!= '' && numeric ($_GET['ID']) == TRUE && strlen ($_GET['key'])== 32 && alpha_numeric ($_GET['key']== TRUE ) PHP: should be if(!empty($_GET['ID']) && numeric($_GET['ID']) == TRUE && strlen($_GET['key']) == 32 && alpha_numeric($_GET['key'] == TRUE)) PHP: and $query = mysql_query("SELECT ID,Random_key,Active FROM users WHERE ID ='" mysql_real_escape_string($_GET['ID'])."'"); PHP: should be $query = mysql_query("SELECT `ID`, `Random_key`, `Active` FROM `users` WHERE `ID` = '" . mysql_real_escape_string($_GET['ID']) . "'"); PHP:
Here is the fixed Code: <?php if($_GET['ID']!= '' && numeric ($_GET['ID']) == TRUE && strlen($_GET['key'])== 32 && alpha_numeric($_GET['key'])== TRUE){ //20 line is coming here// $query = mysql_query("SELECT ID,Random_key,Active FROM users WHERE ID ='". mysql_real_escape_string($_GET['ID']).".'"); if(mysql_num_rows($query)==1) { $row=mysql_fetch_assoc($query); if($row['Active']==1) { $error='This member is already active !'; } elseif($row['Random_key']!=$_GET['key']) { $error='The Confirmation key that was generated for this member does not match with our entered '; } else { $update =mysql_query("UPDATE users SET Active=1 WHERE ID ='".mysql_real_escape_string($row['ID'])."'") or die (mysql_error()); $msg = 'Congratulations ! You just confirmed your membership </br> <p>This script automatically redirects to Login page.</p></br> <p>If you are not redirected to another page within 15 seconds, then please <a href="http://www.mardan.org.uk/login">click here</a>.</p>! '; } } else { $error = 'User not found !'; } } else { $error = 'Invalid data provided !'; } if(isset($error)) { echo $error; } else { echo $msg; } ?> PHP: