View previous topic :: View next topic |
Author |
Message |
chewzzqq -
Joined: 28 Sep 2005 Posts: 198
|
Posted: Sat Nov 25, 2006 8:51 pm Post subject: wap member |
|
|
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 |
|
|
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
|
Back to top |
|
|
chewzzqq -
Joined: 28 Sep 2005 Posts: 198
|
Posted: Sun Nov 26, 2006 4:01 am Post subject: |
|
|
Many Thank Moxxnixx,
i will try it and post results after few day.because not free... _________________
|
|
Back to top |
|
|
chewzzqq -
Joined: 28 Sep 2005 Posts: 198
|
Posted: Wed Nov 29, 2006 12:02 pm Post subject: |
|
|
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 |
|
|
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Wed Nov 29, 2006 2:09 pm Post subject: |
|
|
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 |
|
|
chewzzqq -
Joined: 28 Sep 2005 Posts: 198
|
Posted: Wed Nov 29, 2006 3:00 pm Post subject: |
|
|
i dont how to create a database with the login info _________________
|
|
Back to top |
|
|
chewzzqq -
Joined: 28 Sep 2005 Posts: 198
|
Posted: Thu Nov 30, 2006 3:40 pm Post subject: |
|
|
pls reply....thx _________________
|
|
Back to top |
|
|
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Thu Nov 30, 2006 4:29 pm Post subject: |
|
|
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 |
|
|
chewzzqq -
Joined: 28 Sep 2005 Posts: 198
|
Posted: Thu Nov 30, 2006 5:07 pm Post subject: |
|
|
i will try it _________________
|
|
Back to top |
|
|
|