<?php
############################################################
# \-\-\-\-\-\-\ AzDG - S C R I P T S /-/-/-/-/-/-/ #
############################################################
# AzDGDatingMedium Version 1.9.3 #
# Written by AzDG (hide@address.com) #
# Created 27/07/03 Last Modified 27/07/03 #
# Scripts Home: http://www.azdg.com #
############################################################
# File name dl.php #
# File purpose Library for ajax replies #
# File created by AzDG <hide@address.com> #
############################################################
include_once 'include/config.inc.php';
include_once 'include/options.inc.php';
include_once 'include/security.inc.php';
include_once 'include/functions.inc.php';
include_once 'classes/ajax.class.php';
$Ajax =& new Ajax(C_CHARSET);
if(!isset($check)) $check = 1;
switch($check)
{
case '1':default: // Bad username when register
$username = isset($_REQUEST['username']) ? cb($_REQUEST['username']) : '';
if (!ereg("^[".C_LOGIN_CHARS."]{3,16}$", $username) || empty($username)) die($_RESULT = array( 'username' => $w[266]));
else {
$result = mysql_query('SELECT count(id) as count FROM '.C_MYSQL_MEMBERS_MAIN.' WHERE username = \''.$username.'\'');
$trows = mysql_fetch_array($result);
$count = $trows['count'];
if ($count != '0') die($_RESULT = array( 'username' => $username.': ' . $w[267]));
else die($_RESULT = array( 'username' => ''));
}
break;
case '2': // Return number of new messages
if(IsAccess(C_AJAX_MSGINF) && C_HAVE_MESSAGE && MyID() > 0) {
// $newmsg = cb($_REQUEST['newmsg']);
$count = UnreadedMessages(MyID());
if($count > 0 && $count != '') die($GLOBALS['_RESULT'] = array( 'newmsg' => template($w[331],array($count)), 'icon' => NewMsgIcon(), 'num' => $count));
else die($GLOBALS['_RESULT'] = array( 'newmsg' => '', 'icon' => '', 'num' => '0'));
} else die($GLOBALS['_RESULT'] = array( 'newmsg' => '', 'icon' => '', 'num' => '0'));
break;
}
die;
?>