[php html] Help please

C++, C#, Java, PHP, ect...
Post Reply
Medi
Posts: 21
Joined: Sun Jan 30, 2011 12:51 am

[php html] Help please

Post by Medi »

hey guys i need some help here ive been stumped with this issue for abit now and i cant seem to find the problem when i go to my localhost/vpets/login.php and login the address bar comes up at this localhost/vpets/login.php/authenticate.php and it does nothing. You can try it yourself here >http://99.250.196.77/vpets/index.php< but youll have to register first. ill post my codes down below.

authenticate.php

Code: Select all

<?php
include "connect.php";
 session_start();
 header("Refresh: 2; url='index.php'");
?>
 
<?php
if (isset($_POST['submit'])) 
{
    $player=$_POST['player'];
    $password=$_POST['password'];
    $player=strip_tags($player);
    $password=md5($password);
    $query = "select name,password,location from players where name='$player' and password='$password'"; 
    $result = mysql_query($query) or die("Could not conect to database") ;
    $result2=mysql_fetch_array($result);
    if($result2)
    {
       	    $_SESSION['player']=$player;
       //$locale = $result2[location];
	
      
	   echo "<center><big>Logged in successfully<br><br>";
	   echo "Re-directing you to your location<br><br>";  
    }
    else
    {
       print "Wrong username or password or non-activated account.<A href='login.php'>Try Again</a>";
    }
}
?>



login.php

Code: Select all

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

?>
<!--style
  <link href="style.css" rel="stylesheet" type="text/css" />
 -->
<div id="logo"><img src="images/logo.jpg" width="500" height="120" /></div>


 
 


<div id="logintable">


 <form method="POST" action="authenticate.php">
  <p> </p>
  <p align="center">User Name  <input type="text" name="player" size="15">
  <br>
 Password  <input type="password" name="password" size="15" mask="x">
<br>
<input type="submit" value="submit" name="submit">
<br>
<br>
Not registered? Please <A href='register.php'>Register</a><br>
<br>
Forgot password? <A href="getpass.php">Get Password</a><br>
<br>
  <p align="center"><br>
    <a href="/forums/">Forums.</a></p>
  </p>
</form>
</html>
</div>
Image
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: [php html] Help please

Post by Jackolantern »

Why don't you try removing the header, add a link to go back to the index.php on a successful login and see how that works out. That seems like needless complication for a malfunctioning script at this point. Nothing really jumps out at me in the script that could cause a blank screen.

Also, while I don't think it is the issue here, I would suggest adding a full doctype, header section, and the other segments of a proper HTML page to your login.php form. This will save you a ton of headaches later when trying to get your design to work the same in all browsers.
The indelible lord of tl;dr
Medi
Posts: 21
Joined: Sun Jan 30, 2011 12:51 am

Re: [php html] Help please

Post by Medi »

Jackolantern wrote:Why don't you try removing the header, add a link to go back to the index.php on a successful login and see how that works out. That seems like needless complication for a malfunctioning script at this point. Nothing really jumps out at me in the script that could cause a blank screen.

Also, while I don't think it is the issue here, I would suggest adding a full doctype, header section, and the other segments of a proper HTML page to your login.php form. This will save you a ton of headaches later when trying to get your design to work the same in all browsers.
Thanks for the tip ill do that for now and go back to it when i need to :)
Image
Post Reply

Return to “Coding”