WAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreWAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old April 11th, 2005, 12:49 PM
jennashton jennashton is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 137 jennashton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 11 m 33 sec
Reputation Power: 6
Login Script in PHP for WAP Site Needed

Can anyone point me to a login script that will work with WAP site?

Thanks ahead.

Reply With Quote
  #2  
Old April 11th, 2005, 01:35 PM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
yeah i can help here but would need to where where you're getting valid login data from and what it should be doing on fail and success?
__________________
Andy Moore << oh no it's got a blog.....
Word Press WAP Plugin with Ad Mob Advertising revenue
PHP developer
deploying ringtones, mp3 downloads and realtones
I'm a geek who's obsessed with stats and gadgets

Last edited by andymoo : April 11th, 2005 at 01:41 PM.

Reply With Quote
  #3  
Old April 11th, 2005, 03:06 PM
jennashton jennashton is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 137 jennashton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 11 m 33 sec
Reputation Power: 6
Quote:
Originally Posted by andymoo
yeah i can help here but would need to where where you're getting valid login data from and what it should be doing on fail and success?


Thanks for the quick reply. The password data would be valided from MySQL database and when it's successful an user is directed to a WAP page and if it fails then a error message displays.
Thanks.

Reply With Quote
  #4  
Old April 13th, 2005, 03:10 PM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
Hi there,

The way I'd do this is like this:

First have the WML form with username and password variables going to login.php

Then in login.php have something like this:

$count = mysql_query("SELECT COUNT(DISTINCT username) FROM MEMBERS where username='$username' and password='$password'");
$count = mysql_result($count,0);
That will return 1 for a valid match and 0 for a fail.

Then do something like:

if($count>0){
echo "logged in";
}else{
echo "log in failed, please try again";
}

Hope this helps.

Cheers

Andy

Reply With Quote
  #5  
Old April 15th, 2005, 11:44 AM
jennashton jennashton is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 137 jennashton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 11 m 33 sec
Reputation Power: 6
Please elabrate on why would I want to pass the variable to a filter page and then access the database rather than a direct access after submitting the info at the wml form page.

I am very new to WAP and PHP programming and would like to learn about it.

Thanks.

Jenn

Reply With Quote
  #6  
Old April 15th, 2005, 12:37 PM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
That was just the quickest fix I could think of for it, if you check the validation on each page with the variables passed in the url you can make sure you are only serving content to authorised users.

Reply With Quote
  #7  
Old April 15th, 2005, 02:26 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,613 jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 5 h 32 m 57 sec
Reputation Power: 1550
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
In an ideal world, you would log in, check against the db. if ok, you are logged in -> start session.
On subsequent pages, you would check that session credentials met the criteria met to log in , eg check always against the db.

Accessing the session vairable directly is fine, but for extra security - check the session variable against something else too - session info can be manipulated.
__________________
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.

__________________

Reply With Quote
  #8  
Old June 24th, 2005, 04:43 PM
maximus83 maximus83 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 20 maximus83 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 17 m 51 sec
Reputation Power: 0
hello,

i'm trying to do this same thing, except my username/password is actually embedded in the page itself instead of being pulled from mySQL.

i'm having a problem with the sessions working in WAP on a blackberry device. The page works fine (in IE and mozilla), after successful login, the session is started and it checked on each subsequent page. On the blackberry units however, users are immediately returned to the login page and told that their session has timed out.

I've tried contacting Blackberry about this issue, they say it's something with the code that is wrong.

Here is that code, btw:
PHP Code:
<?php
if ($admin == 'admin' $pass == 'password')
      {
    
session_start();
        
$passc crypt("$seccode"123456);
        if(
$passc != $crypt)
            {
            echo 
"Incorrect Security Code.";
            echo 
"Please try to <a href = \"index.php\">Login</a> again";
            exit();
            
$_SESSION["timestamp"] = "9999999999999999999";
            }        

echo 
"<br/>$seccode";
echo 
"<br/>$crypted";

//Auto log-out timestamp code 
$c_hour date("H");    //Current Hour 
$c_min date("i");    //Current Minute 
$c_sec date("s");    //Current Second 
$c_mon date("m");    //Current Month 
$c_day date("d");    //Current Day 
$c_year date("Y");    //Current Year 

//current timestamp 
$c_timestamp mktime($c_hour,$c_min,$c_sec,$c_mon,$c_day,$c_year); 




    
$_SESSION["admin"] = "$admin";
    
$_SESSION["adminpass"] = "$pass";
    
$_SESSION["timestamp"] = "$c_timestamp";        
    echo 
"Access Granted... Logging in User...";
//change this to logged in screen.
    
?>
    <script type = "text/javascript" language = "javascript">
        window.location = "index.php"
    </script>
    
    
    <?

    
}
    else
    {
    echo 
"Incorrect User/Password";
    echo 
" Please try to <a href = \"index.php\">Login</a> again";
    
$_SESSION["timestamp"] = "9999999999999999999";
    
$ip $_SERVER['REMOTE_ADDR']; 

    
//log code
    
    
    
$entry "Failed Login : Username - $admin  | Password -  $pass  | Ip - $ip  | " " on " date("m") . "/" date("d") . "/" date("Y") . " at " date("H") . ":" date("i") . ":" date("s") . "\n"

    
      
$fp fopen("failedlog.txt""a");
    
fputs ($fp"$entry");
    
fclose($fp);


    }

?>

Reply With Quote
  #9  
Old June 26th, 2005, 09:59 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,613 jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 5 h 32 m 57 sec
Reputation Power: 1550
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
I haven't gotten past your first line, but there is an error there:
PHP Code:
if ($admin == 'admin' $pass == 'password'
Should be && or AND
Does Blueberry support JavaScript?

Reply With Quote
  #10  
Old June 27th, 2005, 03:37 AM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
PHP Code:
if ($admin == 'admin' $pass == 'password'
Should be && or AND
Does Blueberry support JavaScript?[/QUOTE]

or

PHP Code:
if(($admin=="admin") and ($pass="password")){
//blah blah blah


as for blueberry and js i'm not sure.............. i'd hazard a guess it did but am not certain... i'd like one to play with tho and pick up my email on the go but they are just ugly devices and not as sexy as my new samsung d500 mmm lol

Reply With Quote
  #11  
Old June 27th, 2005, 08:53 AM
maximus83 maximus83 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 20 maximus83 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 17 m 51 sec
Reputation Power: 0
The script works fine online thru PC, but from the Blackberry unit, it times out the session immediately.

And yes, Javascript is enabled in the Blackberry.

Is there a more appropriate forum for this?
I though the WAP forum was best.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > Login Script in PHP for WAP Site Needed


Thread Tools  Search this Thread