Page 1 of 1

Maybe some help for some peoples!:

Posted: Mon Mar 14, 2011 9:15 pm
by Huezzer
Hey I've just figured out a actually working Authenticate code: It works wonderful for me :P

Here it's: Authenticate.php

Code: Select all

<?php
include_once 'connect.php';
session_start();
ob_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 "<br><br><br><br><br><center><big>Logged in successfully<br>";
    echo "<A href='index.php'>Continue</a></big></center>";
  
  header('refresh: 2; index.php');
  ob_end_flush();
  }
  else
  {
   echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
  }
}
?>
You can always change some things like " header('refresh: 2; index.php'); " 2 seconds if you don't want it, and also remove it totaly if you don't need it :P

This was just some help for you all, Good luck with your games,

Huezzer. :)

Re: Maybe some help for some peoples!:

Posted: Tue Mar 15, 2011 12:38 am
by 62896dude
Good work, glad you figured it out!