Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. I asked you three specific questions about what you are getting as output. We are not standing right next to you. If you aren't, can't, or won't communicate what you are doing and what results you are getting when you do it, no one can help you.
  2. Is your code echoing 'no' or 'yes'? It will echo 'no' if the username (useremail) that was entered was found in your table. It will echo 'yes' if the username was not found and also if your query failed. To help debug if your query worked or failed in the code you are trying, add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); Edit: Also, echo $query to see exactly what is in it so that you know your form is submitting the expected data.
  3. Check both the Apache error log and the Windows event log for more information. Problems like this, when they are not due to php bugs (which your problem could be), are usually caused by mismatched versions of files. How did you install php and did you do anything unusual like download additional files to get mysqli to work and/or have a previous version of php installed...
  4. You cannot actually use an ID until it has been assigned (to avoid the concurrent visitor/race condition you mentioned.) See this link - http://us.php.net/manual/en/function.mysql-insert-id.php
  5. You are checking if the entered $username is equal to values in a column named UserEmail - Does your UserEmail column actually contain user names?
  6. Slight correction to the above. magic_quotes_gpc can be turned off in a .htaccess file (when php is running as an Apache module and the server has been configured to allow php settings to be changed in a .htaccess file), in a local php.ini (when php is running as a CGI application and the server has been configured to allow php settings to be changed using a local php.ini), or in httpd.conf (Apache only and when you have access to the httpd.conf file.) In all other cases, it can only be tuned off in the master php.ini.
  7. ALL string data that could contain special SQL characters that is put into a query must be escaped so that any special SQL characters in it (like single and double quotes) don't break the syntax of the query. Assuming you are using mysql, see this link mysql_real_escape_string for the function you need to use to escape string data. Unfortunately, php.net has a history of trying to get php to - "help a few beginners blissfully and unknowingly write better (more secure) code." (quote taken directly from the php.net documentation.) This however means that the resulting code is not general purpose and prevents it from working on all servers. The problem is due to magic_quotes_gpc, which automatically escapes external data. Unfortunately (again), this setting can only be turned off in the master php.ini in current versions of php likely to be in use on production servers and most people on the planet won't have access to the master php.ini to turn this offending setting off. So, to make your code work correctly on servers where this setting it both ON and OFF, you must actually detect if the setting is ON using the get_magic_quotes_gpc function then use stripslashes on the data first, then unconditionally use mysql_real_escape_string on the data. The following code example shows the logic needed to make your code work on any current production server, regardless of the magic_quotes_gpc setting - <?php if(get_magic_quotes_gpc()){ $your_data = stripslashes($your_data); } $your_data = mysql_real_escape_string($your_data); ?> Depending on your actual number of variables, this logic could be put into a function to avoid repeating code.
  8. What exact output ARE you getting in your browser? Are you getting any of the output from this code at the end of the page - if(mail($to, $subject, $message, "From: $from")) echo "Unban Request Sent."; else echo "Unban Request couldnt be Sent."; ?> <p> Thank You For Submitting Your Unban Request! <p> </html> And what does a "view source" of the page in your browser show?
  9. Don't use the mysql PASSWORD() function for what you are doing. Use either MD5() or SHA1()
  10. I recommend using the xml parser (so that you can parse the file line by line instead of needing to read the whole thing into memory at once) - http://us3.php.net/xml You will need to wrap the call-back functions in an OOP class of your own so that you can cleanly pass the 'present state' information between the different call-back functions.
  11. If the raw php code is present in the "view source" then either php is not functioning on your web server or the file extension is not .php or you browsed directly to the file instead of browsing to it through a URL. What URL are you using in your browser? It should be something like http://localhost/yourfile.php
  12. mysql_numrows is an old depreciated alias for mysql_num_rows and won't prevent your code from working. When you do a "view source" in your browser of the blank page, what do you get? Did you add the two lines of code that ignace suggested that would show all php runtime errors?
  13. Use absolute file paths - require($_SERVER['DOCUMENT_ROOT'] . "/include/header.php");
  14. The HTML is invalid. It actually works in FF (which ignores a lot of markup errors) but does not work in IE. The problem is there is no closing > in the following - <option value="-1">Please select an Item</option
  15. And don't use the @ in your code anyway. Due to the poor way that this was implemented, just having it present in your code causes the following internal code to occur, even when no error is present - $some_temp_var = error_reporting(0); // get current error_reporting level and temporarily set it to zero statement_that_has_the_@_in_front_of_it; error_reporting($some_temp_var); // restore error_reporting to previous level You should in fact always have error_reporting set to at least E_ALL so that all detected errors are 'reported'. On a development system you should have display_errors set to ON (you want to see what errors are occurring so that that php helps you during the development process by pointing out problems it detects when your code executes.) On a live server you should have display_errors set to OFF and log_errors set to ON (you don't want to display any unexpected errors, but you do want to log them so that you have a record of what (and when something) is occurring, like a legitimate visitor (or a hacker) entering unexpected data that your validation logic does not catch and cause your script to generate a php error.) By correctly managing the display_errors setting (and of course writing and testing your code so that it is as error free as possible and by properly validating data) there is absolutely no reason to put an @ in your scripts.
  16. And since you would want to check in your application code if the UPDATE query is successful before you execute the DELETE query, you would not necessarily want to ever combine them.
  17. Actually, the code you are testing with from premiso produces the same error on line 1 when you set the cookie(). Your editor must have some method within the 'file save as' menu to save as an ANSI encode file or to save a UTF-8 encoded file without the BOM. If you cannot find a method to save the file so that headers will work, I would recommend using Notepad++ http://notepad-plus.sourceforge.net/uk/site.htm , even if just to save the file the way you want (and need) it to be.
  18. If there are no actual characters in the file before the <?php tag, then your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that the editor placed at the start of the file is the output that is being sent that is preventing the header/cookie from working. Either save your file as an ANSI (ASCII) encoded file or if you must save it as a UTF-8 encoded file, save it without the BOM.
  19. You are likely getting a header error that prevents the cookie from being sent. Are you developing 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 will help you by displaying all the errors it detects? Use a phpinfo() statement to confirm that the two settings actually get changed after you restart the web server to get any change made to php.ini to take effect.
  20. http://us.php.net/manual/en/function.array-count-values.php
  21. Was there some problem with the server-side/php solution that was posted in your other thread concerning this?
  22. Your code is either including (or not successfully including) the file containing the settings or including the file using those settings in such a way that the normal variable scope is not being maintained or your code is clearing variables so that they are not available later in the code. Due to its' general purpose nature, there is not a 'one symptom' is always caused by 'one specific thing' relationship in programming. 1013 different people could have written your posts in this thread and each of them could have a different error in their programs that is causing a variable to have a value at one point but not at another point. What specifically didn't you understand about the reply you got - That contained a best guess cause (which you did not bother to provide any information to confirm or eliminate as a cause) because you supplied zero relevant information in your first post and your second post did not supply any relevant information either about what your code is doing that could be causing the symptom.
  23. Best guess is you are including files using URLs instead of file system paths. It would take seeing your code to be able to help you with what it is or is not doing.
  24. I already moved it to the mysql forum section.
  25. <?php $files = glob('img/*.*'); $piclist = ''; foreach($files as $file){ $picfile_x = substr(basename($file), 0, -4); $piclist .= "<li><img src='$file' title='$picfile_x' alt='$picfile_x'/></li>\n"; } echo $piclist; ?>
×
×
  • 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.