Jump to content

Fadion

Members
  • Posts

    1,710
  • Joined

  • Last visited

Posts posted by Fadion

  1. Although this wont really help you, my personal belief is NEVER pass anything in the URL....never.  When i can i pass things to sessions or if i have to POSTS.

     

    That makes no sense. Never pass a url variable? Great, PHP (and all the other web scripting languages) should abandon GET support then...

     

    As for the problem. Your url should be example.com?smth=3, or maybe you've mod_rewrite your urls. You can solve all this with a session. When someone enters the confirmation page, create a session for them. While they go in the reward page, check if the session is set and destroy it (so they don't re enter again without going to the confirmation page first). It should be easy, but if you need sample code, just ask.

     

     

  2. You should check first if the form is submitted, as the query will run every time the page is accessed, not every time the form is submitted. Change the "Writing to the database part" to:

     

    <?php
    if(isset($_POST['txt_username'])){
         $username = mysql_real_escape_string(htmlentities($_POST["txt_username"])); //clean the data
         $password = $_POST["txt_password"];
         $query1 = "INSERT INTO login (username, password) VALUES ('$username', '$password')";
         mysql_query($query1, $connection) or die(mysql_error());
    }
    ?>
    

     

    The password should be hashed so that you don't run the risk of attackers getting your users passwords.

  3. If you have written that code by yourself, you should know where to place it. Otherwise, i'd suggest to start writing some code from scratch as it's the only way to learn. I don't know what the GetSQLValueString() custom function does and your code has too many not needed lines imo, so i'll just suggest the normal way of doing it:

     

    <?php
    if(isset($_POST['submit'])){
         $date = $_POST['date'];
         list($month, $day, $year) = explode('-', $date);
         if(!strtotime($date)){
              echo 'The date format is invalid. It should be: mm-dd-yyyy';
         } elseif(!checkdate($month, $day, $year)){
              echo 'The date is invalid. Either the month, day or year are of a not normal range.';
         }
    }
    ?>
    

  4. I just realized that i made a stupid mistake in my previous post, used UPDATE instead of INSERT  :-\

     

    <?php
    mysql_query("INSERT table (col1, col2) VALUES ('value1', 'value2')");
    ?>
    

     

    Just insert the row, it will be automatically added. Your query may be something like, instead of the WHERE part:

    mysql_query("INSERT INTO Ysers (Comments, email) VALUES ('$CF', '$Friend')");
    

  5. I can't seem to find the date variable there, but anyway the approach to this can be using:

     

    <?php
    $date = '09-03-2008';
    list($month, $day, $year) = explode('-', $date);
    if(!checkdate($month, $day, $year)){
       echo 'The date is invalid';
    }
    ?>
    

     

    It will check if the date is a normal one and not something like "45-78-99999". But it won't check for the date format, instead you can add such a thing:

    <?php
    $date = '09-03-2008';
    if(!strtotime($date)){
        echo 'The date is invalid';
    }
    ?>
    

  6. First of all congrats. You've created a really nice design. Overall I like it, being the design and the way you handled content. But critiques are always welcome, right? :)

     

    Main Page

    - I like the handwritten "i was inspired into...", but the next "get your football fix" doesn't look quite good. Also some letters like the "g" and "y" are cut out.

    - The "ONYAHEAD.com" text is nice, but a bit more work on it could make it stand out more. Some details on the letters outside (cut them out a bit) should look nice.

    - The three columns are a bit stuck to each other and make them difficult to read. In IE7 they look better, but in FF3 not. Also some padding could go well.

    - The links that trigger the slide-in animation could be toggle links. Meaning that they open and hide the content, while you can leave the hide link at the end. I was a bit confused in the beginning as the content was long and i couldn't see the [hide] link, but clicking on the links at the beginning triggered the slide-in again.

     

    Sub Pages

    - Not much to say here, except that the Quick Links at the bottom should be more visible

  7. You mean that script will cheat or hack my point system?

    That shouldn't be a surprise, shouldn't it? It's not difficult to make a script which runs through the "browsers" and lower their points. Even if someone fails on an automated approach, people are so patient that they can click and refresh manually.

     

    If I have users paid to keep the site on my site, it turns into no sense. Actually, if users want to keep the site there, they must click on other sites. The more sites they click, the more points they gain. A site has zero point will be out of the list. Earning money? If there are many users, I can put somes little ads to earn.

    I was just saying, not making it happen and i stated that it would not increase any earnings. Though, the way the site is now, makes it not really interesting. In my opinion...

  8. This thing looks really cool. I'm liking a lot the minimal layout, basically i'm doing what i'm supposed to do...browse. And yep the Element Inspector is a basic version of firebug, but considering this is an early beta, maybe we'll see some some cool stuff in the future. I'm impressed in general, fast and with style.

  9. Hmm. Have the circles a different color then the background? Have you checked that Opacity and Fill Opacity are 100%? If by clicking the shape mask (the black box) you can see the actual shape, it means that the circle is created but its either transparent or has the same color as the background.

  10. Hello for some reason my post script is not updating the database properly,

    it doesn't stack it just overwrites.

     

    I mean that it just overwrites the column instead of keeping previous posts.

     

    All these point in the direction that you should use INSERT instead of UPDATE. INSERT [as the name proposes] adds new records to the database, while UPDATE edits existing ones.

     

    <?php
    mysql_query("UPDATE table (col1, col2) VALUES ('value1', 'value2')");
    ?>
    

     

  11. valtido you say "lol" to much. there is no need for it, its annoying.

     

    I noticed that too (everybody must have noticed it). You can count 4-5 lols in just one of his post and doing a forum search for "lol" will bring up only valtido's posts :D

  12. I'm not very sure as i'm not a MySQL expert, but from what I know, foreign keys are supported only by the InnoDB storage engine. The syntax should be:

     

    INDEX (user_id, id),
    FOREIGN KEY (user_id)
    REFERENCES user_join(id)
    ON UPDATE CASCADE
    ON DELETE CASCADE
    

     

    As you can see, i assigned a user_id field as the foreign key because a foreign key must reference a primary key of the parent table. The "on update cascade" and "on delete cascade" make it so that when a row is deleted in the parent table, every row that references it in the child table is deleted or updated too. Take a look here and here for some detailed information.

×
×
  • 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.