File size: 1.51Kb
<?
function ValidFrom($s)
{
return !eregi("[^a-z0-9_,@.]",$s);
}
require("functionChat.ssp");
$r = GetRandom();
openDB();
$result = checkpass($login,$pass,"");
$redirfrom=substr(str_replace(" ","",$redirfrom),0,255);
$redirfrom=str_replace("#","",$redirfrom);
$redirto=substr(trim($redirto),0,60);
$redirto=str_replace("#","",$redirto);
if (strpos(strtolower($redirto),"@computermag.ru") !== false)
{
$redirto = substr($redirto,0,strpos($redirto,"@"));
}
if (!ValidFrom($redirfrom) && !empty($redirfrom)) LogResult($ErrorMess,$InvNNSyntaxMess,"redir.php?p=$r&login=$login&pass=$pass");
$email = (strpos($redirto,"@") !== false);
if ($email && !validEmail($redirto) && !empty($redirto)) LogResult($ErrorMess,$InvEmailSyntaxMess,"redir.php?p=$r&login=$login&pass=$pass");
if (!$email && !ValidFrom($redirto) && !empty($redirto)) LogResult($ErrorMess,$InvNNSyntaxMess,"redir.php?p=$r&login=$login&pass=$pass");
if (!$email && !empty($redirto))
{
$result=mysql_query("select * from users where nick='$redirto'") or die(mysql_error());
$CountUsers=mysql_num_rows($result);
If ($CountUsers != 1) LogResult($ErrorMess,$InvNickMess,"redir.php?p=$r&login=$login&pass=$pass");
// Нет такого зарегистрированного имени
}
$sqlUpd = "update users set redirfrom='$redirfrom', redirto='$redirto' where nick = '$login' and pass='$pass'";
mysql_query($sqlUpd) or die(mysql_error());
mysql_close();
LogResult($OKMess,$ProfSaveMess,"index.php?p=$r");
?>