Jump to content

Script Not registering users to the Database.


s1wg4u

Recommended Posts

Alright, here's my deal. When I try to register a new user it's almost like it's not generating a unique userid because when it emails me the activation link, it's not generating the activation link. Here's the signup page code.

 

 

Old Yesterday, 11:49 PM

  #1

s1wg4u

Novice (Level 1)

 

Join Date: Jun 2008

Posts: 1

iTrader: (0)

s1wg4u is an unknown quantity at this point

 

need help with a client side image hosting script. PHP

Alright, here's my deal. When I try to register a new user it's almost like it's not generating a unique userid because when it emails me the activation link, it's not generating the activation link. Here's the signup page code.

 

Quote:

<?require_once("inc/config.php");

require_once("lib/cpaint2.inc.php");

$link = mysql_connect($db_server, $db_user, $db_password) or die("Could not connect.");

mysql_select_db($db_name) or die("Could not select database.");

 

function usersignup($uname,$fname,$lname,$email,$pass)

{

global $cp, $support_email, $site_name, $server_url;

$msg="";

 

$sql="select count(*) as total1 from users where username='$uname'";

$result=mysql_query($sql);

while ($row = mysql_fetch_assoc($result)) {

$total1=$row['total1'];

}

if($total1)

{

$id="uname";

$msg="Duplicate username.";

}

 

if($msg="")

{

$sql="select count(*) as total from users where email='$email'";

$result=mysql_query($sql);

while ($row = mysql_fetch_assoc($result)) {

$total=$row['total'];

}

if($total)

{

$id="email";

$msg="Duplicate Email address.";

}

}

if($msg=="")

{

$ip = $_SERVER['REMOTE_ADDR'];

$sql="insert into users set fname='$fname',lname='$lname',joindate=".time().",email='$email',username='$uname',password=$pass,ip ='$ip'";

mysql_query($sql);

$msg="Your are Successfully Registered. Please check your mail box and verify your account";

$id=1;

$uid = mysql_insert_id();

 

///Mail User

$subject = "Verify Your email";

$to = $email;

$from = $support_email;

$code = base64_encode($uid);

$body= "Hello $fname, <br> Welcome to $site_name.<br> To activate your account click the following link<br> $server_url/verify.php?code=$code <br> --------------------------<br> This is an automated E-mail";

$headers = "From: " . $from . "\n";

$headers .= "X-Sender: <" . "$to" . ">\n";

$headers .= "Return-Path: <" . "$to" . ">\n";

$headers .= "Error-To: <" . "$to" . ">\n";

$headers .= "Content-Type: text/html\n";

mail($to,$subject,$body,$headers);

 

}

$x = &$cp->add_node("msg");

$x->set_data($msg);

$x = &$cp->add_node("id");

$x->set_data($id);

//$cp->set_data($msg);

}

function chkupdate($uname,$fname,$lname,$email,$pass,$userid)

{

global $cp;

$msg="";

 

$sql="select count(*) as total1 from users where username='$uname' and userid!=$userid";

$result=mysql_query($sql);

while ($row = mysql_fetch_assoc($result)) {

$total1=$row['total1'];

}

if($total1)

{

$id="uname";

$msg="Duplicate username.";

}

 

if($msg=="")

{

$sql="select count(*) as total from users where email='$email' and userid!=$userid";

$result=mysql_query($sql);

while ($row = mysql_fetch_assoc($result)) {

$total=$row['total'];

}

if($total)

{

$id="email";

$msg="Duplicate Email address.";

}

}

if($msg=="")

{

if($pass)

$pass=",password='$pass'";

$sql="update users set fname='$fname',lname='$lname',email='$email',username='$uname'".$pass." where userid=$userid";

mysql_query($sql);

$msg="Your profile successfully updated.";

$id=1;

}

$x = &$cp->add_node("msg");

$x->set_data($msg);

$x = &$cp->add_node("id");

$x->set_data($id);

//$cp->set_data($msg);

}

function forgetpass($email)

{

global $cp;

$msg="";

 

$sql="select password from users where email='$email'";

$result=mysql_query($sql);

while ($row = mysql_fetch_assoc($result)) {

$pass=$row['password'];

}

if($pass=="")

{

$msg="Wrong Email address provided.";

$id=1;

}

$x = &$cp->add_node("msg");

$x->set_data($msg);

$x = &$cp->add_node("id");

$x->set_data($id);

//$cp->set_data($msg);

}

$cp = new cpaint();

$cp->register('usersignup');

$cp->register('chkupdate');

$cp->register('forgetpass');

$cp->start();

$cp->return_data();

?>

 

 

 

The email i'm recieving is

 

 

 

Hello stephen,

Welcome to ImageSafe.us - Free Image Hosting and Sharing.

 

To activate your account click the following link

http://www.imagesafe.us/verify.php?code=MA==

 

http://www.imagesafe.us/register.php - That's the register page.

 

 

There ya go, i really hope you guys can help, i've stared at it aimlessly unable to find anything.

 

Thanks, and god bless, if you need more information, just post

 

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.