wap member

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Sat Nov 25, 2006 8:51 pm    Post subject: wap member Reply with quote

i want to write a wap site log in with diffrent user name and password.

how to write ?
i just can write a wap site without restric code...
sorry for my poor english
_________________
Back to top View user's profile Send private message Visit poster's website
Moxxnixx
-


Joined: 21 Jun 2003
Posts: 1226
Location: Florida

PostPosted: Sun Nov 26, 2006 3:21 am    Post subject: Reply with quote

chewzzqq,
Here is an example...
http://forums.devshed.com/wap-programming-20/wap-login-script-in-php-225466.html
Back to top View user's profile Send private message Visit poster's website
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Sun Nov 26, 2006 4:01 am    Post subject: Reply with quote

Many Thank Moxxnixx,
i will try it and post results after few day.because not free...
_________________
Back to top View user's profile Send private message Visit poster's website
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Wed Nov 29, 2006 12:02 pm    Post subject: Reply with quote

Code:
 // login.php
<?php
# Header Info
header('Content-Type: text/vnd.wap.wml', true);
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
# Version Type
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
# Import config file
include "/home/jamieb/private/conf.php";
# Connect to database
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<!-- THIS IS THE LOGIN CARD -->
<card id="login" title="Login">
<p>
<do type="accept" label="Login">
<go href="process.php" method="post">
<postfield name="userName" value="$userName" />
<postfield name="password" value="$password" />
</go>
</do>
</p>

<p>
User Name: <input title="userName" name="userName" /> <br />
Password : <input title="password" name="password" type="password" /> <br />
</p>
</card>

</wml> 


Code:
// process.php
<?php
# Header Info
header('Content-Type: text/vnd.wap.wml', true);
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
# Version Type
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
# Import config file
include "/home/jamieb/private/conf.php";
# Connect to database
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
# Verify the user
$sql = mysql_query("SELECT userName,nickName FROM table WHERE userName = '".strtolower($_POST['userName'])."' AND password = '".md5($_POST['password'])."'");
$row = mysql_num_rows($sql);
$login = mysql_fetch_array($sql);
$user = md5($login['userName']);
$nick = $login['nickName'];
if ($row == 0):
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="failed" title="Login Failed">
<p>
Sorry, username or password incorrect!
</p>

<p>
<anchor>Home
<go href="index.php#menu" />
</anchor>
<do type="prev" label="Back"><prev/></do></p>
</card>
</wml>

<?php
exit;
else:
?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="success" title="Login Success">
<p>
<do type="accept" label="Admin">
<go href="admin.php" method="post">
<postfield name="session" value="<?php echo "$user"; ?>" />
</go>
</do>
</p>
<p>Welcome <?php echo "$nick"; ?>, please enter the admin area.</p>
</card>
</wml>

<?php
endif;
?> 


how to write my db localhost,username and password?and database name?
Code:
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);


no understand...

and this
Code:
include "/home/jamieb/private/conf.php";

should i write a conf.php ?

how,don't know how to write..where to write
pls help
and thx for reply
_________________
Back to top View user's profile Send private message Visit poster's website
Moxxnixx
-


Joined: 21 Jun 2003
Posts: 1226
Location: Florida

PostPosted: Wed Nov 29, 2006 2:09 pm    Post subject: Reply with quote

Change...
Code:
include "/home/jamieb/private/conf.php";
to...
Code:
include "conf.php";

Delete...
Code:
# Connect to database
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);


Create a conf.php with the following info...
Code:
<?php
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "userpassword";
$dbname = "databasename";
mysql_connect ($dbhost, $dbuser, $dbpass)
or die ('Could not connect to database because: ' . mysql_error());
mysql_select_db ($dbname);
?>

Put conf.php in the same folder as your login page.

Do you know how to create a database with the login info?
Back to top View user's profile Send private message Visit poster's website
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Wed Nov 29, 2006 3:00 pm    Post subject: Reply with quote

i dont how to create a database with the login info
_________________
Back to top View user's profile Send private message Visit poster's website
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Thu Nov 30, 2006 3:40 pm    Post subject: Reply with quote

pls reply....thx
_________________
Back to top View user's profile Send private message Visit poster's website
Moxxnixx
-


Joined: 21 Jun 2003
Posts: 1226
Location: Florida

PostPosted: Thu Nov 30, 2006 4:29 pm    Post subject: Reply with quote

chewzzqq,
Do you need this login only for yourself or is it for other visitors as well?
If it's for other visitors, you will also need a signup page. You should start
at the beginning.

Go to http://www.xentrik.net/php/signup/index.php and follow the tutorial.
It is very basic and easy to understand.

I don't know wml language so you will have to convert it yourself.
Back to top View user's profile Send private message Visit poster's website
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Thu Nov 30, 2006 5:07 pm    Post subject: Reply with quote

i will try it
_________________
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group