Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Feb 2008
    Posts
    291
    Tokens
    0

    Default Currently Making a Mafia Game...

    I am currently making a mafia game which I used a script for.

    Atm its almost done.
    But Login doesnt work.
    Register works fine... BUt login just redirects to the login page again. Its using php obvo. Any ideas?

  2. #2
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:


  3. #3
    Join Date
    Feb 2008
    Posts
    291
    Tokens
    0

    Default

    <?php
    session_start();
    include_once"includes/db_connect.php";
    if (strip_tags($_GET['logout']) == "yes"){
    session_destroy();
    }elseif (isset($_SESSION['username'])){
    header("Location: MM.php");
    header("Location: choose2.php");
    header("Location: choose1.php");
    exit();
    }

    if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
    $username = addslashes(strip_tags($_POST['username']));
    $password = addslashes(strip_tags($_POST['password']));
    $select = mysql_query("SELECT * FROM users WHERE online > '$timenow' ORDER by rank desc");
    $num = mysql_num_rows($select);

    $ip = $REMOTE_ADDR;



    ///check INFO

    $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1' LIMIT 1");


    $login_check = mysql_num_rows($sql);
    $inf = mysql_fetch_object($sql);
    if ($login_check == "0"){
    $message="You could not be logged in";
    }elseif ($login_check != "0"){


    if ($login_check > "0"){
    if ($inf->status == "Dead"){
    include_once"dead.php";
    exit();

    }
    if ($inf->status == "Banned"){
    $encoded=md5(strtolower($username));
    header("Location: banned.php?banned=$username&encoded=$encoded");
    exit();

    }

    session_register('username');
    $_SESSION['username'] = $inf->username;




    $timestamp = time()+20;
    mysql_query("UPDATE users SET online='$timestamp' WHERE username='$username'");

    mysql_query("UPDATE users SET l_ip='$ip' WHERE username='$username'");



    header("Location: MM.php");

    header("Location: loading.php");


    } else {
    $message= "You could not be logged in.<br />";

    }}}

    ?>

    <html>
    <head>
    <title>Gangsterz Life</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



    <link href="includes/in1.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body {
    background-image: url();
    background-color: #000000;
    }
    .style3 {color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
    .style4 {
    color: #FFFFFF;
    font-size: 16px;
    font-weight: bold;
    }
    .style5 {color: #FFFFFF}
    -->
    </style></head>
    <p align="center"><img src="globalM.png" width="575" height="300"></p>
    <body onLoad="JSFX_StartEffects()">
    <form action="" method="post">
    <p>&nbsp;</p>
    <table width="599" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#333333">
    <!--DWLayoutTable-->
    <tr> </tr>
    <tr>
    <td width="178" height="100">&nbsp;</td>
    <td width="402" valign="top" bgcolor="#333333"><table width="591" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td width="591">&nbsp;</td>
    </tr>
    <tr>
    <td height="28"><table width="99%" border="0" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class=thinline>
    <!--DWLayoutTable-->
    <tr>
    <td width="229" height="20"><div align="center" class="style3">Username:
    <input name="username" type="text" id="username">
    </div></td>
    <td width="236"><div align="center" class="style3">Password:
    <input name="password" type="password" id="password">
    </div></td>
    <td width="78"><p><input type="submit" name="Submit" value="Submit">
    </p> </td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
    </table>
    </td>
    <td width="190"></td>
    </tr>
    <tr>
    <td></td>
    </table>
    <div align="center"><span class="style5"></span>
    </td>
    </tr>
    <a href="register.php"><img src="http://www.lexfest.net/img/register_button.gif" width="102" height="93" border="0"></a>
    </div>
    </form>


    <tr>
    <td><table width="607" height="137" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td height="10" colspan="5">&nbsp;</td>
    </tr>
    <tr>
    <td height="10" colspan="5">&nbsp;</td>
    </tr>
    <tr>
    <br>
    <td width="607" height="137">&nbsp;</td>
    <tr>
    <td><table width="607" height="137" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td height="97" colspan="5">&nbsp;</td>
    </tr>

  4. #4
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    }elseif (isset($_SESSION['username'])){
    header("Location: MM.php");
    header("Location: choose2.php");
    header("Location: choose1.php"); 
    wth?

  5. #5
    Join Date
    Nov 2008
    Location
    Cambridge, UK
    Posts
    901
    Tokens
    100

    Default

    Learn PHP before you try and make something.

    Smashing scripts together and calling it your own game is cheap.

  6. #6
    Join Date
    Feb 2008
    Posts
    291
    Tokens
    0

    Default

    Tis when you login. You can choose your style of site.
    Anyway anyone got ideas?

  7. #7
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by -Adam View Post
    Tis when you login. You can choose your style of site.
    Anyway anyone got ideas?
    Lol...

    PHP Code:
    header("Location: MM.php");
    header("Location: choose2.php");
    header("Location: choose1.php"); 
    I was under the impression header("Location:"); redirected the user? How can he be directed to 3 places at once using header(); ?

  8. #8
    Join Date
    Feb 2008
    Posts
    291
    Tokens
    0

    Default

    Yes

    When you click Choice 1 it redirects you to my site but one different style and the same for choice 2.
    But I cant even get to that as I cant login.

  9. #9
    Join Date
    Oct 2006
    Posts
    16
    Tokens
    0

    Default

    Yeah I think that's the problem, you can only send one header location at a time which maybe causing your problem.

    header("Location: MM.php");
    header("Location: loading.php");


    Start with just one location to begin with, for example loading.php:

    header("Location: loading.php");

    And get rid of the rest and see if it works.

    The next thing is to check the username and password stored in the database, you need to make sure that activated is set to 1 as well. (Simple things can sometimes be the problem)

    I am sure it would also be useful if you could post the contents of MM.php and loading.php so we can make sure there is no redirect in there which could be causing the problem, to once logged in then send the user back to the login page.

    As has been said you can only use 1 header("Location: "); at any one time so MM.php and loading.php after wont work you have to use 1 or the other. For now just put 1 in then you can sort out choosing which layout or area to go to when you get this bit working.
    Last edited by Anzrew; 31-12-2008 at 11:23 AM.

  10. #10
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    Are you getting header("Location: *") confused with include()?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •