View file magmail/saveprof.php

File size: 1.08Kb
<?

require("functionChat.ssp");
$r = GetRandom();

openDB();

$result = checkpass($nn,$pass,"profile");
  

function SetProfItem($Profile,$Label,$ItemValue)
// Предварительно обязательно обнулить profile
{
  $pos1 = strpos($Profile,"<$Label>");
  $pos2 = strpos($Profile,"</$Label>");
  if (($pos1 !== false) and ($pos2 !== false))
  { // Удаление старого
    $Profile = substr($Profile,0,$pos1).substr($Profile,$pos2+strlen("</$Label>"));
  }
  if (trim($ItemValue) != "" ) {$Profile = $Profile."<$Label>$ItemValue</$Label>";}
//    if (trim($ItemValue) != "" ) {$Profile = $Profile."<$Item>".iconv("UTF-8","windows-1251",$ItemValue)."</$Item>";}
  return trim($Profile);
}

$profile= mysql_result($result,0, "profile");    
list($label,$mess,$datalen)=explode("|",$ProfData[$num]);
$profile = SetProfItem($profile,$label,ReplaceChar($data));
$sqlUpd = "update users set profile='$profile' where nick = '$nn' and pass='$pass'";
mysql_query($sqlUpd) or die(mysql_error());
LogResult($OKMess,$ProfSaveMess,"anketa.php?p=$r&amp;nn=$nn&amp;pass=$pass");
mysql_close();   
?>