Jump to content

Warning: md5() expects parameter 1 to be string, and another error


champbronc2

Recommended Posts

Warning: md5() expects parameter 1 to be string, resource given in /home/champbux/public_html/register.php on line 208

 

?

 

Line 205 to 209 reads as such:

echo "You have been registered correctly $username. Please confirm your email address in order to login. If you fail to receive it please contact us. Please check your spam folder as well";
$coder = "SELECT id FROM `users` WHERE `username` = CONVERT( _utf8 '$username' USING latin1 ) COLLATE latin1_swedish_ci";
$codes = mysql_query($coder);
$code = md5($codes);
$sql = mysql_query("INSERT INTO users (ccode) VALUES ('$code')");

 

Also another error is Parse error: syntax error, unexpected T_STRING in /home/champbux/public_html/verify.php on line 26

 

The page is:

<?
include('config.php');

// Passkey that got from link
$passkey=$_GET['code'];

$tbl_name1="users";

// Retrieve data from table where row that match this passkey
$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";
$result1=mysql_query($sql1);

// If successfully queried
if($result1){

// Count how many row has this passkey
$count=mysql_num_rows($result1);

// if found this passkey in our database, retrieve data from table "temp_members_db"
if($count==1){

$sql2="INSERT INTO users(confirmed)VALUES('1');
$result2 = mysql_query($sql2);
}

// if not found passkey, display message "Wrong Confirmation code"
else {
echo "Wrong Confirmation code";
}

// if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
if($result2){

echo "Your account has been activated";



}

}
?>

 

I am sorry for sucking at php so bad.. Any help is appreciated.

In the second file, you left a " off of this line:

 

$sql2="INSERT INTO users(confirmed)VALUES('1');

 

In the first file, you passed $codes, a result resource, to md5().  You need to actually use one of the mysql_fetch_* functions in order to get the string to pass to md5().

$sql2="INSERT INTO users(confirmed)VALUES('1');

 

for the parse error change the above to

 

$sql2="INSERT INTO users(confirmed)VALUES('1')";

 

also why are u trying encrypt the sql_query??

 

you need to use mysql_fetch functions to encrypt the string..

So should it look like:

 

echo "You have been registered correctly $username. Please confirm your email address in order to login. If you fail to receive it please contact us. Please check your spam folder as well";
$coder = "SELECT id FROM `users` WHERE `username` = CONVERT( _utf8 '$username' USING latin1 ) COLLATE latin1_swedish_ci";
$codes = mysql_fetch($coder);
$code = md5($codes);
$sql = mysql_query("INSERT INTO users (ccode) VALUES ('$code')");

 

?

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.