Просмотр файла magmail/saveNote.php

Размер файла: 1.66Kb
<?
                    
require("functionChat.ssp");

function del_utf($s)
{
  $i = 0;
  while ($i < strlen($s))
  {
    $chord1 = ord($s[$i]); 
    if (($chord1 > 127) && (($i+1) < strlen($s))) 
    {
      $i++;
      $chord2 = ord($s[$i]); 
      if (($chord1 < 208) || ($chord1 > 209) || (($chord1 == 208) && ($chord2!=129 && $chord2<144 && $chord2>191)) || (($chord1 == 209) && ($chord2!=145 && $chord2<128 && $chord2>143)))
      {
        $s[$i-1] = "^";
        $s[$i] = "?";
      }
    }
    $i++;
  }
  
  return str_replace("^?","?",$s);
} 

$r = GetRandom();

openDB();

$result = checkpass($login,$pass,"*");

if ($sel == "") LogResult($ErrorMess,$InvSelNumber,"prev");
$friends = mysql_result($result,0, "friends");

$records = explode($dlm,$friends);

if ($sel > count($records)) LogResult($ErrorMess,$InvSelNumber,"prev");

$words = explode(" ",$rec);
$to = $words[0];
$email = (strpos($to,"@") !== false);
if (!$email)
{
  $result=mysql_query("select * from users where nick='$to'") or   die(mysql_error());
  $CountUsers=mysql_num_rows($result);
  If ($CountUsers != 1)   
    LogResult($ErrorMess,$InvNickMess." [$to]","prev"); 
}    
  
$mymess=del_utf($rec);
$rec=str_replace($dlm,";",ReplaceChar(substr(iconv("UTF-8","windows-1251",$rec),0,50)));
$records[$sel-1] = $rec;
$friends = implode($dlm,$records); 
if (strlen($friends) > $notelim) LogResult($ErrorMess,$NotesFull,"prev"); 
$sqlUpd = "update users set friends='$friends' where nick='$login' and pass = '$pass'";
mysql_query($sqlUpd) or die(mysql_error());
mysql_close();

LogResult($OKMess,$menu[54],"notes.php?p=$r&amp;login=$login&amp;pass=$pass");
  
?>