Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Storing the password or the sha1 of the salted password in a session variable does not make sense because that does not uniquely identify the visitor (many users could have the same password.) Storing the username or userid in a session variable is what is normally used to identify a logged in visitor.
  2. What is your code that is setting $subpass and $subrepeat from the form's $_POST variables, which are actually named name="pass" and name="repeatpassword"?
  3. http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
  4. The documentation shows where $header would be used in the mail statement - http://us3.php.net/manual/en/function.mail.php
  5. I'm going to guess that your data has always contained empty values and the problem has always existed, but your localhost development system has error_reporting/display_errors set to hide warning messages (and probably notice messages as well.) If you expect your data to have empty values, then yes you would need to add logic like you just posted to correctly handle the case where $temp['Course_Date_Beginning'] is empty. You should actually have error_reporting set to E_ALL and display_errors set to ON in your master php.ini on your development system so that all php errors are reported and displayed.
  6. http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
  7. You are not putting the $headers variable into the mail() function call, so your email either has no From: address or it is using the default From: address that is set in the php.ini. This limits who your sending mail server will send to and which receiving mail servers will accept the email. Once you correct the code so that $headers is used in the mail() function call, it should work better.
  8. Could you use var_dump() on $temp['Course_Date_Beginning'] like oni-kun suggested so that we can see exactly what is in it right before the line where the error is occurring. By definition, all data fetched from a database is a string data type, but due to php's automatic type casting this is usually not a problem. There are probably 100's of thousands of php web sites that are doing the same thing you are trying without any warning messages, so either what is actually in $temp['Course_Date_Beginning'] is not what you think it is or you have a php version with a bug in it.
  9. The format specifier '%Y-%m-%d' does not match the starting format of 4/17/2010. Also, if you are updating all the rows, you don't need a WHERE clause in the query and you don't need to select anything or loop over anything. Just execute the UPDATE query directly against the database.
  10. 1) Alter your table and add a DATE data type column. 2) Execute an UPDATE query to populate the new column from your existing column using the STR_TO_DATE() function. 3) After you are sure the new column has the correct data and you have changed any existing queries to work with the new column, delete the old column. You can use the mysql DATE_FORMAT() function to retrieve a DATE data type in any format you need. Ref: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_str-to-date http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
  11. The reason why the mysql (and other database) dates are in the YYYY-MM-DD format is because you can do greater-than/less-than comparisons and sorting on dates in that format because the fields making up the date are left-to-right, most significant digit (year) to least significant digit (day.)
  12. You can use the mysql STR_TO_DATE() function in a query to convert any date format into an actual mysql DATE value.
  13. Why would you want to include a local file using a URL? That takes 50-100 times longer than including it using a file system path because with a URL your web server must make a http request back to your web server to request the page, the same as if you browsed to the URL.
  14. You can just make the userid column a unique key and let the database enforce uniqueness.
  15. Here is just one example of the repetitious code we are talking about. Your existing falsestart code that toggles the correct value in your participants table (~73 lines of code) is the equivalent to the following (6 lines of code), which I actually created data for and tested - if(isset($_POST['falsestart'])){ $i = (int)$_GET['round']; // 1 - 6 if($i >= 1 && $i <= 6){ mysql_query("UPDATE participants SET r{$i}j = NOT r{$i}j WHERE regid = '{$_GET['user']}' && eventid = '{$_GET['event']}'") or DIE(mysql_error()); } } Your symptom of simply adding lines of code to your source file and it results in no output is indicative of a corrupted source file (perhaps you copy/pasted from a file that had other character encoded in it) or of a system that is using output buffering and the amount of output exceeded the buffer size. Does your code work on your development system and not on the live server or does it not work on your development system either? Edit: Also if this only occurs when you upload to a live server, have you downloaded the file and compared it with the original as you might be experiencing an upload error (the source file is greater than 1Mbyte) or some other problem with your FTP client/server.
  16. You can only assign fixed values (strings, empty array...) when you define a class variable. You cannot use a variable on the right-hand side in the definition.
  17. I'll second that. Due to the repetition in the code, you easily have 4-5 times more code than necessary. The code also has virtually no validation logic or error checking, error reporting, error recovery logic in it to get it to tell you what it is doing when there is a problem, so it is no wonder it blows up when anything unexpected occurs and you cannot pin down where the problem is even occurring at.
  18. Have you done a 'view source' of the resulting html in your browser so that you know what it really contains? If it still is not working, then you likely have some other broken html before that point on the page.
  19. And what is the actual data that is in $row1['title'] that is not working (i.e. we need to see the code and data responsible for the symptom in order to be able to help you with what your code and data is doing) because it is likely that it contains some html special characters that is breaking the html.
  20. It sounds like you need to put the files into a folder that only php has access to (i.e. either put the folder outside your document root folder or deny all http requests to the files in the folder) and then dynamically output the files using a .php script. The .php script then checks if the current visitor is logged in before outputting the correct content type header followed by the contents of the correct file (assuming you want the file to open in the browser) and/or perform a 'force download', where the download dialog box is presented to allow the visitor to download and save the file on their system.
  21. That's because ^ is a logical xor in php, not a pow() function.
  22. On a live site you would have display_errors set to OFF. Your code should have logic in it to check for errors, output a user error message when an error occurs, and take an appropriate action when there is an error to prevent follow-on errors by preventing the remainder of the code that depends on a previous step from executing (which is what is causing your foreach() error now.) Most of the php functions return a FALSE value when they fail. You should be checking for when that occurs in your code. pseudo code - if($var = file(.....)){ // code to execute when file() worked without any errors (i.e. process the data) } else { // application error reporting code to execute when file() failed - // output a user error message echo "Sorry, We cannot connect to Data, Please try again Later"; } // remainder of the code on your page having nothing to do with the file() statement
  23. Is there some reason you are using a URL to include a local file? You should be using a file system path to include a local file.
  24. You should attempt to use a LOAD DATA LOCAL INFILE query - http://dev.mysql.com/doc/refman/5.0/en/load-data.html
  25. Edit to the above: There is an extra $row = mysql_fetch_object($result); statement left over from modifying the code that would need to be removed.
×
×
  • 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.