Jump to content

unexpected T_STRING, an unexspectide '` ' and looping help


Jragon

Recommended Posts

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.