- Автор темы
- #1
спросил тут Для просмотра ссылки Войди или Зарегистрируйся но спрашиваю ещё и здесь
Моя функция, которая создаёт аккаунт(она ничего и не возвращает)!!!
Часть моего шаблона где функция вызывается!!!
Другой шаблон ОТКУДА функция вызывается!!!!
xAJAX debug
Функция createAccount не возвращает ничего вместо:
Короче я в панике - как проблему решить!?
Моя функция, которая создаёт аккаунт(она ничего и не возвращает)!!!
Код:
function createAccount($aFormData){
global $l,$mysql,$smarty,$REGISTRATION_CONFIRMATION
$objResponse = new xajaxResponse();
$login = $aFormData['login'];
$password = $aFormData['password'];
$password_confirm= $aFormData['password_confirm'];
$email = $aFormData['email'];
$email_confirm = $aFormData['email_confirm'];
$captcha = $aFormData['captcha'];
if (($email==NULL) or ($email_confirm==NULL) or ($captcha==NULL) or ($password==NULL) or ($password_confirm==NULL) or ($login==NULL)){
$objResponse->alert($l['ENTERREGVALUES']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
if($login!=NULL){
$mysql->tmpl = "SELECT * FROM `".PREFIX."users` WHERE `login`='$login' LIMIT 0,1";
$mysql->args = array();
$mysql->query(__FILE__,__LINE__);
if (mysql_num_rows($mysql->result)!=NULL){
$objResponse->alert($l['THISNICKREGISTERED']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
}
if($email==$email_confirm){
$mysql->tmpl = "SELECT * FROM `".PREFIX."users` WHERE `email`='$email' LIMIT 0,1";
$mysql->args = array();
$mysql->query(__FILE__,__LINE__);
if (mysql_num_rows($mysql->result)!=NULL){
$objResponse->alert($l['EMAILREGISTEREDYET']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
}
if ($email!=$email_confirm){
$objResponse->alert($l['EMAILNOTMATCH']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
if ($email and !preg_match('/^[\.A-z0-9_\-]+[@][\.A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/', $email)){
$objResponse->alert($l['EMAILNOTVALID']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
if ($password!=$password_confirm){
$objResponse->alert($l['PASSNOTMATCH']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
if ($captcha!=$_SESSION['captcha_keystring']){
$objResponse->alert($l['CAPTCHANOTMATCH']);
$objResponse->assign("regButton","value",$l['SIGNUP']);
$objResponse->assign("regButton","disabled",false);
return $objResponse;
die();
}
$smarty->assign('case',$REGISTRATION_CONFIRMATION);
$smarty->assign('date',date(DTFM,time()));
$smarty->assign('login',$login);
$smarty->assign('password',$password);
$smarty->assign('url',URL);
$smarty->assign('sitename',SITENAME);
$smarty->assign('email',$email);
$password=md5($password);
$header = "Return-Path: ".ADMIN_EMAIL."\n";
$header .= "X-Sender: ".ADMIN_EMAIL."\n";
$header .= "From: ".ENGINE." <".ADMIN_EMAIL.">\n";
$header .= "X-Mailer:".URL."\n";
$header .= "MIME-Version: 1.0\n";
$time=time();
switch ($REGISTRATION_CONFIRMATION){
case 'admin':
mysql_query("INSERT INTO `".PREFIX."users` (`email`, `joindate`, `password`, `login`, `approved`) VALUES ('$email', '$time', '$password', '$login', 0)");
//$mysql->args=array($email,$password,$login);
//$mysql->query(__FILE__,__LINE__);
mail($email,$l['ADMINAPPROVE'],$smarty->fetch('mail/adminconfirm.tpl'),$header);
mail(ADMIN_EMAIL,$l['TOADMINAPPROVE'],$smarty->fetch('mail/toadminconfirm.tpl'),$header);
break;
case 'no':
$mysql->tmpl('INSERT INTO `'.PREFIX.'users` (`email`, `joindate, `password` , `login` , `approved` ) VALUES (?, ?, ?, 1)');
$mysql->args=array($email,$time,$password,$login);
$mysql->query(__FILE__,__LINE__);
mail($email,$l['REGCONGRATZ'],$smarty->fetch('mail/congratz.tpl'),$header);
break;
}
$objResponse->assign("regform","innerHTML",$smarty->fetch('registered.tpl'));
return $objResponse;
}
Код:
{literal}
<script type="text/javascript">
xajax_showLoginForm("");
function submitSignup()
{
xajax.$('loginButton').disabled=true;
xajax.$('loginButton').value="{/literal}{$l.LOGGINGIN}{literal}";
xajax_login(xajax.getFormValues("loginForm"));
return false;
}
function doReg()
{
xajax.$('regButton').disabled=true;
xajax.$('regButton').value="{/literal}{$l.REGISTERING}{literal}";
xajax_createAccount(xajax.getFormValues("register"));
return false;
}
function hideForm()
{
xajax.$('RedBorder').style.display = 'none';
}
</script>
{/literal}
Код:
<div id="RedBorder" align="right">
<form id="register" method="POST" action="javascript:void(null);" onsubmit="doReg();">
<a href="#CloseWindow" onClick="hideForm('');"><img src="templates/yourdev/images/notOk.gif" alt="{$l.CLOSE}" border="0" /></a>
<table border="0" width="400px">
<tr>
<td height="20" valign="top">
{$l.LOGIN}:
</td>
<td align="left" height="20" valign="top">
<input type="text" name="login" onchange="xajax_checkNick(xajax.getFormValues('register'));" />
<div id="nickStatus"></div>
</td>
</tr>
<tr>
<td height="20" valign="top">
{$l.PASSWORD}:
</td>
<td align="left" height="20" valign="top">
<input type="password" name="password"/>
<div id="passwordStatus"></div>
</td>
</tr>
<tr>
<td height="20" valign="top">
{$l.PASSCONF}:
</td>
<td align="left" height="20" valign="top">
<input type="password" name="password_confirm" onchange="xajax_checkPassword(xajax.getFormValues('register'));" />
<div id="passwordConfirmStatus"></div>
</td>
</tr>
<tr>
<td height="20" valign="top">
{$l.EMAIL}:
</td>
<td align="left" height="20" valign="top">
<input type="text" name="email" />
<div id="emailStatus"></div>
</td>
</tr>
<tr>
<td height="20" valign="top">
{$l.EMAILCONF}:
</td>
<td align="left" height="20" valign="top">
<input type="text" name="email_confirm" onchange="xajax_checkEmail(xajax.getFormValues('register'));" />
<div id="emailConfirmStatus"></div>
</td>
</tr>
<tr>
<td height="58" valign="top" rowspan="2">
{$l.CAPTCHA}:
</td>
<td align="left" height="30" valign="top">
<img src="class/captcha/index.php" alt="{$l.CAPTCHAIMG}" border="1" />
<br />
<input type="text" name="captcha" onchange="xajax_checkCaptcha(xajax.getFormValues('register'));" />
<div id="captchaStatus"></div>
</td>
</tr>
</table>
<div align="center">
<input type="submit" id="regButton" value="{$l.SIGNUP}" />
<input type="reset" value="{$l.RESET}" /><br />
</form>
{$l.REGINFO}
</div>
</div>
Код:
xajax debug output
Wed, 01 Nov 2006 00:35:46 GMT+0300: Received:
Wed, 01 Nov 2006 00:35:46 GMT+0300: Calling createAccount uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=createAccount&xajaxr=1162330546625&xajaxargs[]=%3Cxjxquery%3E%3Cq%3Elogin%3Dasdfasdf%26password%3Dasdfasdf%26password_confirm%3Dasdfasdf%26email%3Dasdfasdf%2540asdfasdf.com%26email_confirm%3Dasdfasdf%2540asdfasdf.com%26captcha%3Dnen8e6%3C%2Fq%3E%3C%2Fxjxquery%3E)
Wed, 01 Nov 2006 00:35:46 GMT+0300: Initializing Request Object..
Wed, 01 Nov 2006 00:35:46 GMT+0300: Starting xajax...
Wed, 01 Nov 2006 00:35:45 GMT+0300: Received: <?xml version="1.0" encoding="windows-1251" ?><xjx><cmd n="as" t="captchaStatus" p="innerHTML"><![CDATA[<img src="templates/yourdev/images/Ok.gif" />]]></cmd></xjx>
Wed, 01 Nov 2006 00:35:45 GMT+0300: Calling checkCaptcha uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=checkCaptcha&xajaxr=1162330545468&xajaxargs[]=%3Cxjxquery%3E%3Cq%3Elogin%3Dasdfasdf%26password%3Dasdfasdf%26password_confirm%3Dasdfasdf%26email%3Dasdfasdf%2540asdfasdf.com%26email_confirm%3Dasdfasdf%2540asdfasdf.com%26captcha%3Dnen8e6%3C%2Fq%3E%3C%2Fxjxquery%3E)
Wed, 01 Nov 2006 00:35:45 GMT+0300: Initializing Request Object..
Wed, 01 Nov 2006 00:35:45 GMT+0300: Starting xajax...
Wed, 01 Nov 2006 00:35:42 GMT+0300: Received: <?xml version="1.0" encoding="windows-1251" ?><xjx><cmd n="as" t="emailStatus" p="innerHTML"><![CDATA[<img src="templates/yourdev/images/Ok.gif" />]]></cmd><cmd n="as" t="emailConfirmStatus" p="innerHTML"><![CDATA[<img src="templates/yourdev/images/Ok.gif" />]]></cmd></xjx>
Wed, 01 Nov 2006 00:35:42 GMT+0300: Calling checkEmail uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=checkEmail&xajaxr=1162330542187&xajaxargs[]=%3Cxjxquery%3E%3Cq%3Elogin%3Dasdfasdf%26password%3Dasdfasdf%26password_confirm%3Dasdfasdf%26email%3Dasdfasdf%2540asdfasdf.com%26email_confirm%3Dasdfasdf%2540asdfasdf.com%26captcha%3D%3C%2Fq%3E%3C%2Fxjxquery%3E)
Wed, 01 Nov 2006 00:35:42 GMT+0300: Initializing Request Object..
Wed, 01 Nov 2006 00:35:42 GMT+0300: Starting xajax...
Wed, 01 Nov 2006 00:35:34 GMT+0300: Received: <?xml version="1.0" encoding="windows-1251" ?><xjx><cmd n="as" t="passwordStatus" p="innerHTML"><![CDATA[<img src="templates/yourdev/images/Ok.gif" />]]></cmd><cmd n="as" t="passwordConfirmStatus" p="innerHTML"><![CDATA[<img src="templates/yourdev/images/Ok.gif" />]]></cmd></xjx>
Wed, 01 Nov 2006 00:35:34 GMT+0300: Calling checkPassword uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=checkPassword&xajaxr=1162330534812&xajaxargs[]=%3Cxjxquery%3E%3Cq%3Elogin%3Dasdfasdf%26password%3Dasdfasdf%26password_confirm%3Dasdfasdf%26email%3D%26email_confirm%3D%26captcha%3D%3C%2Fq%3E%3C%2Fxjxquery%3E)
Wed, 01 Nov 2006 00:35:34 GMT+0300: Initializing Request Object..
Wed, 01 Nov 2006 00:35:34 GMT+0300: Starting xajax...
Wed, 01 Nov 2006 00:35:32 GMT+0300: Received: <?xml version="1.0" encoding="windows-1251" ?><xjx><cmd n="as" t="nickStatus" p="innerHTML"><![CDATA[<img src="templates/yourdev/images/Ok.gif" />]]></cmd></xjx>
Wed, 01 Nov 2006 00:35:32 GMT+0300: Calling checkNick uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=checkNick&xajaxr=1162330532109&xajaxargs[]=%3Cxjxquery%3E%3Cq%3Elogin%3Dasdfasdf%26password%3D%26password_confirm%3D%26email%3D%26email_confirm%3D%26captcha%3D%3C%2Fq%3E%3C%2Fxjxquery%3E)
Wed, 01 Nov 2006 00:35:32 GMT+0300: Initializing Request Object..
Wed, 01 Nov 2006 00:35:32 GMT+0300: Starting xajax...
Wed, 01 Nov 2006 00:35:28 GMT+0300: Received: <?xml version="1.0" encoding="windows-1251" ?><xjx><cmd n="as" t="regform" p="innerHTML"><![CDATA[ <div id="RedBorder" align="right"> <form id="register" method="POST" action="javascript:void(null);" onsubmit="doReg();"> <a href="#CloseWindow" onClick="hideForm('');"><img src="templates/yourdev/images/notOk.gif" alt="Close this window!" border="0" /></a> <table border="0" width="400px"> <tr> <td height="20" valign="top"> Login: </td> <td align="left" height="20" valign="top"> <input type="text" name="login" onchange="xajax_checkNick(xajax.getFormValues('register'));" /> <div id="nickStatus"></div> </td> </tr> <tr> <td height="20" valign="top"> Password: </td> <td align="left" height="20" valign="top"> <input type="password" name="password"/> <div id="passwordStatus"></div> </td> </tr> <tr> <td height="... [long response] ...
Wed, 01 Nov 2006 00:35:28 GMT+0300: Calling register uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=register&xajaxr=1162330528375)
Wed, 01 Nov 2006 00:35:28 GMT+0300: Initializing Request Object..
Wed, 01 Nov 2006 00:35:28 GMT+0300: Starting xajax...
Wed, 01 Nov 2006 00:35:24 GMT+0300: Received: <?xml version="1.0" encoding="windows-1251" ?><xjx><cmd n="as" t="loginform" p="innerHTML"><![CDATA[ <form id="loginForm" method="post" action="javascript:void(null);" onsubmit="submitSignup();"> Login: <input name="login" id="login" type="text" size="10" maxlength="10" /><br /> Password: <input name="password" id="password" type="password" size="10" maxlength="10" /><br /> Log you automatically(cookies)?<input name="autologin" id="autologin" type="checkbox" value="1" checked /><br /> <input id="loginButton" type="submit" value="Log-in!"/><br /> <div class="menu_divlink"><a href="#Reg" onClick="xajax_register();" class="menu_link">SignUP!</a></div> <div class="menu_divlink"><a href="#ForegetPass?" onClick="xajax_forgetPass();" class="menu_link">Forget your pass!?</a></div> </form>]]></cmd></xjx>
Wed, 01 Nov 2006 00:35:24 GMT+0300: Calling showLoginForm uri=http://yourdev.dev/?cid=3&lang=EN (post:xajax=showLoginForm&xajaxr=1162330524390&xajaxargs[]=)
Wed, 01 Nov 2006 00:35:24 GMT+0300: Initializing Request Object..
Код:
$objResponse->assign("regform","innerHTML",$smarty->fetch('registered.tpl'));
return $objResponse;