Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

recoverpw.php 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?PHP
  2. require_once('lib/common.php');
  3. require_once('lib/database.php');
  4. require_once('lib/dashboard.php');
  5. define('NOLOGINREF', true); // So we don't go round in circles
  6. require_once('lib/account.php');
  7. if (isset($_POST['username']) && isset($_POST['email']) && isset($_POST['phone']) && isset($_POST['pass1']) && isset($_POST['pass2'])) {
  8. if ($_POST['pass1'] == $_POST['pass2']) {
  9. if (($error = validPass($_POST['pass1'])) === true) {
  10. $sql = 'SELECT user_id, user_email, ud_telephone FROM users NATURAL JOIN ';
  11. $sql .= 'userdetails WHERE user_name = \''.m($_POST['username']).'\'';
  12. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  13. if (mysql_num_rows($res) != 1) {
  14. l('Failed password recovery attempt [user '.$_POST['username'].'] from '.$_SERVER['REMOTE_ADDR']);
  15. define('MESSAGE', 'Invalid details. Please e-mail support@utd-hosting.com for assistance.');
  16. bfc($_SERVER['REMOTE_ADDR']);
  17. } else {
  18. $row = mysql_fetch_array($res);
  19. if (strtolower($row['user_email']) != strtolower($_POST['email'])) {
  20. l('Failed password recovery attempt [user '.$_POST['username'].', email '.$_POST['email'].'] from '.$_SERVER['REMOTE_ADDR']);
  21. define('MESSAGE', 'Invalid details. Please e-mail support@utd-hosting.com for assistance.');
  22. bfc($_SERVER['REMOTE_ADDR']);
  23. } else {
  24. $file = preg_replace('/[^0-9]/','',$row['ud_telephone']);
  25. $user = preg_replace('/[^0-9]/','',$_POST['phone']);
  26. if ($file != $user || strlen($user) < 1) {
  27. l('Failed password recovery attempt [user '.$_POST['username'].', telephone'.$_POST['phone'].'] from '.$_SERVER['REMOTE_ADDR']);
  28. define('MESSAGE', 'Invalid details. Please e-mail support@utd-hosting.com for assistance.');
  29. } else {
  30. changePass($row['user_id'], $_POST['pass1']);
  31. l('Password recovered by '.$_SERVER['REMOTE_ADDR'], $row['user_id']);
  32. define('MESSAGE', 'Password changed.');
  33. }
  34. }
  35. }
  36. } else {
  37. define('MESSAGE', 'Passwords must be 5-20 characters, and contain at least one upper case letter, one lower case letter, and one number.');
  38. }
  39. } else {
  40. define('MESSAGE', 'Your passwords do not match.');
  41. }
  42. }
  43. addDashboardItem('Useful links', 'Login', 'login');
  44. addDashboardItem('Frequently asked questions', 'Can I give other users access to my control panel?', 'support/006');
  45. addDashboardItem('Frequently asked questions', 'What do I do if I forget my username?', 'support/007');
  46. addDashboardItem('Frequently asked questions', 'Can I file support requests without using the control panel?', 'support/005');
  47. define('TITLE', 'Recover password');
  48. require_once('lib/header.php');
  49. require_once('pages/recover.php');
  50. require_once('lib/footer.php');
  51. ?>