<?php
############################################################
# \-\-\-\-\-\-\     AzDG  - S C R I P T S    /-/-/-/-/-/-/ #
############################################################
# AzDGDatingMedium        Version 1.9.3                    #
# Written by              AzDG (support@azdg.com)          #
# Created 24/10/02        Last Modified 22/03/06           #
# Scripts Home:           http://www.azdg.com              #
############################################################
# File name               remind.php                       #
# File purpose            Forget password script           #
# File created by         AzDG <support@azdg.com>          #
############################################################
include_once 'include/config.inc.php';
include_once 'include/options.inc.php';
include_once 'include/functions.inc.php';
include_once 'include/security.inc.php';
include_once 'templates/'.C_TEMP.'/config.php';
include_once C_PATH.'/header.php';

if(!isset($_POST['p'])) $_POST['p']=''; 
  if ($_POST['p'] == "s") 
  {
    if (c_email($id) == 0) 
    {
      include_once C_PATH.'/header.php';
      printm($w[11]);
    }

    switch(C_ID)
    {
    case '0':
      $tmpvar = 't1.username,';
    break;
    case '1':
      $tmpvar = 't1.id,';
    break;
    default:
      $tmpvar='';      
    break;
    }
    
    $tmp=mysql_query("SELECT ".$tmpvar." t2.email, t2.password FROM ".C_MYSQL_MEMBERS_MAIN." as t1, ".C_MYSQL_MEMBERS_SEC." as t2 WHERE t1.status >= '7' AND t2.email='".cbmail($id)."' AND t1.id = t2.id LIMIT 1");
    if(mysql_num_rows($tmp) == '0') printm($w[196]);
    $i=mysql_fetch_array($tmp);

    switch(C_ID)
    {
    case '0':
      $id = $i['username'];
    break;
    case '1':
      $id = $i['id'];
    break;
    default:
      $id= $i['email'];      
    break;
    }

    $tm=array(C_SNAME);
    $subject=template($w[195],$tm);
    $tm=array($id,$i['password'],C_SNAME);
    $message=template($w[197],$tm);
    sendmail(C_FROMM,$i['email'],$subject,$message,'text');
    printm($w[198],2);
} else {

define('FORGOT_PASSWORD',$w[173]);
define('EMAIL',$w[60].$w[0]);
define('SEND_PASSWORD',$w[200]);

include_once C_PATH.'/templates/'.C_TEMP.'/remind.php';

}

include_once C_PATH.'/footer.php';
?>