Re: [PHP] Session variables does not get sent
--- Jason Wong <[EMAIL PROTECTED]> wrote: > > $username = trim(addslashes($_POST['user_name'])); > > $pass = trim(addslashes($_POST['password'])); > > addslashes() is not needed as you're performing SELECT query > and not an INSERT query. That's not true, since he's using user data in the SQL statement. The query method has nothing to do with whether data should be escaped. Of course, addslashes() is sort of a last result with regard to escaping data for use in a query. The more preferable options are those native to the database you're using, if they exist. MySQL users can use mysql_escape_string(), for example. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] safe_mode, sym-links and stat
Hi I'm running PHP in safe mode, and have symlinked executables to the execution_dir, that works great. With one exception, it is not possible to check the existence of the files, before executing them. It seems to me that stat / lstat resolves the ownership of the orig executables and safe_mode decides that I cannot have access, which is true, but I only want to know if the files that I'm about to execute, ie. the symlinks, exists. Is this a bug, or have I misunderstood something. Any suggestions on how I can solve this. Example: is_file: '; var_dump(is_file($id)); echo 'is_link: '; var_dump(is_link($id)); echo 'is_executable: '; var_dump(is_executable($id)); echo 'is_readable: '; var_dump(is_readable($id)); echo ''; passthru($id.' -version'); ?> Result: Warning: stat() [function.stat]: SAFE MODE Restriction in effect. The script whose uid/gid is 33/33 is not allowed to access /var/lib/typo3/shared/smexec/identify owned by uid/gid 0/0 in /var/www/file_existence_check.php on line 6 Warning: stat() [function.stat]: stat failed for /var/lib/typo3/shared/smexec/identify in /var/www/file_existence_check.php on line 6 bool(false) Warning: lstat() [function.lstat]: SAFE MODE Restriction in effect. The script whose uid/gid is 33/33 is not allowed to access /var/lib/typo3/shared/smexec/identify owned by uid/gid 0/0 in /var/www/file_existence_check.php on line 7 Warning: lstat() [function.lstat]: Lstat failed for /var/lib/typo3/shared/smexec/identify in /var/www/file_existence_check.php on line 7 bool(false) is_file: bool(false) is_link: bool(false) is_executable: bool(false) is_readable: bool(false) Version: ImageMagick 6.0.6 08/31/04 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2004 ImageMagick Studio LLC -- ./Christian Jul Jensen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem
I have a problem when I do login for go to the page of administration on my web, Go back and can't entry this is the code that control this. Where is the problem? Thank you in advance top.location.href='../portada.php';"); } ?>
[PHP] Re: htmlentities and foreign characters from MS Word
That did it! It seems that my version of MySQL doesn't support Unicode encoding, only the various ISO encodings. So, I guess this translation is necessary before storing all text in the DB so foreign characters aren't broken when I retrieve them from the DB. Thanks! I2eptilex wrote: > > Well it seems you have a UTF-8 encoded text after your function. Use > iconv to change it. See http://de3.php.net/manual/en/ref.iconv.php . > > try doing this with your array before inserting it into the DB > > foreach($insert_array as $key => $var){ > $new_arr[$key] = iconv("UTF-8", "ISO-8859-1", $var); > } > > It can be that your array has a different coding than UTF-8 check the > manual for the htmlentities function, but i'm pretty shure that should > solve it. > > I2eptilex > > Monty wrote: > >> I'm having a problem figuring out how to deal with foreign characters in >> text that was copied from an MS Word document and pasted into a form field. >> >> I'm not how sure this is getting stored in the MySQL database, but, when I >> run htmlentities() on this text, each foreign character is converted into 2 >> other foreign characters that don't at all represent the original. >> >> For example, a lowercase u with an umlat over it (ü) is somehow displayed as >> an uppercase A with an umlat over it followed by the 1/4 symbol after parsed >> by htmlentities(). A lowercase o with an ulmat displays as an uppercase A >> with an umlat over it followed by the paragraph symbol. It seems that the >> uppercase A w/umlat is a constant, and the next character changes. >> >> The ord() function returns the same number for all of these foreign >> characters: 195. So, I'm not sure what's happening with these foreign >> characters, and if there's any way to convert them to proper htmlentities >> before being displayed in a browser. I thought htmlentities would do this, >> actually. >> >> Thanks! >> >> Monty. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables does not get sent
no I did this a long time ago (I did have this problem before :o) ) "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dre wrote: > > and by the way .. > > I'm using MS Windows XP Pro. which I do believe that it has some hand in the > > problem :) > > Like you did not change session.save_path setting in php.ini from /tmp > to whatever it is supposed to be on windows. > > > > > > > "Dre" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>I do know this > >>and what happen is that the $_SESSION array become empty once I redirect > >>from the login page (after login) to another members' area page .. !! > >> > >> > >>"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message > >>news:[EMAIL PROTECTED] > >> > >>>Dre wrote: > >>> > I don't know why but session variables does not get posted .. is there > >> > >>any > >> > thing in the php.ini that I should configure as > I can't find any thing wrong in the code I'm using !! > > >>> > >>>Session variables are not posted, they are kept on the server. Only the > >>>session id is sent as a cookie, get or post variable. Session variables > >>>are available in $_SESSION array > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables does not get sent
Dre wrote: no I did this a long time ago (I did have this problem before :o) ) Try echo $_REQUEST[session_name()]; in members/main.php. It should print the session id. Then there should be a session file sess_[session id]. "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Dre wrote: and by the way .. I'm using MS Windows XP Pro. which I do believe that it has some hand in the problem :) Like you did not change session.save_path setting in php.ini from /tmp to whatever it is supposed to be on windows. "Dre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I do know this and what happen is that the $_SESSION array become empty once I redirect from the login page (after login) to another members' area page .. !! "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Dre wrote: I don't know why but session variables does not get posted .. is there any thing in the php.ini that I should configure as I can't find any thing wrong in the code I'm using !! Session variables are not posted, they are kept on the server. Only the session id is sent as a cookie, get or post variable. Session variables are available in $_SESSION array -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables does not get sent
On Monday 06 September 2004 14:08, Peter Brodersen wrote: > On Mon, 6 Sep 2004 13:33:02 +0800, in php.general > > [EMAIL PROTECTED] (Jason Wong) wrote: > >> $username = trim(addslashes($_POST['user_name'])); > >> $pass = trim(addslashes($_POST['password'])); > > > >addslashes() is not needed as you're performing SELECT query and not an > > INSERT query. > > How did you come up with that? The escape mechanism is the same for > SELECT and INSERT. Sorry, you're right. I'll go back to sleep now! -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* A beautiful woman is a blessing from Heaven, but a good cigar is a smoke. -- Kipling */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: htmlentities and foreign characters from MS Word
You could store those texts as binary in MySQL... - Original Message - From: "Monty" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 06, 2004 11:07 AM Subject: [PHP] Re: htmlentities and foreign characters from MS Word > That did it! It seems that my version of MySQL doesn't support Unicode > encoding, only the various ISO encodings. So, I guess this translation is > necessary before storing all text in the DB so foreign characters aren't > broken when I retrieve them from the DB. > > Thanks! > > > I2eptilex wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session again !!!
On Sun, 2004-09-05 at 17:32, Dre wrote: > I really did > and it behaves the same > > I tried isset() also but there is no good it still does not work !!! "Does not work" <-- explain this part. add error_reporting(E_ALL); as the first line of code, in addition to all the other suggestions. Check your server logs also. [ trimmed the rest ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem
On Mon, 2004-09-06 at 11:03, Jorge wrote: > I have a problem when I do login for go to the page of administration on my web, Go > back and can't entry this is the code that control this. Where is the problem? Please read the Newbie Guide first before posting. WHat does your subject tell us about the problem? Add error_reporting(E_ALL); as the first line of PHP code and run your script again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
On Sun, 2004-09-05 at 05:41, [EMAIL PROTECTED] wrote: > I want to build a music site, all copyrights intact, and I want users to be > able to download mp3 or realplayer files using a one-click link. When they > click on a link they will simply be given a typical download window to save > that music file. How do I go about doing that and how should my file > structure work? What should the link include? Is it possible to just say, > for example, http://somesite.com/music/something.mp3? Also, if I wanted them > to listen to streamed music does PHP have any specialized functions I could > use to achieve that? I just need some direction. Any help would be > appreciated. Thank you. For the downloading part, Google "php force download". If you just give the users a link (like in your example) there is nothing that's stopping them from simply requesting the URL. I would suggest you store the files outside your webroot and then have PHP access them (this way, Apache can't see them). Listening to streaming music really doesn't have much to do with PHP. You would need a streaming server (like Windows Media Services, or the open source Darwin Streaming Server (from Apple)). Other options include shoutcast, real media, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
Take a look at: http://netjuke.sourceforge.net/ I'm using in my local network, and works fine!!! On Mon, 06 Sep 2004 12:10:13 +0300, Burhan Khalid <[EMAIL PROTECTED]> wrote: > > > On Sun, 2004-09-05 at 05:41, [EMAIL PROTECTED] wrote: > > > I want to build a music site, all copyrights intact, and I want users to be > > able to download mp3 or realplayer files using a one-click link. When they > > click on a link they will simply be given a typical download window to save > > that music file. How do I go about doing that and how should my file > > structure work? What should the link include? Is it possible to just say, > > for example, http://somesite.com/music/something.mp3? Also, if I wanted them > > to listen to streamed music does PHP have any specialized functions I could > > use to achieve that? I just need some direction. Any help would be > > appreciated. Thank you. > > For the downloading part, Google "php force download". If you just give > the users a link (like in your example) there is nothing that's stopping > them from simply requesting the URL. I would suggest you store the files > outside your webroot and then have PHP access them (this way, Apache > can't see them). > > Listening to streaming music really doesn't have much to do with PHP. > You would need a streaming server (like Windows Media Services, or the > open source Darwin Streaming Server (from Apple)). Other options > include shoutcast, real media, etc. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pablo M. Rivas. http://pmrivas.ipupdater.com --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dinamic generate PDF : which way ? (classes, docbook)
Hi, I plan to dynamic generate some of the documents I need on a regular basis. Sometimes they only differ by the name of the company so my first attempt would be to generate "templates" in word and ask/replace for the values needed. I am evaluating the http://www.ros.co.nz/pdf/, www.fpdf.org and php classes that generate pdf and as another option use docbook to convert. I am not sure which way is better. >From my point of view: a) Both classes seem to be fine but in order to generate (static) tables and other elements I will need a lot of programming calls/variables. So I'd have a manual and perhaps tedious/error procedure to convert the document into the "programable-version" of it. b) I do not have experience with DocBook (even tough I can code html and latex) but I could use an editor to generate the document with the tables, place images etc. Identify the template variables and call docbook to generate the pdf. I'd still have to manually convert the file but would not need a lot of calls to generate a table or even use a php programmer. I am assuming the the tags needed are more easly understanded than $pdf->addCell($data,width..) Any ideias ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF, MSWORD, GRAPHS
Dear all, I have to generate MS WORD Reports, PDF Reports, Graphs using PHP5 + MYSQL. can any body give good links . Thanks in advance. Bharadwaj. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] refresh withou erasing
Hi want to put information on a page without erasing the previous on(like for every 5 minutes), and I think I must do an arrays and a foreach loop...how can I do that? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: refresh withou erasing
You want to put information on a page. That's nice. You want to refresh every 5 minutes? that's also fine. You want it to refresh but to not refresh at the same time... somehow, magically, your browser should know that it only needs to add information... To avoid that issue, you could best store the info in some temporary file (or database) and then each time loop trough it, and issue it to the user. Make sure to include a 5-min.-delay redirect to the same page (refresh). Devil_online wrote: Hi want to put information on a page without erasing the previous on(like for every 5 minutes), and I think I must do an arrays and a foreach loop...how can I do that? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
[EMAIL PROTECTED] wrote: Thanks Anders and Daniel. Daniel, I like your approach. I want to make it as secure as possible. I'm going to place the files outside the web directory and use authentication to approve that the user can download some particular song. I didn't know you could do a forced download. I will definitely have to try that. Thanks again. Nilaab No problem mate, and by the way, i think a friend of mine has a site that streams mp3 files - I'll ask him out about it. -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: refresh withou erasing
thanks..and can you give a hand in the code? > To avoid that issue, you could best store the info in some temporary > file (or database) and then each time loop trough it, and issue it to > the user. Make sure to include a 5-min.-delay redirect to the same page > (refresh). > > > Devil_online wrote: > > Hi want to put information on a page without erasing the previous on(like > > for every 5 minutes), and I think I must do an arrays and a foreach > > loop...how can I do that? > > > > thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
[EMAIL PROTECTED] wrote: Thanks Anders and Daniel. Daniel, I like your approach. I want to make it as secure as possible. I'm going to place the files outside the web directory and use authentication to approve that the user can download some particular song. I didn't know you could do a forced download. I will definitely have to try that. Thanks again. Nilaab It seems that you can just replace the content-type of my previous example with: audio/mpegurl That should force a stream (haven't tested it though). Good luck -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
Daniel Schierbeck wrote: Hey Daniel, do me a favor if you would, and add a year to the date on your computer. Thanks. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrow values in command line php
[EMAIL PROTECTED] wrote: A while back I decided I wanted a simple interactive interpreter for PHP. So I wrote a little PHP script that essentially did a read from stdin, and ran eval on that. Worked for most situations I was in. I'm trying to add some more features now, namely recalling a list of commands using the up and down arrow, and making each line left/right arrow editable. But I'm not sure exactly how to read the input from the arrow characters. Could someone tell me how or point me to a good resource on doing this kind of thing? Thanks, Weston http://www.php.net/readline -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
Daniel Schierbeck wrote: [EMAIL PROTECTED] wrote: Thanks Anders and Daniel. Daniel, I like your approach. I want to make it as secure as possible. I'm going to place the files outside the web directory and use authentication to approve that the user can download some particular song. I didn't know you could do a forced download. I will definitely have to try that. Thanks again. Nilaab It seems that you can just replace the content-type of my previous example with: audio/mpegurl That should force a stream (haven't tested it though). Good luck make that "audio/mpeg" :) -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 - How Do I Let Users Download Music Files?
John Nichel wrote: Daniel Schierbeck wrote: Hey Daniel, do me a favor if you would, and add a year to the date on your computer. Thanks. Oooops... Sorry, i have a crappy, ehh, "legal" *cough* version of Adobe Photoshop, it won't work unless i put the time on my PC back a year, and sometimes i forget to put it back... :) -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDF, MSWORD, GRAPHS
Read the previous message in this thread. the first sentence applies to you. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
I know this is an old thread but I've been away for the weekend and I really want to say this... On Thu, 2 Sep 2004 20:40:45 +0200, Nick Wilson <[EMAIL PROTECTED]> wrote: > You know guys? I think you all take this a bit too seriously, > perdanticness (is there such a word?) is all well and good for an FBI > agent but I stand by the claim that my original question really was > rather simple. What you fail to realise is that none of us get paid to do this. I'm sure we all have different reasons, but I contribute when I can because this list (and the others I contribute to) have helped me in the past, and I'm absolutely certain they'll help me in the future. I used to be a lot more active here, but life changes and I've not had so much spare time. Others, like John, dedicate a lot more of their time to helping others out. That's the only way lists like this can be successful. What annoys a lot of us (fairly regularly) is that a seemingly large number of people assume that if they ask a question here they will get, or more likely that they are "entitled" to get the solution rather than help or advice. All we ask is that you do a bit of research, try and solve it yourself and if you're still stuck post a question that gives all the relevant information so we can avoid wasting our "good intentions and precious time" (ta Jason :)). Anyway, back to my day job. Where did I leave my scythe... -- Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tool to increase your web site?s profitability
On Sun, 2004-09-05 at 19:29, Octavian Rasnita wrote: > Does this list have a moderator? > > Teddy Please learn to TRIM!! No need to post the entire message (spam no less), again -- especially if all you are contributing is one line (to which, I might add, the answer can be found by searching the archives). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: installing PHP on winXP
On Sun, 2004-09-05 at 19:39, Gerben wrote: > my install-paths are still the same. the real problem (I think) is that I'm > missing the php4apache dll for some peculiar reason ||:-| > Thanks anyway. I'll try downloading the zip file and doing it manually. I think the binary installer doesn't include all the .dll files (that was the case the last time I did a binary install of PHP on Windows). On Windows, I always use the zip package, which contains almost all the .dll files. Also note that for Apache2, you would need to use php4apache2.dll (I realize that you are using Apache 1.x, but this is for the benefit of those that are reading the thread). Cheers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dinamic generate PDF : which way ? (classes, docbook)
Hello Robert, I would suggest that if your data is such that it can use DocBook, definitely go the DocBook route. You can also use Apache's Cocoon publish your DocBook content to PDF/HTML/RTF/SVG/TXT etc. Here are some samples that use Apache Cocoon to perform dynamic conversion to PDF/HTML: http://www.xml-dev.com/blog/#88 Here are some other utilities to convert to PDF: http://www.xml-dev.com/blog/#101 This one is pretty good: http://html2pdf.seven49.net/seven49.aspx? Thanks. Saqib Ali http://validate.sf.net robert mena <[EMAIL PROTECTED]> wrote on 09/06/2004 04:56:18 AM: > Hi, > > I plan to dynamic generate some of the documents I need on a regular > basis. Sometimes they only differ by the name of the company so my > first attempt would be to generate "templates" in word and ask/replace > for the values needed. > > I am evaluating the http://www.ros.co.nz/pdf/, www.fpdf.org and php > classes that generate pdf and as another option use docbook to > convert. > > I am not sure which way is better. > > From my point of view: > a) Both classes seem to be fine but in order to generate (static) > tables and other elements I will need a lot of programming > calls/variables. So I'd have a manual and perhaps tedious/error > procedure to convert the document into the "programable-version" of > it. > > b) I do not have experience with DocBook (even tough I can code html > and latex) but I could use an editor to generate the document with > the tables, place images etc. Identify the template variables and > call docbook to generate the pdf. I'd still have to manually convert > the file but would not need a lot of calls to generate a table or even > use a php programmer. I am assuming the the tags needed are more > easly understanded than $pdf->addCell($data,width..) > > Any ideias ? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multi-User Text-Editing
I'm developing a site with information about songs, albums and artists. I would like to have the song lyrics as well, but i don't know how i should approach it. What i want is basically a way for many users to update, add or delete parts of a text (the lyric). It will probably only be 'trusted' users that'll be able to do it (users that has added more than x artists/albums/songs). How can i make a CVS-like system, where you can see the changes people made, maybe roll back to an earlier version etc. etc.? I think i'll use MySQL, but if you think it's easier to use XML or something else, that'll be fine with me (as long as it's generally available). Thank you in advance guys :) -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Force the download of .pdf or image files
How can I force the download of .pdf, .doc and image files? I have some links to downloadable docs in my website, but when we click the links, IE opens the file directly in the window. I wish when the user click a download start, even if it is a .jpg, .gif, .pdf or .doc file. There is a way to make that in PHP? I have the idea do ZIP the files automaticly when my PHP script upload it to the server, but can´t figure out how to make that. Thanks, Rics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Multi-User Text-Editing
Daniel Schierbeck wrote: I'm developing a site with information about songs, albums and artists. I would like to have the song lyrics as well, but i don't know how i should approach it. What i want is basically a way for many users to update, add or delete parts of a text (the lyric). It will probably only be 'trusted' users that'll be able to do it (users that has added more than x artists/albums/songs). How can i make a CVS-like system, where you can see the changes people made, maybe roll back to an earlier version etc. etc.? I think i'll use MySQL, but if you think it's easier to use XML or something else, that'll be fine with me (as long as it's generally available). Thank you in advance guys :) if you really want to, you can use CVS to do that... =) It can be made to use a web-interface and to correctly add/do whatever everything... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-User Text-Editing
> What i want is basically a way for many users to update, add or delete > parts of a text (the lyric). It will probably only be 'trusted' users > that'll be able to do it (users that has added more than x > artists/albums/songs). How can i make a CVS-like system, where you can > see the changes people made, maybe roll back to an earlier version etc. > etc.? You've just described a wiki - one example of a wiki that is written in PHP and MySQL is http://tavi.sourceforge.net. The code is a little spaghetti-like, but you should be able to look through the database schema to understand how they implement the multi-user text editing, and how to handle the related problems of locking and revision control. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dinamic generate PDF : which way ? (classes, docbook)
> Hi, > > I am evaluating the http://www.ros.co.nz/pdf/, www.fpdf.org and php > classes that generate pdf and as another option use docbook to > convert. > > I am not sure which way is better. > > >From my point of view: > a) Both classes seem to be fine but in order to generate (static) > tables and other elements I will need a lot of programming > calls/variables. So I'd have a manual and perhaps tedious/error > procedure to convert the document into the "programable-version" of > it. > > b) I do not have experience with DocBook (even tough I can code html > and latex) but I could use an editor to generate the document with > the tables, place images etc. Identify the template variables and > call docbook to generate the pdf. I'd still have to manually convert > the file but would not need a lot of calls to generate a table or even > use a php programmer. I am assuming the the tags needed are more > easly understanded than $pdf->addCell($data,width..) > > Any ideias ? There is a fairly new project called pdml ( http://pdml.sourceforge.net/index.php ) that extends fpdf that converts html (sort of) into pdf. I have used it some. It's new and a little buggy, but it is usable. You could easily use Smarty, XiTemplate, or some other template engine to manage the markup templates to use with pdml. There are also several scripts and classes on the fpdf.org site that cover all sorts of common tasks ( http://fpdf.org/en/script/index.php ). IMHO DocBook may be a little over-kill and possibly overly burdensome for this task since it requires your markup be written in DocBook XML format. I suppose it could be worth while if you plan to create your documents in several different formats on the fly. Jim Grill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Force the download of .pdf or image files
> How can I force the download of .pdf, .doc and image files? I have some > links to downloadable docs in my website, but when we click the links, IE > opens the file directly in the window. I wish when the user click a download > start, even if it is a .jpg, .gif, .pdf or .doc file. > > There is a way to make that in PHP? > > I have the idea do ZIP the files automaticly when my PHP script upload it to > the server, but can´t figure out how to make that. > > Thanks, > Rics > Very common problem... very easy solution. http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=php+header+force+download Jim Grill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-User Text-Editing
Michal Migurski wrote: What i want is basically a way for many users to update, add or delete parts of a text (the lyric). It will probably only be 'trusted' users that'll be able to do it (users that has added more than x artists/albums/songs). How can i make a CVS-like system, where you can see the changes people made, maybe roll back to an earlier version etc. etc.? You've just described a wiki - one example of a wiki that is written in PHP and MySQL is http://tavi.sourceforge.net. The code is a little spaghetti-like, but you should be able to look through the database schema to understand how they implement the multi-user text editing, and how to handle the related problems of locking and revision control. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html Thanks, I'll look into it. Also the CVS-in-PHP thing. -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-User Text-Editing
Michal Migurski wrote: What i want is basically a way for many users to update, add or delete parts of a text (the lyric). It will probably only be 'trusted' users that'll be able to do it (users that has added more than x artists/albums/songs). How can i make a CVS-like system, where you can see the changes people made, maybe roll back to an earlier version etc. etc.? You've just described a wiki - one example of a wiki that is written in PHP and MySQL is http://tavi.sourceforge.net. The code is a little spaghetti-like, but you should be able to look through the database schema to understand how they implement the multi-user text editing, and how to handle the related problems of locking and revision control. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html Wow, confusing code - but i think i got the idea. Just one thing: After reading the code, it seems to me that every time someone makes a change to a record, a new row is inserted into the DB with the full text of the edited record - not just the changes. I saw that there was an automatic expiration function, but still, wouldn't it be a drag for the server? -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Instant private messenger
Hi, I wanna create an instant private messenger for users who are online on my site. Foe example: I have a list with online users. I select the user which i wanna send an message. A popup window will apear, i write the message and click send. To that user it will appear a popup window with my message. How can i do that? I've googled but all i found was expensive. I need a tutorial or something. Could someone help me please !!! Thank you
Re: [PHP] Instant private messenger
On Tue, 7 Sep 2004 00:31:33 +0300, Phpu <[EMAIL PROTECTED]> wrote: > Hi, > I wanna create an instant private messenger for users who are online on my site. > Foe example: I have a list with online users. I select the user which i wanna send > an message. A popup window will apear, i write the message and click send. To that > user it will appear a popup window with my message. > > How can i do that? I've googled but all i found was expensive. > I need a tutorial or something. Could someone help me please !!! http://php.net is a great site for learning PHP, I mean if that's what you want to code it in and stuff. I haven't ever seen any private messenger tutorials though, probably a little too specific, I dunno.. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-User Text-Editing
> > You've just described a wiki - one example of a wiki that is written in > > PHP and MySQL is http://tavi.sourceforge.net. The code is a little > > spaghetti-like, but you should be able to look through the database schema > > to understand how they implement the multi-user text editing, and how to > > handle the related problems of locking and revision control. > > Wow, confusing code - but i think i got the idea. Just one thing: After > reading the code, it seems to me that every time someone makes a change > to a record, a new row is inserted into the DB with the full text of the > edited record - not just the changes. I saw that there was an automatic > expiration function, but still, wouldn't it be a drag for the server? Yeah, that's what happens. I think it's only a problem if you're storing truly stupendous amounts of text, and then it's just a storage problem - drives are cheap. If anything, storing the changes only would probably be a bigger processor load, since viewing any one page would mean having to reconstruct the content from all previous versions. This way, the overhead of a diff is only incurred when you want to view changes to a file between two given versions. I think the rationale behind CVS storing just diffs is that it has branches and merges, while wiki text generally does not. Also (conjecture) it may be a historical legacy of RCS, from a time when storage was not quite so cheap. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with SSH output when called from apache
Hi everyone !! I want to capture the output of a certain remote command ( issued thru a SSH session to a remote server) in PHP. The following code is working well when ran from the console Ex: php -q test.php But when called from apache .. It's not giving any ouput. [EMAIL PROTECTED] is well configured for ssh without passphrase I've checked the file permissions of /var/wwwhtml/sshtest/id_rsa It's given read permissions for the user 'apache' ( apache is running as apache:apache ) Any hints ??? /Chandu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-User Text-Editing
Daniel Schierbeck wrote: Michal Migurski wrote: What i want is basically a way for many users to update, add or delete parts of a text (the lyric). It will probably only be 'trusted' users that'll be able to do it (users that has added more than x artists/albums/songs). How can i make a CVS-like system, where you can see the changes people made, maybe roll back to an earlier version etc. etc.? You've just described a wiki - one example of a wiki that is written in PHP and MySQL is http://tavi.sourceforge.net. Wow, confusing code - but i think i got the idea. Just one thing: After reading the code, it seems to me that every time someone makes a change to a record, a new row is inserted into the DB with the full text of the edited record - not just the changes. I saw that there was an automatic expiration function, but still, wouldn't it be a drag for the server? Another wiki is the mediawiki projec the one that powers http://www.wikipedia.org/ this is probabl more complex than the one that you have already been referred to. BTW according to theory the time to retrieve a single record from a properly index database does not increase with the number of records in the table. Inserts on the other hand do get slowed down often significantly. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Instant private messenger
Phpu wrote: Hi, I wanna create an instant private messenger for users who are online on my site. Foe example: I have a list with online users. I select the user which i wanna send an message. A popup window will apear, i write the message and click send. To that user it will appear a popup window with my message. How can i do that? I've googled but all i found was expensive. I need a tutorial or something. Could someone help me please !!! Thank you there is a PHP class for jabber at jabberstudio.org -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Instant private messenger
Did you check at http://www.hotscripts.com ? "Phpu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I wanna create an instant private messenger for users who are online on my site. Foe example: I have a list with online users. I select the user which i wanna send an message. A popup window will apear, i write the message and click send. To that user it will appear a popup window with my message. How can i do that? I've googled but all i found was expensive. I need a tutorial or something. Could someone help me please !!! Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with SSH output when called from apache
On Mon, 6 Sep 2004, Chandu Nannapaneni wrote: > I want to capture the output of a certain remote command ( issued > thru a SSH session to a remote server) in PHP. > > The following code is working well when ran from the console > Ex: php -q test.php > > passthru("/usr/bin/ssh -v -i /var/wwwhtml/sshtest/id_rsa > [EMAIL PROTECTED] uptime"); > ?> > > But when called from apache .. It's not giving any ouput. > > [EMAIL PROTECTED] is well configured for ssh without passphrase > I've checked the file permissions of /var/wwwhtml/sshtest/id_rsa > It's given read permissions for the user 'apache' ( apache is running > as apache:apache ) > > Any hints ??? But have you tested this as user apache from the command line? su - apache /usr/bin/ssh -v -i /var/wwwhtml/sshtest/id_rsa [EMAIL PROTECTED] uptime Chances are you will also need to add -o "BatchMode yes" to that ssh command. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unable to use pear
Dear sirs, I have recently installed the FoxServ package 3.0 on my windows xp platform. But when I use the following instruction:: require_once "HTML/Template/ITX.php"; I get this message; Fatal error: Failed opening required 'HTML/Template/ITX.php' (include_path='.;c:\php4\pear') in C:\FoxServ\www\example.8-2.php on line 14 Can you help me?
Re: [PHP] Adding a realtime monitoring console
Hi Kelly, > Assuming the app always attempts communication with registered listeners, > and then must timeout and unregister a dead listener...at that point > aren't we just at my preferred solution: socket communication? I don't know much about sockets, so I couldn't say. If the console will connect via ssh, isn't that a stateful TCP connection? Can you keep that connection open with a "keep-alive" or "heartbeat"? Can the ssh server notify the application when the ssh session dies? How expensive is it for the application to discover a dead listener? > A log can be generated from the history table I have implemented. I'm > developing an application framework and performance is my primary concern. > The file I/O overhead concerns me unless I were able to leverage it. Unless you're confident that performance problems will occur, I would encourage you to completely ignore performance, develop the simplest implementation and test, measuring actual performance. > Do you have any links where I might find the pattern described in more > detail? If nothing else, maybe the article contains ideas that can help > kick-start another ideaThanks...! http://www.dofactory.com/Patterns/PatternObserver.aspx Just google "event listener pattern" or "observer pattern". Also, you may find Extreme Programming to be useful. http://www.extremeprogramming.org/ Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Fetch & Process
Hi How can I parse HTML page which I fetched by PHP so some part of text would be replaced by other text. Also, I managed to delete all HTML code from page (with this code $data[0] = preg_replace("/([<])+([^>])+([.])*([>])+/i","", $data[0]); but also would like to delete all chars except numbers from page, can this be done? Regards. Zoran Your first question: To replace certain elements take a look at preg_replace() http://us4.php.net/manual/en/function.preg-replace.php Example: $foo = 'stuff silly stuff more stuff'; echo preg_replace('/\(.*)\<\/b\>/', "$1 lookie now", $foo); Your second question: You could just use strip_tags() http://us4.php.net/manual/en/function.strip-tags.php Your last question: To delete everything but numbers you could $content = preg_replace('/[^\d]/','', $content); Hope that helps Jim Grill Hi This works great. One more question about preg_replace. Is it possible that for every match other text is replaced? By this I mean when some text between has been found that text is replaced with some Text, on second match, text between is replaced by some other different text etc. Btw, where I can find patterns that are valid? (something like (\w+), (\d+)+i etc. Thanks. Regards.
Re: [PHP] Multi-User Text-Editing
Hi, look at it http://www.freebsd.org/projects/cvsweb.html may be usefull. zareef ahmed --- raditha dissanayake <[EMAIL PROTECTED]> wrote: > Daniel Schierbeck wrote: > > > Michal Migurski wrote: > > > >>> What i want is basically a way for many users to > update, add or delete > >>> parts of a text (the lyric). It will probably > only be 'trusted' users > >>> that'll be able to do it (users that has added > more than x > >>> artists/albums/songs). How can i make a CVS-like > system, where you can > >>> see the changes people made, maybe roll back to > an earlier version etc. > >>> etc.? > >> > >> > >> > >> You've just described a wiki - one example of a > wiki that is written in > >> PHP and MySQL is http://tavi.sourceforge.net. > > > > Wow, confusing code - but i think i got the idea. > Just one thing: > > After reading the code, it seems to me that every > time someone makes a > > change to a record, a new row is inserted into the > DB with the full > > text of the edited record - not just the changes. > I saw that there was > > an automatic expiration function, but still, > wouldn't it be a drag for > > the server? > > > > Another wiki is the mediawiki projec the one that > powers > http://www.wikipedia.org/ this is probabl more > complex than the one that > you have already been referred to. BTW according to > theory the time to > retrieve a single record from a properly index > database does not > increase with the number of records in the table. > Inserts on the other > hand do get slowed down often significantly. > > -- > Raditha Dissanayake. > > http://www.radinks.com/sftp/ | > http://www.raditha.com/megaupload > Lean and mean Secure FTP applet with | Mega Upload - > PHP file uploader > Graphical User Inteface. Just 128 KB | with progress > bar. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to use pear
Hi, Make sure you have installed the pear and double check your included path in your php.ini . As per your message it seems that your pear should be in c:\php4\pear . Check for it and revert back. Zareef Ahmed --- Auditour <[EMAIL PROTECTED]> wrote: > Dear sirs, > I have recently installed the FoxServ > package 3.0 on my windows xp platform. > > But when I use the following instruction:: > require_once "HTML/Template/ITX.php"; > > I get this message; > Fatal error: Failed opening required > 'HTML/Template/ITX.php' > (include_path='.;c:\php4\pear') in > C:\FoxServ\www\example.8-2.php on line 14 > > Can you help me? > = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More on the credit card fraud
The fraudulent orders that I receive on my site come with email addresses of eight random alphanumerics @yahoo.com. Is anyone handy enough with regex or can show me a quick way to test for that, so I can at least refuse all orders with that pattern? (it will work for a little while, until they get wise and change patterns again.) Many thanks, - Brian PS - If anyone wants an update: the orders stopped for a while but started up this weekend with a vengeance. Now they are coming with valid address verification AND card validation numbers! Pretty darn good, whoever's doing it. One of the cops I've spoken with says that they're making a large number of small charges (like mine) to these cards and then, in one case, placing a large $2000 order from QVC. In that case the large charge was declined, thankfully. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] converting seconds since unix epoc to date array
Can anyone tell me how to convert a date stored in the format "-MM-DD" to an integer of seconds since unix epoc, then add $daysToAdd days to this value (I suppose if the integer was a number of seconds it would have to be $daysToAdd*60*60*24 to get the number of seconds to add) then convert the new value to a timestamp which I can output using the function string date ( string format [, int timestamp]) I tried doing this with mktime() and couple different ways using strtotime() and also with strftime() but I kept getting -1 as the result for strtotime() indicating the function couldn't interpret the given date. I've been through all the date-related functions in the manual I can think of, but I'm stumpped on this one...
Re: [PHP] converting seconds since unix epoc to date array
Hi, Try $date="-MM_DD"; $da=explode("-",$date); Now $Y=$da['0']; $M=$da['1']; $D=$da['2']; then use mktime(); Hope you will get the results. zareef ahmed --- Jason FB <[EMAIL PROTECTED]> wrote: > Can anyone tell me how to convert a date stored in > the format > "-MM-DD" to an integer of seconds since unix > epoc, > > then add $daysToAdd days to this value (I suppose if > the integer was > a number of seconds it would have to be > $daysToAdd*60*60*24 to get > the number of seconds to add) > > then convert the new value to a timestamp which I > can output using the function > > string date ( string format [, int timestamp]) > > I tried doing this with mktime() and couple > different ways using > strtotime() and also with strftime() but I kept > getting -1 as the > result for strtotime() indicating the function > couldn't interpret the > given date. > > I've been through all the date-related functions in > the manual I can > think of, but I'm stumpped on this one... = Homepage :: http://www.zasaifi.com __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting seconds since unix epoc to date array
Jason FB wrote: Can anyone tell me how to convert a date stored in the format "-MM-DD" to an integer of seconds since unix epoc, then add $daysToAdd days to this value (I suppose if the integer was a number of seconds it would have to be $daysToAdd*60*60*24 to get the number of seconds to add) then convert the new value to a timestamp which I can output using the function string date ( string format [, int timestamp]) Is this a MySQL timestamp? If so, you can use TO_UNIXTIME() in your query to return a Unix timestamp instead of a MySQL one. You can use DATE_ADD() to add days to the timestamp. You can also use DATE_FORMAT() to format the timestamp before it's returned also. If you don't want to do that, what's wrong with strtotime('-MM-DD') to get the unix timestamp? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting seconds since unix epoc to date array
Jason, This seems to work fine for me: ... as does the more condensed version: If strtotime() is returning -1, that means that it's having trouble converting your -MM-DD date to a timestamp. The common pitfall is that you've got the month and day mixed up (-DD-MM), or that you're not using 2 digit numbers on the day and month (and 4 digit on the year). If you're having trouble with strtotime(), ech out the date you're trying to convert, to make sure it's what you're expecting. It's also worth pointing out that we've made no considerations for timezones, daylight savings, etc. UNIX timestamps are all GMT, so if the times you're seeing are not as expected (and the dates you're collecting aren't GMT dates, then you'll need to dig a lot deeper -- it's depends how much accuracy you want. Justin French On 07/09/2004, at 1:59 PM, Jason FB wrote: Can anyone tell me how to convert a date stored in the format "-MM-DD" to an integer of seconds since unix epoc, then add $daysToAdd days to this value (I suppose if the integer was a number of seconds it would have to be $daysToAdd*60*60*24 to get the number of seconds to add) then convert the new value to a timestamp which I can output using the function string date ( string format [, int timestamp]) I tried doing this with mktime() and couple different ways using strtotime() and also with strftime() but I kept getting -1 as the result for strtotime() indicating the function couldn't interpret the given date. I've been through all the date-related functions in the manual I can think of, but I'm stumpped on this one... --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting seconds since unix epoc to date array
How is the date stored, MySQL db??? if so, you can select dates out as unix timestamps. Otherwise i would use mktime or strtotime... Jason Jason FB <[EMAIL PROTECTED]> wrote: > > Can anyone tell me how to convert a date stored in the format > "-MM-DD" to an integer of seconds since unix epoc, > > then add $daysToAdd days to this value (I suppose if the integer was > a number of seconds it would have to be $daysToAdd*60*60*24 to get > the number of seconds to add) > > then convert the new value to a timestamp which I can output using the function > > string date ( string format [, int timestamp]) > > I tried doing this with mktime() and couple different ways using > strtotime() and also with strftime() but I kept getting -1 as the > result for strtotime() indicating the function couldn't interpret the > given date. > > I've been through all the date-related functions in the manual I can > think of, but I'm stumpped on this one... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting seconds since unix epoc to date array
beware of dates before 1969. Justin French <[EMAIL PROTECTED]> wrote: > > Jason, > > This seems to work fine for me: > > $daysToAdd= 5; > $secondsToAdd = $daysToAdd * 86400; > $dateIn = "2004-07-24"; > $dateInStamp = strtotime($dateIn); > echo date('m/d/Y h:i:s',$dateInStamp+$secondsToAdd); > ?> > > ... as does the more condensed version: > > > > If strtotime() is returning -1, that means that it's having trouble > converting your -MM-DD date to a timestamp. The common pitfall is > that you've got the month and day mixed up (-DD-MM), or that you're > not using 2 digit numbers on the day and month (and 4 digit on the > year). > > If you're having trouble with strtotime(), ech out the date you're > trying to convert, to make sure it's what you're expecting. > > > It's also worth pointing out that we've made no considerations for > timezones, daylight savings, etc. > > UNIX timestamps are all GMT, so if the times you're seeing are not as > expected (and the dates you're collecting aren't GMT dates, then you'll > need to dig a lot deeper -- it's depends how much accuracy you want. > > Justin French > > On 07/09/2004, at 1:59 PM, Jason FB wrote: > > > Can anyone tell me how to convert a date stored in the format > > "-MM-DD" to an integer of seconds since unix epoc, > > > > then add $daysToAdd days to this value (I suppose if the integer was a > > number of seconds it would have to be $daysToAdd*60*60*24 to get the > > number of seconds to add) > > > > then convert the new value to a timestamp which I can output using the > > function > > > > string date ( string format [, int timestamp]) > > > > I tried doing this with mktime() and couple different ways using > > strtotime() and also with strftime() but I kept getting -1 as the > > result for strtotime() indicating the function couldn't interpret the > > given date. > > > > I've been through all the date-related functions in the manual I can > > think of, but I'm stumpped on this one... > > --- > Justin French > http://indent.com.au > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Downloading a part of a file
Hi all, Please tell me how can I fetch an html document from a web page, let's say starting from the character 1000, and get the text until the caracter 5000. In fact, I want to use the GET or POST method, and to also send to the server the HTTP header: Range: bytes=1000-5000 Thanks. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert Smart Quotes to Sraight Quotes - Need Help!
I've been reading for the last three days about character encodings and such, but, have still been unable to figure out what I think should be a simple solution. All I want to do is take curly or "smart" quotes that have been pasted or entered into a form field and convert those into straight quotes (") before I store the text in my database. It appears the data passed from the form to my PHP script is encoded as Unicode. My version of MySQL does not support Unicode character encoding, so, I need to convert that into Latin1 (or ISO-8859-1). When I use iconv() to translate the data that contains curly quotes, the string gets chopped off at the very first curly quote and the rest of the string is lost. This is the command I am using: $var = iconv("UTF-8", "ISO-8859-1", $var); When I use utf8_decode(), I at least get the whole string back, but, all the curly quotes and apostrophes are turned into ? question marks. So, I presume there must be some way to convert those curly quotes into straight ASCII quotes while the text is still in Unicode format, before I run this through either iconv() or utf8_decode(). But, I've searched all over for two days and can't figure out how to accomplish this. I'd really appreciate someone's help with this! It's driving me nuts!! Thanks, Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php