View file chat_polifonia/foto.php

File size: 12.69Kb
<?
header("Cache-Control: no-cache");
require("inc.php");
$ref=rand(10000,1000000);
if(!isset($ps))
{
echo "<HTML>\n";
echo "<HEAD>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1251\">\n";
echo "<TITLE>&#1044;&#1086;&#1073;&#1072;&#1074;&#1080;&#1090;&#1100; &#1092;&#1086;&#1090;&#1086;</TITLE>\n";
echo "<style TYPE=\"text/css\"><!--\n";
echo ".body{ text-align: center; font-family: Arial; font-size: 12pt;}\n";
echo "A:Link{ Color: #FF4A4A; text-decoration: none;}\n";
echo "A:Visited{ Color: #FF9BFF; text-decoration: none;}\n";
echo "A:Active{ Color: #05FA30;}\n";
echo "A:hover{ Color: #05FA30}\n";
echo "BODY{Margin-Left: 0; Margin-Right:0; Margin-Top: 50; Margin-Bottom: 10;}\n";
echo "--></style>\n";
echo "</HEAD>\n";
echo "<BODY TEXT=\"BLACK\" BGCOLOR=\"#F7EDCE\" BACKGROUND=\"07000000.gif\">\n";
echo "<div class=\"body\">\n";
if(@$error=="user")
{$msg="<font color=\"red\" size=\"5\"><b>User was not found</b></font><br><br>";}
if(@$error=="login")
{$msg="<font color=\"red\" size=\"5\"><b>Your login failed</b></font><br><br>";}
echo @$msg;
echo "<font color=\"#B31C7D\" size=\"5\">&#1042;&#1074;&#1077;&#1076;&#1080;&#1090;&#1077; &#1089;&#1074;&#1086;&#1081; \"&#1095;&#1072;&#1090;&#1086;&#1074;&#1089;&#1082;&#1080;&#1081;\" &#1085;&#1080;&#1082; &#1080; &#1087;&#1072;&#1088;&#1086;&#1083;&#1100;.</font>\n";
echo "<b><form method=\"POST\" action=\"foto.php?ref=$ref\" name=\"auth\">\n";
echo "&#1053;&#1080;&#1082;:<br>\n";
echo "<input type=\"text\" name=\"us\" maxlength=\"15\"  size=\"15\"><br>\n";
echo "&#1055;&#1072;&#1088;&#1086;&#1083;&#1100;:<br>\n";
echo "<input type=\"text\" name=\"ps\" maxlength=\"15\"  size=\"15\"><br>\n";
echo "<input type=\"submit\" value=\"&#1042;&#1093;&#1086;&#1076;\" name=\"enter\" onMouseOver=\"style.color='#00FF40'\" onMouseOut=\"style.color='black'\"></b>\n";
echo "</BODY>\n";
echo "</HTML>\n";
 exit;
}
if(isset($us)){
$us=strtr($us,array("а"=>"Р°","б"=>"Р±","в"=>"РІ","г"=>"Рі","д"=>"Рґ","е"=>"Рµ","ё"=>"С‘","ж"=>"Р¶","з"=>"Р·","и"=>"Рё","й"=>"Р№","к"=>"Рє","л"=>"Р»","м"=>"Рј","н"=>"РЅ","о"=>"Рѕ","п"=>"Рї","р"=>"СЂ","с"=>"СЃ","т"=>"С‚","у"=>"Сѓ","ф"=>"С„","х"=>"С…","ц"=>"С†","ч"=>"С‡","ш"=>"С€","щ"=>"С‰","ъ"=>"СЉ","ы"=>"С‹","ь"=>"СЊ","э"=>"СЌ","ю"=>"СЋ","я"=>"СЏ","А"=>"Рђ","Б"=>"Р‘","В"=>"Р’","Г"=>"Р“","Д"=>"Р”","Е"=>"Р•","Ё"=>"РЃ","Ж"=>"Р–","З"=>"Р—","И"=>"Р&#65533;","Й"=>"Р™","К"=>"Рљ","Л"=>"Р›","М"=>"Рњ","Н"=>"Рќ","О"=>"Рћ","П"=>"Рџ","Р"=>"Р ","С"=>"РЎ","Т"=>"Рў","У"=>"РЈ","Ф"=>"Р¤","Х"=>"РҐ","Ц"=>"Р¦","Ч"=>"Р§","Ш"=>"РЁ","Щ"=>"Р©","Ъ"=>"РЄ","Ы"=>"Р«","Ь"=>"Р¬","Э"=>"Р­","Ю"=>"Р®","Я"=>"РЇ"));
}
$link = @mysql_pconnect ($MySQL_Hostname, $MySQL_Username, $MySQL_Password)
                or die ("Can not connect to MySQL");

     @mysql_select_db($MySQLDatabasename) or die ("error select the database...");

               if(isset($id)){
        $result = @mysql_query ("Select * from users where id='".$id."'");
        } else {
                         if ($us=="") {
header ("Location: foto.php?error=user");
mysql_close ($link);
exit;
}
                function rus_to_k($str){
                $str = str_replace("Р°","a",$str);
                $str = str_replace("Р±","b",$str);
                $str = str_replace("РІ","v",$str);
                $str = str_replace("Рі","g",$str);
                $str = str_replace("Рґ","d",$str);
                $str = str_replace("Рµ","e",$str);
                $str = str_replace("С‘","e",$str);
                $str = str_replace("Р¶","j",$str);
                $str = str_replace("Р·","z",$str);
                $str = str_replace("Рё","i",$str);
                $str = str_replace("Р№","y",$str);
                $str = str_replace("Рє","k",$str);
                $str = str_replace("Р»","l",$str);
                $str = str_replace("Рј","m",$str);
                $str = str_replace("РЅ","n",$str);
                $str = str_replace("Рѕ","o",$str);
                $str = str_replace("Рї","p",$str);
                $str = str_replace("СЂ","r",$str);
                $str = str_replace("СЃ","s",$str);
                $str = str_replace("С‚","t",$str);
                $str = str_replace("Сѓ","u",$str);
                $str = str_replace("С„","f",$str);
                $str = str_replace("С…","h",$str);
                $str = str_replace("С‡","c",$str);
                $str = str_replace("С†","q",$str);//ч
                $str = str_replace("С€","w",$str);
                $str = str_replace("С‰",">",$str);//щ
                $str = str_replace("СЊ","<",$str);//ъ
                $str = str_replace("С‹","x",$str);//ы
                $str = str_replace("СЉ",".",$str);//ь
                $str = str_replace("СЌ",":",$str);//э
                $str = str_replace("СЋ",";",$str);//ю
                $str = str_replace("СЏ","}",$str);//я
                $str = str_replace("Рђ","a",$str);
                $str = str_replace("Р‘","b",$str);
                $str = str_replace("Р’","v",$str);
                $str = str_replace("Р“","g",$str);
                $str = str_replace("Р”","d",$str);
                $str = str_replace("Р•","e",$str);
                $str = str_replace("РЃ","e",$str);
                $str = str_replace("Р–","j",$str);
                $str = str_replace("Р—","z",$str);
                $str = str_replace("Р&#65533;","i",$str);
                $str = str_replace("Р™","y",$str);
                $str = str_replace("Рљ","k",$str);
                $str = str_replace("Р›","l",$str);
                $str = str_replace("Рњ","m",$str);
                $str = str_replace("Рќ","n",$str);
                $str = str_replace("Рћ","o",$str);
                $str = str_replace("Рџ","p",$str);
                $str = str_replace("Р ","r",$str);
                $str = str_replace("РЎ","s",$str);
                $str = str_replace("Рў","t",$str);
                $str = str_replace("РЈ","u",$str);
                $str = str_replace("Р¤","f",$str);
                $str = str_replace("РҐ","h",$str);
                $str = str_replace("Р§","c",$str);
                $str = str_replace("Р¦","q",$str);
                $str = str_replace("РЁ","w",$str);
                $str = str_replace("Р©",">",$str);
                $str = str_replace("Р¬","<",$str);
                $str = str_replace("Р«","x",$str);
                $str = str_replace("РЄ",".",$str);
                $str = str_replace("Р­",":",$str);
                $str = str_replace("Р®",";",$str);
                $str = str_replace("РЇ","}",$str);
                return $str;
                }

    $latuser=strtolower($us);
    $ruser = rus_to_k($us);
    if($ruser==$us){
   $result = mysql_query ("Select * from users where latuser = '".$latuser."'");
    } else {
   $result = mysql_query ("select * from users where ruser = '".$ruser."'");
    }
    }

        if (mysql_affected_rows() == 0) {
header ("Location: foto.php?error=user");
mysql_close ($link);
exit;
}

$row = mysql_fetch_array ($result);
if ($ps !== $row["pass"]){
header ("Location: foto.php?error=login");
mysql_close ($link);
exit;
}
if(!isset($id))$id=$row["id"];
$us=$row["user"];

if(isset($go))
{
if(!isset($file))
{
 header ("Location: foto.php?id=$id&ps=$ps&ref=$ref&error=file");
 exit;
 }
$size = filesize($file);
$par = GetImageSize($file);
if($par[2]!==1)
{
 header ("Location: foto.php?id=$id&ps=$ps&ref=$ref&error=nogif");
 exit;
 }
if($size>25600)
{
 header ("Location: foto.php?id=$id&ps=$ps&ref=$ref&error=size");
 exit;
 }
if(($par[0]>174)||($par[1]>174))
 {
 header ("Location: foto.php?id=$id&ps=$ps&ref=$ref&error=pix");
 exit;
 }
$foto=$id.".gif";
if (file_exists ("img/$foto"))
{
unlink ("photos/$foto");
}
Copy($file, "photos/$foto");
@mysql_query ("Update users set img='".$foto."' where id ='".$id."'");
$msg="<b>&#1042;&#1072;&#1096;&#1072; &#1092;&#1086;&#1090;&#1086;&#1075;&#1088;&#1072;&#1092;&#1080;&#1103; &#1076;&#1086;&#1073;&#1072;&#1074;&#1083;&#1077;&#1085;&#1072;</b><br>";
}
$result = mysql_query ("select * from users where id = '".$id."'");
$row = mysql_fetch_array ($result);
echo "<HTML>\n";
echo "<HEAD>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1251\">\n";
echo "<TITLE>&#1044;&#1086;&#1073;&#1072;&#1074;&#1080;&#1090;&#1100; &#1092;&#1086;&#1090;&#1086;</TITLE>\n";
echo "<style TYPE=\"text/css\"><!--\n";
echo ".body{ text-align: center; font-family: Arial; font-size: 12pt;}\n";
echo "A:Link{ Color: #FF4A4A; text-decoration: none;}\n";
echo "A:Visited{ Color: #FF9BFF; text-decoration: none;}\n";
echo "A:Active{ Color: #05FA30;}\n";
echo "A:hover{ Color: #05FA30}\n";
echo "BODY{Margin-Left: 0; Margin-Right:0; Margin-Top: 0; Margin-Bottom: 10;}\n";
echo "--></style>\n";
echo "</HEAD>\n";
echo "<BODY TEXT=\"BLACK\" BGCOLOR=\"#F7EDCE\" BACKGROUND=\"07000000.gif\">\n";
echo "<div class=\"body\">\n";
if(@$error=="file")
{$msg="<font color=\"red\" size=\"5\"><b>&#1042;&#1099; &#1085;&#1077; &#1091;&#1082;&#1072;&#1079;&#1072;&#1083;&#1080; &#1092;&#1072;&#1081;&#1083;!</b></font><br><br>";}
if(@$error=="nogif")
{$msg="<font color=\"red\" size=\"5\"><b>&#1059;&#1082;&#1072;&#1079;&#1072;&#1085;&#1085;&#1099;&#1081; &#1074;&#1072;&#1084;&#1080; &#1092;&#1072;&#1081;&#1083; &#1085;&#1077; &#1103;&#1074;&#1083;&#1103;&#1077;&#1090;&#1089;&#1103; Gif-&#1092;&#1072;&#1081;&#1083;&#1086;&#1084;!</b></font><br><br>";}
if(@$error=="size")
{$msg="<font color=\"red\" size=\"5\"><b>&#1057;&#1083;&#1080;&#1096;&#1082;&#1086;&#1084; &#1073;&#1086;&#1083;&#1100;&#1096;&#1086;&#1081; &#1088;&#1072;&#1079;&#1084;&#1077;&#1088; &#1092;&#1072;&#1081;&#1083;&#1072;!</b></font><br><br>";}
if(@$error=="pix")
{$msg="<font color=\"red\" size=\"5\"><b>&#1053;&#1077;&#1087;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1086;&#1077; &#1088;&#1072;&#1079;&#1088;&#1077;&#1096;&#1077;&#1085;&#1080;&#1077; &#1092;&#1086;&#1090;&#1086;&#1075;&#1088;&#1072;&#1092;&#1080;&#1080;!</b></font><br><br>";}
echo @$msg;
$nick=strtr($us,array("Р°"=>"а","Р±"=>"б","РІ"=>"в","Рі"=>"г","Рґ"=>"д","Рµ"=>"е","С‘"=>"ё","Р¶"=>"ж","Р·"=>"з","Рё"=>"и","Р№"=>"й","Рє"=>"к","Р»"=>"л","Рј"=>"м","РЅ"=>"н","Рѕ"=>"о","Рї"=>"п","СЂ"=>"р","СЃ"=>"с","С‚"=>"т","Сѓ"=>"у","С„"=>"ф","С…"=>"х","С†"=>"ц","С‡"=>"ч","С€"=>"ш","С‰"=>"щ","СЉ"=>"ъ","С‹"=>"ы","СЊ"=>"ь","СЌ"=>"э","СЋ"=>"ю","СЏ"=>"я",
"Рђ"=>"А","Р‘"=>"Б","Р’"=>"В","Р“"=>"Г","Р”"=>"Д","Р•"=>"Е","РЃ"=>"Ё","Р–"=>"Ж","Р—"=>"З","Р&#65533;"=>"И","Р™"=>"Й","Рљ"=>"К","Р›"=>"Л","Рњ"=>"М","Рќ"=>"Н","Рћ"=>"О","Рџ"=>"П","Р "=>"Р","РЎ"=>"С","Рў"=>"Т","РЈ"=>"У","Р¤"=>"Ф","РҐ"=>"Х","Р¦"=>"Ц","Р§"=>"Ч","РЁ"=>"Ш","Р©"=>"Щ","РЄ"=>"Ъ","Р«"=>"Ы","Р¬"=>"Ь","Р­"=>"Э","Р®"=>"Ю","РЇ"=>"Я"));
echo "<font color=\"#D5006A\" size=\"6\">$nick</font><br>\n";
if($row["img"]!="")
{
echo "<img align=\"left\" src=\"fr.php?id=$id\">\n";
}
echo "<b>&#1047;&#1072;&#1075;&#1088;&#1091;&#1078;&#1072;&#1077;&#1084;&#1072;&#1103; &#1092;&#1086;&#1090;&#1082;&#1072; &#1086;&#1073;&#1103;&#1079;&#1072;&#1090;&#1077;&#1083;&#1100;&#1085;&#1086; &#1076;&#1086;&#1083;&#1078;&#1085;&#1072; &#1073;&#1099;&#1090;&#1100; &#1074; &#1092;&#1086;&#1088;&#1084;&#1072;&#1090;&#1077; Gif, &#1088;&#1072;&#1079;&#1088;&#1077;&#1096;&#1077;&#1085;&#1080;&#1077;&#1084; &#1085;&#1077; &#1073;&#1086;&#1083;&#1077;&#1077; 174&#1093;174 &#1087;&#1080;&#1082;&#1089;&#1077;&#1083;&#1077;&#1081;(&#1088;&#1077;&#1082;&#1086;&#1084;&#1077;&#1085;&#1076;&#1091;&#1077;&#1084;&#1086;&#1077; &#1088;&#1072;&#1079;&#1088;&#1077;&#1096;&#1077;&#1085;&#1080;&#1077; 128&#1093;128) &#1080; &#1088;&#1072;&#1079;&#1084;&#1077;&#1088;&#1086;&#1084; &#1085;&#1077; &#1073;&#1086;&#1083;&#1077;&#1077; 25&#1082;&#1073;. &#1045;&#1089;&#1083;&#1080; &#1074;&#1099; &#1093;&#1086;&#1090;&#1080;&#1090;&#1077; &#1079;&#1072;&#1084;&#1077;&#1085;&#1080;&#1090;&#1100; &#1089;&#1074;&#1086;&#1102; &#1092;&#1086;&#1090;&#1082;&#1091; &#1090;&#1086; &#1087;&#1088;&#1086;&#1089;&#1090;&#1086; &#1079;&#1072;&#1075;&#1088;&#1091;&#1079;&#1080;&#1090;&#1077; &#1085;&#1086;&#1074;&#1091;&#1102;, &#1072; &#1089;&#1090;&#1072;&#1088;&#1072;&#1103; &#1072;&#1074;&#1090;&#1086;&#1084;&#1072;&#1090;&#1080;&#1095;&#1077;&#1089;&#1082;&#1080; &#1091;&#1076;&#1072;&#1083;&#1080;&#1090;&#1089;&#1103;.</b><br>\n";
echo "<br><br><br><form ENCTYPE=\"multipart/form-data\" action=\"foto.php?id=$id&amp;ps=$ps&amp;ref=$ref\" method=\"post\">\n";
echo "<b>&#1055;&#1088;&#1080;&#1082;&#1088;&#1077;&#1087;&#1080;&#1090;&#1100; &#1092;&#1086;&#1090;&#1082;&#1091;:</b><br>\n";
echo "<INPUT NAME=\"file\" TYPE=\"file\" SIZE=\"20\"><br>\n";
echo "<input type=\"submit\" name=\"go\" value=\"&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1080;&#1090;&#1100;\" onMouseOver=\"style.color='#00FF40'\" onMouseOut=\"style.color='black'\">\n";
echo "</form>\n";
echo "</BODY>\n";
echo "</HTML>\n";
mysql_close ($link);

?>