This guide describes how to enable a password change email account directly on the web ispcp.
Version 1.0.0 developed by shiizpa (Spanish Corner) 16-04-2009
<cli>cd /var/www/ispcp/gui/include</cli> <cli>wget http://softlayer.dl.sourceforge.net/sourceforge/adodb/adodb507.zip</cli> <cli>aptitude install unzip</cli> <cli>unzip adodb507.zip</cli>
<cli>nano /var/www/ispcp/gui/include/adodb.inc.php</cli>
<?php require_once'adodb5/adodb.inc.php'; define('host','localhost'); define('user','root'); //enter user access to table ISPC define('pass','tucontraseña'); //enter your password define('database','ispcp'); $db = ADONewConnection('mysql'); $db->Connect(host, user, pass, database); ?>
<cli>nano /var/www/ispcp/gui/tools/webmail/change_password.php</cli>
<?php require '../../include/ispcp-lib.php'; require '../../include/adodb.inc.php' ?> <!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>Change e-mail password</title> <meta name="robots" content="noindex,nofollow"> <link rel="stylesheet" type="text/css" href="/webmail/themes/css/omega.css"> <style type="text/css"> <!-- body, td, input, select, textarea { font-family:Tahoma, Geneva, sans-serif; font-size:9px; } input, textarea, select { border:#7f9db9 1px solid; padding:0px; } --> </style> </head> <body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000"> <form action="" method="post" name="login_form"> <div id="container"> <h1>Change e-mail password</h1> <fieldset class="login"> <p class="login"> <table cellpadding="0" cellspacing="0" style="color:#CCC"> <tr> <td align="left"> <strong>Username:</strong></td> <td><input type="text" name="user" style="width:130px;"/></td> </tr> <tr> <td align="left"> <strong>Password:</strong></td> <td><input type="password" name="contrasena" style="width:130px;"/></td> </tr> <tr> <td align="left"> <strong>New:</strong></td> <td><input name="ncontrasena" type="password" style="width:130px;" maxlength="15"/></td> </tr> <tr> <td align="left"> <strong>Repeat new:</strong></td> <td><input type="password" name="rcontrasena" style="width:130px;" maxlength="15"/></td> </tr> <tr> <td colspan="2" align="left"><a href="/webmail">webmail</a></td> </tr> <tr> <td align="left"></td> <td><input type="submit" name="cambiar" value="Change" /></td> </tr> </table> </p> </fieldset> </div> </form> <?php if(isset($_POST['cambiar'])=='Change'&&!empty($_POST['user'])&&!empty($_POST['contrasena'])&&!empty($_POST['ncontrasena'])&&!empty($_POST['rcontrasena'])) { if(isset($_POST['user']))$Usuario=$_POST['user']; if(isset($_POST['contrasena']))$Contrasena=encrypt_db_password($_POST['contrasena']); $UsuarioExiste=(int)$db->GetOne('SELECT count(mail_id) FROM mail_users WHERE mail_addr = ? and mail_pass = ?',array($Usuario,$Contrasena)); $id=$db->GetOne('SELECT mail_id FROM mail_users WHERE mail_addr = ? and mail_pass = ?',array($Usuario,$Contrasena)); if($UsuarioExiste=='1') { if($_POST['ncontrasena']!=$_POST['rcontrasena']) echo '<p align="center" style="color:#F00">The new password does not agree.</p>'; elseif($_POST['ncontrasena']==$_POST['contrasena']) echo '<p align="center" style="color:#F00">The new password is equal to the current.</p>'; elseif(empty($_POST['ncontrasena'])) echo '<p align="center" style="color:#F00">Your new password can not be empty.</p>'; elseif(strlen($_POST['ncontrasena']) < 6) echo '<p align="center" style="color:#F00"> Your new password is too short. Must be at least 6 characters.</p>'; elseif(strlen($_POST['ncontrasena']) > 15) echo '<p align="center" style="color:#F00">Your new password is too long. Must be no ore than 15 characters.</p>'; else { $db->Execute('UPDATE mail_users SET mail_pass=?, status=? WHERE mail_id=?',array(encrypt_db_password($_POST['ncontrasena']),'change',$id)); echo '<p align="center" style="color:#060">Password changed successfully.</p>'; send_request(); } } else echo '<p align="center" style="color:#F00">Bad Data.</p>'; } elseif(isset($_POST['cambiar'])=='Change') { echo '<p align="center" style="color:#F00">To complete missing fields.</p>'; } ?> </body> </html>
Developing…
Version 1.0.0 developed by shiizpa (Spanish Corner) 16-04-2009