[Release]Login/Logout/Password Changer/Email activation/Email Changer/ for CMS

Newbie Spellweaver
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

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: auto@mailer.com");

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: auto@mailer.com");

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: auto@mailer.com");

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: auto@mailer.com");

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:
Newbie Spellweaver
Joined
Jul 1, 2008
Messages
69
Reaction score
0
Re: [Release]Login/Logout/Email activation for CMS

Nice Release !
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,533
Reaction score
448
Re: [Release]Login/Logout/Email activation for CMS

Seems really cool, i did something like that for mPanel.
but users have a choice for email activation or not since some people never setup their smtp server or pop3. Nice release :) rep++ if they had that =]
EDIT: mine is slightly different, if nto activated they have banned status LOL :)
EDIT2: u didnt give the sql queries :)
 
Legendary Battlemage
Joined
May 23, 2008
Messages
628
Reaction score
4
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

This is nice...
 
Banned
Banned
Joined
Jun 23, 2008
Messages
197
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Nice release =) UserCP next, anyone?
 
for(alive>0){makeMoney()}
Loyal Member
Joined
Aug 1, 2006
Messages
357
Reaction score
68
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

why dont you keep poop like this too your self. I payed for a function like this but mine is 500x more complex.
 
Banned
Banned
Joined
Jun 23, 2008
Messages
197
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

why dont you keep poop like this too your self. I payed for a function like this but mine is 500x more complex.

:eek: Because he's nice? -googly eyes-
 
Newbie Spellweaver
Joined
Jul 9, 2008
Messages
13
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Cause I'm not a butt I like to help people out and make peoples servers cooler. Yeah...
I'm not a butt like some people...
 
Banned
Banned
Joined
Jun 23, 2008
Messages
197
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Cause I'm not a butt I like to help people out and make peoples servers cooler. Yeah...
I'm not a butt like some people...

Hey, mind adding a demo?
 
Newbie Spellweaver
Joined
Jul 9, 2008
Messages
13
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Ok I'll do that in a minute cause I'm working on somthing else for CMS
 
Skilled Illusionist
Loyal Member
Joined
May 5, 2008
Messages
352
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Hey, mind adding a demo?

wat r u talking about its not a cms wat site wud he apply it on?



and pretty kool release =)
 
Banned
Banned
Joined
Jun 23, 2008
Messages
197
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

wat r u talking about its not a cms wat site wud he apply it on?



and pretty kool release =)

He would put it into another CMS.... for example KakaCMS O_O You don't even need a CMS to make this work.
 
Newbie Spellweaver
Joined
Jul 9, 2008
Messages
13
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Lol. I could use hamachi and make a youtube video for it to show
xP
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,533
Reaction score
448
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

LOL cus people like him like sharing and its good, and also its not so hard to setup.
Its basically adding a user with an activation key between 1~500f78dj899dd encrypted in sha1 addded into the database with a link to the activation page and the key next to it so when they go to the activation page it gets the id and checks if its correct and boom activated :)
 
Banned
Banned
Joined
Jun 23, 2008
Messages
197
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Lol. I could use hamachi and make a youtube video for it to show
xP

Screenshots?. Don't need to hassle yourself. :eek:

I'll just test it out myself.
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,533
Reaction score
448
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

Lol, and how will it work without all the mysql columns? LOL!!!!! u didnt post those additional queries unless u want us to make it ourselves :)
 
Newbie Spellweaver
Joined
Jul 9, 2008
Messages
13
Reaction score
0
Re: [Release]Login/Logout/Email activation/Email Changer/ for CMS

I expected you to have a CMS already this is just to add on to your CMS

Like
Kaka CMS
Juicy CMS
KearTS CMS

etc.
 
Newbie Spellweaver
Joined
Jul 9, 2008
Messages
13
Reaction score
0
If theres somthing you might like for your CMS please tell me
 
Junior Spellweaver
Joined
Apr 12, 2008
Messages
181
Reaction score
2
SQL queries would be nice. Since the php would be sending blank queries to the database due to people not knowing what column(s) to add.
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,533
Reaction score
448
SQL queries would be nice. Since the php would be sending blank queries to the database due to people not knowing what column(s) to add.
Yes like i requested/mentioned for 2 times. If you want us to blankly create it, it might not work and we will get like syntax errors and stuff :)
 
Back
Top