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
    Aug 2009
    Location
    UK
    Posts
    274
    Tokens
    719

    Post Query Code Problem

    This code dont seem to be working because it dont say wheather im deluxe or standard, I think it might be the query that is the problem.





    HELPPP MEEE


    THANKSSS

  2. #2
    Join Date
    Jul 2008
    Location
    Leeds, UK
    Posts
    47
    Tokens
    0

    Default

    PHP Code:
    <?
    $username 
    addslashes($_POST['username']);

    $result mysql_query("SELECT `accounttype` FROM `users` WHERE `username`='".mysql_real_escape_string($username)."'")or die(mysql_error());
    $row mysql_fetch_array($result);

    $loggedin $_SESSION['logged_in'];
    $username $_SESSION['username'];
    $accounttype $row['accounttype'];

    echo 
    '
    <html>
    <body background="http://lv-cnr.com/bg.png">
    <center>'
    ;

    if(!isset(
    $_SESSION['logged_in']) || !isset($_SESSION['username']))
    {
        
    header("location: index.php");
    }

    switch(
    $accounttype){
        default:
        case 
    "standard":
            echo 
    'You do not have sufficient rights to view this page!';
        break;
        case 
    "deluxe":
            echo 
    'Welcome Deluxe user!';
        break;
    }
    ?>

  3. #3
    Join Date
    Aug 2009
    Location
    UK
    Posts
    274
    Tokens
    719

    Default

    It keeps saying

    You do not have sufficient rights to view this page!

    Even though my accounttype is deluxe?

    Plus i also get


    Warning: Cannot modify header information - headers already sent by (output started at /home/kylesmith09/domains/lv-cnr.com/public_html/staff/tesrt.php:15) in /home/kylesmith09/domains/lv-cnr.com/public_html/staff/tesrt.php on line 19




    Quote Originally Posted by Delatory View Post
    PHP Code:
    <?
    $username 
    addslashes($_POST['username']);
     
    $result mysql_query("SELECT `accounttype` FROM `users` WHERE `username`='".mysql_real_escape_string($username)."'")or die(mysql_error());
    $row mysql_fetch_array($result);
     
    $loggedin $_SESSION['logged_in'];
    $username $_SESSION['username'];
    $accounttype $row['accounttype'];
     
    echo 
    '
    <html>
    <body background="http://lv-cnr.com/bg.png">
    <center>'
    ;
     
    if(!isset(
    $_SESSION['logged_in']) || !isset($_SESSION['username']))
    {
        
    header("location: index.php");
    }
     
    switch(
    $accounttype){
        default:
        case 
    "standard":
            echo 
    'You do not have sufficient rights to view this page!';
        break;
        case 
    "deluxe":
            echo 
    'Welcome Deluxe user!';
        break;
    }
    ?>

  4. #4
    Join Date
    Jul 2008
    Location
    Leeds, UK
    Posts
    47
    Tokens
    0

    Default

    Quote Originally Posted by KyleSmith View Post
    It keeps saying

    You do not have sufficient rights to view this page!

    Even though my accounttype is deluxe?

    Plus i also get


    Warning: Cannot modify header information - headers already sent by (output started at /home/kylesmith09/domains/lv-cnr.com/public_html/staff/tesrt.php:15) in /home/kylesmith09/domains/lv-cnr.com/public_html/staff/tesrt.php on line 19
    it does not sound like you have the right data set in the database
    do echo $accounttype.

    also move the echo '<html... to below the if statement

  5. #5
    Join Date
    Aug 2009
    Location
    UK
    Posts
    274
    Tokens
    719

    Default

    I did that but now it likes to redirect me :/

    This is the code


  6. #6
    Join Date
    Jul 2008
    Location
    Leeds, UK
    Posts
    47
    Tokens
    0

    Default

    If it's redirecting you, then one of the session variables (logged_in or username) doesn't exist.

  7. #7
    Join Date
    Aug 2009
    Location
    UK
    Posts
    274
    Tokens
    719

    Default

    For the code to work i had to edit it to this,

    But it dont redirect me now but even though im deluxe it says i aint got the right like urmm accounttype


  8. #8
    Join Date
    Jul 2008
    Location
    Leeds, UK
    Posts
    47
    Tokens
    0

    Default

    The next bit is that accounttype (presuming it exists) is not deluxe.
    Under $accounttype = $row['accounttype']; put
    print_r($row);
    exit();

    and paste what it says on the screen

  9. #9
    Join Date
    Aug 2009
    Location
    UK
    Posts
    274
    Tokens
    719

    Default

    Its a blank page this is my sql database

  10. #10
    Join Date
    Jul 2008
    Location
    Leeds, UK
    Posts
    47
    Tokens
    0

    Default

    Remove
    print_r($row);
    exit();

    and replace $_POST['username'] to $_SESSION['username'] on line 4
    Last edited by Delatory; 09-02-2010 at 08:13 PM.

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
  •