Re: [PHP] file uploads problem
Just a comment... On Tuesday, September 24, 2002 1:39 PM Jaski wrote: > I tried to copy this file using > move_uploaded_file($userfile, "/place/to/put/uploaded/file"); > > and here a strange thing happened. The file was successfully > copied BUT it had permissions like -rw-- which I interpret as > only accessible to root. I tried copy() function instead and it > failed. > ...having that "permission" doesn't necessarily mean that it's only accessible to root--unless of course you're running Apache as root, which I doubt you'd do. Anyway, if the file was successfully copied why not just try to open it there? - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session & cookies
Jeff, One quick thought ... Is your cookie domain the same domain as the URL domain you are using to test this? If not, the browser will not send the cookie, so that is a potential reason for this behavior. If the domain is the same, I see no reason why this shouldn't work, but I have two ideas you can try. 1. Rather than using the name of the cookie, try this on the receiving page: This should dump the entire array to the screen and would reveal any naming problems. 2. View the HTTP transactions themselves to make sure the proper Set-Cookie and Cookie headers are being used. There are several utilities that can help do this, and I recently wrote one in PHP (it's a quick hack though) you can get at http://protoscope.org/. The messages of interest are the original HTTP response from your Web server (which should contain the Set-Cookie header) and any future HTTP request (which should contain the Cookie header). This is the most reliable way to really analyze these types of problems. Hopefully these ideas will help uncover something. Chris Jeff Bluemel wrote: >ok - no cookie exists... I have Netscape set to accept all cookies. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] file uploads problem
Thanks .. but I think you are saying exactly what I wrote I was doing .. except that you have used exec("cp $file $path") while I tried PHP's copy() function .. I don't think that will make a difference...though will give that a try any way. Forgot to mention in my previous mail that the directory where I am trying to copy the uploaded file from /tmp is in 777 mode already. Jaski On Tue, 24 Sep 2002 Oscar F wrote : >Try: > >$upload = "/path/to/copy/"; >$upload_path = "$upload/$file_filename"; >if (is_uploaded_file($file)) { >Exec("cp $filename $upload_path"); >} > >Then you have the file at /path/to/copy/, and you can >do whatever you want with it. (I'm assuming the file field of the >form is called "file", and that /path/to/copy/ has permissions >set so that PHP can write to it, 777 will work for sure, but I'm >not 100% positive which one would be best due to security and >stuff.). > >HTH. Oscar.- > >Jaski wrote: > >>Hi, >>(Linux RH 7.1, Apache/1.3.22, PHP 4.0.6). >> >>I am trying to write a script to send emails. It needs to >>support attachments. The point where I am stuck is after the >>file to be attached gets uploaded to /tmp as /tmp/tempfilename >>thorough an HTTP POST form. >> >>I am not able to open that file directly .. follwing error shows >>up. >> >>Warning: fopen("/tmp/phpOaILXx","rb") - Operation not >>permitted in >>/var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php >>on line 254 >> >> >>I tried to copy this file using >>move_uploaded_file($userfile, "/place/to/put/uploaded/file"); >> >>and here a strange thing happened. The file was successfully >>copied BUT it had permissions like -rw-- which I interpret >>as only accessible to root. I tried copy() function instead and >>it failed. >> >> >>I think I have tried every thing I could think of .. so please >>HELP :) >> >>jaski >> >>NP. I am subscribed to the digest version so kindly cc any >>replies to me as well. Thanks. >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session & cookies
ok - no cookie exists... I have Netscape set to accept all cookies. I'm wondering if it is in my link, or if it is a configuration error somewhere. here is a copy of the session options from my php.ini (as copied from Zend Server Center) Session data handler files Session save path/tmp Use cookies to store session ID On Session name DomIntCom Session auto start Off Cookie lifetime0 Cookie path /tmp Cookie domain xxx.xxx.xxx Session handler for serializing data php Garbage collection probability 1 Maximum lifetime of data 1440 HTTP referrer check Empty Session entropy length 0 Session entropy file /dev/urandom Session cache control method nocache Session cache expiration 180 Session use transient sid transport On "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Jeff, > > My apologies then. Somehow your response never arrived. It is still best > to always "reply all" for things like this. You get the benefit of > hearing several people's perspectives, and you also potentially help > others who have the same question now or who may have it in the future > (and check the list archives). > > Anyway, back to your problem ... > > Jeff Bluemel wrote: > > >what I mean by this is it was my understanding when reading the sessions > >doc's that there was a way to for the system to use a stored system ID > >stored in an SID, but the information wouldn't be sent to the browser, but > >be stored in a cookie. > > > > Cookies are stored on the client, so they are also sent to the browser. > > Basically, the unique identifier (e.g., PHPSESSID) must be provided by > the Web client in order for it to be associated with previous requests. > The two most common methods of this are for it to send this information > in a cookie (there is a Cookie header in the HTTP request) or as part of > the query string in a URL (such as > http://www.example.org/index.php?PHPSESSID=123456789) that it is requesting. > > >>With use_trans_sid set, PHP is going to append the session ID to the URL > >>of links, etc., on: > >> > >> > >I tried setting the user_trans_sid = 0, but it still will not use a cookie. > >it doesn't appear to change anything when I play with these settings. > > > > Right. I was explaining (poorly looking back) what the use_trans_sid > does. Basically, the idea is that the developer doesn't have to worry > about how the unique identifier is passed back. This is the "easiest" > way to use session management, because it is transparent for the most > part. PHP will try both cookie and URL methods to maintain the unique > identifier, and it will use only a cookie once it can determine that the > client supports them. > > You are having a problem, it sounds like, with the Web client *not* > sending back the cookie in subsequent requests. Thus, use_trans_sid will > append the unique identifier to the URL every time, as it believes the > client to not be supporting cookies (which might just be your problem). > When you combine this with use_only_cookies (sp?), you are basically > telling PHP to ignore the unique identifier if it is sent on the URL. > Thus, it is not receiving the cookie, and it is being instructed to not > use the URL variable. It has no way to identify the client and maintain > state. > > Your problem boils down to one thing: the cookie is not getting passed > back. Focus on this initially. Make sure your Web browser is accepting > the cookie (you can configure most browsers to warn you before accepting > a cookie, so that you can be certain it is being set), and try to make > sure your PHP script is receiving the cookie like it thinks it should > be. For example, if the cookie is named PHPSESSID, try this: > > echo "cookie is [" . $_COOKIE["PHPSESSID"] . "]"; > ?> > > If ths cookie is blank (e.g., "cookie is []"), you have identified your > problem. Hopefully this will help you solve it. > > Happy hacking. > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file uploads problem
Try: $upload = "/path/to/copy/"; $upload_path = "$upload/$file_filename"; if (is_uploaded_file($file)) { Exec("cp $filename $upload_path"); } Then you have the file at /path/to/copy/, and you can do whatever you want with it. (I'm assuming the file field of the form is called "file", and that /path/to/copy/ has permissions set so that PHP can write to it, 777 will work for sure, but I'm not 100% positive which one would be best due to security and stuff.). HTH. Oscar.- Jaski wrote: > Hi, > (Linux RH 7.1, Apache/1.3.22, PHP 4.0.6). > > I am trying to write a script to send emails. It needs to support > attachments. The point where I am stuck is after the file to be > attached gets uploaded to /tmp as /tmp/tempfilename thorough an HTTP > POST form. > > I am not able to open that file directly .. follwing error shows up. > > Warning: fopen("/tmp/phpOaILXx","rb") - Operation not > permitted in > /var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php > on line 254 > > > I tried to copy this file using > move_uploaded_file($userfile, "/place/to/put/uploaded/file"); > > and here a strange thing happened. The file was successfully copied > BUT it had permissions like -rw-- which I interpret as only > accessible to root. I tried copy() function instead and it failed. > > > I think I have tried every thing I could think of .. so please HELP :) > > jaski > > NP. I am subscribed to the digest version so kindly cc any replies to > me as well. Thanks. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mail problem with more than 1k users
on 24/09/02 2:12 PM, Peter J. Schoenster ([EMAIL PROTECTED]) wrote: > Eeks. I hate that. I hate email that does not indicate it knows who > I am. Why is sending one email to one user so bad? I can't think of a > reason that would trump the personalization that I like so much. But > I'm all ears. I hate it too, but the complications of personalised email really do outweigh the benefits, unless you're prepared for: a) long development time b) constantly hitting the "ceiling" of your code/server limits and having to re-evaluate the code ("it worked for 1000, but now i have 3000", etc) c) placing HUGE burdens on the server Bulk mail in a personalised manner should be done with dedicated software and a dedicated server... I think it's a little wishful to place such burdens on a WEB server... especially one which is a shared server. Even if the code does work, the sysadmin should shut it down to prevent the massive performance hit you cause. If you've got your own server(s), that's a different story... but then I'd be using ezmlm or something like that. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file uploads problem
Hi, (Linux RH 7.1, Apache/1.3.22, PHP 4.0.6). I am trying to write a script to send emails. It needs to support attachments. The point where I am stuck is after the file to be attached gets uploaded to /tmp as /tmp/tempfilename thorough an HTTP POST form. I am not able to open that file directly .. follwing error shows up. Warning: fopen("/tmp/phpOaILXx","rb") - Operation not permitted in /var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php on line 254 I tried to copy this file using move_uploaded_file($userfile, "/place/to/put/uploaded/file"); and here a strange thing happened. The file was successfully copied BUT it had permissions like -rw-- which I interpret as only accessible to root. I tried copy() function instead and it failed. I think I have tried every thing I could think of .. so please HELP :) jaski NP. I am subscribed to the digest version so kindly cc any replies to me as well. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail problem with more than 1k users
I started dealing with this several years ago using Perl. The closest I got with sendmail was to check that the call worked, and if it didn't try again up to 5 times. For me, bottom line, if you want to do what you are trying to do, use something besides sendmail. I switched to Qmail, and have successfully sent 15,000+ personalized messages, one at a time, with both Perl and PHP. (It takes a couple hours, but it does work.) Of course I only send opt in email, and I hope you are doing the same, as spam is always evil. :) HTH, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Research and Development" <[EMAIL PROTECTED]>; "PHP General List" <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 7:57 PM Subject: Re: [PHP] Mail problem with more than 1k users > This gets discussed quite frequently. > > My guess is that your ISP *may* be imposing some limitations, but more > likely your PHP script is timing out or something similar. > > Justin > > > on 24/09/02 9:08 AM, Research and Development ([EMAIL PROTECTED]) wrote: > > > Hello. I wrote a PHP script that will pull records from a database > > (emails) and then mail something to the emails in the result set. > > Pretty simple and it worked. > > > > Now that the database has over 1 thousand records I began to experience > > performance problems. I figured that my problem was that Sendmail does > > not process emails that have more than x number of emails. > > > > So I re-designed the script to send emails in parts. 500 emails per > > header. But after the database reached more than 3,000 records the > > emailing did not work at all. Sendmail refused to send to any of the > > emails in the database result set. > > > > Any thoughts? > > > > > -- > 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] Maybe a stupid question but can it be done?
> if the 2 tables have the same name can't he just go > > INSERT INTO table1, table2 (table1.name=$name, table2.name=$name ... > blah); > > think u can do that .. but again that relies on table names being the same > i > guess... No...That's not a valid query. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Maybe a stupid question but can it be done?
opps same fields even sawwy :) > -Original Message- > From: Peter Houchin [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, 24 September 2002 1:49 PM > To: 'PHP General' > Subject: RE: [PHP] Maybe a stupid question but can it be done? > > > if the 2 tables have the same name can't he just go > > INSERT INTO table1, table2 (table1.name=$name, table2.name=$name > ... blah); > > think u can do that .. but again that relies on table names being > the same i > guess... > > > -Original Message- > > From: John Holmes [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, 24 September 2002 12:21 PM > > To: 'Chuck "PUP" Payne'; 'PHP General' > > Subject: RE: [PHP] Maybe a stupid question but can it be done? > > > > > > Just run two inserts. You can't do it with just one. > > > > I'd have to guess you have design issues if you have to do this > > anyhow... > > > > ---John Holmes... > > > > > -Original Message- > > > From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]] > > > Sent: Monday, September 23, 2002 9:45 PM > > > To: PHP General > > > Subject: [PHP] Maybe a stupid question but can it be done? > > > > > > Ok, Let's try this again, for some reason this didn't post from early > > > today. > > > > > > I have db that has two tables that I am needing to post the same > > > information > > > into both tables, I can't use ID. So I am want to see if there is a > > sql > > > statement that will let me or how I can do with a php page. > > > > > > I am sorry to ask, I have looked around to see if there any on the net > > or > > > in > > > my mysql and php books but this seems like a weird task. > > > > > > Chuck Payne > > > Magi Design and Support > > > > > > > > > -- > > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mail problem with more than 1k users
> On 09/23/2002 08:08 PM, Research And Development wrote: > > So I re-designed the script to send emails in parts. 500 emails per > > header. But after the database reached more than 3,000 records the > > emailing did not work at all. Sendmail refused to send to any of the > > emails in the database result set. > > > > Any thoughts? I guess you are putting 500 emails in the Bcc field. I guess. I like to personalize outgoing mail. I has a script sending *lots* of email and I didn't think it through. My cohort had to clean up after me and he said that he just changed a parameter to sendmail to queue the mail, I *think* ... I haven't sent a lot of mail since then but I'll look at how I was using sendmail. On 24 Sep 2002 at 0:41, Manuel Lemos wrote: > I am not sure what you mean by 500 emails per header. > > Anyway, if you are personalizing messages, ie send a message per user, > avoid that at all costs and if possible send a single message to all > users. Eeks. I hate that. I hate email that does not indicate it knows who I am. Why is sending one email to one user so bad? I can't think of a reason that would trump the personalization that I like so much. But I'm all ears. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MAil and mysql help
hi i need to put a mysql_query into an email, best explained.. while ($row=mysql_fetch_rows($base)) //$base=MySQL Query echo "\n"; echo "$row[0]\n"; echo "$row[1]\n"; echo "$row[2]\n"; echo "$row[3]\n"; well. the result is a table with users an information about them.. i want to sent this table by email with the mail() function but i tried putting php code in the $message like echo ""..etc but it doesn't work.. i'll appreciate some help thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Maybe a stupid question but can it be done?
if the 2 tables have the same name can't he just go INSERT INTO table1, table2 (table1.name=$name, table2.name=$name ... blah); think u can do that .. but again that relies on table names being the same i guess... > -Original Message- > From: John Holmes [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, 24 September 2002 12:21 PM > To: 'Chuck "PUP" Payne'; 'PHP General' > Subject: RE: [PHP] Maybe a stupid question but can it be done? > > > Just run two inserts. You can't do it with just one. > > I'd have to guess you have design issues if you have to do this > anyhow... > > ---John Holmes... > > > -Original Message- > > From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]] > > Sent: Monday, September 23, 2002 9:45 PM > > To: PHP General > > Subject: [PHP] Maybe a stupid question but can it be done? > > > > Ok, Let's try this again, for some reason this didn't post from early > > today. > > > > I have db that has two tables that I am needing to post the same > > information > > into both tables, I can't use ID. So I am want to see if there is a > sql > > statement that will let me or how I can do with a php page. > > > > I am sorry to ask, I have looked around to see if there any on the net > or > > in > > my mysql and php books but this seems like a weird task. > > > > Chuck Payne > > Magi Design and Support > > > > > > -- > > 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
[PHP] Re: Mail problem with more than 1k users
Hello, On 09/23/2002 08:08 PM, Research And Development wrote: > Hello. I wrote a PHP script that will pull records from a database > (emails) and then mail something to the emails in the result set. Pretty > simple and it worked. > > Now that the database has over 1 thousand records I began to experience > performance problems. I figured that my problem was that Sendmail does > not process emails that have more than x number of emails. > > So I re-designed the script to send emails in parts. 500 emails per > header. But after the database reached more than 3,000 records the > emailing did not work at all. Sendmail refused to send to any of the > emails in the database result set. > > Any thoughts? I am not sure what you mean by 500 emails per header. Anyway, if you are personalizing messages, ie send a message per user, avoid that at all costs and if possible send a single message to all users. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frusration using Sessions!!!
Don, First I must strongly advise that you never, ever design a Web application that depends on the back button. This is a key characteristic of a poorly designed application in most cases and is worth a second look. Glancing at the HTTP headers you are sending, two things stand out to me. First, I am not sure that both Cache-Control headers will get sent. Even if they are, I am not sure that you're going to see consistency with Web browsers handling the multiple Cache-Control headers. Some HTTP headers are intended to be used in multiple instances, such as Set-Cookie, but Cache-Control is not one. Thus, you should specify your directives in a single Cache-Control header. In addition, many versions of Internet Explorer are known to ignore the no-store directive. This directive does not allow even the storage of a resource on your local computer. The message you see is being given by a browser that actually adheres to this directive. Only non-compliant browsers will not show this warning. Either way, however, you eliminate just about any form of caching with a compliant Web browser with all of the headers you are sending, and it sounds like you specifically want the browser to cache a previously-viewed page. So, you're going to have to make up your mind. :-) The best first step for you to take is to learn what those headers mean that you are sending. Happy hacking. Chris Don wrote: >I am having trouble with sessions. I've created a user login/password >section that uses session variables. Within this section, I have a form >where the user enters data and submits. When the user clicks on the Browser >back button, they should get back to the form with their data intact. This >is indeed what happens most of the time but some users report that they get >the following message after clicking on "Back": > >=== >Warning: Page has Expired The page you requested was created using >information you submitted in a form. This page is no longer available. As a >security precaution, Internet Explorer does not automatically resubmit your >information for you. > >To resubmit your information and view this Web page, click the Refresh >button. >=== > >When the refresh, their data is gone!!! I've gone through the docs and >placed the following headers at the top of every file. Why is this >happening and to only a few users??? > >header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); >header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); >header("Cache-Control: no-store, no-cache, must-revalidate"); >header("Cache-Control: post-check=0, pre-check=0", false); >header("Pragma: no-cache"); >session_cache_limiter('private_no_expire, must-revalidate'); >session_start(); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Small PHP project - will pay!
I have a small PHP project that currently needs to be built based on Microsoft MSDE database (already in place) and later on perhaps move it to MySQL.. If interested please contact me [EMAIL PROTECTED] Thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session and expiration function
thanks.. i will check it out "John Holmes" <[EMAIL PROTECTED]> wrote in message 002601c26378$b4189350$b402a8c0@mango">news:002601c26378$b4189350$b402a8c0@mango... > Just use ini_set() to set a different session.save_path() than what's in > your PHP.ini. then the garbage collector won't touch it. Write your own > script to do the deleting and call whatever functions you need. Add that > to your cron script to run every hour or day, and you're good to go. You > made your own garbage collector. > > I'm going to have to do this for a sourceforge site I have. I started a > thread about this on the PHP board at Devshed and someone posted a > sample function to handle the cleanup. > > ---John Holmes... > > > -Original Message- > > From: christian haines [mailto:[EMAIL PROTECTED]] > > Sent: Monday, September 23, 2002 11:06 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] session and expiration function > > > > thanks john, > > > > hmmm... i suspected as much... > > > > i guess the way to do it would be to set a highly improbable garbage > > collection and long timeout via ini_set. then use a timeout function > > attached to the session which launches on expiration > > > > cheers > > christian > > > > "John Holmes" <[EMAIL PROTECTED]> wrote in message > > 002501c26374$e136db20$b402a8c0@mango">news:002501c26374$e136db20$b402a8c0@mango... > > > > is it possible to have a function execute when a session expires > using > > > > php4 > > > > sessions? > > > > i know how to execute a function if i control the timeout (as > > > mentioned > > > > elsewhere in this group) but what about if the session times out > > > itself > > > > using the inbuilt garbage collection routine. > > > > if so, any ideas how? > > > > > > I don't think there's a way to do it besides hacking the source > code. If > > > you really have to do this, I'd set your own session.save_path() in > your > > > scripts and then write a script to do the cleanup and function > calling > > > for you. > > > > > > ---John Holmes... > > > > > > > > > > > -- > > 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] session and expiration function
Just use ini_set() to set a different session.save_path() than what's in your PHP.ini. then the garbage collector won't touch it. Write your own script to do the deleting and call whatever functions you need. Add that to your cron script to run every hour or day, and you're good to go. You made your own garbage collector. I'm going to have to do this for a sourceforge site I have. I started a thread about this on the PHP board at Devshed and someone posted a sample function to handle the cleanup. ---John Holmes... > -Original Message- > From: christian haines [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 23, 2002 11:06 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] session and expiration function > > thanks john, > > hmmm... i suspected as much... > > i guess the way to do it would be to set a highly improbable garbage > collection and long timeout via ini_set. then use a timeout function > attached to the session which launches on expiration > > cheers > christian > > "John Holmes" <[EMAIL PROTECTED]> wrote in message > 002501c26374$e136db20$b402a8c0@mango">news:002501c26374$e136db20$b402a8c0@mango... > > > is it possible to have a function execute when a session expires using > > > php4 > > > sessions? > > > i know how to execute a function if i control the timeout (as > > mentioned > > > elsewhere in this group) but what about if the session times out > > itself > > > using the inbuilt garbage collection routine. > > > if so, any ideas how? > > > > I don't think there's a way to do it besides hacking the source code. If > > you really have to do this, I'd set your own session.save_path() in your > > scripts and then write a script to do the cleanup and function calling > > for you. > > > > ---John Holmes... > > > > > > -- > 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] session and expiration function
thanks john, hmmm... i suspected as much... i guess the way to do it would be to set a highly improbable garbage collection and long timeout via ini_set. then use a timeout function attached to the session which launches on expiration cheers christian "John Holmes" <[EMAIL PROTECTED]> wrote in message 002501c26374$e136db20$b402a8c0@mango">news:002501c26374$e136db20$b402a8c0@mango... > > is it possible to have a function execute when a session expires using > > php4 > > sessions? > > i know how to execute a function if i control the timeout (as > mentioned > > elsewhere in this group) but what about if the session times out > itself > > using the inbuilt garbage collection routine. > > if so, any ideas how? > > I don't think there's a way to do it besides hacking the source code. If > you really have to do this, I'd set your own session.save_path() in your > scripts and then write a script to do the cleanup and function calling > for you. > > ---John Holmes... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Maybe a stupid question but can it be done?
I just run two insert to do that. with two different sql syntax ... Chuck PUP Payne writes: > Ok, Let's try this again, for some reason this didn't post from early today. > > I have db that has two tables that I am needing to post the same information > into both tables, I can't use ID. So I am want to see if there is a sql > statement that will let me or how I can do with a php page. > > I am sorry to ask, I have looked around to see if there any on the net or in > my mysql and php books but this seems like a weird task. > > Chuck Payne > Magi Design and Support > > > -- > 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] session and expiration function
> is it possible to have a function execute when a session expires using > php4 > sessions? > i know how to execute a function if i control the timeout (as mentioned > elsewhere in this group) but what about if the session times out itself > using the inbuilt garbage collection routine. > if so, any ideas how? I don't think there's a way to do it besides hacking the source code. If you really have to do this, I'd set your own session.save_path() in your scripts and then write a script to do the cleanup and function calling for you. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session and expiration function
hi, is it possible to have a function execute when a session expires using php4 sessions? i know how to execute a function if i control the timeout (as mentioned elsewhere in this group) but what about if the session times out itself using the inbuilt garbage collection routine. if so, any ideas how? many thanks in advance! christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crypt() =or= md5()
I couldn't find anything in the manual, but I don't think crypt() works in windows...or at least 95/98. Or the function may be denied in your PHP.ini for some reason. ---John Holmes... > -Original Message- > From: Anthony Ritter [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 23, 2002 10:25 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Crypt() =or= md5() > > I get the following line when trying to use the crypt() function in php > .. > > Fatal error: Call to undefined function: crypt() in c:\program > files\apache > group\apache\htdocs\handleform1.php on line 16 > > > > However, when I replace crypt() with md5() - the following script works > fine. > > Using: > Windpws 98 / Apache / php4 > ... > > the script: > > > > > HTML Form > > > $FirstName=trim($FirstName); > $LastName=trim($LastName); > $Email=trim($Email); > $Comments=trim($Comments); > $Name=$FirstName." ".$LastName; > print("Your name is $Name\n"); > print("Your e-mail address is $Email\n"); > print("Your comments were: $Comments\n"); > $CryptName=md5($Name); > print("This is the crypt()version of your name: $CryptName\n"); > ?> > > > > > > > > -- > 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] Another Encryption question
Look at a phpinfo() page, do you have mcrypt installed? I'd have to guess no, because that's generally how you get this error. ---John Holmes... > -Original Message- > From: Tom Ray [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 23, 2002 10:15 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Another Encryption question > > also if I comment out $iv, I get the error "Call to undefined function > mcrypt_encrypt()" on that line.. I just don't understand why it keeps > doing this. > > I'm running 4.2.2 > > Tom Ray wrote: > > > I dipped into mcrypt about a month or so, and did this script back > > then. I had it working, it would kick out the encrypted data for me > > but today when I test it I get a Fatal error: Call to undefined > > function: mcrypt_create_iv() in test2.php on line 3. > > And I don't understand why...any help would be great...thanks! > > > > > > > $iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_TripleDES, > > MCRYPT_MODE_CFB), MCRYPT_RAND); > > > > $key = "Secret"; > > $sample2 = "Hello"; > > $sample3 = "Hello There"; > > > > $lockdata = mcrypt_encrypt (MCRYPT_TripleDES, $key, $sample2, > > MCRYPT_MODE_CFB, $iv); > > $test = mcrypt_encrypt (MCRYPT_TripleDES, $key, $sample3, > > MCRYPT_MODE_CFB, $iv); > > echo "$lockdata\n"; > > echo "$test\n"; > > > > ?> > > > > > > -- > 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] Maybe a stupid question but can it be done?
Just run two inserts. You can't do it with just one. I'd have to guess you have design issues if you have to do this anyhow... ---John Holmes... > -Original Message- > From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 23, 2002 9:45 PM > To: PHP General > Subject: [PHP] Maybe a stupid question but can it be done? > > Ok, Let's try this again, for some reason this didn't post from early > today. > > I have db that has two tables that I am needing to post the same > information > into both tables, I can't use ID. So I am want to see if there is a sql > statement that will let me or how I can do with a php page. > > I am sorry to ask, I have looked around to see if there any on the net or > in > my mysql and php books but this seems like a weird task. > > Chuck Payne > Magi Design and Support > > > -- > 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] Another Encryption question
also if I comment out $iv, I get the error "Call to undefined function mcrypt_encrypt()" on that line.. I just don't understand why it keeps doing this. I'm running 4.2.2 Tom Ray wrote: > I dipped into mcrypt about a month or so, and did this script back > then. I had it working, it would kick out the encrypted data for me > but today when I test it I get a Fatal error: Call to undefined > function: mcrypt_create_iv() in test2.php on line 3. > And I don't understand why...any help would be great...thanks! > > > $iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_TripleDES, > MCRYPT_MODE_CFB), MCRYPT_RAND); > > $key = "Secret"; > $sample2 = "Hello"; > $sample3 = "Hello There"; > > $lockdata = mcrypt_encrypt (MCRYPT_TripleDES, $key, $sample2, > MCRYPT_MODE_CFB, $iv); > $test = mcrypt_encrypt (MCRYPT_TripleDES, $key, $sample3, > MCRYPT_MODE_CFB, $iv); > echo "$lockdata\n"; > echo "$test\n"; > > ?> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail problem with more than 1k users
I suggest you get a mailing list program if your sending to more than 1k of users Philip - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Research and Development" <[EMAIL PROTECTED]>; "PHP General List" <[EMAIL PROTECTED]> Sent: Tuesday, September 24, 2002 1:57 PM Subject: Re: [PHP] Mail problem with more than 1k users > This gets discussed quite frequently. > > My guess is that your ISP *may* be imposing some limitations, but more > likely your PHP script is timing out or something similar. > > Justin > > > on 24/09/02 9:08 AM, Research and Development ([EMAIL PROTECTED]) wrote: > > > Hello. I wrote a PHP script that will pull records from a database > > (emails) and then mail something to the emails in the result set. > > Pretty simple and it worked. > > > > Now that the database has over 1 thousand records I began to experience > > performance problems. I figured that my problem was that Sendmail does > > not process emails that have more than x number of emails. > > > > So I re-designed the script to send emails in parts. 500 emails per > > header. But after the database reached more than 3,000 records the > > emailing did not work at all. Sendmail refused to send to any of the > > emails in the database result set. > > > > Any thoughts? > > > > > -- > 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] SQL : left join from multiple tables
Hi again people! How's it goin? Here's the question How do I do left joins from multiple tables? I want to do something like this: "select a.name, b.department, c.position from emp a left join dept b on a.staffno = b.staffno left join position c on a.staffno = c.staffno where staffno = $staffno"; I know the statement above is totally wrong. I'm just hoping u guys can understand what i'm trying to achieve from it. By the way, this is on Oracle 9i, but I guess ANSI would be fine. Thanks again. Sincerely, Faisal __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail problem with more than 1k users
This gets discussed quite frequently. My guess is that your ISP *may* be imposing some limitations, but more likely your PHP script is timing out or something similar. Justin on 24/09/02 9:08 AM, Research and Development ([EMAIL PROTECTED]) wrote: > Hello. I wrote a PHP script that will pull records from a database > (emails) and then mail something to the emails in the result set. > Pretty simple and it worked. > > Now that the database has over 1 thousand records I began to experience > performance problems. I figured that my problem was that Sendmail does > not process emails that have more than x number of emails. > > So I re-designed the script to send emails in parts. 500 emails per > header. But after the database reached more than 3,000 records the > emailing did not work at all. Sendmail refused to send to any of the > emails in the database result set. > > Any thoughts? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do i assign Integers only and not real numbers?
Wouldn't round() work??? Or, if you always want to round down, why not just split it on the decimal? Or as long as you're willing to give up year 10,000 compliance :), the year will "always" be the first four digits. Plenty of options :) I think I'd just use substr() Justin on 24/09/02 12:46 AM, Tom ([EMAIL PROTECTED]) wrote: > Hi all, > > I have a line of code that assigns a new year number: - > > $years = $years + ( $themonth / 12 ); > > but sometimes $years == 1998.08 > > or > > $year == 2002.75 > > etc... > > I cant find anything like a round() or floor() function in PHP so that year > would be 1998 or 2002 only. > > Does anyone know what function would do this? Sorry if I`m wasting your > time if its a really obvious one! > > thanks in advance, > Tom > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Encryption Question
Just how are you going to decrypt it? Password encryption is ordinarily one-way - you have no choice. You have to compare encrypted passwords. -Original Message- From: Tom Ray [mailto:[EMAIL PROTECTED]] SI want to compare a password to a encrypted password stored in my mySQL database using password('password'), what's the best way to compare the two? Encrypted the password sent by the user and compare or pull the password from the database based on username, decrypt it and then compare? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP.exe crash Problem
The interesting thing is that we has the same page on Solaris, it works fine. I will send the code in another email. Thanks very much, Siman <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > We need to see the page. > > -- > > Nicos - CHAILLAN Nicolas > [EMAIL PROTECTED] > www.WorldAKT.com - Hébergement de sites Internet > > "Simanhew" <[EMAIL PROTECTED]> a écrit dans le message de news: > [EMAIL PROTECTED] > > Hi all, > > > > One of my pages always crashes php.exe on Windows XP. I can not find any > > logic error in my code. > > Does anybody have any experience to handle the problem like this ? > > > > Thanks in advance, > > > > Siman > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Maybe a stupid question but can it be done?
Ok, Let's try this again, for some reason this didn't post from early today. I have db that has two tables that I am needing to post the same information into both tables, I can't use ID. So I am want to see if there is a sql statement that will let me or how I can do with a php page. I am sorry to ask, I have looked around to see if there any on the net or in my mysql and php books but this seems like a weird task. Chuck Payne Magi Design and Support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Maybe a stupid question but can it be done?
Ok, Let's try this again, for some reason this didn't post from early today. I have db that has two tables that I am needing to post the same information into both tables, I can't use ID. So I am want to see if there is a sql statement that will let me or how I can do with a php page. I am sorry to ask, I have looked around to see if there any on the net or in my mysql and php books but this seems like a weird task. Chuck Payne Magi Design and Support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL vs. basic text file
Hi Doug, on 22/09/02 9:25 AM, Doug Parker ([EMAIL PROTECTED]) wrote: > often i use text files at my data sources, delimted by the "|" symbol. > i simply delimit the fields of each line, then when i need to open them, > i open the text file, populate an array with each line, then explode the > fields for each to get the corresponding values. i use this method for > catalogs - and even backend interfaces, for which the client can > add/edit/delete products. everything seems to be working fine, and > there doesn't seem to be a need for MySQL or anything. i was wondering > if there is anything i'm not thinking of that perhaps would push me to > favor using php and mysql instead of the plain old text file. If it aint broke, don't fix it I guess, but I'd argue a few points: - at some point, your data will get too large, and the file method will get sluggish. this is where MySQL differs, because you can index columns, have full text indexes for search engines, etc etc to increase performance and features. - simple things like auto-incrementing row numbers - i find updating / editing data MUCH easier in a database than I do in a CSV... - i find complicated queries MUCH easier in a MySQL database. I guess the answer is that you COULD provide functionality for all of this by writing some functions, but my question is WHY, when MySQL is likely to be 1 or 100 or 1000 steps in front of you at all times. What I *DO* find useful is to let some of my customers edit or export their data in CSV format, which I use to munch into a set of MySQL tables... It gives them very cheap, hands-on editing of the data, but still gives me a quick/flexible back-end. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP.exe crash Problem
That's happened to me while trying to run a PHP script that handles Form-based file uploading. The scripts work fine on *nix enviroments. Any toughts?. Oscar F.- simanhew wrote: >Hi all, > >One of my pages always crashes php.exe on Windows XP. I can not find any >logic error in my code. >Does anybody have any experience to handle the problem like this ? > >Thanks in advance, > >Siman > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP.exe crash Problem
We need to see the page. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet "Simanhew" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Hi all, > > One of my pages always crashes php.exe on Windows XP. I can not find any > logic error in my code. > Does anybody have any experience to handle the problem like this ? > > Thanks in advance, > > Siman > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Crypt() =or= md5()
I get the following line when trying to use the crypt() function in php .. Fatal error: Call to undefined function: crypt() in c:\program files\apache group\apache\htdocs\handleform1.php on line 16 However, when I replace crypt() with md5() - the following script works fine. Using: Windpws 98 / Apache / php4 ... the script: HTML Form \n"); print("Your e-mail address is $Email\n"); print("Your comments were: $Comments\n"); $CryptName=md5($Name); print("This is the crypt()version of your name: $CryptName\n"); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another Encryption question
I dipped into mcrypt about a month or so, and did this script back then. I had it working, it would kick out the encrypted data for me but today when I test it I get a Fatal error: Call to undefined function: mcrypt_create_iv() in test2.php on line 3. And I don't understand why...any help would be great...thanks! \n"; echo "$test\n"; ?>
[PHP] PHP.exe crash Problem
Hi all, One of my pages always crashes php.exe on Windows XP. I can not find any logic error in my code. Does anybody have any experience to handle the problem like this ? Thanks in advance, Siman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help.
I am using php-4.1.2 and apache-1.3.26. I am allowing users to download files from my site. The problem is that the file is not downloded fully. After downloading say 84%, the counter stops and download manager says that the download is complete. This problem is intermittent. Sometimes the file is downloaded fully and sometimes not. Here is the code I am using $range=getenv(http_range); $fsize = filesize($DOWNLOAD_FILE_DIRECTORY . $file_name); $p1 = strpos($range, "bytes="); $p2 = strpos($range, "-"); $offset = substr($range, $p1+6, $p2-1); header( "Content-type: " . $file_type ); $header_range = sprintf("Content-Range: bytes %ld-%ld", $offset, $fsize ); header($header_range); $header_range = sprintf("Content-length: %ld", $fsize - $offset ); header($header_range); header("Content-disposition-type: attachment\r\n"); header("Content-disposition: filename=" . $file_name); header( "Content-Description: PHP3 Generated Data" ); header( "Accept-Ranges: bytes" ); $fp = fopen($DOWNLOAD_FILE_DIRECTORY . $file_name, "r"); fseek($fp, $offset); do { $section = fread($fp, 102400); echo $section; } while (!feof($fp)); fclose($fp); --- What could be the problem? Now, I have changed my code to this $fsize = filesize($DOWNLOAD_FILE_DIRECTORY . $file_name); header("Content-Disposition: attachment; filename = " . $file_name); header("Content-Type: application/x-zip"); header("Content-Length: " . $fsize); $fp = fopen($DOWNLOAD_FILE_DIRECTORY . $file_name, "r") fpassthru($fp); flcose($fp); It works with IE 6.0 only. IE 5.5 and 5.0 are still not working. With 5.5 and 5.0 empty files are saved. I don't what I am doing wrong. If anyone have any idea can you please let me know. Thanks for any kind of help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Encryption Question
> I want to compare a password to a encrypted password stored in my mySQL > database using password('password'), what's the best way to compare the > two? > > Encrypted the password sent by the user and compare or pull the password > from the database based on username, decrypt it and then compare? SELECT 1 FROM table WHERE password_column = PASSWORD('$password') AND username = '$username' If a row is returned, the username and password match what's in the database. $password and $username would come from your form or whatever... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encryption Question
I want to compare a password to a encrypted password stored in my mySQL database using password('password'), what's the best way to compare the two? Encrypted the password sent by the user and compare or pull the password from the database based on username, decrypt it and then compare? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] any string function to...
Taylor, You can use: quotemeta($string) for . \\ + * ? [ ^ ] ( $ ). hth. Oscar F.- Taylor York wrote: >Is there any string function to put backslashes on any characters that are >used in regular expressions? IE ()[];.^*$ etc. > > >Thank you, >Taylor > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail problem with more than 1k users
I've had no problems using qmail-inject and MySQL to send over 100K emails in a day. I doubt it's an MySQL problem unless you've done something drastically wrong; perhaps you're bandwidth limited? -Original Message- From: Research and Development [mailto:[EMAIL PROTECTED]] Hello. I wrote a PHP script that will pull records from a database (emails) and then mail something to the emails in the result set. Pretty simple and it worked. Now that the database has over 1 thousand records I began to experience performance problems. I figured that my problem was that Sendmail does not process emails that have more than x number of emails. So I re-designed the script to send emails in parts. 500 emails per header. But after the database reached more than 3,000 records the emailing did not work at all. Sendmail refused to send to any of the emails in the database result set. Any thoughts? -- 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] backup script
do ya self a fav. and look @ phpbuilder, phpwizard etc and and a look will take ya 2 mins to find what your looking for :) > -Original Message- > From: Research and Development [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, 24 September 2002 9:18 AM > To: PHP General List > Subject: [PHP] backup script > > > Hello. Can someone point me to an example of a script that backs up de > database and the web directory and its files? > > 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
[PHP] backup script
Hello. Can someone point me to an example of a script that backs up de database and the web directory and its files? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail problem with more than 1k users
Hello. I wrote a PHP script that will pull records from a database (emails) and then mail something to the emails in the result set. Pretty simple and it worked. Now that the database has over 1 thousand records I began to experience performance problems. I figured that my problem was that Sendmail does not process emails that have more than x number of emails. So I re-designed the script to send emails in parts. 500 emails per header. But after the database reached more than 3,000 records the emailing did not work at all. Sendmail refused to send to any of the emails in the database result set. Any thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session_start function breaks flush function in 4.2.1
>"Chris Andrew" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> I use a script which initially sends a friendly message to a browser, and >> then goes about some lengthy processing. The browser is IE and I am aware >of >> the 256 byte issue. >> >> The script worked nicely in php.4.1.1 but since installing 4.2.1, the >flush >> function doesn't do its job. However, it works if I ommit session_start() >? I can't speak for the differences between 4.1.1 and 4.2.1, but maybe the following information will help you: On my site I have a custom error handler than displays a "friendly" error message screen and emails me an error report. I use output buffering because if an error occurs I don't want this friendly error message screen to be rendered in the middle of whatever else was going on when the error occured...I get the contents of the buffer and then and then call ob_end_clean() to empty it before I display the friendly error message. I noticed that this was not working properly on one section of my site that used sessions. I noticed that if I called session_start() and then an error occured, I got the error message in the middle of the the page, just as if I hadn't cleared the buffer. I then discovered why... I am using trans sid support to perpetuate the session id, and apparently this is implemented internally using an output buffer. Trans sid buffers the page output, then rewrites the hrefs and insert the hidden form values before flushing the buffer to the screen. Apparently you can start multiple buffers, and they are stacked. If you call a buffer function such as ob_end_clean(), it *automatically* operates on the last buffer in the stack...i.e. the buffer that was most recently created. In my case this buffer what the trans sid one, and NOT the one that I started. To make a long story short, I had to end up calling ob_end_clean() TWICE...once to flush the trans sid buffer and once more to flush mine. Maybe something similar is at work with your problem. Try calling the flush function twice back to back and see if that makes any difference... If anyone knows of a way to determine how many output buffers have been started or are currently active please let me know... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Frusration using Sessions!!!
Hi, I am having trouble with sessions. I've created a user login/password section that uses session variables. Within this section, I have a form where the user enters data and submits. When the user clicks on the Browser back button, they should get back to the form with their data intact. This is indeed what happens most of the time but some users report that they get the following message after clicking on "Back": === Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. === When the refresh, their data is gone!!! I've gone through the docs and placed the following headers at the top of every file. Why is this happening and to only a few users??? header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); session_cache_limiter('private_no_expire, must-revalidate'); session_start(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] algorythm question
ok, now it's clear why i must use '|' instead of '+'. i still couldn't get what happens with bits but you don't have to explain more. i know that it's about bitwise operators, and how they handle numbers. no! ok! i just got it! thank you again. --- bob parker <[EMAIL PROTECTED]> wrote: > Couple of points: > You really do need to use the '!' operator to > combine the categories not '+' > eg if your user entered 2 twice you would get > $userLevels = 2 + 2; // wrong we just made our admin > a writer > but > $userLevels = 2 | 2; // ok is still admin because > $userLevels is still 2 > > These operators, | and & are called bit wise > operators to see how they > work look at the binary representations of the > numbers > say $userlevel = 15 then in binary > $userlevel is > $result = & 0001;// $result is 0001 binary or > decimal 1 > $result = & 0010;// $result is 0010 binary or > decimal 2 > $result = & 0100;// $result is 0101 binary or > decimal 4 > $result = & 1000;// $result is 1000 binary or > decimal 8 > the '&' operator only returns the bit or bits which > are both 1 in the > same column. > > The or operator returns the bits which are 1 in > ether column so > 2 | 2 which is 0010 | 0010 still returns 0010 which > is 2 > Hope this helps > bob __ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] date functions
You should be working with UNIX timestamps here. Convert the dates to human readble only after you've done the calcuations. -Kevin - Original Message - From: "Patrick" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 2:38 PM Subject: [PHP] date functions > i got 2 dates and i want to know how many minutes between em,, like: > > $date1 = date("Y-m-j H:i"); > $date2 = date("Y-m-j H:i", strtotime("now") + 1800); > > $minutes = date_something($date1, $date2); > > echo "there are $minutes between, $date1 and $date2"; > > regards > patrick > > > > -- > 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] Problem uploading a file (bug in PHP 4.2.3 !?) worked with 4.2.2
Hi, The upload_tmp_dir in php.ini: ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ;upload_tmp_dir = So it uses c:\windows\temp And file upload: ; Whether to allow HTTP file uploads. file_uploads = On The directory is valid and Apache should have permissions but I don't know how to check that for granted, any hint? What puzzles me is that the whole $_REQUEST comes empty, not even MAX_FILE_SIZE is passed along, nor there is any error being thrown anywhere. I have error reporting set to all. Jose > -Original Message- > From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] > Sent: 23 September 2002 21:49 > To: Jose Fandos; [EMAIL PROTECTED] > Subject: Re: [PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked > with 4.2.2 > > What are the settings for upload_tmp_dir and file_uploads in the php.ini > on > the windows box? Does the Apache user have permission to write to that > directory if it's valid? > > ---John Holmes... > > - Original Message - > From: "Jose Fandos" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, September 23, 2002 4:12 PM > Subject: [PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked with > 4.2.2 > > > > Hi, > > > > I was working on some code and couldn't get the following form to return > > anything under Windows XP with Apache 1.3.26 and PHP 4.2.3. > > > > I've just tried in a Solaris machine with same versions of Apache and > > PHP and it works just fine. Same with a Linux machine running Red Hat > > and same versions of Apache and PHP. Could someone else confirm this > > under XP? > > > > I have the magic_quotes set to Off, but tried with On with the same > > result. In fact the settings in the Unix machines and Windows XP with > > regards to Apache and PHP are as close to each other as they can be. > > > > If it's a known bug, is there any way I can patch or update my PHP to > > have it working again? > > > > The following code will dump the contents of $_REQUEST and $_FILES. When > > a file is selected under Windows XP (and the Apache server and PHP are > > running in Windows XP) the information gets lost, without a trace of an > > error. Works fine when the server is Solaris > > > > Jose > > > > === > > > > > > > > Test > > > > > > Test > > > > > echo '$_REQUEST = '; var_dump($_REQUEST); echo ""; > > echo '$_FILES = '; var_dump($_FILES); echo ""; > > ?> > > > > > > > > > /> > > > > > > > > > > > > == > > > > > > -- > > 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
[PHP] Re: [PHP-DB] advise needed for 'authorized only' site
On 23 Sep 2002 at 8:14, [EMAIL PROTECTED] wrote: > I have set up a section of my company site for use by authorized dealers > only. I am currently using mysql authorization, which works for the > first page, but if someone were to type in the url of an underlying page > they would be able to get in without authorization. I know I could use > .htaccess for handling this but with a minimum of 350 -400 users to keep > track of that would be unwieldly to say the least, especially for my > boss who doesn't have a clue about *nix and has never even heard of > .htaccess. > > What other options do I have to keep the underlying pages from being > accessed without the user being forced to go through the logon screen? Umm .. I did something along these lines awhile back ... yeah, I had all the public pages outside of the document root. I had every request for a page going to my script, if the person was recognized (using a cookie), I would get the page they wanted and return it. Plain cgi and was fast enough. You could do this in PHP. No one can access the restricted pages as they are outside the doc root. This is of course something for mod_perl where you can write your own auth handler and you don't need to do something as goofy as I did above. I don't think PHP has that ability. Your pages can still be in PHP. Here is an example (I just wrote this up will quick so if you go this route, do your homework) http://www.schoenster.com/authtest/ The above url is protected by a mod_perl handler which requires a cookie (script below) If you go to the above url you get redirected here: http://www.schoenster.com/login.php Enter something, cookie set, you are in. Click on welcome.php and logout to kill the cookie. I don't know how you can do this in PHP without doing something goofy like I suggest above or other suggestions I've seen. I use an .htaccess file in /authtest PerlAccessHandler Apache::GateKeeper PerlSetVar login_failure_handler 'http://www.schoenster.com/login.php' PerlSetVar column_name username The mod_perl handler is such (I just cut,pasted from some other stuff) package Apache::GateKeeper; use strict; use Apache::Constants qw(:common REDIRECT); sub handler { my $r = shift; my $location = $r->dir_config("login_failure_handler"); my $okay = get_cookie($r); if ($okay) { return DECLINED; }else { $r->status(REDIRECT); $r->header_out( Location => $location ); return 1; } } ## sub get_cookie { my $r = shift; my %headers_in = $r->headers_in; my $cookie = $headers_in{'Cookie'}; my %cookie = (); my(@bites) = split /;/,$cookie; my $n = ''; my $v = ''; for(@bites) { ($n,$v) = split /=/; $n =~ s/^\s+//; $cookie{$n} = $v; } my $username = $r->dir_config("column_name"); if($cookie{$username}) { return 1; }else { return undef; } } ## 1; Now, if you reckon I should have only given a solution as above in PHP, well, I would have if I had known one. The solutions I've seen so far are not very elegant or evolutionary imho. Can the above be done in PHP so you don't have to tell every page your write to check for permissions? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked with 4.2.2
I did go back to PHP 4.2.2 to double check and it doesn't work there either. > -Original Message- > From: Jose Fandos [mailto:[EMAIL PROTECTED]] > Sent: 23 September 2002 21:12 > To: [EMAIL PROTECTED] > Subject: [PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked with > 4.2.2 > > Hi, > > I was working on some code and couldn't get the following form to return > anything under Windows XP with Apache 1.3.26 and PHP 4.2.3. > > I've just tried in a Solaris machine with same versions of Apache and > PHP and it works just fine. Same with a Linux machine running Red Hat > and same versions of Apache and PHP. Could someone else confirm this > under XP? > > I have the magic_quotes set to Off, but tried with On with the same > result. In fact the settings in the Unix machines and Windows XP with > regards to Apache and PHP are as close to each other as they can be. > > If it's a known bug, is there any way I can patch or update my PHP to > have it working again? > > The following code will dump the contents of $_REQUEST and $_FILES. When > a file is selected under Windows XP (and the Apache server and PHP are > running in Windows XP) the information gets lost, without a trace of an > error. Works fine when the server is Solaris > > Jose > > === > > > > Test > > > Test > >echo '$_REQUEST = '; var_dump($_REQUEST); echo ""; > echo '$_FILES = '; var_dump($_FILES); echo ""; > ?> > > > > /> > > > > > > == > > > -- > 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
Fw: [PHP] How to get count of dimensions in multi array?
Here.. I wrote this simple recursive function for a project a while back. Enjoy.. $val) { if (is_array($array[$key])) { $depth++; matrixdepth($array[$key], $depth); } else { break; } } return $depth; } ?> -Kevin - Original Message - From: "Stefan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 1:45 PM Subject: [PHP] How to get count of dimensions in multi array? > Hello, > I´m trying to figer out how to get the number och dimensions of a array.. > It isn´t the problem to get the count of elements with count(), it´s the > number of dimensions i am stuck at :( > > Any tips would be appreciated. > Best regards, > Stefan > > > > > -- > 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] date functions
Patrick Off the top of my head... Convert both date1 and date2 to unix timestamps, and subtract one from the other. That will give you the number of seconds between them. Then, convert to hours, minutes, etc as required. Peter At 10:38 PM 9/23/2002 +0200, Patrick wrote: >i got 2 dates and i want to know how many minutes between em,, like: > >$date1 = date("Y-m-j H:i"); >$date2 = date("Y-m-j H:i", strtotime("now") + 1800); > >$minutes = date_something($date1, $date2); > >echo "there are $minutes between, $date1 and $date2"; > >regards >patrick > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php - - - - - - - - - - - - - - - - - - - - - Fourth Realm Solutions [EMAIL PROTECTED] http://www.fourthrealm.com Tel: 519-739-1652 - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked with 4.2.2
What are the settings for upload_tmp_dir and file_uploads in the php.ini on the windows box? Does the Apache user have permission to write to that directory if it's valid? ---John Holmes... - Original Message - From: "Jose Fandos" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 4:12 PM Subject: [PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked with 4.2.2 > Hi, > > I was working on some code and couldn't get the following form to return > anything under Windows XP with Apache 1.3.26 and PHP 4.2.3. > > I've just tried in a Solaris machine with same versions of Apache and > PHP and it works just fine. Same with a Linux machine running Red Hat > and same versions of Apache and PHP. Could someone else confirm this > under XP? > > I have the magic_quotes set to Off, but tried with On with the same > result. In fact the settings in the Unix machines and Windows XP with > regards to Apache and PHP are as close to each other as they can be. > > If it's a known bug, is there any way I can patch or update my PHP to > have it working again? > > The following code will dump the contents of $_REQUEST and $_FILES. When > a file is selected under Windows XP (and the Apache server and PHP are > running in Windows XP) the information gets lost, without a trace of an > error. Works fine when the server is Solaris > > Jose > > === > > > > Test > > > Test > >echo '$_REQUEST = '; var_dump($_REQUEST); echo ""; > echo '$_FILES = '; var_dump($_FILES); echo ""; > ?> > > > > /> > > > > > > == > > > -- > 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] date functions
i got 2 dates and i want to know how many minutes between em,, like: $date1 = date("Y-m-j H:i"); $date2 = date("Y-m-j H:i", strtotime("now") + 1800); $minutes = date_something($date1, $date2); echo "there are $minutes between, $date1 and $date2"; regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sockets
Yes. See the online manual notes in the Socket Functions section for links to examples. On Mon, 23 Sep 2002, Martin W Jørgensen wrote: > Is it possible to read and write to multiple sockets at once with php? > > Can anyone please answer that question? > > > > -- > 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] any string function to...
Is there any string function to put backslashes on any characters that are used in regular expressions? IE ()[];.^*$ etc. Thank you, Taylor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] in a logic loop!
I have a logic problem: I have a complicated query. The main thing is that I have an ID, and for a particular ID, I may have between 1 to 3 rows returned. The rows returned are variable, that is for 1 particular ID there might just be 1 row and at a later time it may have 3 rows. But what I need to do is print only one row for a particular ID. Please do not suggest I do it through SQL itself, because it's after using various aggregate functions that I have arrived at the min. result set. I need the logic clarified, because it has me stumped. It will be simple for a clear-thinking individual. What I am doing is: I maintain a set of details in say $prev_row (previous row) and another in cur_row (current row). The minute my cur_row detail (one unique id) doesn't match the prev_row detail, I print out all the previous row details, and reinitialize the various variables (all in a loop). This works fine for all cases but fails for the last ID, because of the logic used. Do I need to create a special case for the last one, or can anyone suggest a better way? -Thanks Naintara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem uploading a file (bug in PHP 4.2.3 !?) worked with 4.2.2
Hi, I was working on some code and couldn't get the following form to return anything under Windows XP with Apache 1.3.26 and PHP 4.2.3. I've just tried in a Solaris machine with same versions of Apache and PHP and it works just fine. Same with a Linux machine running Red Hat and same versions of Apache and PHP. Could someone else confirm this under XP? I have the magic_quotes set to Off, but tried with On with the same result. In fact the settings in the Unix machines and Windows XP with regards to Apache and PHP are as close to each other as they can be. If it's a known bug, is there any way I can patch or update my PHP to have it working again? The following code will dump the contents of $_REQUEST and $_FILES. When a file is selected under Windows XP (and the Apache server and PHP are running in Windows XP) the information gets lost, without a trace of an error. Works fine when the server is Solaris Jose === Test Test "; echo '$_FILES = '; var_dump($_FILES); echo ""; ?> == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Import & Stamp PDF's
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Miles Thompson) wrote: > Each evening I distribute a newsletter to approx 500 subscribers, and I > want to stamp each copy I send with the name, email address and subscriber > number of the recipient. I've not done any programmatic PDF manipulation, > but could this be done using PDFlib? I receive the newsletter as a PDF from > the publisher, it's not generated on my system. I envision it running as > follows: You might want to simplify the problem into two steps: 1. Create a PDF file with the stamp information; 2. Append one file to the other. PDFLib could certainly do the former. I'm not sure about the latter. I have a similar problem (to step 2); we have a phone directory that employees can download, but the front matter and the directory itself come from different departments. They each ftp their parts, as PDF, to a central repository. I have a Perl script on my desktop computer (Mac OS X) that checks this repository for new versions, downloads them when it finds them, and then calls an AppleScript which calls Adobe Acrobat to combine the two files into a single file, then uploads the single file to our web site. It works fine, except that I do have to be logged into my computer for it to work (Adobe Acrobat, being a GUI app, requires that a GUI be started up). I'd love to be able to replace that step with a completely command-line combination routine. You might also check out the Yahoo PDFLib group. It looks fairly active. http://groups.yahoo.com/group/pdflib/ Jerry -- http://www.hoboes.com/jerry/ "Give a man a fish and you feed him for a day. Teach him to fish, and you've depleted the lake."--It Isn't Murder If They're Yankees (http://www.hoboes.com/jerry/Murder/) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sockets
Is it possible to read and write to multiple sockets at once with php? Can anyone please answer that question? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to get count of dimensions in multi array?
Use a foreach syntax. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet "Stefan" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Hello, > I´m trying to figer out how to get the number och dimensions of a array.. > It isn´t the problem to get the count of elements with count(), it´s the > number of dimensions i am stuck at :( > > Any tips would be appreciated. > Best regards, > Stefan > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start() --> no more output
On Sun, Sep 22, 2002 at 06:03:50PM -0500, Michael Sims wrote: > > >session_register("bunt"); > >phpinfo(); > >?> > > > >This is just a simple example. The problem is that the script produces > >no output at all when called with the browser. > > Is it possible that display_errors is set to "Off" in your php.ini? THX for the hint! I've looked it up, and display_errors is set to 'on'. But I've just found out that it must be a problem of the browser (Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3)! When using lynx, I'm getting output as expected. Hm ... GH -- This mail is copyrighted material and must not be processed by closed-source software. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get count of dimensions in multi array?
Hello, I´m trying to figer out how to get the number och dimensions of a array.. It isn´t the problem to get the count of elements with count(), it´s the number of dimensions i am stuck at :( Any tips would be appreciated. Best regards, Stefan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] right name for
What is the right name to use in apache's (2.0.41-dev) IfModule directive to test if the php4 module is loaded? I'm including the file below via httpd.conf's Include statement but the part between the IfModule is being completely ignored: AllowOverride None order deny,allow Deny from all Allow from 127.0.0.1 php_flag engine on php_value include_path '.:/srv/www/default/html/acid/config' order deny,allow deny from all I'm using php-4.2.3 (compiled with apxs2) and apache-2.0.41-dev. The PHP module *is* being loaded in another included file, but it doesn't matter if I put the above in an external file or in httpd.conf itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why my php pages are cached in browsers?
Hi, In browsers, my php pages are cached. All the code that is returned by php are stored. In version 4.1 this not ocurred, anybody can help me? Thanks Rapha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Searching a db
Joshua, I learned a ton by reading this tutorial. See if it helps... http://www.zend.com/zend/tut/tutorial-Ferrara.php Joseph "Joshua E Minnie" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hey all, > I am looking for a way to search a MySQL DB based on a users input > string. The string would be searched on particular fields in my DB, which > is already setup. The problem I am having is that I want to be able to > return strings that match all *or* part of their string. Right now it only > returns exact (case-insensitive) matches. But I want to be able to return > partial matches as well. I have the relevancy calculation worked out but > I'm not sure how to go about gathering the partial matches. > > i.e. > > User inputs: Christmas > Output would be something like: > > Christmas (100%) > Christian (67%) > Christy (67%) > Chandelier (20%) > > Anything below 10% will not be displayed. I am using a class I found at > phpclasses.org called better_field_search. I am looking to modify it to fit > my needs but I'm not sure how to go about it. If anyone has done anything > similar, I would greatly appreciate any help or direction provided. > > > -- > Joshua E Minnie > Advantage Computer Services, LLC > Senior Project Manager > [EMAIL PROTECTED] > Phone: 269.276.9690 > Fax: 269.342.8750 > > "Don't work for recognition, but always do work worthy of recognition." > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error with file upload: "No file uploaded in Unknown on line 0"
I have some code that a user can set a description about an item to be posted, and then add some image files of the item. Its a 3x3 frame of fields, along with an 'include' line for each one.. only selecting a file with the 'Browse' button, or entering a website manually will trigger this include.. Of course, there aren't always going to be 9 images to upload, so sometimes they have to be left blank ... everytime I submit something without all 9 entries filled, I get a bunch of lines in my error log like the following: [error] PHP Notice: No file uploaded in Unknown on line 0 Is there something I can do to combat this? It's quite annoying to see up to 9 of these lines everytime I submit something from my page. I don't want to turn off all error reporting or anything like that, either... I'd like to see something that'll make it a non-error. Thanks! -Jason Young -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] freetype - problems with true type and transprency
Hi there, I am trying to put text into an image. There are some problems where I do not find a solution for. The image is a jpg and stored on the filesystem. Now I would like to create a stamp in trutype font verdana with a name. Just the text on the image. I experianced following problems: o The text has a white background which covers the other image o It does not work with truetype. I tryed imagettftext but results in a broken image. Here is the code which should do the job, but does not: $label = imagecreate(200,50); $white = imagecolorallocate($label,255,255,255); $black = imagecolorallocate($label,0,0,0); Imagestring($label,1,0,0,'andy',$black); #Imagettftext($label, 30,0,10,33,$black,'verdana.ttf',$number); $photoImage = ImageCreateFromJPEG('card_city.jpg'); $pos_x = 5; $pos_y= 220; $label_w= 200; $label_h = 50; ImageCopy($photoImage, $label, $pos_x, $pos_y, 0, 0, $label_w, $label_h); header("Content-type: image/jpeg"); imagejpeg($photoImage); Has anybody an idea how to solve this prob? Thanx in advance for any help. Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing by reference via the variable arg list
Can anyone help with this? I am relativly new to PHP and am trying to use variable numbers of parameters to functions using the func_get_arg(). However, I am unable to determine the correct syntax for passing by reference via the variable arg list. Trevor /* This Works Fine */ function Foo($Index, &$TxtString) { $TxtString = "NewString"; } /* However: how do you pass by reference using a variable number of parameters */ function Foo() { if(func_get_arg(0) == 3) { /* Can you have a variable in function foo that allows access by reference? */ $TxtString = func_get_arg(1); $TxtString = "Second New String"; } } function FooTest() { $StringTest = 'Test'; Foo(2); Foo(3, $StringTest); echo ("$StringText"); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and JavaScript
Hi all, The following code will drive me mad coz it always shows the JavaScript functions and I'd like know why: error_alert(); goHistoryBack(); Thanks in advance Peace & Love skitum
[PHP] Searching a db
Hey all, I am looking for a way to search a MySQL DB based on a users input string. The string would be searched on particular fields in my DB, which is already setup. The problem I am having is that I want to be able to return strings that match all *or* part of their string. Right now it only returns exact (case-insensitive) matches. But I want to be able to return partial matches as well. I have the relevancy calculation worked out but I'm not sure how to go about gathering the partial matches. i.e. User inputs: Christmas Output would be something like: Christmas (100%) Christian (67%) Christy (67%) Chandelier (20%) Anything below 10% will not be displayed. I am using a class I found at phpclasses.org called better_field_search. I am looking to modify it to fit my needs but I'm not sure how to go about it. If anyone has done anything similar, I would greatly appreciate any help or direction provided. -- Joshua E Minnie Advantage Computer Services, LLC Senior Project Manager [EMAIL PROTECTED] Phone: 269.276.9690 Fax: 269.342.8750 "Don't work for recognition, but always do work worthy of recognition." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Disabling cookies per website
Is there a way to disable cookies not for all sites but on a per site basis? If I do an ini_set() on session.use_cookies will all sites be afftected or only the site I am on? Thanks, Rich
[PHP] open_basedir and ".."?
I am not sure how open_basedir restricts myself. In fact I have problems with files that begin with "../". I can not include those files, and get the following Warning: open_basedir restriction in effect. File is in wrong directory in /home/vwww/x/www/htdocs/conpresso/news/aktuelles/index.php on line 2 Warning: Unable to access ../_include/const.php in /home/vwww/x/www/htdocs/conpresso/news/aktuelles/index.php on line 3 Fatal error: Failed opening required '../_include/const.php' (include_path='.:/usr/share/pear') in /home/vwww/x/www/htdocs/conpresso/news/aktuelles/index.php on line 3 open_basedir is set to /home/vwww/x/www/htdocs/, so it should not hit the "magic border". Or am I getting something wrong here and PHP only checks the beginning of each given file/directory-argument and not an absolute path created by the location of the script + relative one given as argument. Balu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL vs. basic text file
Speed Accessability Features Security Performance Simplicity Reusability Indexing Record-Locking To name a few. however, in your situation, it's an existing application which is working great and which no one has any complaints over. If it ain't broke, don't fix it. For your next application, use a database. When it's time for a major upgrade to this one, convert, until then, just leave things the way they are. Let me illustrate a point on the performance/simplicity front. let's say that you need to change the title of an item in a catalog. With a text file: 1.) Open the file 2.) Read the contents of the file until you find the item you're looking for (got help us if it's the last item!) 3.) Parse the line 4.) rewrite the line with the new information 5.) rewrite the file 6.) Close the file ellapsed time: depending on the speed of the computer, typically between 1-5 seconds With a database 1.) Open the database 2.) UPDATE catalog SET title='new title' WHERE item=123 ellapsed time: < 1 second, my benchmarks show usually in the .26-.33 second range -Original Message- From: Doug Parker [mailto:[EMAIL PROTECTED]] Sent: Saturday, September 21, 2002 4:26 PM To: [EMAIL PROTECTED] Subject: [PHP] MySQL vs. basic text file often i use text files at my data sources, delimted by the "|" symbol. i simply delimit the fields of each line, then when i need to open them, i open the text file, populate an array with each line, then explode the fields for each to get the corresponding values. i use this method for catalogs - and even backend interfaces, for which the client can add/edit/delete products. everything seems to be working fine, and there doesn't seem to be a need for MySQL or anything. i was wondering if there is anything i'm not thinking of that perhaps would push me to favor using php and mysql instead of the plain old text file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do i assign Integers only and not real numbers?
Thanks for the answers all, I`ve combined the floor and the precision answer and it does exactly what I want it to do. Cheers, Tom -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: 23 September 2002 16:24 To: Tom; [EMAIL PROTECTED]; Support @ Fourthrealm.com Subject: Re: [PHP] How do i assign Integers only and not real numbers? If you end up using floor(), watch for floating point errors. You could expect your division to come out to a whole number, say 12, but be represented by 11.999 in the computer. So that'll floor() to 11. You can add a fluff to your division to counteract this: $years = floor($years + ($themonth / 12) + 0.0001); ---John Holmes... - Original Message - From: "Support @ Fourthrealm.com" <[EMAIL PROTECTED]> To: "Tom" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 11:06 AM Subject: Re: [PHP] How do i assign Integers only and not real numbers? > Hi Tom, > Try this: > $years = round($years + ( $themonth / 12 )); > > > From the manual: > float round ( float val [, int precision]) > Returns the rounded value of val to specified precision (number of digits > after the decimal point). precision can also be negative or zero (default). > > > ceil() and floor() also exist. > > > > Peter > > > At 03:46 PM 9/23/2002 +0100, Tom wrote: > >Hi all, > > > >I have a line of code that assigns a new year number: - > > > >$years = $years + ( $themonth / 12 ); > > > >but sometimes $years == 1998.08 > > > >or > > > >$year == 2002.75 > > > >etc... > > > >I cant find anything like a round() or floor() function in PHP so that year > >would be 1998 or 2002 only. > > > >Does anyone know what function would do this? Sorry if I`m wasting your > >time if its a really obvious one! > > > >thanks in advance, > >Tom > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > - - - - - - - - - - - - - - - - - - - - - > Fourth Realm Solutions > [EMAIL PROTECTED] > http://www.fourthrealm.com > Tel: 519-739-1652 > - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file reading/writing question.
I'm using 4.2.2 on a Linux 7.1 system. The problem that I am encountering is copying the contents out of a pdf file and writing them to a new file. I've tried fopen() in concert with fread() and fwrite() with no success. The file is created, but the file size is markedly smaller. I've also tried file() and then write the array to a string and write that string to a new file. This has come the closest to success. Any ideas??? Simply copying the files won't work because I will be performing an ereg_replace() with the contents of the copied file. This works on a pdf file with no graphics, however the file I am using has graphics embedded in it. Any ideas??? Thanks in advance, Tim Nields -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL vs. basic text file
I was doing this too with good old AWK CGI scripts and text data files. Once I imported the data into MySQL I said, "Well this is not much benefit." Then I started sorting. Then I accessed the information from a different application. Then I wrote a maintenance application so my customer could sort, review and edit the data. Then I started using multitable queries. I am now so hooked on the database method, I have never looked back. Keep up with your text data. You will always be able to import it into MySQL when you are ready. I would do ahead and migrate to a database; You will have a slight learning curve, but will reap many benefits. John On Sat, 21 Sep 2002, Doug Parker wrote: >-often i use text files at my data sources, delimted by the "|" symbol. >-i simply delimit the fields of each line, then when i need to open them, >-i open the text file, populate an array with each line, then explode the >-fields for each to get the corresponding values. i use this method for >-catalogs - and even backend interfaces, for which the client can >-add/edit/delete products. everything seems to be working fine, and >-there doesn't seem to be a need for MySQL or anything. i was wondering >-if there is anything i'm not thinking of that perhaps would push me to >-favor using php and mysql instead of the plain old text file. >- >- >- >--- >-PHP General Mailing List (http://www.php.net/) >-To unsubscribe, visit: http://www.php.net/unsub.php >- ** John Huggins VANet [EMAIL PROTECTED] http://www.va.net/ ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL vs. basic text file
"Doug Parker" <[EMAIL PROTECTED]> wrote: > i was wondering > if there is anything i'm not thinking of that perhaps would push me to > favor using php and mysql instead of the plain old text file. It sounds like you're basically asking why one would want to use a relational database. Standardization, speed and flexibility for starters. MySQL and many other databases use the SQL language for accessing db data. If your dataset is large a SQL statement to return records from indexed tables will be much faster than code at the application level. And a relational database allows you to store data in separate logical tables instead of one large table - for example tables of products, inventory, customers and orders. Using SQL to query these tables to find out something like the quantity and total revenue of widgets sold in August to customers in New Jersey whose company name begins with R would be much easier with a relational database than 1 or more text file datasets. There are many other benefits, though that's not to say that text files aren't sufficient for your current needs. I recommend reading about relational database online or in a book and playing with one of the more popular open source databases such as MySQL or PostgreSQL. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL vs. basic text file
Well, one major advantage I have found using MySQL verses txt files is the simple implementation of transactions, if you are doing multiple transactions that are related, it is nice to simply "rollback" all other statements if one fails or "commit" if they work. Of course you can do this other ways but the simplicity is nice. Although I am still a newbie, I would also have to say there would be a speed issue, if you only wan't one row returned versus reading enire file into memory then walking through it one at a time, mysql's indexing can greatly speed this process up. HTH, Steve. -Original Message- From: Doug Parker [mailto:[EMAIL PROTECTED]] Sent: Saturday, September 21, 2002 7:26 PM To: [EMAIL PROTECTED] Subject: [PHP] MySQL vs. basic text file often i use text files at my data sources, delimted by the "|" symbol. i simply delimit the fields of each line, then when i need to open them, i open the text file, populate an array with each line, then explode the fields for each to get the corresponding values. i use this method for catalogs - and even backend interfaces, for which the client can add/edit/delete products. everything seems to be working fine, and there doesn't seem to be a need for MySQL or anything. i was wondering if there is anything i'm not thinking of that perhaps would push me to favor using php and mysql instead of the plain old text file. -- 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] MySQL vs. basic text file
often i use text files at my data sources, delimted by the "|" symbol. i simply delimit the fields of each line, then when i need to open them, i open the text file, populate an array with each line, then explode the fields for each to get the corresponding values. i use this method for catalogs - and even backend interfaces, for which the client can add/edit/delete products. everything seems to be working fine, and there doesn't seem to be a need for MySQL or anything. i was wondering if there is anything i'm not thinking of that perhaps would push me to favor using php and mysql instead of the plain old text file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Visual Studio .NET as PHP IDE
> try jext ... http://jext.org > has a good PHP code browser and can colourise C# and PHP. I appreciate the suggestion but I wanted to know specifically about using VStudio .NET as an IDE for PHP. > Don't know what other features you'd want for C# ... In VStudio .NET, the RAD features, for one. Extensive documentation for C# for another. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do i assign Integers only and not real numbers?
If you end up using floor(), watch for floating point errors. You could expect your division to come out to a whole number, say 12, but be represented by 11.999 in the computer. So that'll floor() to 11. You can add a fluff to your division to counteract this: $years = floor($years + ($themonth / 12) + 0.0001); ---John Holmes... - Original Message - From: "Support @ Fourthrealm.com" <[EMAIL PROTECTED]> To: "Tom" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 11:06 AM Subject: Re: [PHP] How do i assign Integers only and not real numbers? > Hi Tom, > Try this: > $years = round($years + ( $themonth / 12 )); > > > From the manual: > float round ( float val [, int precision]) > Returns the rounded value of val to specified precision (number of digits > after the decimal point). precision can also be negative or zero (default). > > > ceil() and floor() also exist. > > > > Peter > > > At 03:46 PM 9/23/2002 +0100, Tom wrote: > >Hi all, > > > >I have a line of code that assigns a new year number: - > > > >$years = $years + ( $themonth / 12 ); > > > >but sometimes $years == 1998.08 > > > >or > > > >$year == 2002.75 > > > >etc... > > > >I cant find anything like a round() or floor() function in PHP so that year > >would be 1998 or 2002 only. > > > >Does anyone know what function would do this? Sorry if I`m wasting your > >time if its a really obvious one! > > > >thanks in advance, > >Tom > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > - - - - - - - - - - - - - - - - - - - - - > Fourth Realm Solutions > [EMAIL PROTECTED] > http://www.fourthrealm.com > Tel: 519-739-1652 > - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-functioning db 'include'
Thanks Geoff, I tried what you suggested, but now the db burps the stuff back. Perhaps, for two lousy lines of code, I'll leave it as it is. Too much trouble to figure why it doesn't like it without actually having the site live. Right now everything passes through 'localhost' which has been extraordinarly 'fussy' lately. Thanks for the suggestion. Regards, Andre On Monday 23 September 2002 10:33 am, Geoff wrote: > Once you go to https://www.yoursite.com > you are at a completely new url as far as the browser is concerned so > you need to include using the full > http://www.yoursite.com/yourinclude.inc syntax or throw another copy of > your include db file in your directory for secure serving > > Not sure if this is what you are referring to but hope it helps > > On Mon, 2002-09-23 at 09:15, Andre Dubuc wrote: > > I've streamlined all files by using an include for db access. > > Everything works except the main registration file which is set to > > https. > > > > When I 'include' a file, the db access doesn't work: all other input that > > accesses the db does, except for one that first calls a 'randomizer' > > function, then an include to the db. > > > > Any ideas why this doesn't work? I figure it must have something to do > > with switching from https (the reg'n file)> http (the randomizer file & > > dbc file) > > > > > https (back to the reg'n file). > > > > Any suggestions on how to fix this? Any help, advice, or suggestions > > gratefully accepted. > > > > Code follows: > > > > /* This is the 'randomizer' script called by require */ > > > > > # return a randomly-generated string with input length > > # Blake Caldwell <[EMAIL PROTECTED]> > > function randomString($length=15){ > > static $srand; > > if($srand != true){ > > $srand = true; > > srand((double)microtime()*100); # only seed once! > > } > > $chars = > > "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; > > for($i=0; $i<$length; $i++){ > > $result .= substr($chars,rand(0,strlen($chars)-1),1); > > } > > return $result; > > } > > > > ?> > > > > /* This script works (with '$db = .' ) */ > > > . . . > > require("randomizer.php"); > > > > $_SESSION['unique_id'] = randomString(15); > > > > $db = pg_connect("dbname=purgatory user=postgres"); > > . . . > > ?> > > > > /* This script DOESN'T work (with 'include("dbc.php"); and where > > dbc.php' = > > in a separate file */ > > > . . . > > require("randomizer.php"); > > > > $_SESSION['unique_id'] = randomString(15); > > include("dbc.php"); > > . . . > > ?> > > > > Tia, > > Andre > > > > -- > > 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] Redirection
Yes that's right.. It's a standard HTTP/1.0 command I'm pretty sure so yeah. Actually referring to the rfc docs it could date back to even eariler HTTP standards too.. Hmm.. Yeah just don't send anything but header's and you can successfully redir. with that header("Location: xxx"); function.. --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: "Chris Shiflett" <[EMAIL PROTECTED]> To: "Sascha Braun" <[EMAIL PROTECTED]> Cc: "PHP Mailingliste" <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 10:22 AM Subject: Re: [PHP] Redirection > Sascha Braun wrote: > > >I want to post a form and after parsing i want to redirect the user to the home page. > > > >header() doesn't work in this circumstance, what can I do else? > > > > header() does work in this circumstance. In what way do you think it > doesn't? > > header("Location: http://www.google.com/";); > exit; > > Include that code "after parsing", and your users will be redirected to > Google's Web site. I'm not aware of any Web client that does not support > this, regardless of how old or uncommon. > > 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] Visual Studio .NET as PHP IDE
Does anyone use VStudio .NET as your IDE in developing PHP Scripts? If so, have you found a way to make it so that it understands PHP? In particular color coding and the understanding of where functions start and end (for the solution explorer, etc). I'm starting to get into C# and I'd like to use just one IDE for development where now I'm using VStudio .NET for C# and Homesite for PHP. Before anyone suggests I use Homesite for C# (which I know I can), I'm still learning C# and I find the help and RAD features of VStudio .NET to be invaluable so switching solely to Homesite isn't really an option. Anyways, any suggestions/insight/information anyone can provide would be most helpful! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confused
well it depends how you want to go about it.. I have done something exactly like this, this morning.. :-p Firstly.. you can use a normal SQL SELECT statement, but use GROUPing to seperate the groups in this case and ORDER them alphabetically or something.. Next.. You can do something like this: 0) echo ""; $curgrp=$row["group_name"]; echo "Group: ".$row["group_name"].""; } echo " ".$row["user_name"].""; } ?> This HAS NOT been tested. but I have ran it through the inbuilt PHP interpretor in my brain.. and passed it through the mySQL server also up in my head.. and it seems OK.. In any case it was mainly to demonstrate the concept.. As you can see.. It iterates through the result table which should look a little like this (using your data supplied): Blue,Tom Blue,Nancy Blue,Jim Red,Bob Red,Susan Red,James You get it? HIH.. Please if you notice any bugs in the coding above.. point it out.. I did it quite quickly and with very little checking as such or testing.. Good luck ;) I could post what I used but that could get confusing.. :-p Anyways.. Now I'm rambling.. ha. I'm off.. --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: "Rankin, Randy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 10:36 PM Subject: [PHP] Confused > I have two MySQL tables, groups and users: > > groups: group_id, group_name > > users: user_id, user_name, group_id, etc. > > I would like to produce one table for each group which will list all the > > members for that particular group. For example: > > Blue (group_id 1) > > Tom (group_id 1) > > Nancy (group_id 1) > > Jim (group_id 1) > > Red (group_id 2) > > Bob (group_id 1) > > Susan (group_id 1) > > James (group_id 1) > > ... > > My question is, do I need to run 2 queries? The first to select all the > > groups and the second to select all the users in each group based on the > > group_id? How would I loop through to create a table for each group? > > Thanks in advance for any help. > > Randy Rankin > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create Thumbnails from image
OMG.. This is the second question tonight I answer that I was just working on today :-p hah.. Ok.. simple.. here's my code I used today for www.operation-scifi.com/lobby Thing is.. It's about as understandable to other's as hieroglyphics.. Therefore.. a simple solution.. do this: Substitute the filepath etc.. and also the 150/100 dimension sizes.. xxx denotes the image type which depending on your GD version .. jpeg has always been supported.. GIF has been removed as of 1.6 I think due to the LZW compression patent by Unisys.. and now they have PNG which my site uses due to it's much better file format and flexibility.. Also BTW.. this script is designed to be a seperate file.. ie image.php perhaps even do what I did and make the filename actually a $_GET param.. As in.. you call: ./image.php?im=whatever.jpg and it generates a thumbnailed version.. if your using JPEG format you can also use this param in the imagejpeg($img2); function: imagejpeg($img2,"",80); whereby the output quality is no 80%.. that means lower qual thumbnail.. There is a lot of fun things that can be done just with the core graphics module of PHP without GD. but GD is soo great it can do much more exciting things.. Like for instance today I wanted to resize these big pics.. That's all good.. But they are somewhat pixellised from the large downshrink. Now.. the function imagecopyresample() would be great.. but's a GD2+ thing.. I don't use GD plus yet.. [downloading the bin as I write this] but that's just one great func. taht allows for resize and interpolation of near pixels (ie smoothing).. w00tage eh?? Anyways.. enough said. rambling on now.. HIH /* IMAGE HANDLING ROUTINE */ $errmsg=Array(); if(strlen($_GET["d"])<1) { $errmsg[]="Invalid GET params sent:"; $errmsg[]="Must send valid data_id to script!"; $fwidth=(strlen($errmsg[count($errmsg)-1])>$fwidth?strlen($errmsg[count($err msg)-1]):$fwidth); } else { $sql=mysql_query("SELECT * FROM opscifi_news_data WHERE data_id = ".$_GET["d"],$DB); if(mysql_num_rows($sql)>0 AND $ditem=@mysql_fetch_array($sql)) { if(!file_exists("./news/n".$ditem["news_id"]."d".$ditem["data_id"].".".subst r($ditem["filename"],strpos($ditem["filename"],".",0)+1,strlen($ditem["filen ame"])-(strpos(fname,".",0)+1 { $errmsg[]="Invalid file request:"; $errmsg[]="File ./news/n".$ditem["news_id"]."d".$ditem["data_id"].".".substr($ditem["filenam e"],strpos($ditem["filename"],".",0)+1,strlen($ditem["filename"])-(strpos(fn ame,".",0)+1))." does not exist!"; $fwidth=(strlen($errmsg[count($errmsg)-1])>$fwidth?strlen($errmsg[count($err msg)-1]):$fwidth); } elseif(!preg_match("/(jpg|jpeg|jpe)/i",$ditem["filename"])) { $errmsg[]="Invalid image type request:"; $errmsg[]="Script can only process image/jpeg files!"; $fwidth=(strlen($errmsg[count($errmsg)-1])>$fwidth?strlen($errmsg[count($err msg)-1]):$fwidth); } else { // Spit out required [standard] MIME-type header header("Content-type: image/jpeg"); // Fetch the "original" friendly filename $row=mysql_fetch_array(mysql_query("SELECT filename FROM opscifi_news_data WHERE data_id = ".$_GET["d"],$DB)); $ditem["filename"]=$row[0]; header("Content-Disposition: image; filename=".$ditem["filename"]); // Update request field in images "data" element if(!isset($_GET["t"])) mysql_query("UPDATE opscifi_news_data SET requests = requests + 1 WHERE data_id = ".$_GET["d"],$DB); // Load nxdx.ext into $f="./news/n".$ditem["news_id"]."d".$ditem["data_id"].".".substr($ditem["fil ename"],strpos($ditem["filename"],".",0)+1,strlen($ditem["filename"])-(strpo s(fname,".",0)+1)); $img=imagecreatefromjpeg($f); $size=getimagesize($f); if(isset($_GET["h"]) or isset($_GET["w"])) { $outimg=imagecreate((isset($_GET["w"])?$_GET["w"]:$size[0]),(isset($_GET["h" ])?$_GET["h"]:$size[1])); imagecopyresized($outimg, $img, 0,0,0,0,(isset($_GET["w"])?$_GET["w"]:$size[0]),(isset($_GET["h"])?$_GET["h" ]:$size[1]),$size[0],$size[1]); } else { $outimg=$img; } imageinterlace($outimg,1); imagejpeg($outimg,"",(isset($_GET["q"])?$_GET["q"]:100)); } } else { $errmsg[]="News Data Item Not in 'news_data' table!"; $fwidth=(strlen($errmsg[count($errmsg)-1])>$fwidth?strlen($errmsg[count($err msg)-1]):$fwidth); } } if(strlen($errmsg)>0) { // Spit out required [standard] MIME-type header header("Content-type: image/jpeg"); $f_size=2; $img=imagecreate(imagefontwidth($f_size)*$fwidth+14,(imagefontheight($f_size )+2)*count($errmsg)+5); imagefill($img, 0, 0, imagecolorallocate($img, 220,220,220)); foreach($errmsg as $pos=>$str) imagestring($img, $f_size, 7, 3+($pos*(imagefontheight($f_size)+2)), $str, imagecolorallocate($img, 255, 0, 0)); imageinterlace($img,1); imagejpeg($img); exit(); } else { exit(); } --oOo
Re: [PHP] How do i assign Integers only and not real numbers?
Hi Tom, Try this: $years = round($years + ( $themonth / 12 )); From the manual: float round ( float val [, int precision]) Returns the rounded value of val to specified precision (number of digits after the decimal point). precision can also be negative or zero (default). ceil() and floor() also exist. Peter At 03:46 PM 9/23/2002 +0100, Tom wrote: >Hi all, > >I have a line of code that assigns a new year number: - > >$years = $years + ( $themonth / 12 ); > >but sometimes $years == 1998.08 > >or > >$year == 2002.75 > >etc... > >I cant find anything like a round() or floor() function in PHP so that year >would be 1998 or 2002 only. > >Does anyone know what function would do this? Sorry if I`m wasting your >time if its a really obvious one! > >thanks in advance, >Tom > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php - - - - - - - - - - - - - - - - - - - - - Fourth Realm Solutions [EMAIL PROTECTED] http://www.fourthrealm.com Tel: 519-739-1652 - - - - - - - - - - - - - - - - - - - - -
RE: [PHP] How do I use a Javascript variable in PHP?
You cann't from php but you can from javascript. For exemple: file - Function insert_value(){ Document.form_name.text_box_name.value = javascript_value; } --- Now: when you click on button insert - then the javascript value insert value into textbox. If you open a window with a calendar and choose a value the syntax of function will be: "Window.opener.form_name.text_box_name.value = your_value; " and close windows with "Window.close();" I hope this help you Kale. -Original Message- From: Tom [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 4:09 PM To: [EMAIL PROTECTED] Subject: [PHP] How do I use a Javascript variable in PHP? Hi all, I hope this is the right place to pose my question, so here goes: - I have a javascript function called calcMonth() and given a number it will return a date i.e. month = calcMonth( 57 ) - month will be 'sept 2002' The problem I`m having is at the beginning of my PHP file I`m calling this calcMonth() then doing a load of php stuff and then trying to use the javascript month variable, but to no avail: - print ""; The result is, the browser displays the words 'javascript:month;' - not a month number I`ve looked everywhere for an answer from persistent javascript data to using framesets to hold the variable but to no avail. I know its quite a bit of javascript, but its mixed in with PHP too so I thought it`d be the right place. Anyways, I hope someone can provide the answer to my problem. Thanks in advance, Tom -- 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] 0 byte session files.
I ran into a problem with sessions on sourceforge, which uses load balancing. What's probably happening for you is that each server is looking in it's own /tmp directory for the sessions. So, a user logs on from a page on Server A, which creates a good session file on Server A for the user. Now, the next request goes to Server B. It doesn't have a session file to load, but it sees a session_start() in the code, so it creates an empty session file. I'm surprised your sessions are even working. A solution would be to have all four servers share a common folder to write session data to. I don't know how possible/easy that is, though... ---John Holmes... - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 23, 2002 10:40 AM Subject: [PHP] 0 byte session files. > Hello, > > I run a site that operates across 4 load balanaced servers and we seem to be > getting a problem where session files are created with 0 bytes (contain no > data) on 2 of the 4 servers. All the servers are FreeBSD 4.5 running Apache > 1.3.26 and PHP 4.2.3. Any suggestions would be appreciated. Note: We have > already investigated most ownership/file privilege possibilities. > > Jacob > > > -- > 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] How long do sessions last
> If I use sessions (not session cookies) by issuing a session_start() and > then log in to an area of my web site, I understand that the session will > last until either I close my browser or issue a session_unset() followed by > a session_destroy(). > > If I log in and walk away from my PC, will the session eventually expire or > will I have to do one of the above? They will eventually get cleaned up by PHP if you are using the session_save_path as specified in php.ini. There are settings in php.ini that control how often this happens: a.. session.gc_probability specifies the probability that the gc (garbage collection) routine is started on each request in percent. Defaults to 1. a.. session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and cleaned up. Note: If you are using the default file-based session handler, your filesystem must keep track of access times (atime). Windows FAT does not so you will have to come up with another way to handle garbage collecting your session if you are stuck with a FAT filesystem or any other fs where atime tracking is not available. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do i assign Integers only and not real numbers?
You could cast it to an int, although the manual warns that you can get spurious errors upon casting an unknown fraction, so be careful. $year= (int) ($years); Mark -Original Message- From: Tom [mailto:[EMAIL PROTECTED]] Sent: 23 September 2002 15:47 To: [EMAIL PROTECTED] Subject: [PHP] How do i assign Integers only and not real numbers? Hi all, I have a line of code that assigns a new year number: - $years = $years + ( $themonth / 12 ); but sometimes $years == 1998.08 or $year == 2002.75 etc... I cant find anything like a round() or floor() function in PHP so that year would be 1998 or 2002 only. Does anyone know what function would do this? Sorry if I`m wasting your time if its a really obvious one! thanks in advance, Tom -- 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] How do i assign Integers only and not real numbers?
Hi all, I have a line of code that assigns a new year number: - $years = $years + ( $themonth / 12 ); but sometimes $years == 1998.08 or $year == 2002.75 etc... I cant find anything like a round() or floor() function in PHP so that year would be 1998 or 2002 only. Does anyone know what function would do this? Sorry if I`m wasting your time if its a really obvious one! thanks in advance, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 0 byte session files.
Hello, I run a site that operates across 4 load balanaced servers and we seem to be getting a problem where session files are created with 0 bytes (contain no data) on 2 of the 4 servers. All the servers are FreeBSD 4.5 running Apache 1.3.26 and PHP 4.2.3. Any suggestions would be appreciated. Note: We have already investigated most ownership/file privilege possibilities. Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-functioning db 'include'
Once you go to https://www.yoursite.com you are at a completely new url as far as the browser is concerned so you need to include using the full http://www.yoursite.com/yourinclude.inc syntax or throw another copy of your include db file in your directory for secure serving Not sure if this is what you are referring to but hope it helps On Mon, 2002-09-23 at 09:15, Andre Dubuc wrote: > I've streamlined all files by using an include for db access. > Everything works except the main registration file which is set to > https. > > When I 'include' a file, the db access doesn't work: all other input that > accesses the db does, except for one that first calls a 'randomizer' > function, then an include to the db. > > Any ideas why this doesn't work? I figure it must have something to do with > switching from https (the reg'n file)> http (the randomizer file & dbc file) > > https (back to the reg'n file). > > Any suggestions on how to fix this? Any help, advice, or suggestions > gratefully accepted. > > Code follows: > > /* This is the 'randomizer' script called by require */ > > # return a randomly-generated string with input length > # Blake Caldwell <[EMAIL PROTECTED]> > function randomString($length=15){ > static $srand; > if($srand != true){ > $srand = true; > srand((double)microtime()*100); # only seed once! > } > $chars = > "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; > for($i=0; $i<$length; $i++){ > $result .= substr($chars,rand(0,strlen($chars)-1),1); > } > return $result; > } > > ?> > > /* This script works (with '$db = .' ) */ > . . . > require("randomizer.php"); > > $_SESSION['unique_id'] = randomString(15); > > $db = pg_connect("dbname=purgatory user=postgres"); > . . . > ?> > > /* This script DOESN'T work (with 'include("dbc.php"); and where dbc.php' = > in a separate > file */ > . . . > require("randomizer.php"); > > $_SESSION['unique_id'] = randomString(15); > include("dbc.php"); > . . . > ?> > > Tia, > Andre > > -- > 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