Jragon Posted July 22, 2010 Share Posted July 22, 2010 Hello, I got an error: Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\md5\includes\functions.php on line 9 My code: <?php function encrypt($string){ include("connect.php"); $md5 = md5($string); $query = sprintf("SELECT * FROM md5 WHERE md5='%s'", mysql_real_escape_string($md5)); $numrows = mysql_num_rows(mysql_query($query)); if($numrows == 0){ $query = sprintf("INSERT INTO md5 (string, md5string) values('%s', '%s')" mysql_real_escape_string($string), mysql_real_escape_string($md5)); mysql_query($query); } return $md5; } function decrypt($md5){ include("connect.php"); $query = sprintf("SELECT * FROM md5 WHERE md5='%s'", mysql_real_escape_string($md5)); $numrows = mysql_num_rows(mysql_query($query)); if($numrows = 1){ $query = sprintf("SELECT * FROM md5 WHERE md5='%s'", mysql_real_escape_string($md5)); $result = mysql_query($query); while(mysql_fetch_assoc($result)){ return 'Your encrypted hash was ' . $md5 . ' and your decrypted hash is ' . $row['string']; } }else{ return 'Sorry that MD5 hash dose not exist on our database.'; } } ?> also there is a strange '` ' with out quotes in the top of my index page My code: <?php include("includes/header.php"); ?> <?php require("includes/connect.php"); ?> <?php include("includes/functions.php"); ?> <form action="" method="post"> <table align="center"> <tr> <td align="center"> Encrypt<input type="radio" name="type" value="encrypt"/> </td> </tr> <tr> <td align="center"> Decrypt<input type="radio" name="type" value="decrypt"/> </td> </tr> <?php if($_POST['type'] == 'encrypt'){ echo ' <tr> <td align="center""> String to be Encrypted <input type="text" name="string"/> </td> </tr>'; }else{ echo ' <tr> <td align="center"> Hash to be Decrypted <input type="text" name="hash"/> </td> </tr>'; } ?> <tr> <td align="center"> <input type="submit" name="submit" value="Submit"/> </td> </tr>' </table> </form> <?php include("includes/footer.php"); ?> I know that its not in any of the included files cos in my browser preview its there and the browser preveew only dose html Thanks Jraogn Link to comment https://forums.phpfreaks.com/topic/208574-unexpected-t_string-an-unexspectide-and-looping-help/ Share on other sites More sharing options...
premiso Posted July 22, 2010 Share Posted July 22, 2010 Please do not double post. If you have new information to add to a topic, do so with a reply (if the edit timeout limit has been reached). Duplicate of: http://www.phpfreaks.com/forums/index.php/topic,305125.0.html Link to comment https://forums.phpfreaks.com/topic/208574-unexpected-t_string-an-unexspectide-and-looping-help/#findComment-1089750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.