- Joined
- Jul 9, 2008
- Messages
- 13
- Reaction score
- 0
This will basically add email activation
What this will do?
It will add to your CMS
Login
Logout
Password Changer
Require email activation
Resend activation code if it doesn't work
Email changer
Add this to your C:\wamp\www
Abyss or whatevery your using
I am going to use all of this and make my own CMS with it.
So Look forward to a CMS of mine later on.
Download this and replace register.php with it
Add this
resend.php
login.php
logout.php
activate.php
members.php
process.php
Credits go to me for creating this
Hope you like the release!~
Join WingsMS!~
1000x exp 750x mesos 500x drop
Also If there is anything you might would like in a CMS please tell me
What this will do?
It will add to your CMS
Login
Logout
Password Changer
Require email activation
Resend activation code if it doesn't work
Email changer
Add this to your C:\wamp\www
Abyss or whatevery your using
I am going to use all of this and make my own CMS with it.
So Look forward to a CMS of mine later on.
Download this and replace register.php with it
To view the content, you need to sign in or register
Add this
resend.php
Code:
<?php
include 'config.php';
if(isset($_POST['resend']))
{
$email = trim($_POST['email']);
$query = mysql_query("SELECT Actkey FROM Users WHERE Email = '$email' LIMIT 1") or die(mysql_error());
while($row = mysql_fetch_array($query)){
$act = $row['Actkey'];
if(mysql_num_rows($query) > 0)
{
$send = mail($email , "Activate your account" , "Thank you for registering with YourWebsite.\n\nClick the link below to activate your account:\nhttp://CHANGETHISURL.COM/activate.php?id=".$act."\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: [email protected]");
if($send){
echo '
<html>
<head>
<title>Success</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the resend activation email page</div>
<br>
<div id="success">
<p>The validation email was successfully sent. <a href="login.php">Click here</a> to login once you have activated.</p>
</div>
</div>
</body>
</html>
';
} else {
echo '
<html>
<head>
<title>Error</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the resend activation email page</div>
<br>
<div id="error">
<p>Ha, what an act. There has been an error processing your activation email. Please contact the administrator.</p>
</div>
</div>
</body>
</html>
';
}
} else {
echo '
<html>
<head>
<title>Error</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the resend activation email page</div>
<br>
<div id="error">
<p>Sorry, your email was not found in the database, please enter an email address that you have registered with and not recieved and email with.</p>
</div>
</div>
</body>
</html>
';
}
}
} else {
?>
<html>
<head>
<title>Resend validation email</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the resend activation email page</div>
<br>
<div id="main">
<p>Ok, so your activation email didn't get sent? DAMN S**T C*H(#@ ((@J no, stop swearing, put that bottle down. You don't need it. We need each other. I'm here to resend your email, so enter your email address, and I will send the validation link to that email, provided you have registered ofcourse, if you are trying to hack me, what a sad guy, taking advantage of my emotions like that... jeez.</p>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<p>Email:<br>
<input name="email" type="text">
<p>
<input name="resend" type="submit" id="resend" value="Resend">
</form>
</p>
Once you enter your email and hit resend, I will make sure your email is valid, then send you out your validation link. If it doesn't come, try me again! I'm not a one night stand you know...
<p>By the way, I am very (case) sensitive so enter the email exactly as you registered with it. </p>
</div>
</div>
</body>
</html>
<? } mysql_close($l); ?>
login.php
Code:
<?php
session_start();
include 'config.php';
if(isset($_POST['login']))
{
$username = trim(addslashes($_POST['username']));
$password = md5(trim($_POST['password']));
$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
// now we check if they are activated
if(mysql_num_rows($query) > 0)
{
if($row['Activated'] > 0)
{
$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];
header("Location: member.php");
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>
</body>
</html>
';
}
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
</div>
</body>
</html>
';
}
} else {
?>
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the login page</div><br>
<div id="main">
<p>You must login to view this page. Enter your username and password below and hit submit:</p>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<p>Username:<br>
<input name="username" type="text" Cid="username">
<p>Password:<br>
<input name="password" type="password" id="password">
</p>
<p>
<input name="login" type="submit" id="login" value="Submit">
</p>
</form>
<p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
<p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>
</div>
</div>
</body>
</html>
<? } mysql_close($l); ?>
logout.php
Code:
<?php
session_start();
$_SESSION['s_logged_n'] = '';
$_SESSION['s_name'] = '';
$_SESSION['s_username'] = '';
session_destroy();
header("Location: login.php");
?>
activate.php
Code:
<?php
include 'config.php';
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM Users WHERE Actkey = '$id' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
if(mysql_num_rows($query) > 0){
$user = $row['id'];
$do = mysql_query("UPDATE Users SET Activated = 1 WHERE id = '$user' LIMIT 1") or die(mysql_error());
$send = mail($row['Email'] , "Activation Confirmation" , "Thank you for activating your account, you are now fully registered and able to use our services.\n\nTo login, click the link below:\nhttp://CHANGETHISURL.COM/login.php" , "FROM: [email protected]");
if(($do)&&($send))
{
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="success">
<p>Activation successful! A confirmation email has been dispatched. You can now login!</p>
<p><a href="login.php">Click here</a> to goto the login page.</p>
</div>';
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>We are sorry, there appears to be an error processing your activation. Please try again later.</p>
</div>';
}
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>Sorry, your activation code was incorrect. Please try again.</p>
</div>';
}
mysql_close($l);
?>
members.php
Code:
<?php
session_start();
if($_SESSION['s_logged_n'] == 'true'){
include 'process.php';
?>
<html>
<head>
<title>Members Page</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">The member page</div><br>
<div id="container">
<? include 'menus.php' ?>
</div>
<div id="spacer"> </div>
<div id="memmain">
<?php
switch($_GET['change']){
case 'password':
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<p>Current password:<br>
<input name="current" type="password"></p>
<p>New password:<br>
<input name="new" type="password"></p>
<p>Confirm new password:<br>
<input name="confirm" type="password"></p>
<p><input type="submit" value="Change Password" name="changepassword"></p>
</form>
';
break;
case 'email':
echo '<p>
WARNING! - By changing your email address you will have to re-validate. Make sure you email address is 100% correct.</p>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<p>Current email:<br>
<input name="current" type="text"></p>
<p>New email:<br>
<input name="new" type="text"></p>
<p>Confirm new email:<br>
<input name="confirm" type="text"></p>
<p><input type="submit" value="Change Email" name="changeemail"></p>
</form>
';
break;
case 'account':
echo '<p>
WARNING - By closing your account, you will not be able to login again under this account. Press the button below to confirm you wish to close your account</p>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<p><input type="submit" value="Close Account" name="closeaccount"></p>
</form>
';
break;
default:
echo '<p>Welcome to the super secret members only control panel!</p>';
}
?>
</div>
</body>
</html>
<?php
} else {
header("Location: login.php");
}
?>
process.php
Code:
<?php
include 'config.php';
if(isset($_POST['changepassword']))
{
$current = trim($_POST['current']);
$new = trim($_POST['new']);
$confirm = trim($_POST['confirm']);
$pw = md5($current);
$query = mysql_query("SELECT * FROM Users WHERE Password = '$pw' LIMIT 1") or die(mysql_error());
if(mysql_num_rows($query) > 0)
{
while($row = mysql_fetch_array($query))
{
if ( $_POST['new'] == $_POST['confirm'] )
{}else{
echo '<script>alert("Your passwords were not the same, please enter the same password in each field.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
$password = md5($new);
$do = mysql_query("UPDATE Users SET Password = '$password' WHERE Password = '$pw' LIMIT 1") or die(mysql_error());
$dotwo = mysql_query("UPDATE Users SET Activated = 0 WHERE Password = '$password' LIMIT 1") or die(mysql_error());
$send = mail($row['Email'] , "Password changed" , "Your password has been changed to: ".trim($_POST['new'])."\n\nYou can change it again via the members only panel, but first you must re-activate your account:\nhttp://CHANGETHISURL.COM/activate.php?id=".$row['Actkey']."\n\nDo not reply to this email, it is automated. Thanks." , "From: [email protected]");
if((($do)&&($dotwo)&&($send)))
{
echo '<script>alert("Password changed. You will now be logged out and you must re-activate your account, check your email, a confirmation email has been sent.");</script>';
echo '<script>location.replace("logout.php");</script>';
exit;
} else {
echo '<script>alert("There appears to have been an error in the script. 1 or 2 of 3 things may have happened:\n\n• Your password could have been reset/changed\n• Your account could have been deactivated, see the resend validation email page\n• Your email may not have been sent.\n\nYou will now be logged out, if you are not able to login, reset your password using the form, or resend the validation email to activate your account again.\n\nWe are sorry for the inconvenience.");</script>';
echo '<script>location.replace("logout.php");</script>';
exit;
}
}
} else {
echo '<script>alert("Incorrect password.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
}
if(isset($_POST['changeemail']))
{
$current = trim($_POST['current']);
$new = trim($_POST['new']);
$confirm = trim($_POST['confirm']);
$query = mysql_query("SELECT * FROM Users WHERE Email = '$current' LIMIT 1") or die(mysql_error());
if(mysql_num_rows($query) > 0)
{
while($row = mysql_fetch_array($query))
{
if ( $_POST['new'] == $_POST['confirm'] )
{}else{
echo '<script>alert("Your email addresses were not the same, please enter the same email to confirm.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
$do = mysql_query("UPDATE Users SET Email = '$new' WHERE Email = '$current' LIMIT 1") or die(mysql_error());
$dotwo = mysql_query("UPDATE Users SET Activated = 0 WHERE Email = '$new' LIMIT 1") or die(mysql_error());
$send = mail($row['Email'] , "Email changed" , "Your email has been changed to: ".trim($_POST['new'])."\n\nYou can change it again via the members only panel, but first you must re-activate your account:\nhttp://CHANGETHISURL.COM/activate.php?id=".$row['Actkey']."\n\nDo not reply to this email, it is automated. Thanks." , "From: [email protected]");
if((($do)&&($dotwo)&&($send)))
{
echo '<script>alert("Email changed. You will now be logged out and you must re-activate your account, check your email, a confirmation email has been sent.");</script>';
echo '<script>location.replace("logout.php");</script>';
exit;
} else {
echo '<script>alert("There appears to have been an error in the script. 1 or 2 of 3 things may have happened:\n\n• Your email could have been reset/changed\n• Your account could have been deactivated, see the resend validation email page\n• Your email may not have been sent.\n\nYou will now be logged out, if you are unable to login or cannot resend the validation email to either addresses, please contact the administrator.\n\nWe are sorry for the inconvenience.");</script>';
echo '<script>location.replace("logout.php");</script>';
exit;
}
}
} else {
echo '<script>alert("Incorrect email.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
}
if(isset($_POST['closeaccount']))
{
$username = $_SESSION['s_username'];
$do = mysql_query("DELETE FROM Users WHERE Username = '$username' LIMIT 1") or die(mysql_error());
if($do){
echo '<script>alert("Your account has now been closed, thank you for being with us. You will now be logged out.");</script>';
echo '<script>location.replace("logout.php");</script>';
exit;
} else {
echo '<script>alert("Your account has NOT been closed, there was an error in the processing of this script, you will now be redirected back, please try again.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
}
?>
Credits go to me for creating this
Hope you like the release!~
Join WingsMS!~
1000x exp 750x mesos 500x drop
Also If there is anything you might would like in a CMS please tell me
Last edited: