Jump to content

[SOLVED] Confused Headache Part 2 - Activation Script


Steve Angelis

Recommended Posts

<?PHP
$username=$_POST['username'];
$activate=$_POST['activate'];

require('../inc/config.php'); 
$linkid = @mysql_connect("$db_host", "$db_uname", "$db_pass");
mysql_select_db("$db_name", $linkid);


$query = "SELECT * FROM nxg_tempmbr WHERE username='$username'";
$result = mysql_query($query) or die("$query does not make any sence;<br>" . mysql_error());
$name_exists = mysql_num_rows($result);
echo $result['activate']."1";
echo $activate;
if ($name_exists == 0) 
{
echo "No such user exists.";
}
else
{
if ($activate == $result['activate'])
{
echo "Correct Code!";
}
else
{
echo "Incorrect activation code.";
}



}



?>

 

The code is rather simple right now.  Check the username, if its it there then it gets the code and checks to see if the code is valid.  It gets past the username part no problem, that works fine, checked if it passes or fails it works.  It echos the variables from the previous form no problem, it checks against the database no problem, but when i try to echo or match up with from the database mainly the activate code it doesn't work and the spelling is all correct.  Any ideas?

Try this

 

<?php
$username=$_POST['username'];
$activate=$_POST['activate'];

require('../inc/config.php'); 
$linkid = @mysql_connect("$db_host", "$db_uname", "$db_pass");
mysql_select_db("$db_name", $linkid);

$result=mysql_query("SELECT activate FROM nxg_tempmbr WHERE username='$username'") or die("$query does not make any sence;<br>" . mysql_error());
if (mysql_num_rows($result)==0){ 
echo "No such user exists.";
}
else{
$result=mysql_fetch_array($result);
if ($activate == $result[0]){
	echo "Correct Code!";
}
else{
	echo 'ERROR--Does '.$result[0].' = '.$activate.'?<br>';
}
}
?>

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.