Video 9

Post all your tuts or request for tuts here.
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Video 9

Post by SpiritWebb »

hallsofvallhalla wrote:are you converting your password on log in to md5 also?
Yes...I didn't change anything. The first account I created, works. When I had my wife try it, the register now works (displays race chosen in the db), but when logging in, it says wrong username or password.

authenticate.php

Code: Select all

 <link href="style.css" rel="stylesheet" type="text/css" />
<STYLE type="text/css">
 <!--
 BODY { background-image:url(loginClear.png);
               background-repeat:no-repeat;
               background-position:center;
               background-attachment:fixed }
 -->
</STYLE>

<body bgcolor="black">
<body text="white">
<div id="successfull">
    <?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)
      {
        /* adding last login */

      /*end last login */
        $_SESSION['player']=$player;


sleep(4);
      header("Location: http://localhost/mythuto/index.php"); /* Redirect browser */

      }
      else
      {
       echo "<A href='login.php'>Back to login</a>";
      }
    }
    ?>
    </div>
    </body>
    </body>
Image

Image
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video 9

Post by hallsofvallhalla »

Code: Select all

sleep(4);
      header("Location: http://localhost/mythuto/index.php"); /* Redirect browser */
what is that garbage?

use

Code: Select all

header("Refresh: 2; url=http://localhost/mythuto/index.php");

THIS MUST be placed at top of page just below include connect and session_start, which needs to be moved above the html

no output must be before it.
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Video 9

Post by SpiritWebb »

Even changing that bit...(which worked before) it still doesn't work for the other account
Image

Image
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Video 9

Post by Torniquet »

could it be due to this....

$query = "select name,password from players where name='$player' and '$password'";

im sure you need to tell it where to look for the password :s

$query = "select name,password from players where name='$player' and password='$password'";
New Site Coming Soon! Stay tuned :D
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Video 9

Post by SpiritWebb »

Torniquet wrote:could it be due to this....

$query = "select name,password from players where name='$player' and '$password'";

im sure you need to tell it where to look for the password :s

$query = "select name,password from players where name='$player' and password='$password'";
I tried a different name, anothere "fake" account, just to test it. And that one worked fine. Just the one my wife created doesn't seem to work. But I will try this method tonight when I get home from work, and let you know.
Image

Image
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Video 9

Post by Torniquet »

ah ok i get ya lol. I know i had this trouble at one point... but cant remember the reason behind it lol.

if i remember before you fix it. ill let ya knows.



offtopic...

background-attachment:fixed << is that to keep the background static when your scrolling?
New Site Coming Soon! Stay tuned :D
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Video 9

Post by SpiritWebb »

Torniquet wrote:
background-attachment:fixed << is that to keep the background static when your scrolling?
Yes

Code: Select all

BODY { background-image:url(loginClear.png);  ///specific image set for background ///
               background-repeat:no-repeat;  ///Keeps the image from repeating ///
               background-position:center;  /// positions the image ///
               background-attachment:fixed }  ///keeps the background static, while scrolling the text. ///
Put that in there, so some people might know what it means. :P
Image

Image
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Video 9

Post by SpiritWebb »

Torniquet wrote:
$query = "select name,password from players where name='$player' and password='$password'";
I tried what you suggested, and it worked. I don't know why it worked with the others, and not one. But hey, it works now...thanks!
Image

Image
Post Reply

Return to “Tutorials”