Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. We cannot really help you with what your code is doing or not doing without seeing it. But in general, a log in script would check at the start of each page if the current visitor was both logged in and had the necessary permissions to access the page that was being requested. If you have user specific pages, you would need to make sure that the current logged in user matched that page.
  2. A) Read the errors messages. B) You have not set a default time zone setting for php to use. C) The version of mysql is too old and is not supported by the client library that php is using to connect to the database.
  3. Before any characters of any kind are sent to the browser. If you are developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON, you will get a header error if something is sent to the browser before the session_start() statement.
  4. You would need to store the number in a session variable. Web servers are stateless. They don't know or care what happened on any page request before or after the current page request. All resources used on any page, such as a variable, are destroyed when the server finishes with that page request.
  5. Per your other thread where someone explained why you can only compare dates that have a YYYY-MM-DD (or similar left to right, most significant to least significant, y,m,d field order), you can only sort or order dates that have that format for the same reason (sorting and ordering involves comparisons.) If your date column is a mysql DATE or DATETIME data type, you can use it in an ORDER BY term directly.
  6. isset($_SESSION['some_name']) would generally be used instead of session_is_registered() and setting a $_SESSION variable is the same as using session_register() and a regular variable name (since you are not referencing $wrongpage, your use of session_register() has no affect any way.) The specific code you have at that start of your file should be - <?php session_start(); if(!isset($_SESSION['username'])) { $_SESSION['wrongpage'] = "Sorry you are not logged in so you can't visit this page: Upload.php <br/>"; header("location:login.php"); exit; } echo .....
  7. I'll guess you mean the php code that is setting the variable (leaving out relevant code almost always wastes time, same as posting a minimal example that has no resemblance to what the actual code is doing.) If so, that variable does not exist outside of the function. You either need to return the value from the function or the code you are putting inside a function definition is actually your main program logic and does not belong inside a function.
  8. What type of values are in your date column? For what you posted, the mysql date() function expects a value or column that is either a DATE or DATETIME. If you are trying to use the php date() function, you would need to break out of the SQL query string so that php would parse the function call instead of mysql parsing it. You can also only compare dates when the parts of the date are ordered left to right, most significant digit (year) to least significant digit (day), and the length of each corresponding field in the two values being compared is the same.
  9. Umm. You would need to tell us what is wrong with that output vs what you expect and post the code responsible for retrieving and displaying the output if you want someone to help with what it is doing.
  10. All non-numeric data put into a query must be escaped so that any special SQL characters in it don't break the SQL syntax of the query. See this link - mysql_real_escape_string
  11. Bumping a thread without providing additional information about the problem is against the forum's rules. What have you done (other than posting it here) to troubleshoot what your code does when you fill in the form fields? Since we don't have access to your server or your database, you are the only one here who can actually troubleshoot what your code is doing. Best guess is that your code is not outputting anything when you fill in the form fields.
  12. Your code works for me. Best guess is that the actual code being executed is not what you think it is. You either have more than one class_lib/db.php folder/file and the wrong one is being included (due to the php include_path setting) or when you uploaded the db.php file it did not work and an older version of the code is what is being used.
  13. http://us2.php.net/manual/en/function.str-pad.php
  14. Your code in UploadVerify.php must be overwriting the value (we would need to see the code to be able to tell) or register_globals are on and you have a same name session or cookie variable that is overwriting the value. Your code is also using session_is_registered/session_register and session_start/$_SESSION variables at the same time. You should only be using session_start/$_SESSION variables both because you should not mix the two methods and because session_is_registered/session_register was depreciated nearly 8 years ago and will be completely removed in php6. You also need an exit; statement after your header redirect to prevent the remainder of the code on the page from executing. Your existing code does not protect anything.
  15. For debugging purposes, turn on full php error reporting/display. Add the following two lines of code after the first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); For each of the servers where you tried this, where are both the To: and From: email address hosted at relative to the sending mail server? About the only thing that putting the mail() function in a while(){} loop will accomplish is getting the web host upset at you and suspending your hosting account. If an error is occurring, that will just make an infinite loop connecting to the sending mail server and passing it the same values over and over until the php script times out.
  16. Given that you are using the non-standard alternative language constructs that make it more difficult to identify the start and end of code blocks, using proper indentation is more important. It's no wonder you need help with your logic, you cannot read it and no one else can either.
  17. mysql_close($con); That line of code is inside of the while() loop and it is closing the mysql connection.
  18. That's not the syntax that wildteen88 showed -
  19. The ones not in quotes are numeric fields.
  20. Anything put into a form can be altered. The only sure way to prevent something from being altered or replaced is to not put it into the hands of the visitor. If you want to display a value, go ahead, but keep and use the actual value on the server only.
  21. Your form method is 'get'. That causes any form data to be appended to the end of the URL being requested, thereby replacing any get parameter you put on the end of the URL. You would need to use a hidden form field to set online=true as part of the URL or you would need to use the post method.
  22. What does this show - var_dump($tweets); Any chance your page is being requested twice, the second time with zero or nothing in the $tweets variable?
  23. Trying to solve this by detecting requests that come from web proxies is only workable if you already have or are willing to make a list (which would happen after the abuse has already occurred) of the thousands of web proxy servers. You need to use a different approach of determining how points are earned and of detecting abuse and we would need to know more about the who, what, when, where, and why in order to be able to help.
  24. Here is a list of problems in your registration_script.php - 1) All of the associative array names ($_POST and $_SESSION) need to be enclosed in quotes so that php does not take ~10 times longer to access each variable by attempting to find a defined constant with the name being used, produce a notice error, then assume you meant a quoted name, then find the actual array index name. 2) As has already been pointed out, your INSERT query does not reference a table name. 3) You are not validating (what happens or should happen if there is no $_SESSION['id'] or if any of the form fields are empty?) or escaping (to prevent sql injection) the external data being put into the INSERT query. 4) INSERT queries don't have WHERE clauses, so the first query on the page will fail due to a SQL syntax error. Are you trying to INSERT a new row or UPDATE an existing row? 5) Your queries don't have any error checking, error reporting/error logging, or error recovery logic to get them to tell you when they fail, why they failed, or to take an appropriate action when they fail. 6) $PHP_SELF was depreciated almost 8 years ago. You should use $_SERVER['PHP_SELF'] (assuming you want the current URL query string to be carried over when the form is submitted) or you should just use an empty string as the action="" attribute to cause the form to submit to the same page. 7) You should use isset($_POST['submit']) to prevent an undefined notice message when the page is requested before the form is submitted. You should be 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. You will save a TON of time. Several of the problems listed would have already been exposed so that you could have found and fixed them yourself. Edit: 9) You are also missing the closing } from the else statement. This would be causing a fatal parse error that would be exposed if error_reporting/display_errors were set as suggested in item #8 in this list.
  25. Php is not installed/running on your server.
×
×
  • 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.