Browser MMO Video #5
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
you could actually just watch the videos up to about 14 or so then I started putting code back in for download.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Video#5
You will get a lot less errors and understand it better if you do it that way. Although I still suggest supplementing it with the book I linked a few posts back!hallsofvallhalla wrote:you could actually just watch the videos up to about 14 or so then I started putting code back in for download.
The indelible lord of tl;dr
Re: Video#5
Well i'm doing it along with the videos and checking in with that book. I'm not doing exactly what the videos say I've already watched all the videos (1-20) now i'm going back and doing them and substituting in what i want for the game I'm makeing and toying around with other code. Now that the videos are getting less and less. . . idk how to put it, necessary? You know they don't have to be a certain way or else the whole game wont work.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Video#5
You should make the whole tutorial game verbatim and then edit it from there. That way you have a working game structure to build on. Substituting new parts as a beginner while you are laying the groundwork is a recipe for problems.
The indelible lord of tl;dr
Re: Video#5
Ehh.. send the code of login.php??
Re: Video#5
Hey, HallsofVallhalla i got a problem at authenticate.php at line 7 heres the code of authenticate.php:
And this is the error
Please help me i copied ur code at authenticate.php at video 7 still doesnt work same error.
Reply!
-ZecH
Code: Select all
<?php
include_once 'connect.php';
session_start();
if (isset($_POST['submit']))
{
$player=$_POST['player'];
$password=$_POST['password'];
$player=strip_tags($player);
$password=strip_tags($password);
$password=md5($password);
$query = "select name,password from players where name='$player' and password='$password'";
$result = mysql_query($query) or die("Could not query players");
$result2 = mysql_fetch_array($result);
if ($result2)
{
$_SESSION['player']=$player;
echo "<big>Logged in successfully<br>";
echo "<A href='battle.php'>Continue</a></big>";
}
else
{
echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
}
}
?>Code: Select all
Notice: Undefined index: player in C:\wamp\www\tutorial\authenticate.php on line 7
Wrong username or password.Try AgainReply!
-ZecH
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
its not finding the post variable 'player', so you need to go to login.php and see if it is different when it sends it. feel free to post your login.php if you cant find it.
Re: Video#5
My english is very bad.. but heres the login.php
Code: Select all
<form method="POST" action="authenticate.php">
User Name <input type="text" name=player" size="21">
Password <input type="password" name="password" size="21" mask="x">
<br>
<input type="submit" value="Login" name="submit">Re: Video#5
Ohhhhh ... Never mind found the problem
i typed player" in login.php instead of "player"
Re: Video#5
Heheh i don't know if this is outdated to write here, but i have been recently doing these tuts ~ and stumpled across a problem. I've looked this thread over, but dont seem to find the answer.
alot of people get the solution ~
to
so i did that, but i still get this ~ Parse error: parse error in C:\wamp\www\Game\authenticate.php on line 13
Ill be posting my login and authenticate code - hope you eagle eyes can spot it out.
Login.php
Authenticate.php
thanks!
alot of people get the solution ~
Code: Select all
$query = "select name,password from players where name='$player' and '$password' ";Code: Select all
$query = "select name,password from players where name='$player' and password='$password' ";Ill be posting my login and authenticate code - hope you eagle eyes can spot it out.
Login.php
Code: Select all
<form method="POST" action="authenticate.php">
User Name <input type="text" name="player" size="21">
password <input type="password" name="password" size="34">
<br>
<input type="submit" value="Log-in" name="submit"></form>
Authenticate.php
Code: Select all
<?php
include_once 'connect.php';
session_start();
if (isset($_POST['Submit']))
{
$player=$_POST['player'];
$password=$_POST['password'];
$player=strip_tags($player);
$password=strip_tags($password);
$password=md5($password)
$query = "select name,password from players where name='$player' and password='$password' ";
$result = mysql_query($query) or die ("Could not query players");
$result2 = mysql_fetch_array($result);
if ($result2)
{
$_SESSION['player']=$player;
echo "<big>Logged in successfully!<br>";
echo "<a href='battle.php'>Continue></a></big>";
}
else
{
echo "<big>Login failed - Wrong username or password. <a href='login.php'> Try Again </a></big>";
}
}
?>