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

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

$r = GetRandom();

openDB();

$result = checkpass($login,$pass,"*");
InitParam(mysql_result($result,0, "names"),mysql_result($result,0, "vals"));
$usetrans = GetParam('usetrans');

if ($to == "" and isset($sel) and $sel != "")
{
  $friends = mysql_result($result,0, "friends");
  $records = explode($dlm,$friends);
  if ($sel > count($records)) LogResult($ErrorMess,$InvSelNumber,"prev");
  $words = explode(" ",trim($records[$sel-1]));
  $to = $words[0];
}  

//$tolong = "$to+";
$sqlSel="select * from letters where tonick='$to+' and fromnick='$login' order by num desc limit 1";
$result=mysql_query($sqlSel) or die(mysql_error());
$countres=mysql_num_rows($result);

$long = ($countres == 1);
 
if ($long)
{
  $messtext = UnReplaceChar(mysql_result($result,0,"messtext"));
  $num = mysql_result($result,0,"num");
  $messEnd = substr($messtext,strlen($messtext)-16);
  $messEnd = win2utf(ReplaceChar($messEnd));
  $log1 = "sendlong";
  $log2 = "addlong";
  $long = 1;
}
else
{
  $log1 = "send";
  $log2 = "startlong";
  $long = 0;
}
 
    

if (strpos(strtolower($to),"@computermag.ru") !== false or strpos(strtolower($to),"@mag.su") !== false)
{
  $to = substr($to,0,strpos($to,"@"));
}  
$email = (strpos($to,"@") !== false);
if ($email && !validEmail($to)) LogResult($ErrorMess,$InvEmail,"selnick.php?p=$r&amp;login=$login&amp;pass=$pass");

$messtype = $ReadType;
if (!$email)
{
  $messtype = $UnReadType;
  $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]","selnick.php?p=$r&amp;login=$login&amp;pass=$pass"); 
  // Нет такого зарегистрированного имени
  $tonick = mysql_result($result,0, "nick");
  $toid = mysql_result($result,0, "ind");
  mysql_close();
}
else
{
  $tonick = $to;
  $toid = 0;  
}  

require("headerwml.ssp");
echo "<card id=\"$MagMail\" title=\"$menu[3]\">\n";
if (isset($foto) or $long) 
{ 
  if (!isset($foto)) $foto = "";
  else $foto = "# foto=$foto#";
  echo "<onevent type=\"onenterforward\">\n";
  echo "<refresh>\n";
  echo "<setvar name=\"mymess\" value=\"$foto\"/>\n";
  echo "</refresh>\n";
  echo "</onevent>\n";
}
echo "<p align=\"center\">"; 

echo "<a href=\"selnick.php?p=$r&amp;login=$login&amp;pass=$pass\">$menu[22]:</a><br/>".NoClones($tonick)."<br/>\n";
echo "<a href=\"addNote.php?p=$r&amp;to=$to&amp;login=$login&amp;pass=$pass\">$menu[50]:</a><br/>\n";

if ($email) 
{
 echo "$menu[31]:";
 echo "<br/><input name=\"subject\" maxlength=\"40\" emptyok=\"true\" title=\"=\" type=\"text\"/>\n";
 echo "$menu[30]:<br/>";
} 
if ($long) { echo "...$messEnd<br/>\n"; }
echo "<input name=\"mymess\" maxlength=\"200\" emptyok=\"true\" title=\"=\" type=\"text\"/>\n"; 



if (!$long) echo "</p><p><anchor>- $menu[21]";
else echo "</p><p><anchor>- $menu[38]";
echo "<go method=\"post\" href=\"addMess.php?p=$r&amp;login=$login&amp;pass=$pass\">\n";
echo "<postfield name=\"log\" value=\"$log1\"/>\n";
echo "<postfield name=\"messtype\" value=\"$messtype\"/>\n";
echo "<postfield name=\"toind\" value=\"$toid\"/>\n";
echo "<postfield name=\"tonick\" value=\"$tonick\"/>\n";
if ($email) {echo "<postfield name=\"subject\" value=\"$(subject)\"/>\n";}
echo "<postfield name=\"mymess\" value=\"$(mymess)\"/>\n";
echo "</go>\n";
echo "</anchor>\n";

if (!$long) echo "<br/><anchor>- $menu[40]";
else echo "<br/><anchor>- $menu[39]";
echo "<go method=\"post\" href=\"addMess.php?p=$r&amp;login=$login&amp;pass=$pass\">\n";
echo "<postfield name=\"log\" value=\"$log2\"/>\n";
echo "<postfield name=\"messtype\" value=\"$ReadType\"/>\n";
echo "<postfield name=\"toind\" value=\"0\"/>\n";
echo "<postfield name=\"tonick\" value=\"$tonick"."+"."\"/>\n";
echo "<postfield name=\"mymess\" value=\"$(mymess)\"/>\n";
echo "</go>\n";
echo "</anchor>\n";

echo "<br/><anchor>- $menu[45]";
echo "<go method=\"post\" href=\"editMess.php?p=$r&amp;login=$login&amp;pass=$pass&amp;tonick=$tonick&amp;usetrans=$usetrans\">\n";
echo "<postfield name=\"long\" value=\"$long\"/>\n";
echo "<postfield name=\"toid\" value=\"$toid\"/>\n";
if ($email) {echo "<postfield name=\"subject\" value=\"$(subject)\"/>\n";}
echo "<postfield name=\"mymess\" value=\"$(mymess)\"/>\n";
echo "</go>\n";
echo "</anchor>\n";

echo "</p><p align=\"center\">\n";
if ($long) echo "<a href=\"dispMy.php?p=$r&amp;login=$login&amp;pass=$pass&amp;num=$num&amp;to=$to\">$menu[42]</a><br/>\n";

if (!$email) echo "<a href=\"profile.php?p=$r&amp;login=$login&amp;pass=$pass&amp;to=$to\">$menu[7]</a><br/>\n";

echo "<a href=\"notes.php?p=$r&amp;login=$login&amp;pass=$pass\">$menu[51]</a><br/>\n";

echo "<a href=\"/logos/magmail/index.php?sort=time\">$menu[41]</a>\n";

echo "<br/><a href=\"dispMess.php?p=$r&amp;page=old&amp;login=$login&amp;pass=$pass\">$menu[2]</a>\n";
//echo "<br/><a href=\"dispSent.php?p=$r&amp;page=old&amp;login=$login&amp;pass=$pass\">$menu[19]</a>\n";
echo "<br/><a href=\"index.php?p=$r&amp;login=$login&amp;pass=$pass\">$MagMail</a>\n";

echo "<do type=\"prev\" label=\"$menu[2]\">\n";
echo "<go href=\"dispMess.php?p=$r&amp;page=old&amp;login=$login&amp;pass=$pass\"/>\n";
echo "</do>\n";

echo "</p>";
include ("bottom.inc");
?>