login.php
<?php session_start();
session_register('username');
$_SESSION['username'] = session_id();
header("Content-type: text/vnd.wap.wml"); ?>
<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Nokia" newcontext="true">
<p align="center"><b>Login</b><br/><br/></p>
<p>
Username:
<input name="username" size="10" />
<br/>
Password:
<input type="password" name="password" size="10" maxlength="20"/><br />
<anchor>
Submit
<go href="verify.php" method="post">
<postfield name="username" value="$(username)"/>
<postfield name="password" value="$(password)"/>
</go>
</anchor>
</p>
</p>
</card>
</wml>
------------------------------------
Verify.php
<?php session_start();
session_register('username');
$_SESSION['username'] = session_id();
header("Content-type: text/vnd.wap.wml"); ?>
<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Nokia" newcontext="true">
<p>
<?php
if ($username==NULL && $password==NULL)
{
echo"Please Try Again!!!<br/>";
echo"NO Username & Password<br/>";
echo "Click <a href=\"login.php\">here</a> to try again !!<br/>";
}
else
{
$Connect = mysql_connect("localhost","root","");
mysql_select_db("wap");
$check == 0;
$result=mysql_query("select * from account");
$number_of_rows = mysql_num_rows($result);
$i=0;
$check=0;
while ($number_of_rows != 0)
{
$row = mysql_fetch_row($result);
$number_of_rows--;
if ($username==$row[0] && $password==$row[1])
{
echo"Congratulations !!<br/>";
echo "Hello!! <b> $username</b><br/>";
echo"You had access Nokia website<br/>";
echo "Click <a href=\"welcome.php\">here</a> to CONTINUE !!<br/>";
$check=1;
break;
}
}
if ($check == 0)
{
echo"Please Try Again!!!<br/>";
echo"Wrong Username OR Password<br/>";
echo "Click <a href=\"login.php\">here</a> to try again !!";
}
}
?>
</p>
</card>
</wml>
--------------------------------------
welcome.php
<?php session_start();
session_register('username');
$_SESSION['username'] = session_id();
header("Content-type: text/vnd.wap.wml"); ?>
<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Nokia" newcontext="true">
<p>
<?php
echo $_SESSION['username'];
?>
</p>
</card>
</wml>
i have tried to put the session_start() to every pages and login with ABC, but the output for welcome.php is "c38634edaf64b39db68276113a976449", not ABC.
i run this script in nokia mobile browser, not in IE, will it affect the result?