473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

WML PHP Login pages

XP
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.

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?

Jul 17 '05 #1
4 3402
XP wrote:
if(mysql_affected_rows()==0){
print"no such login in the system";
exit();
}


This and the previous exit cause the WML page to be invalid, because the
closing <p>, <card> and <wml> tags will be missing.

Try something like the following instead:

<!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
....
$result = @mysql_query($query);
if (!$result) {
print mysql_error();
}
else if (mysql_affected_rows()==0) {
print "no such login in the system";
}
else {
print "successfully logged into system";
print "<b> output....<b> <br>";
print "$password";
}
?>
</p>
</card>
</wml>
JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
print "successfully logged into system";
print "<b> output....<b> <br>";
print "$password";
}


Replace the following line:

print "<b> output....<b> <br>";

With:

print "<b> output....</b> <br />";
JW

Jul 17 '05 #3
XP

Janwillem Borleffs wrote:
Janwillem Borleffs wrote:
print "successfully logged into system";
print "<b> output....<b> <br>";
print "$password";
}


Replace the following line:

print "<b> output....<b> <br>";

With:

print "<b> output....</b> <br />";
JW

Thanks for that. But, what I am trying to do is to redirect the user,
once they are logged in. I want to place either an automatic forward to
another page or to place a link to another page so that once the user
is logged on, they can move on to the next stage. If I use wml here,
obviously it does not work. Do I need to put a series of /'s around the
code?

Jul 17 '05 #4
XP wrote:
Thanks for that. But, what I am trying to do is to redirect the user,
once they are logged in. I want to place either an automatic forward
to another page or to place a link to another page so that once the
user is logged on, they can move on to the next stage. If I use wml
here, obviously it does not work. Do I need to put a series of /'s
around the code?


On the same page:

<?php
// connect to mysql database
....
$result = @mysql_query($query);
if (!$result) {
$message = mysql_error();
}
else if (mysql_affected_rows()==0) {
$message = "no such login in the system";
}
else {
header("Location: newpage");
exit;
}
?>
<!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 print $message ?>
</p>
</card>
</wml>
JW

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: TheDD | last post by:
Hello every body, i have to do a news system wich use php/mysql. i need 3 accounts: * a 'reader' who doesn't need to log in to read the news * a 'writer' who can write news in a pending news...
2
by: Rujuta Gandhi | last post by:
Hi All, I am facing a very crucial problem. Im developing a web application using .net studio 2005(beta). I want my Login.aspx page to be secured(https) for encrypted login information...
0
by: Tim T | last post by:
Hi, I have a web application that has a number of users who administer their own data... i have several pages that check to see if a valid userID session exists, and if not, send them to a...
4
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I would like to add a second, different login page for...
3
by: E | last post by:
Hi, I'm creating a few pages on my site that you need to login to view. The login pages and the secure pages are .aspx . If I want links at the top of all pages on the site that says either...
1
by: Jakob Lithner | last post by:
When I started a new ASP project I was eager to use the login facilities offered in Framework 2.0/VS 2005. I wanted: - A custom principal that could hold my integer UserID from the database -...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
1
by: PokerMan | last post by:
Hi I am trying to use the login control but there seems to be so much set up required and it seems to lock the entire site and require a login for every page. All i want is to use the...
3
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
The majority of pages on our site need authentication (forms auth against the aspnetdb database). I created an '~/auth' folder with its own config file forcing authentication for any pages in the...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.