Jump to content

Recommended Posts

hey guys i got this script from a friend but his script has something i dont like in when your in the register form you fill out eveything after that its tells me to check my emaill for activation but then in the activation page it tells me to put a code in so i  can activate my account i dont want that i just want user to get an email an when the click on it they will be able to login instead of putting a code in here are the register and the activtion code plz help me

 

register

 

<?php $title = "Register"; ?>
<?php require("styles/top.php"); ?>
<div id='full'>
<?php

$form = "<form action='register.php' method='post' enctype='multipart/form-data'>
<table cellspacing='10px'>
<tr>
	<td></td>
	<td><font color='red'>*</font> are required</td>
</tr>
<tr>
	<td>First Name:</td>
	<td><input type='text' name='firstname' class='textbox' size='35'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Last Name:</td>
	<td><input type='text' name='lastname' class='textbox' size='35'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Username:</td>
	<td><input type='text' name='username' class='textbox' size='35'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Email:</td>
	<td><input type='text' name='email' class='textbox' size='35'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Password:</td>
	<td><input type='password' name='password' class='textbox' size='35'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Confirm Password:</td>
	<td><input type='password' name='repassword' class='textbox' size='35'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Avatar:</td>
	<td><input type='file' name='avatar'></td>
</tr>
<tr>
	<td>Youtube Username:</td>
	<td><input type='text' name='youtube' class='textbox' size='35'></td>
</tr>
<tr>
	<td>Bio/About:</td>
	<td><textarea name='bio' cols='35' rows='5' class='textbox'></textarea></td>
</tr>
<tr>
	<td></td>
	<td><input type='submit' name='submitbtn' value='Register' class='button'></td>
</tr>
</table>
</form>";

if ($_POST['submitbtn']){

	$firstname = strip_tags($_POST['firstname']);
	$lastname = strip_tags($_POST['lastname']);
	$username = strip_tags($_POST['username']);
	$email = strip_tags($_POST['email']);
	$password = strip_tags($_POST['password']);
	$repassword = strip_tags($_POST['repassword']);
	$youtube = strip_tags($_POST['youtube']);
	$bio = strip_tags($_POST['bio']);

	$name = $_FILES['avatar']['name'];
	$type = $_FILES['avatar']['type'];
	$size = $_FILES['avatar']['size'];
	$tmpname = $_FILES['avatar']['tmp_name'];
	$ext = substr($name, strrpos($name, '.'));

	if ($firstname && $lastname && $username && $email && $password && $repassword){
		if ($password == $repassword){
			if (strstr($email, "@") && strstr($email, ".") && (strlen($email) >= 6)){

				require("scripts/connect.php");

				$query = mysql_query("SELECT * FROM users WHERE username='$username'");
				$numrows = mysql_num_rows($query);
				if ($numrows == 0){

					$query = mysql_query("SELECT * FROM users WHERE email='$email'");
					$numrows = mysql_num_rows($query);
					if ($numrows == 0){

						$pass = md5(md5($password));
						$date = date("F d, Y");

						if ($name){
							move_uploaded_file($tmpname, "avatars/$username.$ext");
							$avatar = $username.$ext;
						}
						else
							$avatar = "defavatar.png";

						$code = substr(md5(rand(1111111111, 99999999999999)), 2, 25);

						mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', '$pass', '$avatar', '$bio', '$youtube', '', '0', '$code', '0', '$date')");

						$webmaster = "Admin@******.com";
						$subject = "Activate Your Account";
						$headers = "From: ******<$webmaster>";
						$message = "Hello $firstname. Welcome to *******.com Below is a link for you to activate your account on ******.com\n\n Clicke Here to Activate Your Account: http://www.*******.com/activate.php?code=$code";

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

						echo "Thank You for registering. You must now activate your account throught the activation email that has been sent to <b>$email</b>. You must activate your account to be able to login. If you are haveing problems please contact the site administrator at <a href='mailto:admin@*******.com'>Admin@*******.com</a>.";

					}
					else
						echo "That email is already taken. $form";
				}
				else
					echo "That username is already taken. $form";
			}
			else
				echo "You did not enter a valid email. $form";
		}
		else
			echo "Your passwords did not match. $form";
	}
	else
		echo "You did not fill in all the required fields. $form";
}
else
	echo "$form";

?>
</div>
<?php require("styles/bottom.php"); ?>

 

 

activation

 

<?php $title = "Activate Your Account"; ?>
<?php require("styles/top.php"); ?>
<div id='full'>
<?php

$getcode = $_GET['code'];

$form = "<form action='activate.php' method='post'>
<table>
<tr>
	<td>Activate Code:</td>
	<td><input type='text' name='code' value='$getcode' size='35'></td>
</tr>
<tr>
	<td>Username:</td>
	<td><input type='text' name='username' size='35'></td>
</tr>
<tr>
	<td>Password:</td>
	<td><input type='password' name='password' size='35'></td>
</tr>
<tr>
	<td></td>
	<td><input type='submit' name='submitbtn' vlaue='Activate'></td>
</tr>
</table>
</form>";

if ($_POST['submitbtn']){
	$code = strip_tags($_POST['code']);
	$username = strip_tags($_POST['username']);
	$password = strip_tags($_POST['password']);

	if ($code && $username && $password){
		if (strlen($code) == 25){
			$pass = md5(md5($password));
			require("scripts/connect.php");
			$query = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$pass'");
			$numrows = mysql_num_rows($query);
			if ($numrows == 1){

				$row = mysql_fetch_assoc($query);
				$dbcode = $row['code'];

				if ($code == $dbcode){

					mysql_query("UPDATE users SET active='1' WHERE username='$username'");

					echo "You account has been activated. You may now login. <a href='login.php'>Click here to login.</a>";

				}
				else
					echo "You activation code incorrect. $form";
			}
			else
				echo "Your username and password are invalid. $form";
		}
		else
			echo "You have not supplied a valid code. $form";
	}
	else
		echo "You did not fill in the entire form. $form";
}
else
	echo "$form";
?>

</div>
<?php require("styles/bottom.php"); ?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/243563-registetion-and-activateion-helpppp-plz/
Share on other sites

$message = "Hello $firstname. Welcome to *******.com Below is a link for you to activate your account on ******.com\n\n 
<a href='http://www.sitename.com/login.php'>Clicke Here to Activate Your Account: http://www.*******.com/activate.php?code=$code</a>";

purpose of email activation - validate the email address
This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.