Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <?php
  2. define('_VALID', true);
  3. define('_ADMIN', true);
  4. include('../include/config.php');
  5.  
  6. $err = NULL;
  7. $msg = NULL;
  8. if ( isset($_POST['submit_login']) ) {
  9. $username = trim($_POST['username']);
  10. $password = trim($_POST['password']);
  11.  
  12. if ( $username == '' or $password == '' ) {
  13. $err = 'Please provide a username and password!';
  14. } else {
  15. if ( $username == $config['admin_name'] && $password == $config['admin_pass'] ) {
  16. $_SESSION['AUID'] = $config['admin_name'];
  17. $_SESSION['APASSWORD'] = $config['admin_pass'];
  18. VRedirect::go($config['BASE_URL']. '/siteadmin/index.php');
  19. } else {
  20. $err = 'Invalid username and/or password!';
  21. }
  22. }
  23. }
  24.  
  25. if ( isset($_POST['submit_forgot']) ) {
  26. if ( !isset($_SESSION['email_forgot']) )
  27. $_SESSION['email_forgot'] = 1;
  28.  
  29. if ( $_SESSION['email_forgot'] == 3 ) {
  30. $err = 'Please try again later!';
  31. }
  32.  
  33. if ( $err == '' ) {
  34. require '../classes/email.class.php';
  35. $mail = new VMail();
  36. $mail->set();
  37. $mail->Subject = 'Your ' .$config['site_name']. ' administrator username and password!';
  38. $message = 'Username: ' .$config['admin_name']. "\n";
  39. $message .= 'Password: ' .$config['admin_pass']. "\n";
  40. $mail->AltBody = $message;
  41. $mail->Body = nl2br($message);
  42. $mail->AddAddress($config['admin_email']);
  43. $mail->Send();
  44. $msg = 'Email was successfuly sent!';
  45. }
  46.  
  47. $_SESSION['email_forgot'] = $_SESSION['email_forgot']+1;
  48. }
  49.  
  50. $smarty->assign('msg',$msg);
  51. $smarty->assign('err',$err);
  52. $smarty->display('header.tpl');
  53. $smarty->display('login.tpl');
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement