|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
cookies, sessions?
i use php and work with wml.
any solution that can pass the value to every page after login? for example, when i login with ABC, then the ABC will display in every page like "Welcome ABC" as i know WML can't work with cookies, can it work with sessions? or any other solution? or something like $HTTP_GET_VARS ??? |
|
#2
|
||||
|
||||
|
You can use $_GET if you want. It depends on how you write your wml. Personally I cheat and echo PHP vars in WML, so I suppose sessions would work OK too, though I have never tried it(yet).
When I upgrade my football teams WAP site, I will probably use sessions. I have one update page currently that is only accessable if $_POST vars are present. This is a bit of a drag really, as to go to that page again, I link through a form to submit user details again. All the other pages on the site are generated dependant on $_GET vars.
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure # Any form of employment is strictly prohibited ...... __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. __________________ |
|
#3
|
||||
|
||||
|
can you show me some example?
i don't know this $_POST function, maybe this is the way that can help me thank you.... |
|
#4
|
||||
|
||||
|
Code:
login.php
<?php
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>
</card>
</wml>
----------------------------
verify.php
<?php
session_start();
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
echo "<wml>";
echo "<card id=\"card1\" title=\"Nokia\">";
echo "<p>";
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])
{
session_register('username');
session_register('password');
$_SESSION['username'] = $row[0];
$_SESSION['password'] = $row[1];
echo"Congratulations !!<br/>";
echo "Hello!! <b>" . $_SESSION['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 !!";
}
}
echo "</p>";
echo "</card>";
echo "</wml>";
?>
now it shows this error message: Cannot load http://localhost/verify.php (HTTP Error 500 Server Error) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > cookies, sessions? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|