Jump to content
MakeWebGames

Recommended Posts

Posted

hi.

I need some help whith emailvalidations...

I get this error:Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/arash/public_html/activation.php on line 11

Invalid Validation Code

 

what is wrong here?

and here is the code:

 

 

<?php
session_start();
include "mysql.php";
$c;
if(!$_GET['code'] || !$_GET['act'])
{
die("Invalid Use Of System.");
} else {
$code=$_GET['code'];
$cq=mysql_query("select * from confirm where code=$code",$c);
if(mysql_num_rows($cq)== 0)
{ die("Invalid Validation Code"); }
$r=mysql_fetch_array($cq);
if($_GET['act'] == 'activate')
{
mysql_query("UPDATE users SET confirmed='1' WHERE userid={$r[user]}",$c);
mysql_query("DELETE FROM confirm WHERE code=$code",$c);
print "Account Validated!

[url='login.php']Login[/url]";
} else if($_GET[act] == 'cancel')
{
mysql_query("DELETE FROM users WHERE userid={$r[user]}",$c);
mysql_query("DELETE FROM confirm WHERE code=$code",$c);
print "Your account has successfully been cancelled, Were sorry you had to leave.";exit;
} else {
die("Invalid Action.");
}
}
?>
Posted

are you using v1 or v2 ?...

if your using v2 and if im not mistaking. you have to change

mysql_num_rows

into

mysql_num_array

 

but i could be wrong....

Posted

thanks for the reply...

i did change it to array and now I get this error:

 

Fatal error: Call to undefined function mysql_num_array() in /activation.php on line 11

Posted

<?php

session_start();

include "mysql.php";

$c;

if(!$_GET['code'] || !$_GET['act'])

{

die("Invalid Use Of System.");

} else {

$code=$_GET['code'];

$cq=mysql_query("select * from confirm where code=$code",$c);

if(mysql_num_rows($cq) != 1)

{ die("Invalid Validation Code"); }

$r=mysql_fetch_array($cq);

if($_GET['act'] == 'activate')

{

mysql_query("UPDATE users SET confirmed='1' WHERE userid={$r[user]}",$c);

mysql_query("DELETE FROM confirm WHERE code=$code",$c);

print "Account Validated!

Login";

} else if($_GET[act] == 'cancel')

{

mysql_query("DELETE FROM users WHERE userid={$r[user]}",$c);

mysql_query("DELETE FROM confirm WHERE code=$code",$c);

print "Your account has successfully been cancelled, Were sorry you had to leave.";exit;

} else {

die("Invalid Action.");

}

}

?>

try != 1 if i follow this right you wanting to ensure $cq isnt empty if not 1 then throw a error, != 1 i may be wrong need to get some coffee :D

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.   Paste as plain text instead

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