Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. session.save_path = full_file_system_path_to_folder_no_trailing_slash session.gc_maxlifetime = integer_value_in_seconds
  2. Your best bet would be to get a 'print to pdf' application, there are some free ones (rather than buying the full application from Adobe) and install it on the same computer where you have Publisher installed. Then open the document in Publisher and print to the .pdf format. Assuming you are doing this on the same computer where your web server is installed, you could accomplish the "open the document in Publisher and print to the .pdf format" through a php script.
  3. Define: normal characters? < and > have significance in HTML since they define the start and end of HTML tags. Anything inside of < and > characters is a HTML tag and is not displayed in the browser. Perhaps if you define what it is you are trying to accomplish?
  4. You shouldn't use special characters in table names. The - is a special character. Only the set of alphanumeric characters from the current character set, “_”, and “$” are not special.
  5. You didn't state what it was doing when it is not working, but you technically need to enclose the filename in double-quotes to get all browsers to recognize the file name, i.e. filename="whatever" Also, any chance your filename contains special characters (even a space) that would require urlencoding the value?
  6. If your problem is that your session data files are getting deleted when you don't expect them to be delete (and not really that you want to make the session last 8 hours, you just want them to last as long as the visitor is on your site), it is either because your session data files are being stored in with the session data files of the other accounts on the shared web server and someone has set his session.gc_maxlifetime to a short value (the shortest setting of all the accounts 'wins') and/or you are expecting a session to last longer than the default session.gc_maxlifetime setting of 1440 seconds (24 minutes) even when there is no activity by any one visitor (just having a page 'open' in the browser doesn't actually mean anything to the web server) that keeps the last access time of the session data file updated so that it won't get deleted when session garbage collection runs. To start with, you need to check what a phpinfo(); statement shows for the session.save_path setting. If it is blank or \tmp or any other path that is not specific to your account's folder naming, it means that your session data files are being stored in a common location with all the other account's session data files. You need to create a folder within your account's folder tree and set your session.save_path setting to point to your own folder. This will allow only your session settings to affect your session data files. After you have done the above or have confirmed that you are already storing your session data files in your own folder AND you need the session data files to exist longer, in the case of someone just sitting on your site with a page open, such as when typing a reply in a form or reading a long page, you either need to set your session.gc_maxlifetime setting to a longer value or you need to use AJAX to cause the page to periodically make a http request to the web server to execute a session_start() statement on a page to keep the last accessed time of the session data file updated. As to how you set the session.save_path and session.gc_maxlifetime (and session.cookie_lifetime if you actually want the session to last longer than one browser session) settings on your server, depends on if and how your host has set up php or how he permits you to set them. The settings being mentioned must be set before every session_start() statement. It is best if you globally set them in the master php.ini (when you have access to it - i.e. you own the server), in a .htaccess file (when php is running as an Apache Module and your web host permits you to change php settings), in a local php.ini (when php is running as a CGI application and your web host permits you to change php settings), or in your script (usually in an include file that is always included before any session_start() statement gets executed.)
  7. By design, Sessions are intended to last one browser session. They end when either the session id is dropped by the browser or when the session data file is deleted on the server. If you have some unique need to make a session last longer than one browser session, you would need to set both the session.cookie_lifetime and session.gc_maxlifetime settings to the longer desired value. If you are on a shared web server, using the default session.save_path setting, you would also need to set session.save_path to point to a private folder within your account's folder tree so that only your session settings affect your session data files.
  8. If this data happens to be in a database, it is best (fastest, simplest code, avoids php's Unix timestamp problems...) to do any date formatting in the query when you retrieve the data.
  9. My previous testing was of the actual file data only. So, yes magic_quotes does affect the ['name'] element and the field name. The bug in your version, with the extra non-escaped array index name was fixed in php5.2.7 However, on windows, the \ added in the file name truncates the name and only produces me.sql for your example. Does work correctly with magic_quotes off.
  10. The php.net documentation only states the order in which directory entries are returned by the read method is system-dependent. It is likely that the order is that which the entries are stored in the directory structure. If you want your files to be listed in a specific order, you should read the names into an array and sort that array the way you want. You many find that using a function like glob would be more suitable as it returns file names sorted alphabetically by default.
  11. A) It gets the value of the magic_quotes_gpc setting, B) However, since the magic_quotes_gpc setting never had an affect on any of the $_FILES data, the code doesn't actually perform a useful function, C) You do however need to escape (using mysql_real_escape_string) any external data that you put into a query.
  12. Don't use short opening php tags <? in your code. Always use full opening php tags <?php
  13. If you are escaping the data correctly, only once, when inserting it, the \ characters are not in the actual data and you should not need to do anything when retrieving the data. If you do have the \ characters in the actual data and you only escaped the data once yourself in your code or you get some \ characters added when you retrieve the data, see this link - http://www.php.net/manual/en/security.magicquotes.php
  14. The 1st user contributed note in the php.net documentation seems to address php5.3 by using a function that forms an array of references or values depending on the php version - http://us3.php.net/manual/en/mysqli-stmt.bind-param.php#100879
  15. http://www.php.net/manual/en/language.constants.predefined.php
  16. The \ escape characters themselves are NOT inserted into the database. You should also be using mysql_real_escape_string() instead of addslashes() and you should be using nl2br() when you display the data, not when you insert it into your database.
  17. Your code likely contains a logic error that is causing it to loop forever and consume all available memory. You would need to post your code to get any specific help with what it is doing.
  18. @Tonic-_-, almost everything that can be done in a web application has been done countless times. Nothing you are doing in one specific portion of your code is so unique that we haven't already seen it dozens of times. If you cannot troubleshoot what your code is doing and you aren't, can't, or won't post the actual portion of your code responsible for producing the symptom, I don't know just what help you were expecting to get from a programming help forum. Short answer: Don't waste the forum's time with coding problems that cannot be answered because the problem is in code that you did not bother to show in your post.
  19. You don't have a valid mysql connection at that time you are calling mysql_real_escape_string() (and it is attempting to create a connection using default values, which doesn't work.) You must make a mysql connection before you call that function.
  20. It would probably be helpful if you posted what data you do have and what result you are trying to accomplish. It sounds like a date and two times per row? What format is the date and what format is the time?
  21. Since you were getting the binary image data output at one point in this thread, your connection was working at that point in time.
  22. ^^^ This is the root cause of your problem. When you used file_get_contents() to read the data and insert it into your database, magic_quotes_runtime already escaped the data and then you unconditionally used mysql_real_escape_string() to escape the data a second time. When magic_quotes (_gpc or _runtime, depending on where the data comes from) is on, you must first use stripslashes() to remove the escape characters that magic_quotes added before you escape the data yourself. You can also turn magic_quotes_runtime off in your script. You apparently have double-escaped data stored in your database (one level of escape characters are actually in the stored data - when data is escaped only once, the escape characters are not stored in the actual database, when data is escaped twice, one set of \ characters is actually in the data) and since magic_quotes_runtime is ON, when you retrieve the data from your database, it is getting escaped at that point as well. (Yes, php.net created a huge blunder when they tried to get the php language to do something that the person writing the code should have been doing only when he wanted it to be done.) A) You should correctly escape (only once) the image data when you store it in the database. The data that is already double-escaped in your database should be removed and reinserted. B) In your code that retrieves the data, you need to turn off magic_quotes_runtime so that the the data won't get escaped in that code.
  23. There's no specific small 1024 limit to a variable size. If the symptom was present both for data that was read from a file or from a database, the symptom is being caused by something that is common to both those methods. Either there's something in your code or the actual data causing it, something going on with your server/php causing it, or something with the method you are using to view the result that is causing it. Since phpmyadmin is just a php script, it would likely show the same symptom if the problem is being caused by something with your server/php (assuming that phpmyadmin is running on the same server as your script.) That kind of narrows down the problem to something you are doing in your actual code or with the actual data (phpmyadmin would display the data literally by passing it through htmlentities before outputting it.) Best guess is you have something in your data that is broken HTML and it causes the visible output in your browser to appear to stop at a certain point. Have you done a 'view source' in your browser so you know what exactly is being output? I recommend that you post some code and data, it could be a simplified version, as long as it reproduces the problem, so that someone else can duplicate the problem to either confirm or eliminate your code as the cause of the problem, both for using a flat file and a mysql database (seeing the code that produces the symptom for both methods would help to narrow down the problem.)
  24. You should use fgetcsv and if you want help with the error you got when using it, you would need to post your code and the error message.
×
×
  • 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.