Page 29 of 35
Re: Video#5
Posted: Thu May 19, 2011 2:58 pm
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~.
Re: Video#5
Posted: Thu May 19, 2011 4:50 pm
by hallsofvallhalla
yeah it often works that way. 9 out of 10 times it is a missing bracket, or ; or ' or " or mis spelling.
Re: Video#5
Posted: Fri May 27, 2011 5:33 pm
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;
Re: Video#5
Posted: Tue May 31, 2011 2:12 am
by Jackolantern
You need to add a semicolon after "session_start" on line 3.
Re: Video#5
Posted: Sat Jun 04, 2011 10:15 am
by ricliv
Okay, thanks, Now.. I get a error when I register a new user.. it sais.. "could not register" :S.
Re: Video#5
Posted: Sat Jun 04, 2011 10:00 pm
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>";
}
}
?>
Re: Video#5
Posted: Sun Jun 05, 2011 12:08 am
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?
Re: Video#5
Posted: Sun Jun 05, 2011 10:03 am
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>";
?>
Re: Video#5
Posted: Sun Jun 05, 2011 8:00 pm
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!
Re: Video#5
Posted: Sun Jun 05, 2011 8:02 pm
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.