[PHP] Simple HTTP request, with "Range" header
What I want to do is write something simple in PHP that makes an HTTP request, takes the data received, and passes it through. Specifically, I am hoping to retrieve just a part of a file from the web server. If I wanted the whole file I would just do header("Location:..."); I imagine I would want to form a basic get header request, with URL, whatever else I need, and a "Range:bytes=1000-2000" header. If I understand correctly, the (HTTP/1.1) web server would return the document I want, just bytes 1000-2000. Then I would take whatever is received and use a pass through function to pipe it out. I realize it might be simpler to do a file read (assuming I'm doing this on the very same server as the document), and then just seek to the given position and pass through whatever I wish. As far as that option goes, I was concerned that this might somehow be less efficient than the above scenario, which would be letting the web server do the seeking. But maybe both options are inefficient. Or maybe they're both reasonable! The real goal is to be able to take a URL like this: http://example.com/myscript.php?url=example2.org/test.bin&start=1000 and return the document from http://example2.org/test.bin to the user's browser, starting at byte 1000. Any pointers at all would be appreciated. - Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with PHP and HTML
I have a HTML form that has a session variable called $cost. Now I want to set the value to this table data input field. Anyone know how this is accomplished? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Assigning data to fields
I am kind of new to PHP. I know how to use a select statement and a query to get data out of a table in MySQL, but how do I assign those fields to variables? I know this must be easy! Thanks in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assigning data to fields
I used the examples you have lead me to and I get this error? I am stumped? mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/pay.php on line 51 Have any idea what this means? Thanks! "Brad Bonkoski" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I think this should be a good reference for you: > http://www.php.net/manual/en/function.mysql-fetch-array.php > > HTH > -Brad > > Ken wrote: > > > I am kind of new to PHP. I know how to use a select statement and a query to > > get data out of a table in MySQL, but how do I assign those fields to > > variables? I know this must be easy! Thanks in advance!! > > > > -- > > 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
Re: [PHP] Assigning data to fields
Thanks John! That was it! "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 01c26698$1abbc290$7c02a8c0@coconut">news:01c26698$1abbc290$7c02a8c0@coconut... > > I used the examples you have lead me to and I get this error? I am > > stumped? > > > > mysql_fetch_array(): supplied argument is not a valid MySQL result > > resource > > in /home/pay.php on line 51 > > You're query probably failed. Look at mysql_error(). > > www.php.net/mysql_error > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL back up
Hi All! Anyone know how to code the MySQL command in PHP to make the database script download to your local hard disk, without writing 100 lines of code? I tried the mysqldump without any luck, but I think there is an easy way to do it, just not sure how to code it. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL back up
Here is the code I tired to use: $backupdir/$nam.sql"); passthru("gzip $backupdir/$nam.sql"); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: MySQL back up
Okay here is the new code and this is still not working. $backupdir/$nam.sql"); exec("gzip $backupdir/$nam.sql"); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: MySQL back up
Okay, I took out all the reason for error, I took the variables out of the code and replaced them with the actual values. I do not execute the gzip function. All I get is an empty file. Also I made sure the back up directory is set to 777. Now phpMySQLAdmin will perform the same function, so there must be a way to do this without the phpMySQLAdmin program? Has anyone tried to do what I am trying to do? Has anyone tried with this code? One more thing, I borrowed a free script written in perl that uses mysqldump and it worked. The point here is that I want this to work in PHP so I can include this code in a bigger application I am writing. Thanks for all your ideas! "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 01c27058$c1770170$7c02a8c0@coconut">news:01c27058$c1770170$7c02a8c0@coconut... > > Okay here is the new code and this is still not working. > > > > > > > require("./config.php"); > > > > $sqlserver = $server1; > > $sqlusername = $username1; > > $sqlpassword = $password1; > > $sqldatabase = $database1; > > > > //** > > $nam_bak=date('D,d-m-Y'); > > Can you have a filename with a comma in it? > > > exec("mysqldump -u\"$sqlusername\" -p\"$sqlpassword\" \"$sqldatabase\" > > > > $backupdir/$nam.sql"); > > Take out the \" quotes around username, password, and database. > > > > > exec("gzip $backupdir/$nam.sql"); > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDF to PHP (code)
Jason, I had trouble with PDFLib too, and I turned to this site for help! I found this much easier to implement and the webmaster will give you lots of help!! http://ros.co.nz/pdf/ This does not use PDFLib. "Jason Morehouse" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I've got a pretty detailed PDF that I need to dynamically re-create with > PHP / pdflib. Before I sit around for endless hours inputing x, y, fonts and line > coordinates, is there *any* tool that can help automate this? > > Basically, the miracle I'm looking for would take a PDF file, and export > it to PHP code that can reproduce it -- or something along that line. > > Thanks in Advance! > -J > > -- > Jason Morehouse (jm[ät]netconcepts[döt]com) > Netconcepts - http://www.netconcepts.com > Auckland, New Zealand > Linux: Because rebooting is for adding hardware. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpwebhosting.com
>> have you priced an OC-12 lately? > No I haven't. Can you enlighten me? I was curious :) http://gometanet.com/connect/fiber.htm OC12 622 Mb Monthly Fee $550,000 Setup Fee call (prolly between 10k and 20k) I'll have to ask my wife first... _Ken At 06:24 PM 1/17/01 -0500, you wrote: >> But even if they had 100 servers, have you priced an OC-12 lately? > >No I haven't. Can you enlighten me? > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Can't find php.ini on my Linux/Apache module install
I can't seem to locate the php.ini file on my system. Here's some pertinent info from phpinfo(): PHP Version 4.0.4pl1 SystemLinux i686 unknown Configure Command './configure' '--with-mysql' '--with-apxs' '--enable-versioning' Server API Apache Configuration File (php.ini) Path /usr/local/lib find -name php.ini reveals no php.ini file. /usr/local/lib contains a php directory. The php directory seems to only contain PHP 4.0 source code. There IS a php3.ini file on the system, from a previous install. Is there any chance that this file is still being used? Where SHOULD this file be? And how do I find out for sure which one it is? Is it possible that it doesn't exist? If not, does that mean I could create one in /usr/local/lib? Where am I supposed to get a default version? Thanks, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Resolved: Can't find php.ini on my Linux/Apache module install
OK, I answered my own question. After researching on php.net, I determined that the php.ini should have been in /usr/local/lib, but was missing, presumably because whoever did the install skipped the step of copying php.ini-dist to /usr/local/lib/php.ini. I downloaded a source .tar, extracted it, found php.ini-dist, copied it to /usr/local/lib/php.ini, restarted Apache, and I'm in business. So, PHP was using default values in lieu of a php.ini file. - Ken At 12:11 AM 2/27/01 -0500, Ken wrote: >I can't seem to locate the php.ini file on my system. > >Here's some pertinent info from phpinfo(): > >PHP Version 4.0.4pl1 >SystemLinux i686 unknown >Configure Command './configure' '--with-mysql' '--with-apxs' '--enable-versioning' >Server API Apache >Configuration File (php.ini) Path /usr/local/lib > >find -name php.ini reveals no php.ini file. > >/usr/local/lib contains a php directory. The php directory seems to only contain PHP >4.0 source code. > >There IS a php3.ini file on the system, from a previous install. Is there any chance >that this file is still being used? > >Where SHOULD this file be? And how do I find out for sure which one it is? Is it >possible that it doesn't exist? If not, does that mean I could create one in >/usr/local/lib? Where am I supposed to get a default version? > >Thanks, > >Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] IE 5.5,authentication,PHP sessions: IE never stops running?
I'm experiencing strange behavior with my user authentication scheme in my PHP app, with users using IE 5.5 (PC and Mac). I am using browser authentication (WWW-Authenticate and 401 headers), "no cache" headers, and PHP 4 sessions. I am finding that even when the user totally quits IE, if he then restarts IE, one or both (haven't isolated for sure yet) of the following happen: - The browser still knows the user and password, and so will send it to the server upon an authentication request under the same realm, without prompting the user. (The user does NOT have "save this password" checked on the user/password prompt when it first comes up.) - The session is still active. A call to session_start() returns the pre-existing session, instead of getting a new one. If the user restarts his machine, IE no longer remembers his user and password, and so a prompt is displayed upon authentication headers being sent. And I presume (not 100% certain) that a new session gets created. Both of these are behaving like IE is still running. Is this a known issue with IE 5.5? Does it just stay running? These symptoms make it sound like this, and less like a logic problem in my PHP app. (I have verified that the username and password are sent when the user gets an authentication prompt, without the user typing anything. I'm assuming there's no possible way that a PHP session can retain this information; I am reading $PHP_AUTH_USER and $PHP_AUTH_PW...there's no way these can be set unless the browser were already running and the user had previously entered them into their prompts, right?) Has anyone else run into this? My application works perfectly under Netscape 4, IE 4, and Opera 5. Thanks, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops running?
Thanks for the idea, John. I know about the auth logout. Unfortunately, that means that when a user clicks "logout", he gets a "log in" prompt! And, in IE, he has to deliberately blank out the password field, THEN hit enter, THEN the prompt will come again, and he has to hit escape. There's another possible path than the above, but it, too, involves a prompt coming up when they hit logout, and they have to clear the password field. If, when they click "logout", and they get the first confusing "log in" prompt, they click "cancel", then they won't be logged out. The browser will continue to remember and report their username and password. Try explaining how to follow these instructions to an inexperienced user! The point of my system was to use, among other things, the session cookie to determine whether the user is in a new session or the same one as before. The logout button sets a flag in the database. In short, then I know, when the user's browser tries to log in again, if he's in the SAME session, and he had previously hit logout, then I will have to send an auth header, with a new realm. But if he's in a NEW session, then I can assume his browser no longer remembers his user/pass, so the actual user must've typed it, so here I will let the user proceed without sending an auth header. If IE 5.5 refuses to clear the user/password field, and refuses to clear the session cookie, then I can't think of any way of him getting to log out without making him go through an annoying second "enter your username and password" prompt...which is most disappointing. It's sounding like, thanks to this terrible behavior of IE 5.5, I may have to switch to not using browser authentication at all, and instead deal with the nuisance or security risk of passing along authentication information in the session, and requiring the user to click "logout" when it's time to logout (forcing a destruction of the information stored in the session). Any suggestions? - Ken At 09:45 PM 3/3/01 -0600, John Henckel wrote: >I, too, am using PHP with authentication and IE 5. However I am using .htaccess to >generate the headers instead of PHP. I found this text... > >a quote from PHP manual. >>Both Netscape and Internet Explorer will clear the local browser window's >authentication cache for the realm upon receiving a server response of 401. This can >effectively "log out" a user, forcing them to re-enter their username and password. >Some people use this to "time out" logins, or provide a "log-out" button. > >This doesn't answer Ken's question, but at least perhaps you can use it to provide a >"log-out" button. Let me know if it works or not. > >At 09:57 PM 3/3/01 -0500, kenzo wrote: >>I'm experiencing strange behavior with my user authentication scheme in my PHP app, >with users using IE 5.5. >> >>I am using browser authentication (WWW-Authenticate and 401 headers), "no cache" >headers, and PHP 4 sessions. >> >>I am finding that even when the user totally quits IE, if he then restarts IE, one >or both (haven't isolated for sure yet) of the following happen: >> >>- The browser still knows the user and password, and so will send it to the server >upon an authentication request under the same realm, without prompting the user. >(The user does NOT have "save this password" checked on the user/password prompt when >it first comes up.) >>- The session is still active. A call to session_start() returns the pre-existing >session, instead of getting a new one. >> >>If the user restarts his machine, IE no longer remembers his user and password, and >so a prompt is displayed upon authentication headers being sent. And I presume (not >100% certain) that a new session gets created. >> >>Both of these are behaving like IE is still running. Is this a known issue with IE >5.5? Does it just stay running? These symptoms make it sound like this, and less >like a logic problem in my PHP app. (I have verified that the username and password >are sent when the user gets an authentication prompt, without the user typing >anything. I'm assuming there's no possible way that a PHP session can retain this >information; I am reading $PHP_AUTH_USER and $PHP_AUTH_PW...there's no way these can >be set unless the browser were already running and the user had previously entered >them into their prompts, right?) >> >>Has anyone else run into this? My application works perfectly under Netscape 4, IE >4, and Opera 5. >> >>Thanks, >>Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
At 03:11 PM 3/4/01 -0600, Don Read wrote: >On 04-Mar-01 Ken wrote: > > I know about the auth logout. Unfortunately, that means that when a user > > clicks "logout", he gets a "log in" prompt! And, in IE, he has to > > deliberately blank out the password field, THEN hit enter, THEN the prompt > > will come again, and he has to hit escape. > >I'm still playing with this but ... > >My script handles the authentication against a MySQL table; >and this might (probably) have to get tweaked to play well with .htaccess > >The logout script creates a "mark" (tmpfile, db entry, whatever) >then redirects to a non-protected page. My script does something very similar, but it's more advanced than that, because it handles these various scenarios: - Someone clicks "logout", then closes browser, then starts new browser and logs in as same of different user - Someone clicks "logout", then tries to log in again as same or different user - Someone just closes browser, without clicking "logout" This would all work perfectly if it weren't for IE5.5 completely refusing to behave like it has closed when it has closed. So I have to require IE5.5 users to click logout, which is really no good. Your script suffers the same problem: An IE5.5 user in the 3rd scenario would just get logged right back on without being prompted. - Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
At 03:18 PM 3/4/01 -0800, Michael A. Peters wrote: ... >Generally, I don't think a login prompt when a user clicks logout is such bad thing. > >It lets the user know they are logged out, and the software is waiting for another >login. > >If they choose to go elsewhere, that's fine. Why it's bad is that, if the user clicks "cancel", they are not logged out. They have to manually clear the field, THEN OK, then they get prompted AGAIN, THEN they hit cancel. That's nuts, and my users aren't going to understand that. >I personally in your situation would use php to determine the browser. >If its IE 5.5 state "Due to a bug in IE 5.5 that browser is not supported for use >with this page." > >You could give them the choice to continue anyway, or possibly do session >authentication only with IE 5.5 if you really wanted to go out of your way to cover >up for Microsofts bug. > >Don't lessen security because of a browser bug, though- instead, refuse to support >the browser. ... Well, I guess nothing is going to solve my problem of making people hit "logout" instead of just closing the browsers, if they're using IE5.5, since both the user/password are still remembered by the browser, and the session is kept active. I would love to not support IE5.5, but my client uses this version primarily. I will ask them to downgrade...but I wouldn't be surprised if IE doesn't let you install an older version! Anyway, can someone please test to see if this doesn't happen in IE5.0? I really hate this situation, yessir. - Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
At 04:11 PM 3/5/01 +1300, Simon Garner wrote: >From: "Ken" <[EMAIL PROTECTED]> > > Why it's bad is that, if the user clicks "cancel", they are not logged >out. They have to manually clear the field, THEN OK, then they get prompted >AGAIN, THEN they hit cancel. That's nuts, and my users aren't going to >understand that. > > > >Why do they need to be able to log out? Because they are on a shared computer. >If the user doesn't want their password saved (e.g. they're on a public PC) >then they just uncheck the "Save password" box when logging in, and then >they can close the browser and be "logged out". > >If they want their password saved then they can check the "Save password" >box and not worry. Nope - with IE5.5, even with that box NOT checked, the user remains logged in until either a) the computer is restarted, or b) a new user-authentication header is sent, AND the user clears out the password field and hits OK. Otherwise the user stays logged in, in spite of the HTTP spec. >It sounds to me like you're trying to implement something that no users are >actually going to need or want... Nope, I'm working with a real client, who has multiple users on the same machine, and IE5.5 is installed on it, and, lo and behold, though the rest of the browsers work fine, IE5.5 has this awful bug. >However, if you want more control over the authentication process I suggest >making your own login form and using cookies, instead of HTTP >authentication. Then you can log users out just by unsetting the cookie(s). This is how I will wind up going, EXCEPT the users will be required to click "logout", since merely closing the browser, in IE5.5, does not seem to clear the user/password from the browser's memory, NOR does it clear any session cookie. Again, works fine in other browsers, per spec. Thanks, Ken >Cheers > >Simon Garner -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
At 04:28 PM 3/5/01 +1300, Simon Garner wrote: >From: "Ken" <[EMAIL PROTECTED]> > > Nope - with IE5.5, even with that box NOT checked, the user remains logged >in until either a) the computer is restarted, or b) a new >user-authentication header is sent, AND the user clears out the password >field and hits OK. Otherwise the user stays logged in, in spite of the HTTP >spec. > >Admittedly I'm running IE5.01, but if I close and reopen the browser it will >pop up the authentication dialogue again (with values filled out, if I did >Save Password). >Does this really not happen in 5.5? Yes. Someone else on the list wrote, "I didn't believe you until I tried it for myself." At least, it happens in 5.5 on the PC and Mac that my client has. Someone proposed I download any patches MS has, so I'll ask my client to do that, and we'll see if it's fixed. Some members of the list have verified that this happens in IE 5.5, and some members indicate that it is not happening in their IE 5.5. And so far no problem fix has been found on MS's site. > > This is how I will wind up going, EXCEPT the users will be required to >click "logout", since merely closing the browser, in IE5.5, does not seem to >clear the user/password from the browser's memory, NOR does it clear any >session cookie. Again, works fine in other browsers, per spec. > >You mean it doesn't clear per-session cookies (expiry=0) either? Cripes... Correct. Expiration is 0. Other browsers on the same system are clearing the cookie when the browser is shut down, including IE 4. >What Windows version is this under? Windows 98 and Mac OS 8 or 9. - Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
At 10:56 AM 3/5/01 -0600, John Henckel wrote: >1. open mytest.php and when the password prompt appears, I enter a userid/password. >2. I see the "Hello" page with my userid and password. >3. close IE and reopen mytest.php, again the prompt appears -- this is good. >4. close IE and Restart Windows. >5. open mytest.php and when the password prompt appears, I hit CANCEL. >6. the message "Sorry you are not authorized" appears >7. in the address box I type www.google.com and wait for it to appear >8. I press the BACK button and guess what I see? I see the "Hello" page with my >userid and password from step 2 !! apparently the page is retrieved from >the browser cache. This is exactly one of the things I was complaining about: It is NOT a browser cache issue - it still remembers your username and password, and will continue to send it with page requests. This happens when you hit "cancel" on the new password prompt. You'd think it would forget the username and password at this point, but it doesn't. You have to clear the password field and hit OK. Crazy, huh? - Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE 5.5,authentication,PHP sessions: IE never stops
At 02:39 PM 3/5/01 -0500, Chris Poirier wrote: >There is a suggestion in the PHP online documentation that has worked for >me (except in Opera 5, which seems to ignore the Realm). Add a timestamp >to the Realm that changes with each new session. IE 5.0 will prompt for a >different password, because it sees it as a different login. This is, in fact, what my system attempts to do. The catch is that I CAN'T change the realm with a new session...because I don't GET a new session, because IE 5.5 is not starting a new session when it should! Indeed, when I change the realm, I get the prompt. But I can't tell when the user closed his browser and started a new one, because IE 5.5 (on the machines I'm testing on) is still keeping the old session, acting like the browser never closed. Again, my system works perfectly on the other browsers I've tried. It changes the realm when appropriate. It sets a flag in the database when the user hits logout. And it works the way it should. Just in IE 5.5 (on the machines I'm testing on) do I get this horrible behavior. - Ken >Later, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] parsing "problem" with 4.0.5
With 4.0.4pl1 and earlier, this did not occur, but with 4.0.5, there are some files on our server that are not getting parsed as php, and just showing up as the code itself. The problem files are a mess, but I only mention them since they got parsed before. They are php files that the designers here have created in HomeSite and saved as PC format, so they are basically 1 long line when I open them in vi, and have ^M's everywhere. If they pull them back into HomeSite and save as UNIX format and upload, no problem. What changed in PHP that would make this difference. I would just tell them to do this with all the problem ones, but there are a lot. This is on OpenBSD, btw. Thanks. -Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP Parsing Database Text
Is it possible to have PHP parse text queried from a database (security issues notwithstanding)? If so, how? _Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP and Apache authorization: how to logout. Help!
At 03:41 PM 2/1/02 -0800, Lazor, Ed wrote: >Even with a javascript function opening a new window and closing the old? > >-Original Message- >From: Matthew Walker [mailto:[EMAIL PROTECTED]] >Sent: Friday, February 01, 2002 3:42 PM > >I've done some investigating on my own. There is no way to do this. >Period. It's not QUITE as impossible as this, but nearly. You can give the browser a new challenge, and hope that it will clear the old username/password information that it's memorizing for the session. But I have found that certain combinations in certain browsers can subvert any such techniques. Thus, only quitting the browser entirely will force the browser to forget the authentication information. HOWEVER, certain users with IE 5 on the Mac have reliably reported that even quitting the browser doesn't work for them, but they instead have to restart their machines. (The HTTP specification mentions nothing about logout functionality.) Thus, if logging out is important to your application, then using browser-based authentication is not an acceptable solution. You'll have to use session management and build your own login screen. (Or, of course, reuse an existing one from one of the many good public libraries.) - Ken [EMAIL PROTECTED] >-Original Message- >From: Aras Kucinskas [mailto:[EMAIL PROTECTED]] >Sent: Thursday, January 31, 2002 10:39 AM >To: [EMAIL PROTECTED] >Subject: [PHP] PHP and Apache authorization: how to logout. Help! > >My site is in directory which is protected with .htaccess file. >I want to develope a logout function, which can reset Apache >authorization. > >What to do? >HTTP header... >unset $PHP_AUTH_USER ... > >Any suggestions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] form submission error trapping
> > -Original Message- > > From: Steven Walker [mailto:[EMAIL PROTECTED]] > > > > I created one php page that both displays the form and validates the > > input. When the user hits the submit button, it submits the data to > > itself. If anything is missing from the page, the form is reshown with > > missing fields highlighted and the other fields filled in. If on the > > other hand the info passes the validation test, the information is shown > > to screen a new button (hidden form) allows the user to continue. Only catch is, you have to build all that logic to populate your fields. Piece of cake when you have a simple form, not so easy when you have a dynamically-generated form (with a variable number of inputs) including multi-select buttons and the like. I guess the real challenge is converting a pre-existing page like the one I've described into one that can re-populate itself on an error condition. Building it that way from scratch is merely a programming task. - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_destroy won't work, PHP 4.0.3pl Win95
I am able to create a session. A cookie is set in the browser. The variables I registered are in the session. I can access it. But I can't do anything that would modify or destroy the session. Example: If I have a script: PHP gives me this error: "Warning: Session object destruction failed in script.php on line (session_destroy line #)" and I get my "Couldn't destroy" message. And, in fact, the session file remains in my c:\temp folder, and next time a script is called and does session_start(), it gets all the original values of my session. Similarly, in a different script, no matter what I do about changing my registered variables, next time a script is called with session_start(), the original values are still in the session. I cannot do anything about changing the contents of a session at all. (And the cookie is still set, but I know about how that works. But I want to destroy the session on the server, which is what I thought session_destroy was supposed to do.) Any ideas? - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reg ex help-Removing extra blank spaces before HTML output
I want to remove all superfluous blank spaces before I sent my HTML output, to make the output smaller. So I'd like to take $input, replace any number of blank space or newlines that are consecutive and replace them with a single blank. I.e. I will list a blank space as b and a newline as n: If input is: bTEXTHEREbbbnnnbnMOREbEVENMORE Then output should be: bTEXTHEREbMOREbEVENMORE I imagine this would be handled by a simple regular expression call, but I'm no pro with them yet. Any help? Thanks, Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Reg ex help-Removing extra blank spaces before HTML output
At 02:43 PM 12/5/01 -0500, Jack Dempsey wrote: >$t = preg_replace('/\s+/',' ',$text); One more thing: How do I replace with newline instead of a space? I read through the manuals but couldn't grasp how to do this. \n didn't cut it. And, more advanced - The above replaces any groups of 2 or more blanks (newlines, spaces, tabs) with a single blank. Is there an easy way to replace them with EITHER a space or a newline, depending on whether any newlines were present in the input? I.e. bb would be replaced with b, but bnbn would be replaced with n. Right now the issue is that I'm sometimes getting results that have no line breaks for a really long time, and I know there are reasons to try to avoid individual lines of HTML longer than 200 characters. Thanks! - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Reg ex help-Removing extra blank spaces before HTML output
OK, this time the \n worked. The only thing I changed was using / delimiters instead of | delimiters in the search string. No idea if/why that would affect anything in the replacement string. Anyway, I finally came up with exactly what I wanted: preg_replace(array("/\s*\n+\s*/", "/[ ]+/"), array("\n", " "), $input); All padding (defined as any series of spaces, newlines and sometimes tabs) is removed from $input, but always leaving at least a space or a newline in its place. If there were any newlines in the "padding", then a newline is left. If there weren't, then a space is left. Thanks for the help! Ken [EMAIL PROTECTED] At 04:40 PM 12/6/01 -0500, Jack Dempsey wrote: >one call to preg_replace...if you check out php.net/preg_replace, you'll see >what i mean...use arrays... >and as long as you have them ordered in the right way, it'll execute them in >that order, so by the time the \s replace comes up all your 'bbbnbb' will be >fixed...problem then is that those newlines would get caught by the \s and >get switched to spaces...so, if you want them to stay, then use [ ] to >represent a space instead of \s...might want [ \t] to catch tabs as well... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sending PHP script output to stderr?
Is there a way to get a PHP script to return text that would be directed to stderr instead of to stdout? This is for a PHP script that I'm running via cron, and I don't need its output (which at the least includes the annoying "Content-type: text/html" at the top), but I would like to know about errors. Thanks, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Positioning HTML output in browser window
At 06:59 PM 12/20/01 -0700, Leland wrote: >I tried generating a in the orginal list, but I haven't >been able to create the return link on the other page that will refrence >this. I tried Link but it doesn't >work. Did you try Link ? From RFC 2396, "Uniform Resource Identifiers (URI): Generic Syntax": URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] absoluteURI = scheme ":" ( hier_part | opaque_part ) relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] And don't leave out the quotes, either. - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Client side fatal PHP error
At 08:53 PM 12/25/01 -0500, jjt wrote: >Why does this error not show up every time? It will show up every time PHP attempts to call the (incorrect) function. But the functions won't be called every time. For example, due to short-circuit evaluation, if the string is "B" or "P", the error will never happen. Also, if your if statement isn't always reached, then the error will not happen. Finally, not all users will report the error when they get it. But you can deal with that by looking at your PHP error log file. I believe there is a way to call PHP from the command line and do a "syntax check" on a given file. But I have never tried it and I have no idea if it really works. Check the manual. - Ken [EMAIL PROTECTED] > >> if (strtoupper(substr($xmbrcode,11,1)) != "B" && > >> strtoupper(substr($xmbrcode,11,1)) != "P" && > >> srtoupper(substr($xmbrcode,11,1)) != "H" && > >> srtoupper(substr($xmbrcode,11,1)) != "O") { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to act on many files (i.e. *)
I can't find a way in PHP to behave on multiple files, without knowing the script somehow knowing the filenames already. In particular, I want to delete all files in a directory. unlink("*") doesn't seem to work with wildcards (at least not on my test Windows environment). I can't find any function that gets me a list of filenames, either. Am I missing something, or do I have to shell out to do this? - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to act on many files (i.e. *)
I got my answer: Use directory functions, not filesystem functions: http://www.php.net/manual/en/ref.dir.php - Ken [EMAIL PROTECTED] At 02:51 PM 8/24/01 -0400, Ken wrote: >I can't find a way in PHP to behave on multiple files, without knowing the script >somehow knowing the filenames already. > >In particular, I want to delete all files in a directory. unlink("*") doesn't seem >to work with wildcards (at least not on my test Windows environment). > >I can't find any function that gets me a list of filenames, either. > >Am I missing something, or do I have to shell out to do this? > >- Ken >[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] `T_VARIABLE' or `'$''
At 02:31 PM 8/24/01 +0100, Paul Roberts wrote: >I'm using preg_replace and getting the following error > >parse error, expecting `T_VARIABLE' or `'$'' This sounds like PHP was expecting a variable name somewhere where you didn't provide one. Perhaps you left off a "$" before a variable name. It might not be in your preg_replace call. - Ken [EMAIL PROTECTED] ken's last ever radio extravaganza http://free-music.com/ken/extrav/ >anyone know where I can find out abut them, I did a search of the manual but >nothing came up. > >Paul Roberts > >[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how can i cache php scripts enterpretet
At 06:29 PM 8/24/01 +0200, Ralph Deffke wrote: >I have developed a web portal for big compamies with a lot of traffic on >their pages. main functions, like member authentication etc. are called >on every page request. it would make sence to have them ready >enterpretet to skip enterpretation on each request. i know that there >are tools arround like Zent Cache. however they require an >recompilation/binding on the server. but this is on such big corporate >servers almost impossible. > >Does anybody know a solution for that ? Try "Alternative PHP Cache", open source: http://apc.communityconnect.com/ - Ken [EMAIL PROTECTED] ken's last ever radio extravaganza http://free-music.com/ken/extrav/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Displaying all variables currently set?
Is there a way to get PHP to list the names and/or contents of all variables? phpinfo() shows environment variables, server variables, and form variables, but doesn't actually show what variables you may have in scope, like $myvar. Is there any way to get this information? It would be ridiculously useful for debugging. - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Redirect in the middle of code?
At 08:11 AM 9/10/01 -0700, Steve Edberg wrote: >Right off the top of my head, you have three options that I can see: >(3) Use a META REFRESH tag. For example: > > > >where 1 is the time (in seconds) before you want the redirect, and 'page.php' is >where you want the redirect to. Of course, this tag needs to be in the >section, so it might not help you much. Not necessarily true, the part. My application outputs a line really late in the HTML document - definitely inside the section - and the refresh seems to be working for all. - Ken [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Why is the behavior between Apache2 and Tomcat so different?
"Cannot modify header information - headers already sent " output buffering is off on tomcat? check the php.ini or did some error message happen before this - which will cause this error since the error was sent to the browser before your headers. In which case fix it by turning off php.ini error reporting (display_errors: off) cheers On Tue, 15 Mar 2005 15:45:13 +0300, Burhan Khalid <[EMAIL PROTECTED]> wrote: > david joffrin wrote: > > Hi, > > > > I have the same piece of PHP script running on either Apache2 or Tomcat. > > On Tomcat, I have the folllowing errors: > > 1- Cannot modify header information - headers already sent > > OR 2- Undefined index: error in ... > > > > For one, I think this is because I am using the header PHP function. > > For two, I think this is because there is from time to time a http > > request parameter ("error") which not always defined. > > Check your error reporting levels. I bet they differ (check in php.ini > and any error_reporting() functions) > > By the way, I'm curious -- how did you get PHP to work on Tomcat? > > -- > 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
Re: [PHP] Configure PHP
You should check your php.ini file... i haven't used linux for a while so i can't remember where it is... and this is probably distro specific... do a search for it. php.ini. change the settings for session support, the file should be pretty self explanatory then restart apache. On Tue, 15 Mar 2005 15:00:31 +0200, Steven Sher <[EMAIL PROTECTED]> wrote: > Can someone please help me configure php. I have installed php on SUSE > 9.2 by default it loads php with session support disabled how do I > enable it, I know I am supposed to use some configure command or > something but not sure how, please help. > > Thanks > Steve > > -- > Click here to get Firefox Free > http://www.spreadfirefox.com/?q=affiliates&id=75643&t=1 > > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean > > > -- > 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
Re: [PHP] Configure PHP
in which case you'll have to recompile php again... but according to the manual session is enabled by default... (again, it really depends on what distro). find the source folder for php, and do ./configure --enable-session (and lots of other stuff if you want it)... do ./configure --help to see the list of things you can enable/disable On Tue, 15 Mar 2005 15:21:39 +0200, Steven Sher <[EMAIL PROTECTED]> wrote: > I have checked the php.ini file all setting ok, when you load ph there > are certain paramters you can specify such as "--disable-session" or in > my case I would like to "--enable-session" > but not sure exactly how. > steve > > Ken wrote: > > >You should check your php.ini file... > >i haven't used linux for a while so i can't remember where it is... > >and this is probably distro specific... > > > >do a search for it. php.ini. > >change the settings for session support, the file should be pretty > >self explanatory > >then restart apache. > > > > > >On Tue, 15 Mar 2005 15:00:31 +0200, Steven Sher <[EMAIL PROTECTED]> wrote: > > > > > >>Can someone please help me configure php. I have installed php on SUSE > >>9.2 by default it loads php with session support disabled how do I > >>enable it, I know I am supposed to use some configure command or > >>something but not sure how, please help. > >> > >>Thanks > >>Steve > >> > >>-- > >>Click here to get Firefox Free > >>http://www.spreadfirefox.com/?q=affiliates&id=75643&t=1 > >> > >>This message has been scanned for viruses and > >>dangerous content by MailScanner, and is > >>believed to be clean > >> > >> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > >> > >> > > > > > > > > -- > Click here to get Firefox Free > http://www.spreadfirefox.com/?q=affiliates&id=75643&t=1 > > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i calculate total process time?
I do that for my site and sometimes for some very strange reason it returns a negative figure. so i use abs() to make sure it's positive always (but then it might not be true value...) On Tue, 15 Mar 2005 09:08:31 -0600, Chris Boget <[EMAIL PROTECTED]> wrote: > > Hi, i wanna ask if anybody knows how to calculate the total process > > time of a script. I guess there exists a > > function to perform but i dont know which one it is. I mean if u c any > > PHP Nuke site, it says this page is produced in seconds. I made > > some codes it calculates but i dont believe that it is equal to total > process > > time.. Thanx.. > > // At the very beginning of the script > $startTime = date( 'U' ); > > // At the very end of the script > $endTime = date( 'U' ); > > echo 'Total processing time: ' . ( $endTime - $startTime ) . ' second(s)'; > > thnx, > Chris > > -- > 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] Re: [PEAR] Re: HTTP_Download to track amount of bytes downloaded help
On Thu, 17 Mar 2005 12:19:38 +0100, Ken <[EMAIL PROTECTED]> wrote: > Header for download script > > http://localhost/download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers > > GET /download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers > HTTP/1.1 > Host: localhost > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) > Gecko/20050225 Firefox/1.0.1 > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > Accept-Language: en-us,en;q=0.5 > Accept-Encoding: gzip,deflate > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive: 300 > Connection: keep-alive > Referer: http://localhost/?item=repository&cat=2 > Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin; > GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c; > wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670; > comment_author_86a9106ae65537651a8e456835b316ab=Administrator; > comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com; > visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e; > userdetails[username]=strikers; userdetails[loggedin]=y; > phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D; > PHPSESSID=bb9309b20034a71e4c59382028afd1c3; > phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716; > phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D > > HTTP/1.x 200 OK > Date: Thu, 17 Mar 2005 11:10:04 GMT > Server: Apache/2.0.49 (Win32) PHP/4.3.10 > X-Powered-By: PHP/4.3.10 > Pragma: cache > Cache-Control: public, must-revalidate, max-age=0 > Accept-Ranges: bytes > x-sent-by: PEAR::HTTP::Download > content-disposition: attachment; filename="KPM1.avi" > Etag: "2063849717d32dd19e534b77cabac517--856247520" > Content-Length: 0 > Keep-Alive: timeout=15, max=84 > Connection: Keep-Alive > Content-Type: application/x-octetstream > *** END > > And after I refresh the page: > *** > http://localhost/?item=repository&cat=2 > > GET /?item=repository&cat=2 HTTP/1.1 > Host: localhost > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) > Gecko/20050225 Firefox/1.0.1 > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > Accept-Language: en-us,en;q=0.5 > Accept-Encoding: gzip,deflate > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive: 300 > Connection: keep-alive > Referer: http://localhost/?item=repository&cat=1 > Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin; > GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c; > wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670; > comment_author_86a9106ae65537651a8e456835b316ab=Administrator; > comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com; > visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e; > userdetails[username]=strikers; userdetails[loggedin]=y; > phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D; > PHPSESSID=bb9309b20034a71e4c59382028afd1c3; > phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716; > phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D > Cache-Control: max-age=0 > > HTTP/1.x 200 OK > Date: Thu, 17 Mar 2005 11:10:10 GMT > Server: Apache/2.0.49 (Win32) PHP/4.3.10 > X-Powered-By: PHP/4.3.10 > Cache-Control: no-store, no-cache, must-revalidate, max-age=0 > Pragma: no-cache > Expires: Sat, 01 Jan 2000 00:00:00 GMT > Set-Cookie: visited=y; expires=Fri, 18-Mar-2005 11:10:10 GMT > Keep-Alive: timeout=15, max=80 > Connection: Keep-Alive > Transfer-Encoding: chunked > Content-Type: text/html; charset=ISO-8859-1 > END* > > I strongly believe that this is a ffox problem. It does not happen at > all with IE... > > Ken > > On Thu, 17 Mar 2005 11:43:27 +0100, Michael Wallner <[EMAIL PROTECTED]> wrote: > > Hi Ken, you wrote: > > > > > Thanks for the reply > > > Second thing: > > > I am getting errors from refreshing the page after I cancel the download: > > > > > > Warning: fseek(): supplied argument is not a valid stream resource in > > > C:\php\pear\HTTP\download.php on line 849 > > > > > > Warning: fread(): supplied argument is not a valid stream resource in > > > C:\php\pear\HTTP\download.php on line 855 > > > > > > I
[PHP] Re: [PEAR] Re: HTTP_Download to track amount of bytes downloaded help
i forgot to add: pressing go has the same effect as refresh. On Thu, 17 Mar 2005 12:20:12 +0100, Ken <[EMAIL PROTECTED]> wrote: > On Thu, 17 Mar 2005 12:19:38 +0100, Ken <[EMAIL PROTECTED]> wrote: > > Header for download script > > > > http://localhost/download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers > > > > GET /download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers > > HTTP/1.1 > > Host: localhost > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) > > Gecko/20050225 Firefox/1.0.1 > > Accept: > > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > Referer: http://localhost/?item=repository&cat=2 > > Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin; > > GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c; > > wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670; > > comment_author_86a9106ae65537651a8e456835b316ab=Administrator; > > comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com; > > visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e; > > userdetails[username]=strikers; userdetails[loggedin]=y; > > phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D; > > PHPSESSID=bb9309b20034a71e4c59382028afd1c3; > > phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716; > > phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D > > > > HTTP/1.x 200 OK > > Date: Thu, 17 Mar 2005 11:10:04 GMT > > Server: Apache/2.0.49 (Win32) PHP/4.3.10 > > X-Powered-By: PHP/4.3.10 > > Pragma: cache > > Cache-Control: public, must-revalidate, max-age=0 > > Accept-Ranges: bytes > > x-sent-by: PEAR::HTTP::Download > > content-disposition: attachment; filename="KPM1.avi" > > Etag: "2063849717d32dd19e534b77cabac517--856247520" > > Content-Length: 0 > > Keep-Alive: timeout=15, max=84 > > Connection: Keep-Alive > > Content-Type: application/x-octetstream > > *** END > > > > And after I refresh the page: > > *** > > http://localhost/?item=repository&cat=2 > > > > GET /?item=repository&cat=2 HTTP/1.1 > > Host: localhost > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) > > Gecko/20050225 Firefox/1.0.1 > > Accept: > > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > Referer: http://localhost/?item=repository&cat=1 > > Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin; > > GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c; > > wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670; > > comment_author_86a9106ae65537651a8e456835b316ab=Administrator; > > comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com; > > visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e; > > userdetails[username]=strikers; userdetails[loggedin]=y; > > phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D; > > PHPSESSID=bb9309b20034a71e4c59382028afd1c3; > > phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716; > > phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D > > Cache-Control: max-age=0 > > > > HTTP/1.x 200 OK > > Date: Thu, 17 Mar 2005 11:10:10 GMT > > Server: Apache/2.0.49 (Win32) PHP/4.3.10 > > X-Powered-By: PHP/4.3.10 > > Cache-Control: no-store, no-cache, must-revalidate, max-age=0 > > Pragma: no-cache > > Expires: Sat, 01 Jan 2000 00:00:00 GMT > > Set-Cookie: visited=y; expires=Fri, 18-Mar-2005 11:10:10 GMT > > Keep-Alive: timeout=15, max=80 > > Connection: Keep-Alive > > Transfer-Encoding: chunked > > Content-Type: text/html; charset=ISO-8859-1 > > END* > > > > I strongly believe that this is a ffox problem. It does not happen at > > all with IE... > > > > Ken > > > > On Thu, 17 Mar 2005 11:4
Re: [PHP] sessioncookies?
No, you'll have to use another cookie name. Alternatively, you can use arrays setcookie('cookiename['arrayname']', $value, time()); On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes <[EMAIL PROTECTED]> wrote: > Hello, > > I have a following line in my code to set a session cookie when user logs > in. It works fine. > setcookie("sess_id","$sess_id",0,"/"); > > Can I store more information to the session cookie? I mean other variables. > Like I tried it like this with no success. > setcookie("sess_id","$sess_id",$another_variable,0,"/"); > > Thanks > -Will > > -- > 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] sessioncookies?
if you check your cookies (if you are using firefox) you should see multiple cookies from many sites. It is allowed and I think you can set as much as possible. However I wouldn't because you'll probably end up forgetting some of them and it'll become a hassle. Besides, some browsers might reject cookies, so don't rely too heavily on cookies. And then there is the security factor to consider... you don't want to store too many cookies that might give away passwords/usernames. That's all the bad reason I can think of. Good luck :D On Fri, 18 Mar 2005 18:30:58 +0200, William Stokes <[EMAIL PROTECTED]> wrote: > OK. so can I set 2 or more session cookies for the same user? Like this: > setcookie("sess_id","$sess_id",0,"/"); > setcookie("cookie2","$another_variable",0,"/"); > > If so is there a limit? Or is it a bad idea for some other reason? > > Thanks > -Will > > "Ken" <[EMAIL PROTECTED]> kirjoitti > viestissä:[EMAIL PROTECTED] > > No, you'll have to use another cookie name. > > Alternatively, you can use arrays > > > > setcookie('cookiename['arrayname']', $value, time()); > > > > > > On Fri, 18 Mar 2005 15:07:34 +0200, William Stokes <[EMAIL PROTECTED]> > > wrote: > >> Hello, > >> > >> I have a following line in my code to set a session cookie when user logs > >> in. It works fine. > >> setcookie("sess_id","$sess_id",0,"/"); > >> > >> Can I store more information to the session cookie? I mean other > >> variables. > >> Like I tried it like this with no success. > >> setcookie("sess_id","$sess_id",$another_variable,0,"/"); > >> > >> Thanks > >> -Will > >> > >> -- > >> 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re-setting all cookies
/*From the php manual $arr = array(1, 2, 3, 4); foreach ($arr as &$value) { $value = $value * 2; } */ $_COOKIE is a variable... but you need the key for setcookie(). so you can do: foreach($_COOKIE as $key => $value){ setcookie("$key","", time()-3600); } i know there is the $value bit that we never use, but this is the simplest form I can think of. can anyone else think of something better? HTH :D On Tue, 22 Mar 2005 08:39:45 -, AndreaD <[EMAIL PROTECTED]> wrote: > I want a button that resets all my cookies. Can I reset them all with a > foreach command? > > AD > > -- > 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] Session destroy/unset question - the same session_id is regenerated.
After unsetting and destroying the session, the same sid is generated. is this a normal behaviour? i did this: session_start() //kill session variables unset($_SESSION); session_destroy(); Thanks in advance ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checkbox value
isset($_POST['checkboxname']) or isset($_GET['checkboxname']) depending on the method of your form. a good thing to do is to do var_dump($_POST) or var_dump($_GET) to see all the values posted from the form... hth ken On Thu, 24 Mar 2005 15:42:10 +0200, William Stokes <[EMAIL PROTECTED]> wrote: > Hello, > > I have a checkbox in a form. How can I determine if the user has set the > checkbox on or not? > > Thanks > -Will > > -- > 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
Re: [PHP] convert date format
try preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}))#', $row['date'], $matches); $month = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); $converted_date = $matches[3]." ".$month[$matches[2]]. " ".$matches[1]; untested... On Thu, 24 Mar 2005 12:52:04 +0200, Angelo Zanetti <[EMAIL PROTECTED]> wrote: > hi guys, > > I need to convert a date from this format: 2005-03-25 to 25 mar 2005. > I have tried the mktime, strftime and the date functions but they all > take a time stamp but I only have the dates in the format of 2005-03-25. > > These are what i tried where $row['date'] is 2005-02-24 but they all > return 01 Jan 1970??? > > echo(mktime(0,0,0, date("j", $row['date']), date("M", $row['date']), > date("Y", $row['date']))); > echo(strftime("%d", $row['date']) . " " . strftime("%b", $row['date']). > " " . strftime("%Y", $row['date'])); > echo(date("d",$row['date'] ) . " " . date("M", $row['date']) . " " . > date("Y",$row['date'] )); > > thanks in advance > angelo > > -- > 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] Download Link !
>On Fri, 25 Mar 2005 11:25:09 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> >wrote: > Hello, > > When I purchased a website template from templatemonster.com, they sent > the download link to my email, this link was active for only 2 or 3 days > then it became inactive. > > Now I'm writing a script for selling website templates, the templates > are uploaded to a certain folder, when someone buys a template a > download link must be sent to his/her email address, and must be active > for only 2 or 3 days.. > > Anyone have an idea how to start or where to start? > Any link, any tutorial? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > A quick outline: when a user purchases something, enter an unique string (try md5(microtime()) although it's not completely unique) into the database. make a script that verifies the string... verify.php?unique=12345&user=johndoe in verify.php you'd have something that compares $_GET['unique'] to the database value, same with $_GET['user'] Then if that's good, send the download link. However, I would use headers for downloads. By doing this you can place your template files outside your web directory, which will make it more secure, obviously. if you know how to use pear then i suggest using http_download. if you don't, have a look at the fpassthru bit in the manual. http://www.php.net/fpassthru hth... it was a bit too simple but you have the general idea now :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirection, same host, two domains
On Fri, 25 Mar 2005 11:42:15 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Friday 25 March 2005 11:36, Alexandru Martin wrote: > > Okay, here is my problem. I had a site hosted on a sub domain > > (mysite.domain.com) , now I registered my own domain, mysite.com . The > > thing is mysite.com is still hosted on mysite.domain.com. What i want to > > do is : If people type in their browsers mysite.domain.com redirect to > > mysite.com and if they type mysite.com to display the page. > > I'm guessing it should be something like this : if ( refferer = > > mysite.domain.com ) { redirect to mysite.com } else { my html code } > > This probably would be better accomplished through apache and DNS > > -- > Win a Vespa Scooter or a Dell Gift Card worth $3,000.00 > http://www.morningstarcom.net/raffle-contest.php > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > MailScanner thanks transtec Computers for their support. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > If it's running apache stick this in a file named .htaccess and place it in the web root folder Redirect 301 / http://www.mysite.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header already sent problem
On Fri, 25 Mar 2005 15:03:45 -, AndreaD <[EMAIL PROTECTED]> wrote: > is there an alternative way to suppress the headers already sent problem? > Ob_start/flush is not very neat way to so this. > > AD > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > you can set output_buffering = 4096; or some value you want in your php.ini file. Alternatively try to rearrange your code to make sure that you put all your header() commands BEFORE anything is sent to the browser. Many CMS out there don't use OB as their code are well written so that anything to do with header() is before data sent to browser. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] deleting all my cookies
setcookie("$name",'',time()-3600); cheers On Wed, 30 Mar 2005 15:29:47 +0100, AndreaD <[EMAIL PROTECTED]> wrote: > I have a button that sets a variable when pressed. I then try delete any > cookies using the following code but no joy. > > if (isset($scrub)){ > echo "this works"; > if (isset($_COOKIE['cookie'])) { > foreach ($_COOKIE['cookie'] as $name => $quantity) { > > setcookie($name, ""); > } > } > } > > Please help. Any suggestions welcome. > > AD > > -- > 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
Re: [PHP] getting check box values into an array
On Thu, 31 Mar 2005 12:45:04 +0200, Merlin <[EMAIL PROTECTED]> wrote: > Hi there, > > I am facing a problem in getting all values from a form. > There are loads of input check boxes in there which are named: > x_1, x_2 etc. > > Now I want to get that post data into an array. > > Somehow like this: > for ...{ > $interests[] = $_POST[x_1]; > } > > The problem is that the script does not know how many x there are and it does > not know the number. So how to get them all? > > Has anybody an idea, I am lost on that one. > > Thanx for any hints, > > Merlin > > PS: I know that there is another way in passing the checkbox values, but due > to > some JS reasons I do have to go that way. check the php manual for the function foreach foreach($_POST as $value) { $interests[] = $value; } hth, sorry for the first mail i screwed up :D ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] if question
On Apr 6, 2005 10:47 AM, William Stokes <[EMAIL PROTECTED]> wrote: > > Hello, > > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes > on like this. > > How this can be done? > > Thanks > -Will > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php basically divisble by 3? use the modulus operator. $reminder = $testVariable % 3; if ($reminder == 0) { return true; } HTH
Re: [PHP] Simple array question, array delete
On Apr 6, 2005 3:09 PM, Ryan A <[EMAIL PROTECTED]> wrote: > > Hey, > I have a $data_recs array like this: > > 12 > 445 > 45655 > 4 > 343 > etc > > when the user gives me a number, i have to check if its in the array and > delete that entry...how do i do that? > I have looked at the manual but have gotten confused with array > pop,splice,array_key_exists etc > > Thanks, > Ryan > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php foreach ($array as $key=>$value) { if(strpos($value, $userValue) { unset($array['$key']); } } i believe... not sure if it works or not hope this helps
Re: [PHP] Simple array question, array delete
On Apr 6, 2005 3:27 PM, Ken <[EMAIL PROTECTED]> wrote: > > On Apr 6, 2005 3:09 PM, Ryan A <[EMAIL PROTECTED]> wrote: > > > Hey, > > I have a $data_recs array like this: > > > > 12 > > 445 > > 45655 > > 4 > > 343 > > etc > > > > when the user gives me a number, i have to check if its in the array and > > delete that entry...how do i do that? > > I have looked at the manual but have gotten confused with array > > pop,splice,array_key_exists etc > > > > Thanks, > > Ryan > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Anti-Virus. > > Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > foreach ($array as $key=>$value) > { > if(strpos($value, $userValue) > { > unset($array['$key']); > } > } > > i believe... not sure if it works or not > > hope this helps > > > sorry the if bit is not strpos if ($value == $userValue) { // the unset part here }
[PHP] setcookie ???
On Apr 6, 2005 2:30 PM, William Stokes <[EMAIL PROTECTED]> wrote: > > This doesn't set the cookie? Can you see why? I can't... > > $showbrowseteam = 'somejargon'; > setcookie("showbrowseteam","$showbrowseteam",0,"/"); > > Thanks > -will > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > you've set the cookie time to 0... which is a very long time ago. setcookie("showbrowseteam",$showbroseteam, time()+time_in_seconds,"/"); hth
Re: [PHP] zipfile problems
On Apr 7, 2005 1:54 PM, George Pitcher <[EMAIL PROTECTED]> wrote: > Hi, > > My first posting for a long while. > > If anyone is using the 'class.zipfile.php' library, can they help me. I am > trying to create some PDFs, then zip and email them back to me. > > I get the zipfile but it only contains the first pdf file, even though 4 are > being created in my test site. > > I am getting the following errors on my page: > = > Notice: Undefined variable: crc in C:\Program Files\Apache > Group\Apache2\htdocs\egretgui\includes\class.zipfile.php on line 62 > Notice: Undefined variable: c_len in C:\Program Files\Apache > Group\Apache2\htdocs\egretgui\includes\class.zipfile.php on line 63 > Notice: Undefined variable: unc_len in C:\Program Files\Apache > Group\Apache2\htdocs\egretgui\includes\class.zipfile.php on line 64 > = > > I've looked on the web and can't find any decent documentation for this > class. > > Can anyone help me get round this problem? > > For info, my server is NT4 and I'm using PHP 5.0.2. > > George > > === > > George Pitcher > HERON Technical Manager > Ingenta plc > 23-38 Hythe Bridge Street, Oxford, OX1 2ET > T +44 (0)1865 799051 direct > T +44 (0)1865 799000 switchboard > F +44 (0)1865 799134 > E [EMAIL PROTECTED] > > www.ingenta.com > > Ingenta: Technology + Services for the Publishing and Information Industries > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > That's not really an error... that's just a notice... I think everything should be fine with the script. You might want to try turning off error_reporting in php.ini... Hope this helps... Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
On Apr 8, 2005 4:11 PM, Brad Brevet <[EMAIL PROTECTED]> wrote: > Hi, I am curious how to pass a variable without using something like id=321. > > I have seen sites that have something like > http://www.website.com/something/321 and the variable is passed how exactly > is that done? And is it called something specific so I know how to refer to > it in the future? > > Thanks, > > Brad > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > in fact thats probably for search engine optimization. Try http://www.seochat.com for more details and info. Basically apache will use a thing called the URL rewrite engine (it rewrites URL) to change http://www.website.com/something/321 into probably something like http://www.website.com/index.php?thing=something&number=321. other ways of passing variables by not using URI: cookies session forms... POST / http/1.1 hope this helps... i am sorry if i haven't explained it properly enough. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How get words on a webpage
On Apr 12, 2005 9:07 AM, issin <[EMAIL PROTECTED]> wrote: > Dear all, > >I want get words include "today ** tonight" on > www.XXX.com/index.html, and then show on my webpage. > >Please advise, thanks! > > issin > > Information from NOD32 > This message was checked by NOD32 Antivirus System for Linux Mail Server. > http://www.nod32.com > > Man one thing: RTFM http://www.php.net/echo/ http://www.php.net/printf/ Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How get words on a webpage
On 4/13/05, issin <[EMAIL PROTECTED]> wrote: > Ken, > > Echo and printf can't get words on other webpage. I want get words, > no only show. > Thanks! > > Issin > > -Original Message- > From: Ken [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 12, 2005 3:16 PM > To: issin > Subject: Re: [PHP] How get words on a webpage > > Man > > one thing: RTFM > > http://www.php.net/echo/ > http://www.php.net/printf/ > > On Apr 12, 2005 9:07 AM, issin <[EMAIL PROTECTED]> wrote: > > Dear all, > > > >I want get words include "today ** tonight" on > > www.XXX.com/index.html, and then show on my webpage. > > > >Please advise, thanks! > > > > issin > > > > Information from NOD32 > > This message was checked by NOD32 Antivirus System for Linux Mail Server. > > http://www.nod32.com > > > > > > Information from NOD32 > This message was checked by NOD32 Antivirus System for Linux Mail Server. > http://www.nod32.com > ahhh! I get your drift now. you can do so by using fopen $fp = fopen("http://www.XXX.com/index.html";, r); $contents = fread($fp, 1000); fclose($fp);' then use string functions or regexp to search $contents for what you want. HTH. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email through PHP
On 19 Apr 2005 15:04:08 +0530, Balwant Singh <[EMAIL PROTECTED]> wrote: > hi, > > I am using FEDORA 3 and PHP. I want to send email to outside by my above > mentioned linux machine through PHP. For this i want to use my SMTP > sever, which is on a WINDOWS machine > > Please inform what setting to be done in php.ini or any other file to > send the email. > > with best wishes > balwant > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > erm, isn't it easier to have the smtp on your fedora box instead...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last visitors
On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > Hey, > Am a bit puzzled as to how to do this, I am modifying a profiles/dating > site, the site works like this: > if you are a "guest" you can see only limited details of a profile, if you > have logged in, you see many more details. > > On the profile page there should be "last 10 visitors", it will not register > the guests, but if someone had logged in and visited your profile, it should > show their usernameif there are 10 enteries in the db and when the 11th > person comes...then the first person who came should be "bumped" off and the > 11th person takes his place and so on > > I hope i have explained it well, I dont think many of you even needed that > long explanation as you might have already seen this on many sites and knew > what i was talking about by the second line, but better more infomation than > less right? > > Any ideas, links,code or classes on how i can implement this? > > Thanks, > Ryan > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Instead of having a seperate table to see the latest people logged on, isn't it better to query an existing user table based on the last login time? SELECT username from users ORDER BY login_time DESC LIMIT 10? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Last visitors
On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > > >> the site works like this: > > > if you are a "guest" you can see only limited details of a profile, if > > you > > > have logged in, you see many more details. > > > On the profile page there should be "last 10 visitors", it will not > > register > > > the guests, but if someone had logged in and visited your profile, it > > should > > > show their usernameif there are 10 enteries in the db and when the > > 11th > > > > > person comes...then the first person who came should be "bumped" off and > > the > > > 11th person takes his place and so on > > > > Instead of having a seperate table to see the latest people logged on, > isn't it better to query an existing user table based on the last > login time? > > SELECT username from users ORDER BY login_time DESC LIMIT 10? > > > I am not checking for the last people logged in, I want to see the last > people who have viewed the profile... > each profile will have its own last "10 people visited" > > Thanks, > Ryan > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005 > > ah! i see. sorry for misunderstanding you. perhaps on the script for the profiles page, the logic should be like: profile for user: adam if the browsing user is logged in: (for example the browsing user is ben) insert into the database that ben has seen adam's profile end if and your table in the database can be: user visitor time_of_visit adam ben 1290122141 (unix timestamp) then you can query it on the database for each user. SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit DESC LIMIT 10 As for cleaning up... that's the bit that I can't figure out myself :(. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last visitors
On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > > I am not checking for the last people logged in, I want to see the last > > people who have viewed the profile... > > each profile will have its own last "10 people visited" > > /* > ah! i see. sorry for misunderstanding you. > perhaps on the script for the profiles page, the logic should be like: > > profile for user: adam > > if the browsing user is logged in: (for example the browsing user is ben) > insert into the database that ben has seen adam's profile > end if > > and your table in the database can be: > > user visitor time_of_visit > adam ben 1290122141 (unix timestamp) > > then you can query it on the database for each user. > > SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit > DESC LIMIT 10 > As for cleaning up... that's the bit that I can't figure out myself :(. > */ > > Hey, > Thanks for replying. > > > ah! i see. sorry for misunderstanding you. > > No problem, I guess i didnt explain it well enough, and you dont have to > help me but you are trying, so thank you. > > > As for cleaning up... that's the bit that I can't figure out myself :(. > > exactly, I came to the same part as youbut then i would have a LOT of > wasted records without the cleanup... just cant figure it out. > > Thanks, > Ryan > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005 > > Well... I had a thought... you can do a count query SELECT user, count(visitor) as visitor_count FROM profile_visit GROUP BY user; then you have a recordset like... user count(visitor) adam 9 ben 12 grab the recordset in php while($object= mysql_fetch_object($result)) { if($object->visitor_count > 10) { //SELECT the least recent visit_time $query = "SELECT visit_time FROM profile_visit WHERE user=' " .$object->user. " ' LIMIT 9,10"; $result = mysql_query($query); list($visit_time) = mysql_fetch_row($result); //DELETE anything that is less recent than $visit_time, the visit time for anything before the 10th most recent visit. $query = "DELETE FROM profile_visit WHERE user=' " .$object->user." AND visit_time < '$visit_time'"; } } it's probably not very streamlined, but it should work. Try posting on devshed as well. They are very quick and good with this kind of stuff forums.devshed.com HTH Ken execute this in cron, once a day or something like that... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last visitors
what if you have something like 1000 users on your system. you'd have 1000 txt files! :( the DB seems to be a better idea as it's probably more expandable... you can do other queries to it and stuff... whereas 1000 txt files will be a pain in the butt to keep track of. On 4/19/05, Ryan A <[EMAIL PROTECTED]> wrote: > Hey, > > > As to exactly how you decide which are the most recent 10 records to do > > > > this deletion, that is a little more complex. > > Yep, for sure > > > > Something like > > > > DELETE FROM profile_visits > > > > WHERE user='billy' > > > > AND time_of_visit NOT IN ( > > > > Select time_of_visit > > > > FROM > > > > profile_visits > > > > WHERE user='billy' > > > > ORDER by time_of_visit DESC LIMIT 10 > > > > ) > > > > > > > > Should give you an idea. > > Yep, gets me thinking in a few other directions... > > I am also toying with the idea of having a txt file for each profile > (instead of using the DB) and fetch/record/delete/update the last 10 > there... what do you think? easier? > > Thanks, > Ryan > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005 > > -- > 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
Re: [PHP] Line feed in a echo
On 4/26/05, Andri Heryandi <[EMAIL PROTECTED]> wrote: > Use echo "something "; > > is that what you mean? > > > Mario de Frutos Dieguez wrote: > > > How can i make a line feed in a echo instruction? like printf("foo\n"); > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > you can do it by using echo as well: echo "This is a line feed\n"; or a carriage return echo "this is a carriage return\r"; check out http://www.php.net/strings Hope this helps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Line feed in a echo
On 4/26/05, Ken <[EMAIL PROTECTED]> wrote: > On 4/26/05, Andri Heryandi <[EMAIL PROTECTED]> wrote: > > Use echo "something "; > > > > is that what you mean? > > > > > > Mario de Frutos Dieguez wrote: > > > > > How can i make a line feed in a echo instruction? like printf("foo\n"); > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > you can do it by using echo as well: > > echo "This is a line feed\n"; > or a carriage return > echo "this is a carriage return\r"; > > check out http://www.php.net/strings > > Hope this helps > i meant this URI: http://se2.php.net/manual/en/language.types.string.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Line feed in a echo
On 4/26/05, Mario de Frutos Dieguez <[EMAIL PROTECTED]> wrote: > Andri Heryandi escribió: > > > Use echo "something "; > > > > is that what you mean? > > > > > > Mario de Frutos Dieguez wrote: > > > >> How can i make a line feed in a echo instruction? like printf("foo\n"); > >> > > > yes that's it thx > > -- > Mario de Frutos Dieguez > > División de Ingeniería del Software > y Comunicaciones > > CARTIF -Parque Tecnológico Boecillo > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > in that case i suggest using instead as that is valid xhtml 1.0. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] number of cookies and if there are any cookies set?
On 4/26/05, AndreaD <[EMAIL PROTECTED]> wrote: > I need two bits of info... > > (i) Are there ANY cookies set? > > (ii) How many cookies are set? > > how do I find this information out? > > AD > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > you can access cookies by using the superglobal variable (as an array) $_COOKIE. if ( isset($_COOKIE['cookiename']) ) { // do some stuff. cookie with cookiename is set. } i don't know the best method to check how many cookies are set but i guess you count the array $_COOKIE. $number = count($_COOKIE) hope this helps. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] _$ variable
Please somebody tell me what _$ (start from underscore) variable means. I'm trying to find it from PHP.NET, but I cannot find that.
[PHP] using cookies
Hi there, I have never used cookies before, however I am trying to implement them to make things a little more secure. Rather than passing a sql statement via a hidden input tag I am setting a cookie. This works fine except that when I look at the sql after it is pulled from the cookie everything is escaped, for instance. SELECT * FROM inventory WHERE name='Watches' would become SELECT manufacturer FROM inventory WHERE name=\'Watches\' This is a problem cause trying to use preg_replace doesn't seem to work. I get an error saying that the delimeter must not be a \. What a bummer. I am a little stuck. I will take any suggestions. Maybe I am just going about things the wrong way. *** Shrug *** Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning data from a function in a class
Hi there, I am totally new at classes and oop... I have never done any object oriented stuff before so I don't know if my question is a php one, a browser issue or an oop one but here goes. I am writing a class that deals with members for a site (I know there are examples on the web, I have used pieces parts from them...) and things seem to be going ok (actually better than OK, I have totally amazed myself so far). but I have one issue. I have a function in the class that returns the session ID if there is a valid session. otherwise it returns 0. This function works fine in IE6 however fails in mozilla or lynx. I have NO idea why and can't seem to figure out where to even start. I would really appreciate any advice. I have included the code snippits below. -- from class.session_logger.php -- function is_logged_in() { session_start(); $this->current_session_id=session_id(); $db_vars = new db_vars; @$sql_connection = mysql_connect($db_vars->db_server, $db_vars->db_user, $db_vars->db_pass); if($sql_connection) { $db_connection = mysql_select_db($db_vars- >db_dbname, $sql_connection); $sql_query = "select sessionid from session where sessionid='$this->current_session_id'"; $query_result = mysql_query($sql_query); if($row=mysql_fetch_array($query_result, MYSQL_ASSOC)) { return $row[sessionid]; } else { return 0; } } } --- --- how I have calling this - $session_logger = new session_logger; $session_id=$session_logger->is_logged_in(); //echos the session id in IE6, echos 0 in Mozilla ??? echo(" la la la $session_id>"); - Thanks kenn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_destroy problem
Hi there, I have written a class that manages sessions. I have never used sessions before so all this is new to me. Everything works fine as far as starting the session and logging in however when I call sessoin destroy it doesn't seem to work the function returns 1 as it should if all goes well however if I go to another page and do some other browsing even if I close the browser the session still hangs around. Is there something I don't know about sessions? I have read the documentation on the session_destroy function, I don't think that I am missing anything... Anyone have any suggestions? I am totally confused. Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session_destroy problem
Hi there, So it is the browsers problem. I tested what you said and Mozilla acts as you stated and IE does as well. I guess my question is. Is there no way to close clear out the session when the user logs out? The way I set things up the class that I wrote just gets the current sessionid and does a select from the database to see if it has been logged. The problem this creates is that someone could sit down and reopen a browser and have access to the site as if they where logged because the session is not gone. Hmm - Like a said I have never used sessions before so I am learning about them. Thank you for your input... Ken > What browser are you running? I find that IE drops the session when > you close the browser window actively working the site. On Mozilla I > have to close every instance of Mozilla regardless of the site before > it drops the session. Pretty aggravating so I'm going to have to start > working on a method based on responses to your post. > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > -Original Message- > From: Ken Nagorski [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 09, 2003 1:35 AM > To: [EMAIL PROTECTED] > Subject: [PHP] session_destroy problem > > Hi there, > > I have written a class that manages sessions. I have never used > sessions before so all this is new to me. Everything works fine as far > as starting the session and logging in however when I call sessoin > destroy it doesn't seem to work the function returns 1 as it should if > all goes well however if I go to another page and do some other > browsing even if I close the browser the session still hangs around. Is > there something I don't know about sessions? I have read the > documentation on the session_destroy function, I don't think that I am > missing anything... > > Anyone have any suggestions? I am totally confused. > > Thanks > Ken > > > > > -- > 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] Read values from Text Area Box
Hi, there. (B (BI'm trying to find out how to get multiple values from text area box (B. (B (B (BValues are like this. (B (Baaa\n (Bbbb\n (Bccc\n (Bddd\n (Beee\n (B (BI need to take "\n" from each value and put all the values to array. (B (B (BPlease advise me if anyone knows about this. (B (B (BSincerely, (B (B (BKEN
[PHP] help with cURL
The latest version of curl has a problem with certain SSL certificates. The cURL commandline added a -k option to override the problem. Is there a PHP CURL_something foe curl_setopt to do the same override? Ken - This mail sent through IMP: http://horde.org/imp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Referral Site...
I'm new to PHP and so this may be something of a newbie question. My bad if it is. I've spent a week now looking for information on capturing the referral site with php so that I can store it with some session information. If any of you have any idea how to accomplish this I would greatly appreciate any information. Thanks in advance...Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scripts not running on OS X 10.3
I can't get even the test script to run on my Mac. I turned personal web sharing on, checked the httpd.config file (all is well) type 127.0.0.1/test.php in the browser and get a "source view" of the page (ie: shows up in the browser winbdow). What am I doing wrong? Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts not running on OS X 10.3
I can't get even the test script to run on my Mac. I turned personal web sharing on, checked the httpd.config file (all is well) type 127.0.0.1/test.php in the browser and get a "source view" of the page (ie: shows up in the browser winbdow). What am I doing wrong? Thanks Ken > Got a line like this in your httpd.conf? > AddType application/x-httpd-php .php Yeah. both of these are uncommented in httpd.conf: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts not running on OS X 10.3
Ken Tozier wrote: I can't get even the test script to run on my Mac. I turned personal web sharing on, checked the httpd.config file (all is well) type 127.0.0.1/test.php in the browser and get a "source view" of the page (ie: shows up in the browser winbdow). What am I doing wrong? Thanks Ken > Got a line like this in your httpd.conf? > AddType application/x-httpd-php .php Yeah. both of these are uncommented in httpd.conf: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps Restarted Apache? Yep. same result. Possibly have another httpd.conf file that Apache is reading? Possibly. I used the package installer from Marc liyannage's web site which seems to have done something odd to the httpd.conf file but I don't know enough unix yet to fix it without possibly screwing up. there are the following config files in the /private/etc/httpd directory: httpd.conf httpd.conf.applesaved httpd.conf.bak httpd.conf.default httpd.conf.entropy-backup.1059884513 httpd.conf.entropy-temp In addition to these, there is another config file named "httpd.conf.php" in the "/usr/local/php/" directory Which one Apache is using is a mystery to me. Anything in the error logs when you start Apache? No. this appears to be in order. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts not running on OS X 10.3
Odd. To be sure it's using the conf file you want, have you tried starting Apache with the command.? /path/to/httpd -f /path/to/httpd.conf I tried your suggestion but the system won't let me modify it even with su permissions. I'm too tired and frustrated to continue tonight. Clearly, the installer must have messed something important up so I'm just going to reinstall Panther tomorrow (have to partition my drive anyway so what the heck) Thanks for all your help. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String display issue
I am writing an application where users will input information such as 6' section of 3/4" pipe How can I get the whole line to show up on the screen when both single and double quotes are contained in the text string. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions simply don't work
I'm getting this message all the the time I try to start a session with session_start. Cannot send session cookie - headers already sent It's the first line of code in the file. I'm even getting the error with a single session_start() function on its own in a file. It fails on Apache on my intranet and IIS after being uploaded to a web server. The browser is set to recieve cookies. All the books say it should work. Has anybody any ideas? I've wasted a whole day on this joker! Ken Lee. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/Postgresql problem
I am trying to get PHP to work with an instance of postgresql on a server. There is already one, 'proprietary' postgresql running with its own user, own group and own (not default) port. The postgresql I am installing will be used for several database projects. following are my config/makes and the results: Postgres (7.3.5) configures, compiles and installs cleanly with: ./configure --enable-odbc --enable-tcl --enable-locale --with-python --with- perl --with-readline make; make install At which point I can create users and databases and connect to them with the command-line tools. PHP configures and compiles cleanly with: ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql --with- pgsql=/usr/local/pgsql --with-gettext --with-ldap --without-imap --enable- sigchild --enable-force-cgi-redirect make However make test (or make install and attempt to use it) yield the follow flow of messages: PHP Warning: Function registration failed - duplicate name - pg_connect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - pg_pconnect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - pg_close in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - pg_connection_status in Unknown on line 0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/Postgresql problem
I am trying to get PHP to work with an instance of postgresql on a server. There is already one, 'proprietary' postgresql running with its own user, own group and own (not default) port. The postgresql I am installing will be used for several database projects. following are my config/makes and the results: Postgres (7.3.5) configures, compiles and installs cleanly with: ./configure --enable-odbc --enable-tcl --enable-locale --with-python --with- perl --with-readline make; make install At which point I can create users and databases and connect to them with the command-line tools. PHP configures and compiles cleanly with: ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql --with- pgsql=/usr/local/pgsql --with-gettext --with-ldap --without-imap --enable- sigchild --enable-force-cgi-redirect make However make test (or make install and attempt to use it) yield the follow flow of messages: PHP Warning: Function registration failed - duplicate name - pg_connect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - pg_pconnect in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - pg_close in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - pg_connection_status in Unknown on line 0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Command output into any array?
Hello, Is it possible to have the contents of a shell_exec command go into an array? I have the following in my PHP script: Which calls a shell script "dirlist.sh", which returns results similar to the following: www www/docs www/test Is it possible to have each line put into an array? so that it would look like: $results = array("www", "www/docs", "www/test"); The shell script has dynamic output, so the number of lines, and line content wouldn't be the same on every execution. I would like to use a foreach loop to put the output from the script into a form, so I am just wondering if the command/array scenerio is possible. Thank you for any help, Ken Jansons E-Mail: [EMAIL PROTECTED]
[PHP] Object Copying
As we all know, this copies an object in PHP: $obj2 = $obj1 Assuming $obj1 is an object (of a class). I want this never, ever to happen unless I want it to. All the time, I run into something where PHP made a copy of my object for X odd reason -- I pass an object to a function, I put it in an array, etc etc etc. Is there a way I can have PHP warn me if an object is copied, or put that in the class code somehow? Preferable a way to fix PHP not to copy the object, but the reference. I'd settle for a warning system though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Specific References Incident
I have one specific incident I could use some help with too. I have the following method: function validate() { if ($this->returning) { $errors = array(); foreach ($this->children as $child) { $child->error = "Foo"; $error = $child->validate(); if ($error) { $this->errors_exist = 1; array_push ($errors, $error); } } } $this->errors = $errors; } The $this->children attribute should be an array of (references to) objects. I think somehow in the foreach ($this->children as $child) the objects are being copied, as $child->validate(); seems not to effect the original objects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Specific References Incident
That's what I had thought too, but no: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/ken/Projects/kwidgets/widgets.inc on line 74 On Thursday 10 January 2002 04:51 pm, Martin Towell wrote: > does this work?? change > foreach ($this->children as $child) { > to > foreach ($this->children as &$child) { > > > -Original Message- > From: Ken Kinder [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 11, 2002 10:44 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Specific References Incident > > > I have one specific incident I could use some help with too. I have the > following method: > > function validate() { > if ($this->returning) { > $errors = array(); > > foreach ($this->children as $child) { > $child->error = "Foo"; > $error = $child->validate(); > if ($error) { > $this->errors_exist = 1; > array_push ($errors, $error); > } > } > } > > $this->errors = $errors; > } > > The $this->children attribute should be an array of (references to) > objects. > > I think somehow in the foreach ($this->children as $child) the objects are > being copied, as $child->validate(); seems not to effect the original > objects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Specific References Incident
Negative. On Thursday 10 January 2002 04:54 pm, Mark wrote: > On Thu, 10 Jan 2002 16:49:45 -0700, Ken Kinder wrote: > >That's what I had thought too, but no: > > > >Parse error: parse error, expecting `T_VARIABLE' or `'$'' in > >/home/ken/Projects/kwidgets/widgets.inc on line 74 > > how about this: > foreach ($this->children as $key => $value) { > $child=&$this->children[$key]; > > >On Thursday 10 January 2002 04:51 pm, Martin Towell wrote: > >> does this work?? change > >>foreach ($this->children as $child) { > >> to > >>foreach ($this->children as &$child) { > >> > >> > >> -Original Message- > >> From: Ken Kinder [mailto:[EMAIL PROTECTED]] > >> Sent: Friday, January 11, 2002 10:44 AM > >> To: [EMAIL PROTECTED] > >> Subject: [PHP] Specific References Incident > >> > >> > >> I have one specific incident I could use some help with too. I > >>have the > >> following method: > >> > >> function validate() { > >> if ($this->returning) { > >>$errors = array(); > >> > >>foreach ($this->children as $child) { > >> $child->error = "Foo"; > >> $error = $child->validate(); > >> if ($error) { > >> $this->errors_exist = 1; > >> array_push ($errors, $error); > >> } > >>} > >> } > >> > >> $this->errors = $errors; > >> } > >> > >> The $this->children attribute should be an array of (references > > to) > > >> objects. > >> > >> I think somehow in the foreach ($this->children as $child) the > >>objects are > >> being copied, as $child->validate(); seems not to effect the > >>original > >> objects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Second newbie question
I have a second newbie question, and I promise I really did try to find this in the docs. Is there a method that can be called when an attribute or method is called that doesn't exist? A catch-all method? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Specific References Incident
Nope. Tried that too. On Thursday 10 January 2002 05:18 pm, Rasmus Lerdorf wrote: > Use a while(list()=each()) loop. > > On Thu, 10 Jan 2002, Ken Kinder wrote: > > Negative. > > > > On Thursday 10 January 2002 04:54 pm, Mark wrote: > > > On Thu, 10 Jan 2002 16:49:45 -0700, Ken Kinder wrote: > > > >That's what I had thought too, but no: > > > > > > > >Parse error: parse error, expecting `T_VARIABLE' or `'$'' in > > > >/home/ken/Projects/kwidgets/widgets.inc on line 74 > > > > > > how about this: > > > foreach ($this->children as $key => $value) { > > > $child=&$this->children[$key]; > > > > > > >On Thursday 10 January 2002 04:51 pm, Martin Towell wrote: > > > >> does this work?? change > > > >>foreach ($this->children as $child) { > > > >> to > > > >>foreach ($this->children as &$child) { > > > >> > > > >> > > > >> -Original Message- > > > >> From: Ken Kinder [mailto:[EMAIL PROTECTED]] > > > >> Sent: Friday, January 11, 2002 10:44 AM > > > >> To: [EMAIL PROTECTED] > > > >> Subject: [PHP] Specific References Incident > > > >> > > > >> > > > >> I have one specific incident I could use some help with too. I > > > >>have the > > > >> following method: > > > >> > > > >> function validate() { > > > >> if ($this->returning) { > > > >>$errors = array(); > > > >> > > > >>foreach ($this->children as $child) { > > > >> $child->error = "Foo"; > > > >> $error = $child->validate(); > > > >> if ($error) { > > > >> $this->errors_exist = 1; > > > >> array_push ($errors, $error); > > > >> } > > > >>} > > > >> } > > > >> > > > >> $this->errors = $errors; > > > >> } > > > >> > > > >> The $this->children attribute should be an array of (references > > > > > > to) > > > > > > >> objects. > > > >> > > > >> I think somehow in the foreach ($this->children as $child) the > > > >>objects are > > > >> being copied, as $child->validate(); seems not to effect the > > > >>original > > > >> objects. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] FYI: Specific References Incident
>From PHP Cookbook: for ($c = 0; $c < count($topics); $c++) { ... } Only way to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: counting with dates (help!)
Another macro language I used had a newdate function. Pass it a data and an offset in number of days and it would return the new date. I duplicated it in php here: function newdate( $strdate, $ndays) { # strtotime doesn't like dashes $strdate = str_replace("-","/",$strdate); $temp = strtotime($strdate); $n = $ndays * 24 * 60 * 60; $n2 = $temp + $n; return( date("Y-m-d", $n2 )); # return(date("m/d/Y", $n2 )); } Ken Gregg Enhanced Data Systems, Inc. http://www.rwre.com for the best in Southwest Oregon Real Estate Sander Peters wrote: > Hello, > > This is my problem: > > $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y))); > $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y))); > echo ($today - $last_week); > The result is a number like 8876 (20020107-20011231 = 8876) > But in date thinking it should be 7! > > How can I let php count in real days/month/years in stead of numbers? > > Maybe this is a silly question, but anyone who has the answer would help > me very much! > > Thanks in advance! > > -- > Met vriendelijke groet / With Greetings, > > Sander Peters > >site: http://www.visionnet.nl/ > email: mailto:[EMAIL PROTECTED] > webmail: mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] open php as stream
This is a tough one to explain but here goes. Running php as cgi on apache. I am converting from FirstBase (cgi macro processor) to php and I need to process a php script from Firstbase running as a cgi program. The problem is php ignores the command line (-f and script parameters) passed in popen and tries to process my firstbase script instead. fb is very close to php so here is my FirstBase script: { chdir( path_dir ); fh = popen( "/usr/local/bin/php -f wzdownload.php", "r"); if (fh < 0) { print( "failed to open stream" ); exit(); } while (fgets(buf, 4096, fh) > 0) { print( buf ); print( "" ); } pclose( fh ) } Any ideas as to how to work around this? Thanks in advance Ken Gregg Enhanced Data Systems, Inc. http://www.rwre.com for the best in Southwest Oregon Real Estate -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: foreach array into mail isn´t working
Blank lines are important to the parsing of mail messages. File does not strip newlines. Try your code and strip the newlines off the email addresses. If you still have problems try it and drop the newlines from the subject. Ken Gregg Enhanced Data Systems, Inc. http://www.rwre.com for the best in Southwest Oregon Real Estate "Josepablo PéRez" wrote: > Hello people, > > I got this script: > > $maildb = file("mailaddr.txt"); > > foreach ($maildb as $address) > { mail($address, "THis is the subject\n", "This is the message\n", "From: >[EMAIL PROTECTED]\n"); } > ?> > > The mailaddr.txt looks like: > > [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > However the script does send mails BUT they look like this: > > From Nobody <[EMAIL PROTECTED]> > To [EMAIL PROTECTED] > Subject [No Subject] > > **From here down is the message body*** > > Subject THis is the subject > From: [EMAIL PROTECTED] > > This is the message > > Anybody have an idea why?? I tried it on 2 servers running PHP4 doesnt work, however >i also tried using the mail(...) i used up there but alone and that does work.. so >the array is screwing something up.. > > Josepablo Pérez > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Trouble w/Apache PHP on WinME
I am doing some php development and testing it on my WinME system. I have Apache installed and the only way I can get anything to execute is with a shebang at the beginning of the file. Then the shebang is printed in the page:( Anyone know how to get around this. I don't have this trouble with ASP pages. Thanks -Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php