Jump to content

mmosel

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Everything posted by mmosel

  1. Hi all, While checking my error_log, It doesn't seem to want to write each error to a new line. This seems odd, because on some servers I've seen it write to new lines without any adjustments. Do I need to use the error_append_string to add a '\n' to each error line? Or, is there something I'm missing?
  2. Ok, thank you. I have some work to do then. Question: Does a mysql_error() NOT throw a PHP error?
  3. Hi all, I have a couple of error related questions. First off, I have a function that I run when I need a special error display. Currently, if there is a mysql_error, I run my function with the mysql_error() inside the function which displays it on a error page. 1. Is it bad to show the user a mysql_error() notice? 2. If I have error_reporting off, will mysql_error() still show up? 3. Is there an easy php function to add content or errors to the error log, or do I have to write something custom? Thanks for all your help!
  4. UPDATE: Well, I did some more testing, and it looks like my problem has to do with the fact that my code for the download is located inbetween an ob_start() and ob_end_flush() section. That's good and bad news. I can't really change the entire script and the output buffer. I need to find a way for it to work within the output buffer. It's still strange that the download works fine when I remove the content-length line. Any ideas out there? Well, with some more testing, it turns out that if there is any output during the output buffer, then the header content-length is wrong and the file doesn't save properly on download. So, it's definitely an output buffer issue. Now if I could only figure out how to fix it!
  5. Hi, Thanks for all your suggestions! I tried them all, and unfortunately it still doesn't work right. The thing is that it just doesn't seem to work right when I use the content-length header, but when I remove that, it works fine. When I do use the content-length header, it will save the file and it will show the right size while downloading, and it will save the file as the right size - but it won't open. This is with zip files. It's odd. I wish I could solve this.
  6. Hello all, I am seeking some help with a problem that I just can't solve yet. I have a download script where I use php to deliver a file. Here's the basic download script: [code]     $length = filesize($source);                       header('Pragma: private');      header('Cache-control: private, must-revalidate');      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");               header("Content-type: application/zip");      header("Content-Transfer-Encoding: Binary");      header("Accept-Ranges: bytes");      header("Content - length: $length");           header("Content-disposition: attachment; filename=filename.zip");      readfile($source); [/code] This code works great, except that when I use the 'Content-length' header, the file downloads, and the downlaod queue shows the size of the file, but then the file doesn't open right. However, if I remove the content-length header altogether, then the file downloads just fine, and it opens fine. However, then the download queue doesn't know how large the file is! I would like for the download queue to know how big the file is, so that the user can see how long it will take, etc. If anyone has any ideas or tips, I would love to know! Thanks. NOTE: I had to alter the 'Content-length' line by adding spaces before and after the dash because the board wouldn't post the content. Strange.
  7. [!--quoteo(post=382092:date=Jun 9 2006, 06:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 06:08 PM) [snapback]382092[/snapback][/div][div class=\'quotemain\'][!--quotec--] OK, then that's just the "HTML illusion". Actually PHP understands that it is &sub and not the math symbol, but once it's printed the browser thinks it's the entity. Internally there should be no issue, but if you want it to be displayed correctly, use htmlentities($_SERVER['REQUEST_URI']); [/quote] Ah, maybe that would have worked. I actually just finished combing through my scripts and updating the &sub variable to something else, and now the REQUEST_URI works like I thought it would. Thanks for your tips...
  8. [!--quoteo(post=382085:date=Jun 9 2006, 05:40 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 05:40 PM) [snapback]382085[/snapback][/div][div class=\'quotemain\'][!--quotec--] That's because it's a HTML entity. You should use: ?page=this&sub=that [/quote] That's for HTML output, not URLs I believe. URL encoding is different. I actually tried that, but my script didn't recognize that. & should be correct for PHP and it does normally work.
  9. I've written my site using &sub in my url for getting to certain sub-pages. The only problem is that when I use the php variable $_SERVER["REQUEST_URI"] I get back a math character '⊂' . Strange. Technically, that should equal ⊂ but my url doesn' have the semicolon. I thought I could just replace the ⊂ with &sub in my script and it would work, but my editing tools don't recognize the character! Worst case scenario is that I'm going to have to rewrite my whole site to use a different variable for the sub-page. That is unless someone here has a bright idea! Word to the wise - don't use &sub as a variable in your script for URLs. (as in ?page=this&sub=that) There's alot more to avoid too... [a href=\"http://en.wikipedia.org/wiki/Help:Filling_the_page\" target=\"_blank\"]http://en.wikipedia.org/wiki/Help:Filling_the_page[/a] See the bottom of this page for more...
  10. [!--quoteo(post=368256:date=Apr 24 2006, 08:40 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Apr 24 2006, 08:40 PM) [snapback]368256[/snapback][/div][div class=\'quotemain\'][!--quotec--] if the form is doing a header redirect, you will either have to use curl (which has a FOLLOWLOCATION option), or if you get full headers back with fsockopen, check for the "Location:" they're redirecting you to. [/quote] Thanks Michael, I'll look into the cURL option...
  11. [!--quoteo(post=368237:date=Apr 24 2006, 07:59 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Apr 24 2006, 07:59 PM) [snapback]368237[/snapback][/div][div class=\'quotemain\'][!--quotec--] CURL is probably the method of choice here, but I'm curious about the fsockopen thing. There is an fsockopen example on the PHP site talking about exactly what you're trying to do... [a href=\"http://us2.php.net/fsockopen\" target=\"_blank\"]http://us2.php.net/fsockopen[/a] It's pushing request headers that mimics a POST request. Have you seen that example? [/quote] Hi, thanks. Yeah, I'm familar with posting data via fsockopen. The problem is that in a situation where you want to be redirected to the same URL that you're posting too. fsockopen is used to return a result to the same script. In the mean time, I'm going to use Javascript and auto submit a form to the new URL.
  12. I understand how fsockopen() works, and as far as I know, this is the only way to Post data to a page using PHP. However, when using a form submit, you get redirected to the page posted to. Is there a way using PHP to post data to a page AND have the page open as if posted to from a form?
  13. [!--quoteo(post=367095:date=Apr 20 2006, 11:38 PM:name=Dobakat)--][div class=\'quotetop\']QUOTE(Dobakat @ Apr 20 2006, 11:38 PM) [snapback]367095[/snapback][/div][div class=\'quotemain\'][!--quotec--] Does your computer has the same time as your host? [/quote] Well, in this case, I [i]am [/i]the host! :)
  14. It's strange, when I send an email via mail() in php (hosted on my local server), the time of the email get's stamped an hour ahead of my computer's time. When I send email via my email client, the time stamp is correct. Odd. The only thing I can think of is that it's not accounting for the daylight savings time shift. Anyone know about this?
  15. [!--quoteo(post=365805:date=Apr 17 2006, 08:20 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 17 2006, 08:20 PM) [snapback]365805[/snapback][/div][div class=\'quotemain\'][!--quotec--] Yes it is, but the client should have the session ID. [/quote] Ok, gotcha. The thing I don't like about passing the SID in the url is that it can then be more easily passed around. For securing content, such as downloads, this kinda sucks. I think that I'll require cookies for my site - but only cookies that expire at the end of the session. I hope that doesn't turn off too many users!
  16. [!--quoteo(post=365760:date=Apr 17 2006, 06:46 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 17 2006, 06:46 PM) [snapback]365760[/snapback][/div][div class=\'quotemain\'][!--quotec--] It's simple, the session ID can be stored in a cookie file or passed through the URLs. Placing the SID in URLs will ensure that sessions will work if your visitor disabled cookies. [/quote] I thought session information was stored server side?
  17. Ok, my site uses sessions. When I'm logged in, my site's sessions remember me as logged in. I can leave the site altogether and go somewhere else, come back, and it shows that I'm still logged in. This is great - this is how I would expect it to behave. So, why would I want or need to place my user's SID in the URL? I don't see the need for it. Please enlighten me!
  18. [!--quoteo(post=365232:date=Apr 16 2006, 01:03 AM:name=mmosel)--][div class=\'quotetop\']QUOTE(mmosel @ Apr 16 2006, 01:03 AM) [snapback]365232[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi all, I've been humming right along developing my site locally. Until today I haven't had a set include_path in my php.ini file. Haven't needed it. This has allowed me to do the following type of include with php: say I have directory 1 and within directory 1 I have two sub directories - a & b. Now say I have a script that I run in directory 1. This script includes a file in directory a, like this: include 'a/test.php'; Now, inside of test.php I have another include statement - include 'b/test2.php'; This works great. No need to back out of the directory or anything. PHP simply finds the file in directory b. Now, if I define the include_path in my php.ini (say for a PEAR install) - now the type of include above doesn't work AT ALL!!! I'm stumped! It will include the first file, but if the second file isn't in directory a, all of a sudden it spits out an error saying that the file can't be found anymore (and it looks in the PEAR directory). So, is there a way to have both? I really like the standard way, in fact, most of my scripts are setup this way. [/quote] Well - I stumbled upon the solution. It was hard to track down! But it's simple (isn't in always? no, not really) Anyway, you just have to place a single period . and then the separator (which is either a ; or : depending upon your setup) So I just added the " . ; C:\path to pear" and now my relative includes work again. Whew!
  19. Hi all, I've been humming right along developing my site locally. Until today I haven't had a set include_path in my php.ini file. Haven't needed it. This has allowed me to do the following type of include with php: say I have directory 1 and within directory 1 I have two sub directories - a & b. Now say I have a script that I run in directory 1. This script includes a file in directory a, like this: include 'a/test.php'; Now, inside of test.php I have another include statement - include 'b/test2.php'; This works great. No need to back out of the directory or anything. PHP simply finds the file in directory b. Now, if I define the include_path in my php.ini (say for a PEAR install) - now the type of include above doesn't work AT ALL!!! I'm stumped! It will include the first file, but if the second file isn't in directory a, all of a sudden it spits out an error saying that the file can't be found anymore (and it looks in the PEAR directory). So, is there a way to have both? I really like the standard way, in fact, most of my scripts are setup this way. Help!!
  20. Hi all, I hope all is well, I'm just beginning to write my site's advanced search engine. I've checked out the full-text search engine tutorial and it's great - no problem there. I can easily grasp how to write a basic search engine. However, my needs are a bit more complex. For example: I have a table full of products. In this table I have ids for three external tables that will need to be included in the advanced search. I have an artists table, a media type table, and two category tables. For the artist and media table, I can simply query the tables for the id and then include the id in my search of the product table. Where I think I need help is with my categories. You see, I have a many to many table inbetween my products and my categories table. It get's tricky with my category table itself, because I have three levels of categories. As an example, my category table kinda looks like this: id | cat_name | level2_id | level3_id So, If I was only searching for a top level category, with an id of 7, I could search the many-to-many products_categories table for all products that match id 7. (I guess I would have to join the many-to-many table with the products table? Not sure about this) - However, the above results would be limited because they wouldn't include any of the sub or sub-sub category ids! So, for a thorough search of all products in a top category, I might have to search for matches of 50 or more category ids! So I need to some how be able to tie in the search through the category tables and then the search through the many-to-many table and then finally combine that with the search of the products table itself. Did I lose you yet? Can you see how I might be a little confused here? Any tips or suggestions to point me in the right direction? -mmosel
  21. I'm curious, beyond standard hash encryption, what's the latest on hacker proof login scripts? Do you time out a login script if someone tries to login more than a given number of times? Do you use those pictures that require you to enter the word? What's next? two passwords? What are you doing to prevent brute force attacks on your login scripts?
  22. [!--quoteo(post=357509:date=Mar 23 2006, 02:51 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 02:51 AM) [snapback]357509[/snapback][/div][div class=\'quotemain\'][!--quotec--] you can then use the variable $system_message to display a message to users on pages they visit during a timeout period. so to kick off the above, then in your admin panel all you need is a mysql_query that sets an 'offline' field to true, and a field 'offlinetime' to: time()+(60*15). hope that makes sense. [/quote] Hmm, thanks. That's interesting. So, I would designate the time in the future that i want the site to go offline, and if someone visits the page and the math works out then the site is offline. I dig it. I already have a system that I wrote that includes a customizable site alert message that I can turn on at the top of every page. I also have a switch to shut the site completely off. I can then choose 1 of 3 changeable messages to show to visitors. In my first script I check the db for both switches (alert and offline). If offline is true, then I simply include my offline.php and exit(); out of my script. It works great, but I think I'm going to try and incorporate your code example to see if I can have it automated so that users can see the time reducing as they surf! That would be nice. 15mins - 10 - 5 etc. before site goes offline. Thanks for everyones input! I'll give it a go tomorrow night maybe...
  23. Already have that. That's not what I'm asking...
  24. Ok, I'm building a script in my admin section so that I can switch the site on and off completely. I also have message options to be displayed when the site is offline. I'm also creating a warning or notice switch to warn current users about the pending shutdown of the site as I don't want to shut people down in the middle of a transaction. So, I'm wondering how I can automate the shutdown process so that the site warns them 15 minutes before the actual shutdown? I think some sort of timed script would do the trick, but how? How can I do it within PHP? Or would I have to use CRON or something else? Thanks for any tips!
  25. [!--quoteo(post=354162:date=Mar 12 2006, 07:47 AM:name=saiko)--][div class=\'quotetop\']QUOTE(saiko @ Mar 12 2006, 07:47 AM) [snapback]354162[/snapback][/div][div class=\'quotemain\'][!--quotec--] put ob_start(); at the start and ob_end_flush(); at the end. if u havent already [/quote] Thanks. Already have that setup. Appreciate the post.
×
×
  • 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.