Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Which kind of a timestamp? There is a Unix timestamp and there is a mysql TIMESTAMP (which is actually a Unix timestamp but is input/output as a '1970-01-01 00:00:01' format.) You should normally use a mysql DATETIME data type to avoid all the problems, limitations, and extra time and code needed when a Unix timestamp is used.
  2. register_globals magically populated program variables from the corresponding $_POST, $_GET, $_COOKIE, $_SESSION, $_SERVER, $_ENV... variables. Unfortunately, they also back-populated SESSION variables, which meant that hackers could magically set your session variables by simply putting a $_GET variable on the end of the URL when he visits one of your pages that you think is being protected by a log in script. A lot of web sites where taken over this way. register_globals were turned off by default nearly 8 years ago. You need to use the correct source variable in your code. Your form is using the POST method, so the values are present in $_POST variables, such as $_POST['pseudo'] You are also passing $create on the end of the URL as a GET parameter, so you would use $_GET['create'] If you are using session variables with the session_register(), session_is_registered(), or session_unregister() functions, you will need to make addition changes in your code in order to remove those functions.
  3. $_FILES["file"]["type"] won't be set to any value if there is an upload error. Any logic to test $_FILES["file"]["type"] would need to come after any logic that tests if $_FILES["file"]["error"] is equal to zero (a successful upload.) You may want to read the upload handling section in the php manual - http://www.php.net/manual/en/features.file-upload.php
  4. Since session variables only exist on the server and the browser only supplies the matching session id, you probably have disabled cookies in your FF browser settings. What have you done to troubleshoot if your browser is receiving the session id cookie?
  5. Use var_dump() on the value in each array to see exactly what they are. You will probably find you have some white-space character as part of the value.
  6. Unfortunately, the upload script posted on the w3schools site is ass backwards. The first example, where they check the ['error'] element first, is correct. However, when they added ['type'] checking, they put if first, which won't work when there is an upload error. When an upload error occurs, that code will report an "Invalid file" and it will never reach the code checking the ['error'] element and you will never see the "Error: " . $_FILES["file"]["error"] . "<br />"; output that would tell you why the upload failed. Think about any code you find posted on the Internet (don't just follow along with it). Does it make sense and in the case of the w3schools code, does it make sense to check some piece of the uploaded data before you have tested if the upload even worked? Edit: Quote taken from the w3schools site -
  7. Show us the actual lines you put into the local php.ini For debugging purposes, what does adding the following code to your form processing code show - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "FILES:"; print_r($_FILES); echo "</pre>"; Edit: Also, is your .php script in the same folder where you put the php.ini? According to one of the 1and1 FAQ, you must put a php.ini into each folder where you put a .php script in order to affect that php script.
  8. Also tell us what a phpinfo(); statement shows for the register_globals setting.
  9. And, post the code you are putting on each page to restrict access to the content on it to only a logged in visitor.
  10. <?php // find all dates of a specific day of week (monday) $day = 'Monday'; // which day name to find $start = '2010-01-26'; // starting date $end = '2010-05-30'; // ending date $date = date('Y-m-d',strtotime("$start $day")); // get the first date matching the day to be found // check if the first matching date is <= the $end date if($date<=$end){ $array = array(); // array to hold the results while($date <= $end){ $array[] = $date; // store the date $date = date('Y-m-d',strtotime("$date + 1 week")); } echo "These are the matching dates:"; echo "<pre>",print_r($array,true),"</pre>"; } else { echo "There are no matching dates between: $start and $end<br />"; } ?>
  11. There are a number of existing date picker scripts - http://www.dynamicdrive.com/dynamicindex7/index.html You will still need to validate and possibly reformat the entered date in your php form processing code.
  12. The blank page is because you are getting a fatal runtime error because an instance of the calls does not exist and you are referencing it. You should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php would help you by displaying all the errors it detects (you can set these two values in your script, but parse errors won't be reported and displayed.) The require/include functions only read the contents of the file into the current script. If the file only contains a class definition, you still need to create an instance of that class before you can reference it (assuming you are not referencing static members of a class.)
  13. To actually check for and find duplicates you would want to use array_count_values
  14. You need to plan your upgrade to php5. The end of life of php4 was slightly over 2 years ago.
  15. It is likely that the extra character was always in the file but that output_buffering was turned on in the master php.ini, thereby hiding the problem. The output_buffering setting likely got turned off by your web host.
  16. For debugging purposes, add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL);
  17. Two computers on the same network CANNOT have the same IP address. What exactly is your question about?
  18. Yes, but what was the error, as that would allow someone to help determine how to fix it.
  19. If you are having a problem with what the code in uploadpage.php is doing, what relevance would there be in posting your login code? Your login code is attempting to perform a header() redirect after it has output content to the page. This will only work on a limited number of server configurations and should be avoided. Your php logic that determines what to do on the page should be first. You then only output content on that page (including any doctype...) if you are going to remain on that page.
  20. It sounds like FF is requesting the page twice (once with a matching session ID and once without it.) FF has a nasty habit of requesting pages twice due to some of the debugger add-ons. Also, what does your form look like? Any javascript that could be submitting the form and the normal browser's form submission doing it as well? Any URL rewriting or redirecting to a different path than where the session cookie was first sent and the session cookie path setting is not set to '/'? Your code should be testing that $_SESSION['username'] is at least set before doing anything on the form processing page. Your form page should only output the form if the current visitor is logged in and your form processing code should also check if the current visitor is logged in.
  21. I'm going to go with with a guess that there is some code like - if($var = ''){... ...} instead of code that should be - if($var == ''){... ...}
  22. It is a little too minimal. You should also be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php would help you by displaying all the errors it detects (for example there is no code setting the variables you are using in the body of your script, you are however setting variables starting with $reg_xxxxxx.) The form processing code (in a real application) would check a bunch of things that the code you posted is not doing - 1) That the form has been submitted before doing anything (is the submit button $_POST variable set?) 2) That $password and $confirmpass actually has something in them before testing if they are not equal (an empty string is equal to an empty string and will pass the current test.) 3) Check if the username is empty. 4) Have error checking logic on all the mysql_ function calls (check if they worked or failed, output a meaningful user error message when they fail and log and/or display system information so that you can find and fix the problem that is causing them to fail, and take appropriate action upon an error so that you don't produce other errors or insert non-existent data... 5) Escape all the string data being put into a query. Only one variable is being escaped now. 6) After testing if the mysql_query() executed without error (see my item #4 above), use mysql_affected_rows() to determine if the INSERT query actually inserted the row before echoing a message that the registration was successful. 7) You would also want to check (or enforce using unique indexes in the table) if some of the values are unique, such as the username and email address.
  23. ASSUME = To make an ASS out of U and ME In programming, if you are not 100% sure what something is you must confirm it. They likely have a method in place (check the FAQ section) to switch to php5.
  24. Add the following lines of debugging code immediately after the first opening <?php tag and tell us what is displays after the form is submitted - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>";
  25. What does a phpinfo(); statement show for the php version? It appears you are using a script that has php5 OOP syntax on a php4 system.
×
×
  • 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.