Browser MMO Video #5
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Video#5
What on Earth? Another issue with a variable not being passed from the form? We had one of these the other day. I have never had one of these personally. What is causing them? Because the code seems fine.
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
i need to look on how we fixed the last one. It must be something to do with Wamp or the browser. What browser and version are you using?
Re: Video#5
I am using google chrome version 11.0.696.68 (current) and wamp version 2.1 64 bit
Re: Video#5
just tried in firefox and internet explorer (current versions) with no luck.
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
is your wamp icon green in your tray?
if so try this, create a page called test.php
then create another page called test2.php
save these where ever and navigate to them in the browser localhost\directory\test.php
see what heppens
if so try this, create a page called test.php
Code: Select all
<form method="post" action="test2.php">
Type something in here: <input type="text" name="testpost" size="15"><br>
<input type="submit" value="submit">
Code: Select all
<?php
$testvariable = $_POST['testpost'];
echo "You typed " . $testvariable;
?>
see what heppens
Re: Video#5
Yes, it is green.
When I go to test.php it works, type something in and it directs me to test2.php which says what i typed.
When I go to test.php it works, type something in and it directs me to test2.php which says what i typed.
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
aha! then cope and paste this. dont worry about it looking exactly the same. let me know the result
register.php
register.php
Code: Select all
<form method ="post" action="reguser.php">
Type Username Here: <input type="text" name="player" size="21"><br>
Type Password Here: <input type="text" name="password" size "15"><br>
ReType Password Again: <input type="text" name="pass2" size "15"><br>
Type Email Address: <input type="text" name="email" size "60"><br>
<input type="submit" value="submit">
Re: Video#5
Just fixed it and came to say so when I saw your post. Not sure what it was, but continued through video 9 and i guess the code from it fixed the error. Thanks for the help.
Re: Video#5
Watcher wrote:I am just starting this, everything has been fine till now, after I log in I get the goblin stats but none for the player just shows this.
Hit points =
Attack =
Defense =
Goblin
Hit points = 5
Attack = 3
Defense = 3
Attack!
I actually get what Watcher gets as well, which has been boggling my mind. I first wrote my own code and then thought I messed up, so I copy and pasta'd the code in from the videos and still got this problem. It is letting someone with a blank name be logged into the game. There is no user with a blank name and the code looks identical. Any help?
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
<?php
include_once 'connect.php';
session_start();
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
...
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video#5
can you show us the actual stat panel code?
also I do not recommend anyone attempting the code until video 14 or more. It is only going to aggravate you. We have seen it well more than 1,000 times here. Watch then download code at 14 or maybe even 20
also I do not recommend anyone attempting the code until video 14 or more. It is only going to aggravate you. We have seen it well more than 1,000 times here. Watch then download code at 14 or maybe even 20