Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile 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:
  #1  
Old August 10th, 2007, 01:36 AM
bintang2k bintang2k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 1 bintang2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 4 sec
Reputation Power: 0
WML - Work in Emulator but didn't work on Mobile Phone

I need help, my script work on emulator, but when I uploaded it, it didn't work when I browse it using my mobile. Would you please check my script, please

===============
index.wml
===============

Code:
<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 
<wml> 
<head><meta http-equiv="Cache-control" content="no-cache"/></head>
    <card id="login1" title="User Login"> 
        <p> 
        <do label="Login" type="accept">     
            <go href="cek_login.php" method="post"> 
	<postfield name="username" value="$user"/>  
	<postfield name="password" value="$pass"/>  
	<postfield name="tipe_user" value="$type"/>  
	           </go> 
        </do> 
        Username: 
	<input type="text" title="Username" name="user"/> <br/> 
        Password: 
	<input type="text" title="Password" name="pass"/> <br/> 
        Tipe User: 
	<select name="type"> 
	<option value="admin">Admin</option> 
	<option value="siswa">Siswa</option> 
	<option value="guru">Guru</option> 
	<option value="ortu">Ortu</option> 
	</select> 
        </p> 
    </card> 
</wml>


======================
check_login.php
======================
PHP Code:
<?php
// send wml headers
header("Content-type: text/vnd.wap.wml"); 
echo 
"<?xml version=\"1.0\"?>";
echo 
"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" 
   
" \"(URL address blocked: See forum rules)\">"
?>
<?php

    $user 
$_REQUEST[username];
    
$pass $_REQUEST[password];
    
$type $_REQUEST[tipe_user];
    
        if (
$user=="")
        {
            echo 
" <br/> <big><b> ERROR </b></big><br/>";
            echo 
"<br/><big>Username is empty</big><br/><br/><br/><br/>";
            echo 
"[ <a href=\"index.php\">Ulangi</a>]";
        }
        else if (
$pass=="")
        {
            echo 
" <br/> <big><b> ERROR </b></big><br/>";
            echo 
"<br/><big>Password is empty</big><br/><br/><br/><br/>";
            echo 
"[ <a href=\"user_login.wml\">Ulangi</a>]";
        }
        else if (
$type=="")
        {
            echo 
" <br/> <big><b> ERROR </b></big><br/>";
            echo 
"<br/><big>User Type is empty</big><br/><br/><br/><br/>";
            echo 
"[ <a href=\"user_login.wml\">Ulangi</a>]";
        }
        else        
        {
                
$database "smp";
        
$mysql_konek=mysql_connect("localhost","root","") or die ("Can't connect to MySQL server");
        
mysql_select_db($database);
        
            switch (
$type) {
            case 
"admin":
               
$sql=mysql_query("SELECT * FROM user_admin WHERE admin_id='$user'
                                AND admin_pass=MD5('$pass')"
);
                
$id_    "admin_id";
                
$type_    "admin";
               break;
            case 
"guru":
               
$sql=mysql_query("SELECT * FROM user_guru 
                                WHERE guru_id='$user'
                                AND guru_pass=MD5('$pass')"
);
                
$id_    "guru_id";
                
$type_    ="guru";
               break;
            case 
"siswa":
               
$sql=mysql_query("SELECT * FROM user_siswa 
                                WHERE siswa_id='$user'
                                AND siswa_pass=MD5('$pass')"
);
                
$id_    "siswa_id";
                
$type_    ="siswa";
               break;
            case 
"ortu":
               
$sql=mysql_query("SELECT * FROM user_ortu
                                WHERE ortu_id='$user'
                                AND ortu_pass=MD5('$pass')"
);
                
$id_    "ortu_id";
                
$type_    ="ortu";
               break;
            }
                        
            
$row=mysql_fetch_array($sql);
            
$cekdata=mysql_num_rows($sql);
            if (
$cekdata>=1)
                {
                echo     
"Welcome $user,<br/>";
                echo     
"Please choose the menu bellow :<br/>";
                echo     
"<p align=\"left\">"
                echo     
"        + <a href=\"nilai.php?user=$user&tipe=$type\"> Grades List</a><br/>"
                    
.    "    + <a href=\"jadwal.php?user=$id&type=$type_\"> Schedule List</a><br/>"
                    
.    "    + <a href=\"absensi.php?user=$id\">Attendance List</a></br>";
                echo     
"</p>";
                echo     
"<br/>";
                
                }
            else
            {
                echo 
"<br/><b>LOGIN FAILED</b>";
                echo 
"===========";
                echo 
"<br/> The user bellow aren't registered yet: <br/><br/>";
                echo 
"Username : <b>$user</b><br/>";
                echo 
"Password : <b>*****</b><br/><br/>";
                echo 
"[<a href=\"index.wml\">Back to Login Page</a>]";
            }
        }
   
?>

Reply With Quote
  #2  
Old August 10th, 2007, 02:33 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,910 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st 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 4 Weeks 1 Day 11 h 9 m 14 sec
Reputation Power: 1693
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
Hi bintang - welcome to Dev Shed.

First off, can you explain what "doesn't work" means?

For your login processing, 2 things stand out....
php Code:
Original - php Code
  1. <?php
  2.     $user = $_REQUEST[username];
  3.     $pass = $_REQUEST[password];
  4.     $type = $_REQUEST[tipe_user];
  5. // should be
  6.     $user = $_REQUEST['username'];
  7.     $pass = $_REQUEST['password'];
  8.     $type = $_REQUEST['tipe_user'];
  9. // this should be validated too !!!
  10.  
Secondly, you have not encapsulated your text within the required <card> and <wml> tags....
__________________
Cheers,

Jamie

# mdb4u | mobile movie database] | Please help to test and promote
# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

__________________

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
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > WML - Work in Emulator but didn't work on Mobile Phone


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT