enter the userid and password. This then connects to this page. If I
enter the userid and password correctly, it prints successfully logged
into system. If I enter the wrong information all I get is an erro page
HTTP status 502 etc.
Can anyone help?
<?php
Header("Content-type: text/vnd.wap.wml");
Header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-cache");
echo ("<?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="result" title="Test password login">
<p>
<?php
// connect to mysql database
$dab = mysql_pconnect("localhost", "root");
$db = mysql_select_db("login");
$query = "SELECT user, pass FROM login WHERE user='$userid' AND
pass='$password'";
$result = @mysql_query($query);
if(!$result){
$err=mysql_error();
print$err;
exit();
}
if(mysql_affected_rows()==0){
print"no such login in the system";
exit();
}
else{
print "successfully logged into system";
}
print "<b> output....</b> <br/>";
print "$password";
?>
</p>
</card>
</wml>
Reply
Bent Stigsen May 4, 4:17 pm show options
Newsgroups: comp.lang.php
From: Bent Stigsen <n...@thevoid.dk> - Find messages by this author
Date: Wed, 04 May 2005 17:17:34 +0200
Local: Wed,May 4 2005 4:17 pm
Subject: Re: WML PHP login page
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse
- Hide quoted text -
- Show quoted text -
XP wrote:
I am having problems with the blow page. I have a login page where I
enter the userid and password. This then connects to this page. If I
enter the userid and password correctly, it prints successfully logged into system. If I enter the wrong information all I get is an erro page HTTP status 502 etc. [snip] <wml>
<card id="result" title="Test password login"> [snip] if(mysql_affected_rows()==0){
print"no such login in the system";
exit(); [snip] </card>
</wml>
The xml will be malformed if you exit before closing nodes.
/Bent
Reply
XP May 4, 5:09 pm show options
Newsgroups: comp.lang.php
From: "XP" <auj...@dsl.pipex.com> - Find messages by this author
Date: 4 May 2005 09:09:05 -0700
Local: Wed,May 4 2005 5:09 pm
Subject: Re: WML PHP login page
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse
Thanks. That seems to work now.
How do I add things into the if or else. For example after printing
successfully logged into system, how do I make it go to specific page?
When I add to the else statement, I get an error. What format do I need
to enter here?