Просмотр файла ilichat3.9/ilichat/buttons.php

Размер файла: 4.68Kb
<?php
// Chat is powered by Kaysar
// ICQ : 197042
// ilichat version 3.5
error_reporting(0);
include('start.php');
include("config.php");
include("./includes/wml/banned");

header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");


//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
	if(mysql_num_rows($q) == 0)
	{
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
	echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
	echo "<card title=\"ERROR\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
	echo "<small>Ошибка авторизации!<br/>\n";
	echo "</small></p></card></wml>";
	exit();
	}

//END AUTH
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
print '<card title="Кнопки">'.
'<p>';
$q = mysql_query("select `sftky` from `chat_users` where `id`='".$id."';");
$row = mysql_result($q, 0);
if(empty($_POST['action'])) {
	print "Сказать:<br/>";

if(strpos($row, "1") !== false) {
print "<select name=\"button1\">";
print"<option value=\"1\">On</option>
<option value=\"0\">Off</option>";
print "</select><br/>"; }
else {
print "<select name=\"button1\">";
print"<option value=\"0\">Off</option>
<option value=\"1\">On</option>";
print "</select><br/>"; }

print "Обновить:<br/>";

if(strpos($row, "2") !== false) {
print "<select name=\"button2\">";
print"<option value=\"2\">On</option>
<option value=\"0\">Off</option>";
print "</select><br/>"; }
else {
print "<select name=\"button2\">";
print"<option value=\"0\">Off</option>
<option value=\"2\">On</option>";
print "</select><br/>"; }

print "Кто где?:<br/>";

if(strpos($row, "3") !== false) {
print "<select name=\"button3\">";
print"<option value=\"3\">On</option>
<option value=\"0\">Off</option>";
print "</select><br/>"; }
else {
print "<select name=\"button3\">";
print"<option value=\"0\">Off</option>
<option value=\"3\">On</option>";
print "</select><br/>"; }

print "Настроение:<br/>";

if(strpos($row, "4") !== false) {
print "<select name=\"button4\">";
print"<option value=\"4\">On</option>
<option value=\"0\">Off</option>";
print "</select><br/>"; }
else {
print "<select name=\"button4\">";
print"<option value=\"0\">Off</option>
<option value=\"4\">On</option>";
print "</select><br/>"; }

print "Почта (0):<br/>";

if(strpos($row, "5") !== false) {
print "<select name=\"button5\">";
print"<option value=\"5\">On</option>
<option value=\"0\">Off</option>";
print "</select><br/>"; }
else {
print "<select name=\"button5\">";
print"<option value=\"0\">Off</option>
<option value=\"5\">On</option>";
print "</select><br/>"; }

print "Прихожая:<br/>";

if(strpos($row, "6") !== false) {
print "<select name=\"button6\">";
print"<option value=\"6\">On</option>
<option value=\"0\">Off</option>";
print "</select><br/>"; }
else {
print "<select name=\"button6\">";
print"<option value=\"0\">Off</option>
<option value=\"6\">On</option>";
print "</select><br/>"; }


print "-<br/><anchor title=\"go\">Сохранить<go href=\"buttons.php?".SID."\" method=\"post\">";
print "<postfield name=\"button1\" value=\"$(button1)\"/>";
print "<postfield name=\"button2\" value=\"$(button2)\"/>";
print "<postfield name=\"button3\" value=\"$(button3)\"/>";
print "<postfield name=\"button4\" value=\"$(button4)\"/>";
print "<postfield name=\"button5\" value=\"$(button5)\"/>";
print "<postfield name=\"button6\" value=\"$(button6)\"/>";
print "<postfield name=\"button7\" value=\"$(button7)\"/>";
print "<postfield name=\"button8\" value=\"$(button8)\"/>";
print "<postfield name=\"action\" value=\"update\"/>";
print "</go></anchor><br/>-<br/>";
}
else
{
$button1 = intval($_POST['button1']);
$button2 = intval($_POST['button2']);
$button3 = intval($_POST['button3']);
$button4 = intval($_POST['button4']);
$button5 = intval($_POST['button5']);
$button6 = intval($_POST['button6']);
if(@mysql_query("update chat_users set `sftky`='".$button1.$button2.$button3.$button4.$button5.$button6."' where id='".$id."';"))
 print "Кнопки успешно сохранены!<br/>";
	print "<a href=\"buttons.php?".SID."\">Изменить кнопки</a><br/>";
}
print "<a href=\"menu.php?".SID."\">Прихожая</a>";
print '</p></card></wml>';
?>