<?php
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
print '<?xml version="1.0" encoding="utf-8"?>'.
'<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"'.
' "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';

include "./ini.php";

$login=htmlspecialchars(stripslashes(trim($login)));
$login=substr($login,0,20);
$pass=htmlspecialchars(stripslashes(trim($pass)));
$name=htmlspecialchars(stripslashes(trim($name)));
$live=htmlspecialchars(stripslashes(trim($live)));
$sex=htmlspecialchars(stripslashes(trim($sex)));
$mobile=htmlspecialchars(stripslashes(trim($mobile)));
$about=htmlspecialchars(stripslashes(trim($about)));
$email=htmlspecialchars(stripslashes(trim($email)));
$wapurl=htmlspecialchars(stripslashes(trim($wapurl)));
$weburl=htmlspecialchars(stripslashes(trim($weburl)));
$icq=htmlspecialchars(stripslashes(trim($icq)));
$operator=htmlspecialchars(stripslashes(trim($operator)));

print '<card title="Registration">'.
'<p align="center">';

$query_users_login = @mysql_query("select * from `".$px.$utable."` where login='".$login."' and ci='".$ci."';");
$users_login = @mysql_fetch_array($query_users_login);

if(empty($login)) $error='Please fill your nick!<br/>';
if(empty($pass)) $error=$error.'Password empty!<br/>';
if(empty($name)) $error=$error.'&#1&#1103;!<br/>';
if(empty($sex)) $error=$error.'Fill your name in!<br/>';
if(preg_match("/[^\da-zA-Z-@#!_]+/",$login)) $error.='Please erase symbols, no symbols permitted!<br/>';
if(preg_match("/[^\da-zA-Z_]+/",$pass)) $error.='error!<br/>';
///////////////////////////////////
$db_login = $users_login['login'];

if(empty($error))
{

        if(strtolower($login) != strtolower($db_login))
        {
$sub='welcome';
$let='welcome to tekwap';
$from='tekwap team';
        @mysql_query("insert into `".$px.$utable."` values(0,'$login','$pass','$name','MEMBER','$pic','$Comments','$smilie','$wins','$lose','$sex','$bday','$bmonth','$byear','','$live','$mobile','$operator','$email','$wapurl','$weburl','$icq','$cash','$about','Im new here :)',0,0,'','','','','','',0,0,0,'".time()."','".time()."','".getenv(REMOTE_ADDR)."','".getenv(HTTP_USER_AGENT)."','$ci');");
	@mysql_query("insert into `".$px.$ltable."` values(0,'$from','".$login['login']."','$sub','$let','".time()."',1);");

        print '<img src="./image/ok.gif" alt="success"/><b>';
	print $login."</b><br/>Registration was successful please login below.<br/>Hope U Can Enjoy Your Stay Here.<br/>Don't ForGet To Invite all Your Friends Here !<br/>";
        print '<anchor>Login<go href="in.php?ci='.$ci.'" method="post">
        <postfield name="login" value="$(login)"/>
        <postfield name="pass" value="$(pass)"/>
        </go>
        </anchor>';
        }
        else
        {
        print 'Error while trying to Register. No symbols are allowed in password or nick and all feild should be filled in. The username maybe in use already!';
        print "<br/><a href=\"./rega.php\">Register</a><br/>";
	}
}
else
{
        print $error;
}
print '</p></card></wml>';

@mysql_close();
?>

