0

Hello, I'm looking for someone who can help me fix and clean up a PHP email verification form that I can't get fixed with my lite knowledge of PHP.

7
Contributors
21
Replies
22
Views
6 Years
Discussion Span
Last Post by MooGeek
0

Please show some code and specify what is the problem, so that we can decide if we can help you.

0

There is a problem with the SQL setup and I have a few questions regarding some hijacking issue to be placed within the script. If anyone is still interesting in helping me fix it and get it working.

Edited by Siberian: n/a

0

There is a problem with the SQL setup and I have a few questions regarding some hijacking issue to be placed within the script. If anyone is still interesting in helping me fix it and get it working.

You haven't even answered rey's question. Show efforts before ask for help. Empty hands have to leave empty!

0

Can you tell,what problems are you facing and write some code for that so that we can correct it or show you the direction to correct it???
We don't write complete codes,we only help to clarify any doubt or any error....

Edited by IIM: n/a

-1

You haven't even answered rey's question. Show efforts before ask for help. Empty hands have to leave empty!

I did read the replies, I have the code already done I would like some help on fixing it and getting it to work as well as adding some hijack features. I did say I'm learning Javascript not PHP that is the reason behind the question...arggghh !!!

0

I did read the replies, I have the code already done I would like some help on fixing it and getting it to work as well as adding some hijack features. I did say I'm learning Javascript not PHP that is the reason behind the question...arggghh !!!

Are you really reading the replies?? How can we help when there is no script!! it's not gonna Magically fix itself by just replying "Okay, hold on a sec. Abrakadabra! " and POOF your script is fixed! we need to have the script so WE CAN SEE WHAT WE CAN HELP.

0

Are you really reading the replies?? How can we help when there is no script!! it's not gonna Magically fix itself by just replying "Okay, hold on a sec. Abrakadabra! " and POOF your script is fixed! we need to have the script so WE CAN SEE WHAT WE CAN HELP.

<?php

//PHP comments use two slashes - // NOT ##

if (mysql_connect("localhost", 'database_name', 'password'))

   {

   if (mysql_select_db("datbasename"))

      {      
	print 'Ok, connected';
      //Make sure you change this to a field name in your form

      if ($_POST['form_submitted'] == '1')

         {
	  
	$activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
	$username = mysql_real_escape_string($_POST[username]);
	$password = mysql_real_escape_string($_POST[password]);

	$email = mysql_real_escape_string($_POST[email]);


	$sql="INSERT INTO users (username, password, email, activationkey, status)

	VALUES ('$username', '$password', '$email', '$activationKey', 'verify')";


	('$_POST[username]', '$_POST[password]', '$_POST[email]','$activationKey', 'verify')";


         //Form submitted, user must be registering

         //Do something here

         }

      else

         {

         // No value found, user must be activating their account!

         }

      }

   else

      {

      die(mysql_error());

      }

   }

else

   {

   die(mysql_error());

   }
echo "An email has been sent to $_POST[email] with an activation key. Please check your mail to complete registration.";

##Send activation Email

$to      = $_POST[email];

$subject = " YOURWEBSITE.com Registration";

$message = "Welcome to our website!\r\rYou, or someone using your email address, has completed registration at YOURWEBSITE.com. /rYou can complete registration by clicking the following link:\rhttp://www.YOURWEBSITE.com/verify.php?$activationKey\r\rIf this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ YOURWEBSITE.com";

$headers = 'From: noreply@ YOURWEBSITE.com' . "\r\n" .

    'Reply-To: noreply@ YOURWEBSITE.com' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

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

} else {

##User isn't registering, check verify code and change activation code to null, status to activated on success

$queryString = $_SERVER['QUERY_STRING'];

$query = "SELECT * FROM users"; 

$result = mysql_query($query) or die(mysql_error());

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

    if ($queryString == $row["activationkey"]){

       echo "Congratulations!" . $row["username"] . " is now the proud new owner of an YOURWEBSITE.com account.";

       $sql="UPDATE users SET activationkey = '', status='activated' WHERE (id = $row[id])";

       if (!mysql_query($sql))

  {

        die('Error: ' . mysql_error());

  }

    }

  }

}

?>

That is the entire script, there is another PHP script but that works unless this script breaks the other script which I will seriously loose it. As for this script the first area I'm having issues over is the top which is this section:

{
	  
	$activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
	$username = mysql_real_escape_string($_POST[username]);
	$password = mysql_real_escape_string($_POST[password]);

	$email = mysql_real_escape_string($_POST[email]);


	$sql="INSERT INTO users (username, password, email, activationkey, status)

	VALUES ('$username', '$password', '$email', '$activationKey', 'verify')";


	('$_POST[username]', '$_POST[password]', '$_POST[email]','$activationKey', 'verify')";

I know that I have to enter in the database user name, I know I have to supply a database password, as well as a email address. What I don't know is what do I supply for the activationKey and the verify string ? The script is giving me an error on line 32 which specifically is this line:

('$_POST[username]', '$_POST[password]', '$_POST[email]',

I want to get the script to work, first thing.

0

I did read the replies, I have the code already done I would like some help on fixing it and getting it to work as well as adding some hijack features. I did say I'm learning Javascript not PHP that is the reason behind the question...arggghh !!!

My answer is already with me . Just read them from my machine and fix your code


EDIT:
Since there is code posted, let me see and try to lend a help

Edited by Stefano Mtangoo: n/a

0
<?php

//PHP comments use two slashes - // NOT ##

if (mysql_connect("localhost", 'database_name', 'password'))

   {

   if (mysql_select_db("datbasename"))

      {      
	print 'Ok, connected';
      //Make sure you change this to a field name in your form

      if ($_POST['form_submitted'] == '1')

         {
	  
	$activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
	$username = mysql_real_escape_string($_POST[username]);
	$password = mysql_real_escape_string($_POST[password]);

	$email = mysql_real_escape_string($_POST[email]);


	$sql="INSERT INTO users (username, password, email, activationkey, status)

	VALUES ('$username', '$password', '$email', '$activationKey', 'verify')";


	('$_POST[username]', '$_POST[password]', '$_POST[email]','$activationKey', 'verify')";


         //Form submitted, user must be registering

         //Do something here

         }

      else

         {

         // No value found, user must be activating their account!

         }

      }

   else

      {

      die(mysql_error());

      }

   }

else

   {

   die(mysql_error());

   }
echo "An email has been sent to $_POST[email] with an activation key. Please check your mail to complete registration.";

##Send activation Email

$to      = $_POST[email];

$subject = " YOURWEBSITE.com Registration";

$message = "Welcome to our website!\r\rYou, or someone using your email address, has completed registration at YOURWEBSITE.com. /rYou can complete registration by clicking the following link:\rhttp://www.YOURWEBSITE.com/verify.php?$activationKey\r\rIf this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ YOURWEBSITE.com";

$headers = 'From: noreply@ YOURWEBSITE.com' . "\r\n" .

    'Reply-To: noreply@ YOURWEBSITE.com' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

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

} else {

##User isn't registering, check verify code and change activation code to null, status to activated on success

$queryString = $_SERVER['QUERY_STRING'];

$query = "SELECT * FROM users"; 

$result = mysql_query($query) or die(mysql_error());

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

    if ($queryString == $row["activationkey"]){

       echo "Congratulations!" . $row["username"] . " is now the proud new owner of an YOURWEBSITE.com account.";

       $sql="UPDATE users SET activationkey = '', status='activated' WHERE (id = $row[id])";

       if (!mysql_query($sql))

  {

        die('Error: ' . mysql_error());

  }

    }

  }

}

?>

That is the entire script, there is another PHP script but that works unless this script breaks the other script which I will seriously loose it. As for this script the first area I'm having issues over is the top which is this section:

{
	  
	$activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
	$username = mysql_real_escape_string($_POST[username]);
	$password = mysql_real_escape_string($_POST[password]);

	$email = mysql_real_escape_string($_POST[email]);


	$sql="INSERT INTO users (username, password, email, activationkey, status)

	VALUES ('$username', '$password', '$email', '$activationKey', 'verify')";


	('$_POST[username]', '$_POST[password]', '$_POST[email]','$activationKey', 'verify')";

I know that I have to enter in the database user name, I know I have to supply a database password, as well as a email address. What I don't know is what do I supply for the activationKey and the verify string ? The script is giving me an error on line 32 which specifically is this line:

('$_POST[username]', '$_POST[password]', '$_POST[email]',

I want to get the script to work, first thing.

Where is the form?
what does adding

print_r($_POST);

reveal?

0

I followed it from a tutorial, hoping it would work on atleast the second run of me fixing things up, it didn't. Now I'm left in this mess trying to get a simple forum to work to finish up a site that is way looong over due completion and the thing that has held me up the most is this forum. The forum on the page works sending me an email works, well up to this point but I wanted to add an email verification so I don't get junk email or garbage replies this way someone who wants to contact me is serious about doing so because they would verify there email address which would get sent to them and the message is sent to me as well as their email address is stored in the database. Problem is if / when I get this code working will the other PHP code that was working flawless break as well, I sure damn well hope not cause I an't no PHP guru to fix it and it's annoying me and I don't have the time to become one at this point, I just need to get this site up and running and by that getting the forum verification working. If no one wants to help, I'll move elsewhere.

Edited by Siberian: n/a

0

I already have a tutorial on creating a PHP form, I don't need another one. I want to fix my existing code which I have, those links are about validating an email address I have that partially done.

0

I already have a tutorial on creating a PHP form, I don't need another one. I want to fix my existing code which I have, those links are about validating an email address I have that partially done.

what is that which is partially done? Is validating part that is not working? How do you validate?
Unless you be explicit, people will keep skipping your thread!

0

what is that which is partially done? Is validating part that is not working? How do you validate?
Unless you be explicit, people will keep skipping your thread!

I explained everything in one of my recent posts.

0

Huh, using ready made scripts are all well and good until they don't work and you find you don't have the skills to fix them. Oh, no problem, I'll get the nice people at DW to do it for me.

How about contacting the script author?

0

But you said

I followed it from a tutorial

So I assume somebody wrote that? Sorry not trying to be obtuse, but first stop with ready made scripts is the author.

0

If you cannot provide the info... then all the best...

Neither I can't understand what he's trying to say..... O_____+

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.