Browser MMO Video #5

Location of the Videos
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

you could actually just watch the videos up to about 14 or so then I started putting code back in for download.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Video#5

Post by Jackolantern »

hallsofvallhalla wrote:you could actually just watch the videos up to about 14 or so then I started putting code back in for download.
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!
The indelible lord of tl;dr
Dizuki
Posts: 217
Joined: Tue Jun 22, 2010 9:10 pm

Re: Video#5

Post by Dizuki »

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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Video#5

Post by Jackolantern »

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
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: Video#5

Post by ricliv »

Ehh.. send the code of login.php??
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: Video#5

Post by ricliv »

Hey, HallsofVallhalla i got a problem at authenticate.php at line 7 heres the code of 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>Wrong username or password.<A href='login.php'>Try Again</a></big>";
  }
}
?>
And this is the error

Code: Select all

Notice: Undefined index: player in C:\wamp\www\tutorial\authenticate.php  on line 7
Wrong username or password.Try Again
Please help me i copied ur code at authenticate.php at video 7 still doesnt work same error.

Reply!

-ZecH
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

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.
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: Video#5

Post by ricliv »

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">
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: Video#5

Post by ricliv »

Ohhhhh ... Never mind found the problem ;) i typed player" in login.php instead of "player"
faceless
Posts: 8
Joined: Tue Aug 10, 2010 12:58 am

Re: Video#5

Post by faceless »

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 ~

Code: Select all

$query = "select name,password from players where name='$player' and '$password' ";
to

Code: Select all

$query = "select name,password from players where name='$player' and password='$password' ";
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

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>";
	}
	
}

?>
thanks!
Post Reply

Return to “Older Browser MMO Videos”