Просмотр файла katrinka.ru/user_settings.php

Размер файла: 5.04Kb
<?php
  include 'config.php';
  include 'guestbook/mylib.php';
  session_start();
  header("Cache-Control: no-cache");
  header("Content-type: text/vnd.wap.wml");
  if (ereg("^SIE-.*",$_SERVER['HTTP_USER_AGENT'])) $sie=1; else $sie=0;
  $uid=0;
  $lang=$_GET['lang'];
  if ((trim($_COOKIE['Login'])!='')&&(trim($_COOKIE['Password'])!='')) {
	$login=htmlspecialchars(trim($_COOKIE['Login']),ENT_QUOTES);
	$pass=htmlspecialchars(trim($_COOKIE['Password']),ENT_QUOTES);
  } else {
	$login=htmlspecialchars(trim($_POST['login']),ENT_QUOTES);
	$pass=htmlspecialchars(trim($_POST['pass']),ENT_QUOTES);
  }
  if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) exit;
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<?php
 if (isset($_SESSION['id'])) {
	$id=$_SESSION['id'];
	$res=pg_query($conn,"select name,invisible,refresh,ppp,access,translit,posts,showemail,showpics,ftpp,fppp,fnewtop from users where id='$id';");
	$name=uconv(pg_result($res,0,0));
	$invisible=pg_result($res,0,1);
	$refresh=pg_result($res,0,2);
	$ppp=pg_result($res,0,3);
	$access=pg_result($res,0,4);
	$translit=pg_result($res,0,5);
	$posts=pg_result($res,0,6);
	$showemail=pg_result($res,0,7);
	$showpics=pg_result($res,0,8);
	$ftpp=pg_result($res,0,9);
	$fppp=pg_result($res,0,10);
	$fnewtop=pg_result($res,0,11);
} else {
	$res=pg_query($conn,"select id,name,invisible,refresh,ppp,access,translit,posts,showemail,showpics,ftpp,fppp,fnewtop from users where login='$login' and passwd='$pass' and moder=0;");
	$rows=pg_numrows($res);
	pg_close($conn);

	if (!$rows) { 
		print "<card id=\"Login\" title=\"Login\">\n";
		print "<p>\n";
		loginform(1);
		print "</p></card></wml>";
		exit;

	}
	$id=pg_result($res,0,0);
	$name=uconv(pg_result($res,0,1));
	$invisible=pg_result($res,0,2);
	$refresh=pg_result($res,0,3);
	$ppp=pg_result($res,0,4);
	$access=pg_result($res,0,5);
	$translit=pg_result($res,0,6);
	$posts=pg_result($res,0,7);
	$showemail=pg_result($res,0,8);
	$showpics=pg_result($res,0,9);
	$ftpp=pg_result($res,0,10);
	$fppp=pg_result($res,0,11);
	$fnewtop=pg_result($res,0,12);
}

$_SESSION['id']=$id;
$_SESSION['ppp']=$ppp;
$_SESSION['access']=$access;
$_SESSION['translit']=$translit;
$_SESSION['refresh']=$refresh;
$_SESSION['ftpp']=$ftpp;
$_SESSION['fppp']=$fppp;
$_SESSION['fnewtop']=$fnewtop;

		print "<card id=\"Settings\" title=\"".uconv($login)."\" newcontext=\"true\">\n";

		print "<p>\n";
		print "WARNING! Do not touch these settings if you are not sure what you are doing!<br/><br/>\n";
		if (($access)||($posts>9000)) {
			print "Invisible ";
			print "<select name=\"invisible\" value=\"".$invisible."\">\n";
			print "<option value=\"0\">No</option>\n";
			print "<option value=\"1\">Yes</option>\n";
			print "</select><br/>\n";
		}
		print "Hide translit converter ";
		print "<select name=\"translit\" value=\"".$translit."\">\n";
		print "<option value=\"0\">No</option>\n";
		print "<option value=\"1\">Yes</option>\n";
		print "</select><br/>\n";
		print "Chat room refresh interval (in 1/10 sec): \n";
		print "<input name=\"refresh\" type=\"text\" value=\"".$refresh."\" maxlength=\"3\" format=\"3N\"/><br/>\n";
		print "Display posts per page (chat): \n";
		print "<input name=\"ppp\" type=\"text\" value=\"".$ppp."\" maxlength=\"2\" format=\"2N\"/><br/>\n";
		print "Display topics per page (forum): \n";
		print "<input name=\"ftpp\" type=\"text\" value=\"".$ftpp."\" maxlength=\"2\" format=\"2N\"/><br/>\n";
		print "Display posts per page (forum): \n";
		print "<input name=\"fppp\" type=\"text\" value=\"".$fppp."\" maxlength=\"2\" format=\"2N\"/><br/>\n";
		print "New replies at (forum): ";
		print "<select name=\"fnewtop\" value=\"".$fnewtop."\">\n";
		print "<option value=\"t\">Top</option>\n";
		print "<option value=\"f\">Bottom</option>\n";
		print "</select><br/>\n";
		print "Show e-mail in your profile ";
		print "<select name=\"showemail\" value=\"".$showemail."\">\n";
		print "<option value=\"0\">No</option>\n";
		print "<option value=\"1\">Yes</option>\n";
		print "</select><br/>\n";
		print "Show pictures in the chat ";
		print "<select name=\"showpics\" value=\"".$showpics."\">\n";
		print "<option value=\"0\">No</option>\n";
		print "<option value=\"1\">Yes</option>\n";
		print "</select><br/>\n";
?>
<anchor title="Ok">Ok<go href="user_sup.php" method="post">
<?php
print "<postfield name=\"login\" value=\"".$login."\"/>\n";
print "<postfield name=\"pass\" value=\"".$pass."\"/>\n";
?>
<postfield name="invisible" value="$(invisible)"/>
<postfield name="translit" value="$(translit)"/>
<postfield name="refresh" value="$(refresh)"/>
<postfield name="ppp" value="$(ppp)"/>
<postfield name="ftpp" value="$(ftpp)"/>
<postfield name="fppp" value="$(fppp)"/>
<postfield name="fnewtop" value="$(fnewtop)"/>
<postfield name="showemail" value="$(showemail)"/>
<postfield name="showpics" value="$(showpics)"/>
<?php print "<postfield name=\"lang\" value=\"".$lang."\"/>\n"; ?>
</go></anchor>
</p>
</card>
</wml>