Re: Video#5
Posted: Sat Jun 25, 2011 8:04 pm
change it up how you want, just use it as a base to get started then modify it to make it work for you. No harm in that. Especially if it speeds up development.
Here are my login codes:hallsofvallhalla wrote:strange, post your code here, though if I was you I would keep watching the videos as it may fix itself on its own.
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
<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" />
Problem Solved. Missed the last quotation.Klone wrote:Here are my login codes:hallsofvallhalla wrote:strange, post your code here, though if I was you I would keep watching the videos as it may fix itself on its own.
authenticate.php:login.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> } } ?>
The problem is that when I click Login, nothing appears on the authenticate.php page.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" />
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'";
$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
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'";
$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
if (isset($_POST['submit']))
{ //changed ( to {, and made similar changes all the way down through the code
$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'";
$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
<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">
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='$player' and '$password'";
$result = mysql_query($query) or die("Could not query players");
$result2 = mysql_fetch_array($result);
if ($result2)
{
$_SESSION['player']=$player;
echo "<big>Loggon in Successfully<br/>";
echo "<a href='battle.php'>Continue</a></big>";
}
else
{
echo "<big>Wrong Username or Password.<a href='login.php'>Try Agin</a></big>";
}
}
?>
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'";
$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
$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'";
That's true for the most part - the videos show you everything you need to do. However... if something goes wrong, you need to be able to figure out what happened and how to fix it. So there is some skill needed, but really very little.joedraco wrote:Valhala said i need no skills in this program and he will teach the viewer all along the way, but with these errors I start to doubt that.