Email Activation For Registration Forms

Registration page:

<html>
<body>
<form action="verify.php" method="post" name="register">
Username: <input type="text" name="username" />
Password: <input type="text" name="password" />
Email: <input type="text" name="email" />
<input type="submit" />
</form>
</body>

</html>


Verifying in php:

verify.php


<?php
mysql_connect("localhost", "root", "") or die(mysql_error());

mysql_select_db("test") or die(mysql_error());

if ($_POST['form_submitted'] == '1') {
##User is registering, insert data until we can activate it

$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')";

if (!mysql_query($sql))

{

die('Error: ' . 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. You 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 Team";

$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());

}

}

}

}
?>

Mail script for user & admin at a time

<?php

$yourname = $_POST['yourname'];
$subject = $_POST['subject'];
$email =$_POST['email'];
$comments = $_POST['comments'];
$package = $_POST['package'];
$price= $_POST['price'];

$to="rmonicse@gmail.com";

$subject = "Package Order";

$message = $package."\n".$price."\n".$yourname."\n".$subject."\n".$email."\n".$comments;

$headers = 'From: UPTREND TECHNOLOGIES LTD@ http://www.uptrendgroupbd.com' . "\r\n" .

'Reply-To: noReply@ http://www.uptrendgroupbd.com' . "\r\n" .

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



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



$to=$email;
$subject = "Package Ordering Confirmation";
$message ="Thanks for ordering.We wil contact as soon as possible";
$headers = 'From: UPTREND TECHNOLOGIES LTD@ http://www.uptrendgroupbd.com' . "\r\n" .

'Reply-To: noReply@ http://www.uptrendgroupbd.com' . "\r\n" .

'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
<script>
window.alert('message') ;
</script>
header("Location: http://www.uptrendgroupbd.com/uptrendsoft");
?>

Master Page concept using jquery

Script:

<script type="text/javascript">
$().ready(function() {

$('.unique_id').click(function(e){
var segment = $(this).attr('segment');
$('.content_text').hide();

$.ajax({
url: segment+".html",
dataType: "text",
success: function(data){
$('.content_text').html(data);
eval($(data).filter('script'));
$('.content_text').fadeIn('slow');
}
});
e.preventDefault();
});
});
var $VisualLightBoxParams$ = {autoPlay:true,borderSize:21,enableSlideshow:true,overlayOpacity:0.4,startZoom:true};

</script>


we can apply the class named unique_id in any div. Such as example


<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="index.html" class="panel_text">Home</a></li>
<li class="green"><a href="#" class="unique_id panel_text" segment="convention-program">Convention Program</a></li>
<li> <a href="spech_of_delegates.html" class="panel_text unique_id" segment="spech_of_delegates">Speech of all delegates.</a></li>
<li><a href="#" class="panel_text unique_id" segment="elected_ executive_body_ of_ ieb">Elected Executive body of IEB</a></li>
<li><a href="time_series_list.html" class="unique_id panel_text" segment="time_series_list" >Time-series list of Presidents </a></li>
<li><a href="agm_reports.html" class="unique_id panel_text" segment="agm_reports" >AGM Reports</a></li>
<li><a href="#" class="panel_text">Memorial Lectures</a></li>
<li><a href="bye-laws.html" class="unique_id panel_text" segment="bye-laws" >IEB Constitution/Bye-laws.</a></li>
<li><a href="#" class="panel_text">Prof. Institutions's Introduction</a></li>
<li><a href="#" class="panel_text">Member Database</a> </li>
<li><a href="#" class="panel_text">Fellow Database</a> </li>
<li><a href="#" class="panel_text">IEB welfare scheme </a></li>
<li> <a href="#" class="panel_text">IEB Publications </a></li>
<li> <a href="gallery.html" class="unique_id panel_text" segment="gallery" >Photo Gallery </a></li>
<li> <a href="gallery.html" class="unique_id panel_text" segment="Advertisements of the Sponsors." >Advertisements of the Sponsors. </a></li>
</ul>
</div>

The sub page : its depends on content_text class.


<div class="content_text">
<h1> Bye-laws</h1>
<p class="content_text_shape">

<iframe src="Binder1.pdf" style="width:600px; height:500px;" frameborder="0"></iframe>



</p>
</div>

<div style="clear:both;"></div>
</div>
powered by Blogger | WordPress by Newwpthemes | Converted by BloggerTheme