|
|
|
|
|
|
| |
Want a password reminder?
| <?php
/*********************************************************
** Class password reminder
**
** Author.: leapinglangoor [ leapinglangoor@yahoo.co.in ]
** Date...: 23rd June 2004
** Version: v2.3
**
** Descreption: Ok, all this class does is use the passed
** email, $email and send the passwd to the id
** afer checking it exists.
**
**********************************************************/
class reminder
{
var $mailer['from'] = 'someone@somwhere.tld';
var $db['host'] = 'localhost';
var $db['user'] = 'root';
var $db['pass'] = '';
var $db['db'] = 'users';
var $db['table'] = 'user_info';
var $db['field_passwd'] = 'password'; // Specify the name of the field in the table corresponding to the password field.
var $db['field_email'] = 'email'; // Same as above only for the email
function remind( $email )
{
@mysql_connect( $this->db['host'], $this->db['user'], $this->db['pass'] ) or die( 'Cant connect' );
@mysql_select_db( $this->db['db'] ) or die( 'No db' );
$sql = "SELECT `$this->db['field_passwd']` FROM `$this->db['table']` WHERE `$this->db['field_email']` = `$email`";
$result = mysql_query( $sql ) or die( 'Cant query' );
if( !mysql_num_rows( $result ) )
return 0;
mail( $email, 'Password reminder', 'From: ' . $this->mailer['from'] ) or die( 'Cant mail' );
return 1;
}
} // End class reminder
?> | |
Example.php (*Config the vars in the class first*):
| <?php
include( 'reminder.php' );
$rem = new reminder;
$email = 'some@somwehere.tld';
if( $rem->remind( $email ) )
echo 'Password successfully sent';
else
echo 'Email not found in database';
?> | | |
|
| MySQL Handler Categories : PHP, Databases, MySQL, Classes and Objects, PHP Classes | | | Powerful php/mysql Pagination for up to 6 URL Params Categories : PHP, PHP Classes, Databases, MySQL, Navigation | | | PostGreSQL and MySQL 2 in 1 db Manager Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL | | | MySQL Class to ease Database connectivity Categories : MySQL, PHP Classes, Databases, PHP | | | usercounter class Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables | | | Simple Mini Poll class library (SimPoll) Categories : PHP, PHP Classes, Databases, MySQL, Complete Programs | | | Online Automatic Class Generator for MySQL Tables Categories : PHP, PHP Classes, Classes and Objects, Databases, MySQL | | | Simple database class Categories : PHP, PHP Classes, MySQL, Databases | | | Simple usersOnline class - keep track of how many users are online on your site Categories : PHP, PHP Classes, Databases, MySQL | | | Specify your connection settings and create a link to a MySQL database. Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides | | | Setting up InnoDB on MySQL and using Transactions Begin, Commit, Rollback in PHP. Categories : PHP Classes, Databases, PHP, MySQL, InnoDB | | | Ajax PHP Tree (Left and Right) with MySQL Categories : PHP, Databases, MySQL, AJAX, PHP Classes | | | YellowPages Content Grabber (PHP5 +) Categories : PHP, PHP Classes, Regexps, Databases, MySQL | | | Convert SQL from oracle,mysql,mssql,sqlite and odbc to SQL compatible Categories : PHP, PHP Classes, Databases, MySQL, MS SQL Server | | | MySQL Connection/Query Class Categories : Databases, MySQL, PHP, PHP Classes | |
|
|
|