Browser MMO Video #5

Location of the Videos
User avatar
Articus
Posts: 10
Joined: Thu May 19, 2011 5:07 am

Re: Video#5

Post by Articus »

hallsofvallhalla wrote: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
Roger, roger. Programmer in me twitching when I see something not working, I'll just keep it in a corner with a broom. ;)

Seems vid 8 code fixed it! Hooray~.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#5

Post by hallsofvallhalla »

yeah it often works that way. 9 out of 10 times it is a missing bracket, or ; or ' or " or mis spelling.
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: Video#5

Post by ricliv »

I got a problem with battle.php

"Parse error: syntax error, unexpected T_IF in C:\wamp\www\tutorial\battle.php on line 5"
this is a part in my battle.php (1-12)

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

Re: Video#5

Post by Jackolantern »

You need to add a semicolon after "session_start" on line 3.
The indelible lord of tl;dr
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: Video#5

Post by ricliv »

Okay, thanks, Now.. I get a error when I register a new user.. it sais.. "could not register" :S.
User avatar
RogueTomboy
Posts: 61
Joined: Sun May 22, 2011 3:42 pm

Re: Video#5

Post by RogueTomboy »

Okay i am playing around with Halls codes to try and teach myself different things. Right now I am trying to make the "Submit" and "Register" buttons on the login pages into actual images.

I have managed to make the button images show for them but the problem I am having is when I click the Register button I can't get it to link to my register page. Here are my codes...

Login:

Code: Select all

<link href="splashpage.css" rel="stylesheet" type="text/css" />

<div id="login">
<form method="POST" action="authenticate.php">
User Name <input type="text" name="player" size="21"><br><br><br>
Password <input type="password" name="password" size="21" mask="x">
<br><br><br><br><input type="image" src="images/login.png" border="0" value="submit" alt="submit" name="submit">

<div id="register">
<a href='register.php'><input type="image" src="images/register.png" border="0" value="register" alt="register" name="register"></a></form>
</div>
Authenticate:

Code: Select all

<?php
include_once 'connect.php';
session_start();

if (isset($_POST['submit_x']))
{
  $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='index.php'>Continue</a></big>";
  }
  else
  {
   echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
  }
}
?>
Need art? Commissions are always open!
http://www.ladytankstudios.com

Currently addicted to:
Image
Collect & Explore for pets
User avatar
62896dude
Posts: 516
Joined: Thu Jan 20, 2011 2:39 am

Re: Video#5

Post by 62896dude »

I think the problem is with your register page, can we see that? (the code for it). Also, what is the file name of your button?
Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
User avatar
RogueTomboy
Posts: 61
Joined: Sun May 22, 2011 3:42 pm

Re: Video#5

Post by RogueTomboy »

My button file name is register.png.

Here is my register page:

Code: Select all

<?php
include 'connect.php';

?>

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

 <?php
      print "<select name='classchoice' length='20'>";
      $classinfo="SELECT * from classes";
      $classinfo2=mysql_query($classinfo) or die("Could not select classes");
      while ($classinfo3=mysql_fetch_array($classinfo2))
      {
        print "<option>$classinfo3[name]</option>";
      }
      print "</select><br>";
?>
</form>
<?php

      print "<center><h3>Class Starting modifiers</h3></center>";
      print "<center>";
      print "<table border='0' width='70%' cellspacing='20'>";
      print "<tr><td width='25%' valign='top'>";
      print "</td>";
      print "<td valign='top' width='75%'>";
      $selectclass="SELECT * from classes";
      $selectclass2=mysql_query($selectclass) or die("could not select Classes");
      print "<table border='1' bordercolor='black' bgcolor='#ffffff'>";
      print "<tr><td><font color='cc0033'>Class<font color='ffffff'>_____________</td><td><font color='cc0033'>Attack<font color='ffffff'>_</font><td><font color='cc0033'>Defense<font color='ffffff'>_</font></td><td><font color='cc0033'>Hit Points<font color='ffffff'>_</font></td><td><font color='cc0033'>Spell Points<font color='ffffff'>_</font></td></tr>";
      while($selectclass3=mysql_fetch_array($selectclass2))
      {
       print "<tr><td>$selectclass3[name]</td><td>$selectclass3[attack]</td><td>$selectclass3[defense]</td><td>$selectclass3[hpoints]</td><td>$selectclass3[spoints]</td></tr>";
          
      }
      print "</table>";
      print "</td></tr></table>";    
      print "</center>";
    
    
?>
Need art? Commissions are always open!
http://www.ladytankstudios.com

Currently addicted to:
Image
Collect & Explore for pets
User avatar
62896dude
Posts: 516
Joined: Thu Jan 20, 2011 2:39 am

Re: Video#5

Post by 62896dude »

Okay, I can't guarantee that this will work for you, but it did for me, here is what you do:

In register.php where your code says:

Code: Select all

<input type="submit" value="submit">
Replace it with this:

Code: Select all

<input type="image" src="register.png">
Let me know if this works!
Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
User avatar
62896dude
Posts: 516
Joined: Thu Jan 20, 2011 2:39 am

Re: Video#5

Post by 62896dude »

Oops, I'm sorry, I just realized that I completely misread your question, I will post another response in a few minutes hopefully answering your actual question.
Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
Post Reply

Return to “Older Browser MMO Videos”