WML PHP login page

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

    WML PHP login page

    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>

  • Bent Stigsen

    #2
    Re: WML PHP login page

    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 logged
    > into system. If I enter the wrong information all I get is an erro page
    > 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

    Comment

    • XP

      #3
      Re: WML PHP login page

      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?

      Comment

      • Bent Stigsen

        #4
        Re: WML PHP login page

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

        The principles are the as for ordinary web-pages. For most part, you
        wont waste time by trying out methods in a ordinary browser. Best would
        be a wap-emulator, as you are more likely to get some sensible
        information in case of errors.

        How you would do things like login pages, would depend on what kind of
        limitations a wap-device would have. It is not something I am familiar
        with, so I cannot really help you there. But I would look into if a
        wap-device would behave properly if using php-sessions, cookies, and if
        it would understand a location header. That will make things easier.

        [color=blue]
        > When I add to the else statement, I get an error. What format do I need
        > to enter here?[/color]

        You dont actually need to have you control structure where the output
        should be. You can store things in a variable and print it out later.

        if ($user_is_valid ) {
        $content_of_car d1 = '<a href="...">proc eed</a>';
        } else {
        $content_of_car d1 = 'access denied';
        }
        ....
        <card ...
        <?php echo $content_of_car d1ยด; ?>


        There seems to be plenty of info on wap on the net (google for more):

        Sorry! We can't seem to find the resource you're looking for



        /Bent

        Comment

        Working...