WML PHP Login pages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • XP

    WML PHP Login pages

    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.or g/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($q uery);
    if(!$result){
    $err=mysql_erro r();
    print$err;
    exit();
    }
    if(mysql_affect ed_rows()==0){
    print"no such login in the system";
    exit();
    }
    else{
    print "successful ly 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.d k> - 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:[color=blue]
    > 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[/color]
    logged[color=blue]
    > into system. If I enter the wrong information all I get is an erro[/color]
    page[color=blue]
    > HTTP status 502 etc.[/color]
    [snip][color=blue]
    > <wml>
    > <card id="result" title="Test password login">[/color]
    [snip][color=blue]
    > if(mysql_affect ed_rows()==0){
    > print"no such login in the system";
    > exit();[/color]
    [snip][color=blue]
    > </card>
    > </wml>[/color]

    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.pip ex.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?

  • Janwillem Borleffs

    #2
    Re: WML PHP Login pages

    XP wrote:[color=blue]
    > if(mysql_affect ed_rows()==0){
    > print"no such login in the system";
    > exit();
    > }[/color]

    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.or g/DTD/wml_1.1.xml">
    <wml>
    <card id="result" title="Test password login">
    <p>
    <?php
    // connect to mysql database
    ....
    $result = @mysql_query($q uery);
    if (!$result) {
    print mysql_error();
    }
    else if (mysql_affected _rows()==0) {
    print "no such login in the system";
    }
    else {
    print "successful ly logged into system";
    print "<b> output....<b> <br>";
    print "$password" ;
    }
    ?>
    </p>
    </card>
    </wml>


    JW



    Comment

    • Janwillem Borleffs

      #3
      Re: WML PHP Login pages

      Janwillem Borleffs wrote:[color=blue]
      > print "successful ly logged into system";
      > print "<b> output....<b> <br>";
      > print "$password" ;
      > }[color=green]
      >>[/color][/color]

      Replace the following line:

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

      With:

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


      JW



      Comment

      • XP

        #4
        Re: WML PHP Login pages


        Janwillem Borleffs wrote:[color=blue]
        > Janwillem Borleffs wrote:[color=green]
        > > print "successful ly logged into system";
        > > print "<b> output....<b> <br>";
        > > print "$password" ;
        > > }[color=darkred]
        > >>[/color][/color]
        >
        > Replace the following line:
        >
        > print "<b> output....<b> <br>";
        >
        > With:
        >
        > print "<b> output....</b> <br />";
        >
        >
        > JW[/color]


        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?

        Comment

        • Janwillem Borleffs

          #5
          Re: WML PHP Login pages

          XP wrote:[color=blue]
          > 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?[/color]

          On the same page:

          <?php
          // connect to mysql database
          ....
          $result = @mysql_query($q uery);
          if (!$result) {
          $message = mysql_error();
          }
          else if (mysql_affected _rows()==0) {
          $message = "no such login in the system";
          }
          else {
          header("Locatio n: newpage");
          exit;
          }
          ?>
          <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
          "http://www.wapforum.or g/DTD/wml_1.1.xml">
          <wml>
          <card id="result" title="Test password login">
          <p>
          <?php print $message ?>
          </p>
          </card>
          </wml>


          JW



          Comment

          Working...