 |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6  | This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 9th, 2005, 05:41 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
chap 2......login problem
i can't log in to the movie1.php?
can any1 help me? thanks.....
login.php
=================
<html>
<head>
<title>Please log in</title>
</head>
<body>
<?php include "header.php" ?>
<form method "post" action="http://localhost/movie1.php">
<p> Enter your username:
<input type="text" name="user">
</p>
<p>Enter your password:
<input type="password" name="pass">
</p>
<p>
<input type="submit" name+"submit" value="submit">
</p>
</form>
</body>
</html>
movie1.php
===================
<?php
session_start();
$_SESSION['username']=$_POST['user'];
$_SESSION['userpass']=$_POST['pass'];
$_SESSION['authuser']=0;
//Check username and password information
if (($_SESSION['username']== 'joe') AND
($_SESSION['userpass']== '12345'))
{
$_SESSION['authuser']=1;
}
else
{
echo "Sorry , u dont have permission to view this page,
Loser! ! !";
exit();
}
?>
<HTML>
<HEAD>
<TITLE>Find my favorite movie</TITLE>
</HEAD>
<BODY>
<?php include "header.php";?>
<?php
$myfavmovie=urlencode("Kung Fu");
echo "<a href='http://localhost/moviesite.php?favmovie= $myfavmovie'>";
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</BODY>
</HTML>
moviesite.php
========================
<?php
session_start();
//check to see if user has logged in with a valid password
if ($_SESSION['authuser']!=1) {
echo "Sorry , u cant enter this page. SUCKER! ! ! ";
exit();
}
?>
<HTML>
<HEAD>
<TITLE>My movie site - <?php echo $_REQUEST['favmovie'] ?></TITLE>
</HEAD>
<BODY>
<?php include "header.php"; ?>
<?php
echo "Welcome to our site, ";
echo $_SESSION['username'];
echo "! <br>";
echo "My favorite movie is: ";
echo $_REQUEST['favmovie'];
echo"<br>";
$movierate=5;
echo "My movie rating for this movie is: ";
echo $movierate;
?>
</BODY>
</HTML>
|
|

June 10th, 2005, 12:58 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
One thing I can see immediately from the code posted above is an error in movie1.php
echo "<a href='http://localhost/moviesite.php?favmovie= $myfavmovie'>";
shouldn't have a space in the URL. It should be:
echo "<a href='http://localhost/moviesite.php?favmovie=$myfavmovie'>";
Also, what happens when you try? Is there any kind of error message?
|
|

June 13th, 2005, 03:50 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i don have any error.
it should be log in into the movie1.php
but the page say "Sorry , u dont have permission to view this page,Loser! ! !";
|
|

June 13th, 2005, 02:59 PM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Are you typing in the right user name and password?
The username is: Joe
The password is: 12345
http://www.DanForum.tk
|
|

June 14th, 2005, 03:57 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yes , i type the right pass and username.
i also don know y cant log in.
|
|

June 14th, 2005, 06:34 AM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try adding this at the beginning of the movie1.php (after the opening <?php tag)
Code:
while(list($key, $val) = each ($_POST))
{
echo "$key -- > $val<br>";
}
and post back on the new output that appears at the top of the page.
What this does is output to you all the info being past to the page from the superglobal POST.
|
|

June 15th, 2005, 05:15 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
after i add ......nothing happen
|
|

June 16th, 2005, 01:54 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That means nothing is being passed from the previous page.
Something I've just noticed. In this line:
<input type="submit" name+"submit" value="submit"> from login.php
should be
<input type="submit" name="submit" value="submit">
Also from login.php
<form method "post" action="http://localhost/movie1.php">
should be
<form method="post" action="http://localhost/movie1.php">
The form data was being sent via the GET method rather than POST.
Try that.
|
|

June 17th, 2005, 03:05 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks......at last , i did it....thanks so much
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| chap 2 exercise problem 6 |
iramwebtech |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
1 |
April 16th, 2009 04:14 PM |
| chap 18, p591 problem |
deanbrown |
BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 |
4 |
June 10th, 2008 12:36 AM |
| WebShop (Chap 9) Question about Login |
SDonnelly |
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 |
3 |
October 19th, 2006 04:12 AM |
| problem with binding example (chap 16) |
cr1sty |
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 |
8 |
September 12th, 2005 03:16 PM |
| problem in chap 11 |
joeore |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
1 |
January 30th, 2004 04:38 PM |
|
 |