Jump to content

Register script's E-mail confirmation & Activation


simonttz

Recommended Posts

What is the code?

 

 

This is my register input fields code:

 

<?php

//Get the values Passed by the html form

$fname = $_POST['fname'];$lname = $_POST['lname'];$email = $_POST['email'];$gender = $_POST['gender'];

$uname = $_POST['uname'];$upass = $_POST['upass'];$about = $_POST['about'];$website = $_POST['website'];

$mode = $_POST['mode'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

.style193 {font-family: Narkisim}

-->

</style>

</head>

<body>

<?php

if(!$mode){ //No mode was set we can assume they want to submit it, Lets show the form

 

 

 

?>

<form id="form1" name="form1" method="post" action="register.php">

  <p>

    <label for="fname">First Name:</label>

    <input type="text"  name="fname" style="background-color:#808080" id="fname" />

  Gender:

    <input type="checkbox" name="gender" id="gender" value="male" />

    <label for="gender">Male</label>

    <input name="gender" type="checkbox" id="gender" value="female" />

    <label for="gender">Female</label>

</p>

  <p>

    <label for="lname">Last Name:</label>

    <input type="text" name="lname" style="background-color:#808080" id="lname" />

  </p>

  <p>

    <label for="email">Email Addrr</label>

    <input name="email" type="text" id="email" style="background-color:#808080" size="25" maxlength="50" />

  </p>

  <p>

    <label for="uname">Usernames:</label>

    <label for="uname"> </label>

    <input name="uname" type="text" id="uname" style="background-color:#808080" size="25" />

  </p>

  <p>

    <label for="uname"></label>

    <label for="upass">Passwords:</label>

    <input name="upass" type="password" id="upass" style="background-color:#808080" />

  </p>

  <p>

    <label for="label">Confirm Pa</label>

    <input name="upass2" type="password" id="label" style="background-color:#808080" />

  </p>

  <p>

    <label for="uname"></label>

    <label for="upass"></label>

    <label for="website"><span class="style193">Personal Websites</span>:</label>

    <input name="website" type="text" id="website" style="background-color:#808080" />

</p>

  <p>

    <label for="upass"></label>

    <label for="website"></label>

    <label for="about">Tell us a bit about yourself:<br />

    </label>

    <textarea name="about" cols="42" rows="4" id="about" style="background-color:#808080"></textarea>

</p>

  <p>

    <label for="website"></label>

    <label for="about"></label>

    <label for="register"></label>

    <input type="submit" name="register" id="register" value="Register" />

    <input type="button" name="Cancel" id="Cancel" value="Cancel" />

    <input name="mode" type="hidden" id="mode" value="doreg" />

</p>

  <p>

    <label for="about"></label>

    <label for="register"></label>

  </p>

  <p>

    <label for="register"></label>

  </p>

</form>

<?php

}elseif($mode=="doreg"){ //Ok they filled the form in lets process it.

 

 

 

if($fname and $lname and $email and $gender and $uname and $upass and $website and $about){ //Check that all fields where filled (not best way of doing it)

 

 

 

//Right we have all the fields filled and ready, now we can add them to the database

 

 

 

if(mysql_query(%MYSQL QUERY HERE%)){

 

 

 

 

 

echo "Your registration was successful"; //Ok the query was done successfully show the registered message

 

 

 

}else{

 

 

 

 

 

echo "We where unable to register you at this time, Please try again later"; //Oh Dear we couldnt enter the details into the database!

 

 

 

 

 

echo "<br />".mysql_error();

 

 

}

 

 

 

}else{

 

 

 

 

 

echo "You failed to supply all fields, Please go back and try again";

 

 

 

}

}else{ //This should only happen if they try to access something which doesnt exist

 

 

 

echo "Unexpected error occured";

}

?>

</body>

</html>

Link to comment
Share on other sites

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.