Jump to content

dalawh

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by dalawh

  1. dalawh

    Visitor IP

    Thanks for the link.
  2. dalawh

    Session

    I was wondering how sessions worked and how similar are they to cookies. Is there a set indexes for sessions or do you define your own? How do sessions look like? Are they like cookies, where each cookie is like a file with a bunch of variables? Where are the sessions stored?
  3. dalawh

    Visitor IP

    There seemed to be a typo in my question. What I meant to ask was...Now my question is whether $_SERVER['HTTP_CLIENT_IP'] and $_SERVER['HTTP_X_FORWARDED_FOR'] where the same or not. If not, what is the difference between them?
  4. dalawh

    Writing into a file

    Just to confirm, I should use 'c' right? 'c' writes at the beginning of file or creates a file and write if it does not exist. So it is a basically r+ without the read?
  5. dalawh

    Writing into a file

    I was wondering if there was any way to set a file to write to beginning? It seems I am only allowed to do one or the other. Is there an alternative to this?
  6. dalawh

    Visitor IP

    Only question left unanswered is "Now my question is whether $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] where the same or not. If not, what is the difference between them?".
  7. dalawh

    Visitor IP

    Not to be rude or anything, but you didn't even answer one of my question.
  8. dalawh

    Visitor IP

    I did a few searches and I found that though $_SERVER['REMOTE_ADDR'] gets you the IP of a visistor, it is not always accurate because they could be hiding behind a proxy. I read that it was good to check $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] to see if they contained value and if they did, it meant that they were behind a proxy, so it was better to use $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] instead of $_SERVER['REMOTE_ADDR']. Now my question is whether $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] where the same or not. If not, what is the difference between them? I also read that $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] were not always accurate because of the fact that the header could be spoofed. I tested this and it seems that the few proxies I used, the $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] were not able to detect that it was behind a proxy. My question now is if there was a more accurate way to track an IP as opposed to this? I also want to know if there was any way to track the original IP of someone using a VPN or VPS?
  9. Thanks a lot, that worked. I read somewhere that isset only works for things set to null, did not know undefined and null where the same.
  10. <form name="form" action="enter.php" method="post"> First Name: <input type="text" name="first" /><br /> Last Name: <input type="text" name="last" /><br /> <input type="checkbox" name="c1" value="1" onclick="showSubmit()" /> <input type="checkbox" name="c1" value="1" onclick="showSubmit()" /> <input type="checkbox" name="c3" value="1" onclick="showSubmit()" /> <!-- SUBMIT BUTTON HERE --> </form> If I only check the 1st and the 3rd checkbox and press the submit button, but in my enter.php, I made it check print out each of the inputs like so: <?php echo $_POST["first"];echo $_POST["last"];echo $_POST["c1"]; echo $_POST["c2"]; echo $_POST["c3"];?> I will get a warning/error claiming that the c2 is undefined. Is there a built in function that checks if something is undefined ? That way I can use a if and else statement: if is it undefined, it will print something, and if it is checked (defined), make it print something else.
  11. Thanks a lot for the help.
  12. Let's say I am in the root directory and in the root, there are folders called images, temp, and random. If I change directory to temp and in the temp folder, there are folders called files, images, and cookie. If I use chdir("random"), it will not work because it only looks in the current directory? If I use a path meaning chdir("random/randoms/stuff.txt"), it will work? Absolute path is the default path?
  13. dalawh

    Aligning

    Oh okay. That makes sense. Learning new things every day.
  14. dalawh

    Aligning

    What I just noticed is that dsonesuk moved the time div to the grey area and by making the margins the size of the time div, it goes up by that much. Am I right?
  15. Okay, I will stick to the relative path and not chnage the directory. What would be some good times to change directories? Since getcwd gets you the current directory, when you change to a new directory and you want to change back to the original directory, does using chdir() to the original directory work? What I mean is that does chdir() only search the current directory for directories or does it do a global search?
  16. What is the difference between using the directory functions to change the directory and opening file as opposed to just opening the file straight? I am not sure if you can open a file in a different directory by using the directory function or not, so correct me if it is not possible. chdir("info/");$fileName="info.txt";$file=fopen($fileName,"r+"); VS $directory="info/";$fileName="info.txt";$file=fopen($directory.$fileName,"r+"); If we use the first, how do we change back to the previous directory? If both is possible, which is the better method? Outside of opening files, which is better? Using strings or directory functions?
  17. dalawh

    Aligning

    Doesn't that move the time into the search area?
  18. dalawh

    Aligning

    That seems like a really bad way to position things. Is there any align setting that puts it on the bottom?
  19. dalawh

    Aligning

    It is something like...<div class="container"><div class="blue_area"> <div class="left_side"> <!-- THE LEFT SIDE OF THE PICTURE Includes float:left; width:70%; --> </div> <div class="right_side"> <!-- Includes float:left; width:30%; --> <div class="search"> <!-- DARK BLUE AREA --> </div> <div class="time"> <!-- SKY BLUE AREA --> </div> </div> <!-- NAVIGATION CODE GOES HERE Style include clear:both; --></div><div class="grey_area"> <!-- NAVIGATION CODE GOES HERE Style include clear:both; --></div></div> That is how it looks. Gotta figure out how to position it to the bottom.
  20. dalawh

    Aligning

    I am having a little trouble with aligning <div> in my webpage.I want to move the <div> with "TIME GOES HERE" all the way down to the top of the grey navigation bar.
  21. dalawh

    Cookies

    Oh okay. Thanks a lot.
  22. dalawh

    Cookies

    So the $_COOKIE array does not go by numeric index?
  23. dalawh

    Cookies

    I just realized something... since the $_COOKIE array is a normal array, instead of using the names, couldn't I just use $_COOKIE[0] to get the value of the name. I know this is less accurate, but isn't that a possibility. Also, thanks for informing me of the array_keys.
  24. Oh okay. Thanks for the help.
  25. dalawh

    Cookies

    I notice that you can check if a cookie is set or retrieve the information if you knew the name, but what happens if the name was dynamic (changing for each person)? Is there no way to retrieve it? Should the name always be dynamic?
×
×
  • Create New...