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 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: PHP Issue

  1. #11
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    If thats the WHOLE code of the file, make sure you're including the file which contains your database information.

  2. #12
    ScottDiamond. Guest

    Default

    Quote Originally Posted by Invent View Post
    If thats the WHOLE code of the file, make sure you're including the file which contains your database information.
    Ditto. config.php, for example.

  3. #13
    Join Date
    Jun 2004
    Location
    London
    Posts
    116
    Tokens
    0

    Default

    WOW that code is SO insecure.
    By having a GET variable directly inputted into a query is suicide.
    That easily allows SQL injection and could delete the whole of your database.
    TOTAL FIX + SECURITY FIX:

    PHP Code:
    <?php
    if(empty($_GET['category']) == true) {
    echo 
    "<a href="products.php?category=soccer">Soccer Trophies</a><br />"; }else{
    $cat addslashes($_GET['category']);

    $query mysql_query("SELECT * FROM catalogue WHERE category = '$cat'"); 
         
    if(
    mysql_error()) {
    print(
    mysql_error());
    }

    while(
    $row mysql_fetch_array($query)) {
    echo(


    <table border='1'>
    <tr>
    <td><img src='images/"
    .$row[item_number].".JPG'></td>
    </tr>
    <br>
    <tr>
    <td>Item Number: "
    $row['item_number']."</td>
    </tr>
    </tr><br>
    <tr><td>"
    .$row[price]." GBP (Great Brittish Pounds)</td></tr>
    <br>
    </table>
    <br>
    "
    );
    }
    ?>
    Rep if this works :rolleyes:
    Last edited by *; 22-07-2007 at 05:13 PM.

  4. #14
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
       $conn 
    mysql_connect("localhost","USERNAME","PASSWORD");
       
    mysql_select_db(DATABASENAME) or die(mysql_error());
    if(empty(
    $_GET['category']) == true) {
    echo 
    "<a href="products.php?category=soccer">Soccer Trophies</a><br />"; }else{
    $cat addslashes($_GET['category']);

    $query mysql_query("SELECT * FROM catalogue WHERE category = '$cat'"); 
         
    if(
    mysql_error()) {
    print(
    mysql_error());
    }

    while(
    $row mysql_fetch_array($query)) {
    echo(


    <table border='1'>
    <tr>
    <td><img src='images/"
    .$row[item_number].".JPG'></td>
    </tr>
    <br>
    <tr>
    <td>Item Number: "
    $row['item_number']."</td>
    </tr>
    </tr><br>
    <tr><td>"
    .$row[price]." GBP (Great Brittish Pounds)</td></tr>
    <br>
    </table>
    <br>
    "
    );
    }
    ?>

  5. #15
    ScottDiamond. Guest

    Default

    Quote Originally Posted by Jamie. View Post
    PHP Code:
    <?php
       $conn 
    mysql_connect("localhost","USERNAME","PASSWORD");
       
    mysql_select_db(DATABASENAME) or die(mysql_error());
    if(empty(
    $_GET['category']) == true) {
    echo 
    "<a href="products.php?category=soccer">Soccer Trophies</a><br />"; }else{
    $cat addslashes($_GET['category']);

    $query mysql_query("SELECT * FROM catalogue WHERE category = '$cat'"); 
         
    if(
    mysql_error()) {
    print(
    mysql_error());
    }

    while(
    $row mysql_fetch_array($query)) {
    echo(


    <table border='1'>
    <tr>
    <td><img src='images/"
    .$row[item_number].".JPG'></td>
    </tr>
    <br>
    <tr>
    <td>Item Number: "
    $row['item_number']."</td>
    </tr>
    </tr><br>
    <tr><td>"
    .$row[price]." GBP (Great Brittish Pounds)</td></tr>
    <br>
    </table>
    <br>
    "
    );
    }
    ?>
    No they would have to inculde the config.

  6. #16
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    yeh but i was just showing -.- so neh

  7. #17
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Create a file with this and include all the configs, etc.

    PHP Code:
    <?php
    require_once('myconfig.php');

    $query "SHOW TABLES;";
    $res mysql_query($query) or die (mysql_error());
    $rows mysql_fetch_assoc($res);
    do {
    var_dump($rows);
    } while(
    $rows mysql_fetch_assoc($res));

    ?>
    If this returns nothing then there is a problem on the MySQL side, is it returns all the tables in the current database there is a problem with your script.

  8. #18
    Join Date
    Jun 2004
    Location
    London
    Posts
    116
    Tokens
    0

  9. #19
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    i adapted it actually

  10. #20
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by Jamie. View Post
    PHP Code:
    $conn mysql_connect("localhost","USERNAME","PASSWORD");
       
    mysql_select_db(DATABASENAME) or die(mysql_error()); 
    Quote Originally Posted by * View Post
    Jamie why take my code :S
    You talking about that? Because that aint your code, so he can use it all he likes.

Page 2 of 3 FirstFirst 123 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
  •