Jump to content

pixy

Members
  • Posts

    295
  • Joined

  • Last visited

    Never

Posts posted by pixy

  1. Lol, dude, chill out.

    Later today I'll post you my view_users.php script if you want it. It lets you sort by the different types of information (IE, order by username, first name, last name, etc.) pagnates results over pages so you don't have to show a long list of members on one page.
  2. The banner is quite ugly. If you're going to try and sell your skills at making graphics, you're going to want to invest some serious time to creating your own site--as it reflects your capabilities as a designer.

    The colors--they're just kind of dull. There's no colorscheme but blue blue blue and more blue. Try several colors that look good together, focus on one and impliment the others throughought the page to make it look pulled together.

    The layout is a bit--square. Even though everything's contained in tables, it still looks a bit messy. I think you should try drawing out a layout on a piece of paper before you design it. Don't even consider having limits for coding or graphics, and eventually you'll have a great design. Personally, I even color mine in with markers and colored pencils. :D
  3. I dont know WHY it would give you those wierd characters if you took the commas out. & is used to append the variables to the URL, so they shouldn't change...

    Can you access the page through page.php?action=filter&platform=DS&platform=Adventure&genre=RPG&genre=Adventure
  4. Whatever your primary key is that you have set on auto_increment is the id you would enter with the mysql_insert_id(); function.

    Try this format, but fill in your values:
    $query = "INSERT INTO table1 (value1, value2) VALUES ('$variable1, '$variable2)";
    $result = mysql_query($query);
    if ($result) {
        $id = mysql_insert_id();
        $new_query = "INSERT INTO table2 (id_colum) VALUES ('$id')";
        $new_result = mysql_query($new_query);
        if ($new_result) {
            echo 'Everything is sucessfull!';
        }
        else {
            echo mysql_error();
    }
    else {
        echo myslq_error();
    }
  5. I think it'd be easier to write your own, since loads of those have all these psycho templates for this and that, and it's a royal pain.

    Seriously, if you can't include it, you'd have to go into the templates and code and change around a lot of stuff. I'm unfamiliar with the script, so I don't really know how they do everything...
  6. Whenever you put symbols in links (suchs as commas) it was automatically encode the URL properly...hence the reason you have all those funky things in there.

    How are you appending the variables to the link. Can you post some code?
  7. Just relying on $_GET too much. When I first started coding I thought that using the $_GET method looked cool so I tried to use it with EVERYTHING. O_O

    You should consider actually spacing your code in a reasonable way. It looks like it's all just floating around in cyberspace--it makes it much easier to debug.
  8. Looks like something to do with javascript to me. Either that or something with Flash, but I'm assuming against the latter.

    Technically they could be constants, but as a rule you capitalize those--and using constants makes no sense in this case.

    I'm stumped.
  9. Instead of relying on links to edit the name and description, pull it out of the database.

    [code]
    <?php
    include("db.php");
    // I dont know what the echo $id is for...
    if (isset($_GET['id'])) {
       if (!is_numeric($_GET['id'])) {
           die('You are trying to use an invalid link');
       }
       else {
           $id = $_GET['id'];
       }
    }

    if (isset($_POST['submitted'])) {
       $errors = array();
       if (empty($_POST['name'])) {
           $errors[] = 'You did not enter a name for the image.';
       }
       else {
           $name = $_POST['name'];
       }
       if (empty($_POST['desc'])) {
           $errors[] = 'You did not enter a description';
       }
       else {
            $desc = $_POST['desc'];
       }
       $id = $_POST['id'];
       if (empty($errors)) { // No errors, so update DB
           $query = "UPDATE image SET name='$name', description='$desc' WHERE id='$id'";
           $result = mysql_query($query);
           if ($query) {
                echo 'The image named '.$name.' was sucessfully updated.';
           }
           else {
                echo mysql_error();
           }
       }
       else {
            foreach ($errors as $msg) {
                echo '<li> '.$msg.'</li>';
            }
       }
    }
    else {
       $query = "SELECT name, description FROM image WHERE id='$id'";
       $result = mysql_query($query);
       if (mysql_num_rows($result) == 1) {
           $row = mysql_fetch_array($result, MYSQL_NUM);
           echo '<form action="thisfile.php" method="post">
           <b>Name:</b> <input type="text" name="name" value="'.$row[0].'"><br>
           <b>Description:</b><br>
           <textarea name="desc">'.$row[1].'</textarea><br>
           <input type="submit" name="submit" value="Submit">
           <input type="hidden" name="id" value="'.$id.'">
           <input type="hidden" name="submitted" value="TRUE">
           </form>';
       }
       else {
           echo 'We could not select that from the database.';
       }
    }
    ?>
    [/code]
  10. Can you give us a sample link? Maybe it's going over the maximum number of characters.

    Whenever you're using $_GET method to get variables, check that they're set first.
    if (isset($_GET['id'])) {
        if (!is_numeric($_GET['id'])) {
            echo 'You are using an invalid id';
            // include footers
            die();
        }
        else {
            $is = $_GET['id'];
        }
    }

    That, of course, only works when you're doing numeric values, but it's the same principle.
  11. ^ Wouldn't that do nothing? I'd think you'd need to do something like if (isset($_POST['submit'])) { ... but why?

    What I do personally is create a hidden field and check if that has been submitted--that way, they can't mess it up since it's in the HTML...

    Here, i'm just going to write it for you...Please ask questions if they're something that just seems out there--because they're a reson for everything. :)
    [code]
    <?php
    if (isset($_POST['submitted'])) {
        $errors = array();
        if (empty($_POST['username'])) {
            $errors[] = 'You did not enter a username.';
        }
        else {
            $username = $_POST['username'];
        }
        if (empty($_POST['password'])) {
            $errors = 'You did not enter a password.';
        }
        else {
            $pw = $_POST['password'];
        }
        if (empty($_POST['password2'])) {
            $errors[] = 'You did not confirm your password.';
        }
        else {
            $pw2 = $_POST['password'];
        }
        if ($pw != $pw2) {
            $errors[] = 'Your password and confirmed password do not match.';
        }
        if (empty($errors)) { // No errors, so continue with script...
            // First, make sure the username doesn't already exist
            $query = "SELECT username FROM users WHERE username='$username'";
            $result = mysql_query($query);
            if (mysql_num_rows($query) == 0) { // No results come back, so can register
                $query = "INSERT INTO users (username, password) VALUES ('$username', SHA('$pw'))";
                // SHA() encrypts it, always incrypt passwords! :)
                $result = mysql_query($query);
                if ($result) {
                    echo $username.', you have been sucessfully registered.';
                    // Send an email if you wanna
                }
                else {
                    echo mysql_error();
                }
            }
            else {
                echo 'Someone with that username has already registered.';
            }
        }
        else {
            foreach ($errors as $msg) {
                echo '<li> '.$msg.'</li>';
            }
        }
    }
    else {
        echo '<form action="register.php" method="post">
        <B>Username:</b> <input type="text" name="username" value="';
        if (isset($_POST['username'])) {
            echo stripslashes($_POST['username']);
        }
        echo '"><br>
        <b>Password:</b> <input type="password" name="password"><br>
        <b>Confirm Password:</b> <input type="password" name="password2"><br>
        <input type="submit" name="submit" value="Register">
        <input type="hidden" name="submitted" value="TRUE">
        </form>';
    }
    ?>
    [/code]
  12. Yea, and then on the page you just process as many links as you have.
    if (isset($_GET['var'])) {
      $var = $_GET['var'];
    }

    Just remember that sending links through the URL isn't very secure, and you should always validate $_GET variables as much as you can depending on the type of information you will recieve, because they would be very easy to use in a malicious manner. I usually use the is_numeric() function to check ID's.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.