Jump to content

unexpected T_STRING, an unexspectide '` ' and looping help


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

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.