Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Cleaning up my code.. a little advice?

  1. #11
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Sure.

    It's pretty basic-- not much you can do to simplify if/else statements, unless there's another method (like switches).

    But looking into those better string functions is a good idea.

    If you're using an include, then should work well.

    Good luck.

    Are there any specific parts of the code you were wondering about?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #12
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Yes, there was one in particular. Lines 35 to 47. As stated in the //comment tags there I am not sure all that is needed, since the page that section goes on doesn't have a password input box. It needs to check the session, and load the include if there is no session. It then needs to show the HTML content (the last else{..)

    But it only checks for the posted password, so I don't think it needs the array and the post ID sections (exactly lines 38 to 41 I think can just be deleted, but I am not sure).

    Also, ALL the pages here that they go to are .html, and I have this part:

    PHP Code:
    header('Location: http://' $_SERVER['HTTP_HOST'] . $p[$_POST['id']][1] . '?pass=' $_POST['pass']); 
    on both parts, and I would like to NOT have the "?pass=password" in the URL as it is distracting. If I could get rid of that, that would be awesome!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #13
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Why don't you set a session variable of "pass" to "[password]"? That would eliminate any need for the link and make it more secure.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #14
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    How would that effect the rest of it though? I guess I don't understand what you mean exactly.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #15
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The only point in sending "password" in the url is to get it to the next page, right? You can do this:

    //first page, above header:
    $_SESSION['pass'] = $passval;
    //next page:
    if isset($_SESSION['pass'])....
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #16
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    hmm Okay... I will think about that. Thanks!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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