RE: [PHP] utf8 encoding £ to £ problem
Hi Chris, Do you use £ or £? I've had problems uploading onto a linux box for ages, but a straight text £ never seems to work, so I have to get one of my colleagues to do it instead... Does that help? Nunners -Original Message- From: Chris Dean [mailto:[EMAIL PROTECTED] Sent: 05 December 2006 12:38 To: php-general@lists.php.net Subject: [PHP] utf8 encoding £ to £ problem Hi I was just wondering if anyone knows why php's utf8_encode function converts the £ symbol into £ Is this a bug in php or is it because utf8 doesn't include the £ symbol (can't find a quick and easy ref to say if it does or not) and as such the function outputs junk? Kind Regards Chris Dean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Process of creating invoices requiring human thought!
Im creating an invoicing system for a childrens nursery, and Im trying to work out how I can replicate the thought process one would normally go through when working out the bill for each day. Ive created all the mysql tables that I think I need, with all the info possible; along the following lines (Im only showing whats relevant): Child -> childId, starttime, endtime Fees -> feeId, starttime, endtime, rate (£) The easiest way to explain this is as follows: The nursery fees are broken down into AM (8am to 12.30pm), PM (12.30pm to 6pm) and All Day (8am to 6pm), and furthermore theres an hourly rate for extras. Child A starts at 9 and finishes at 5 therefore they come under the all day rate Child B starts at 8.30 and finishes at 12pm therefore they come under the AM rate Child C starts at 9.30 and finishes at 1pm, and because its not a straight they do AM, PM or All Day, theyll probably fall under AM, cos its including lunch. Can anyone see an easy way of putting that sort of human thinking into a script? Any guidance would be gratefully received Just to give a bit more background, there are two nurseries (at the moment) and they have different session times, so the fees table does need to have the starttime and endtime. :-( Cheers Nunners
[PHP] RE: Error Reporting for file commands
Sometime ago, I posted the email below, regarding some problems with a file manager we have developed for our users. The problem still exists, and is now starting to cause "complaints". Mainly from my manager, who's fed-up with receiving the error emails from the system, but it must be annoying users! The scenario is; we have a fairly large Linux cluster, with a RAID disc. Obviously because of the number of disc calls, there's a fair amount of caching. We think the problem is related to this, and would ideally like purely to suppress the error, as it's normally when the script is trying to delete something already deleted. I've tried turning off errors (error_reporting(0)) and indeed using @ on all php file system calls, but it still triggers an error. Does anyone know of any issues with suppressing errors on the following functions? - unlink - mkdir - copy - scandir All of these fail sporadically, even with the above error stuff turned off, and trigger an error. Anyone's thoughts gratefully received Thanks Nunners -----Original Message- From: James Nunnerley [mailto:[EMAIL PROTECTED] Sent: 25 July 2006 16:33 To: 'php-general@lists.php.net' Subject: Error Reporting for file commands We've created a file manager which allows users to access their web space on a server. It's working brilliantly, except that it would seem there are some caching issues, either by the system cache or the web server cache that are causing us a headache. When the script tries to delete a file, we always check (using file_exists) to see whether the file exists before it's deleted. The check comes back true, but the unlink then fails, saying no file or directory there! We've tried turning off all errors (using error_reoprting(0) ) but this would seem to have little difference in the error - it still comes back with a failure. We are using our own error handling, but before the command is carried out, there is this 0 call... Does anyone know how we can stop these errors? Cheers Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: New Large Scale Project.
I can strongly recommend Joomla - I have it working with Menalto's Gallery2, and just got a phpBB bridge working as well. Can I also recommend you use Joomla over Mambo? About a year ago the core developers (now at Joomla) fell out with the so called owners of Mambo, about ownership and future developments so they created Joomla. They're in the process of developing v1.5 which is going to have some really cool features, mainly for 3rd party developers, so although you may not experience the features with it's direct release, other components and modules are already being developed that will improve the CMS no end... Hope that helps Nunners -Original Message- From: Colin Guthrie [mailto:[EMAIL PROTECTED] Sent: 14 August 2006 10:06 To: php-general@lists.php.net Subject: [PHP] Re: New Large Scale Project. Wesley Acheson wrote: > Basically the different areas I would need are authentication, > galleries (for images), permission levels. Internal messaging (not > real time), forums (hopefully I can just plugin an existing one but > intregrated with my new so that registering users for the site > registers for the forum and vice versa, also I would like each new > gallery entry to create a new forum entry for that image). Comments, > ratings and such like. Sales (This would have to be a script written > elsewhere, I am in no way confident when it comes to dealing with > sensitve info like credit card details.) etc. etc. > > My other problem is even though I'm confident coding I find design > very difficult I've a good idea of how the website would work but only > in general terms. > > Out of the box mambo or drupal doesn't seem to do what I want really I use Joomla quite a bit (Mambo by an other name). I've used the bridge components and Menalto Gallery and it works pretty well. THere are various core hacks you can apply too to setup varying permission levels and other stuff. Simple Machine Forums also has a good bridge component (it's what the Joomla forums themselves use). So with a little fiddling you can probably make Joomla do what you need. If you are not confident dealing with CC payments and the like, then I strongly suggest you use a third party service for this. Col. -- 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] Regular Expresson for checking password strength
I want to have a regular expression that check the following criteria are met by $password: - contains at least 6 characters (any) - has at least 1 letter - has at least 1 number - other 6 characters can be anything... I'm happy to work out the structure of a postcode etc, but to be honest I'm still fairly new to working with regular expressions. What the best/easiest way to check whether a variable contains a range? It might be RegExp don't do this? Cheers Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Spam:[PHP] Error Reporting for file commands
> [snip] > When the script tries to delete a file, we always check (using > file_exists) to see whether the file exists before it's deleted. > > The check comes back true, but the unlink then fails, saying no file or > directory there! > [/snip] > > Could you please post the code you are using to check and unlink the > file? Heres the function - sometimes the scandir fails, sometimes the unlink, sometimes the rmdir at the end. They all have @ to try and surpress the error, but I think it's a system halt failure - I can only assume? You'll also see there are quite a lot of clearstatcache - that was another attempt to sort this problem out! function system_rmdir($dir) { $current_error_level = error_level(); error_reporting(0); $dir = $dir."/"; $dir=str_replace("//", "/", $dir); clearstatcache(); if (is_dir($dir)) { $dir_contents = scandir($dir); foreach ($dir_contents as $item) { clearstatcache(); if (is_dir($dir.$item) && $item != '.' && $item != '..') { system_rmdir($dir.$item.'/'); } elseif (file_exists($dir.$item) && $item != '.' && $item != '..') { @unlink($dir.$item); } } clearstatcache(); if (is_dir($dir)) { @rmdir($dir); } } error_reporting($current_error_level); } Thanks Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error Reporting for file commands
We've created a file manager which allows users to access their web space on a server. It's working brilliantly, except that it would seem there are some caching issues, either by the system cache or the web server cache that are causing us a headache. When the script tries to delete a file, we always check (using file_exists) to see whether the file exists before it's deleted. The check comes back true, but the unlink then fails, saying no file or directory there! We've tried turning off all errors (using error_reoprting(0) ) but this would seem to have little difference in the error - it still comes back with a failure. We are using our own error handling, but before the command is carried out, there is this 0 call... Does anyone know how we can stop these errors? Cheers Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Running php5 with Zeus and fcgi
Does anyone have any experiences of running php5 as a fcgi and Zeus server? And in particular getting "Bad Gateway" errors. We are tempted to report it as a fault/bug, but have looked around the net (including bugs.php.net) it would seem that there's already a reported bug, but it's a little unclear as to whether it's fixed? Cheers Nunners
[PHP] FTP - moving/copying files
I'm setting up an ftp manager which allows a user to connect to their space on an external server. All the php-ftp functions work fine - after I'd realized how to use the passive functionality - see previous email to list! I've also got working the download and upload functionality, which is quite nice, but annoying - it doesn't allow you to download the file without creating a temporary version (whereas if it were a local copy you'd be able to copy it to a variable, then echo it out... Finally, what I now need to do it be able to move/copy files within the FTP space. The standard FTP commands (mv & cp or copy) are not featured in php-ftp functions. Does anyone have any suggestions bar copying the whole lot to a local drive then upload in the new space? Cheers Nunners
RE: [PHP] FTP Problems
Ah - whoops - just worked out why - you need to set the passive mode after you login, not after a connect! Silly solution! -Original Message- From: James Nunnerley [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:37 To: 'Jochem Maas' Cc: 'chris smith'; php-general@lists.php.net Subject: RE: [PHP] FTP Problems Thanks all - it would seem that php is failing to set the passive mode to true - I can get around it temporarily, but need to find a more permanent option. Does anyone have any experience as to why setting ftp_pasv to true fails? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:29 To: James Nunnerley Cc: 'chris smith'; php-general@lists.php.net Subject: Re: [PHP] FTP Problems James Nunnerley wrote: > Thanks for the reply Chris. > > How would you suggest displaying the current "home" directory for the user? > I've tried / and indeed the "real" directory name on that particular server. you could try '~/' (or maybe just'~') as the dir name which equates to the 'the current users homedir' when you in a shell - no idea whether that is even allowable when going in via ftp but might be worth a shot though - given what you have been saying in your thread one would hazard to guess that the ftp server your working with is a little borked (but that a gut feeling). > > Funnily enough, I've also just tried a generic php/ftp script tool, and it > works on a third party server into the one I'm trying to connect to, but not > from the server I'm working on! > > Is there anyway in which php needs configuring for certain connections? > > -Original Message- > From: chris smith [mailto:[EMAIL PROTECTED] > Sent: 27 June 2006 14:16 > To: James Nunnerley > Cc: php-general@lists.php.net > Subject: Re: [PHP] FTP Problems > > On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: >> I'm trying to create some functionality which requires FTPing onto another >> server, using the php functions. >> >> Doing the following comes up with a successful login, but cannot display > the >> current directory; yet when I FTP directory from the server which is > serving >> the php pages, it works fine. >> >> // set up basic connection >> $conn_id = ftp_connect($ftp_server, 21); >> ftp_pasv($conn_id, true); >> >> // login with username and password >> $login_result = ftp_login($conn_id, $username, $password); >> >> // check connection >> if ((!$conn_id) || (!$login_result)) { >> >> echo "FTP connection has failed!"; >> echo "Attempted to connect to $ftp_server for user $username"; >> exit; >> >> } else { >> >> echo "Connected to $ftp_server, for user $username"; >> >> } >> >> echo(ftp_pwd($conn_id).""); # Comes back with / >> >> $buff = ftp_nlist($conn_id,""); > > ftp_nlist requires a directory name. A blank string is not a directory name. > > http://au.php.net/ftp_nlist > -- 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] FTP Problems
Thanks all - it would seem that php is failing to set the passive mode to true - I can get around it temporarily, but need to find a more permanent option. Does anyone have any experience as to why setting ftp_pasv to true fails? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:29 To: James Nunnerley Cc: 'chris smith'; php-general@lists.php.net Subject: Re: [PHP] FTP Problems James Nunnerley wrote: > Thanks for the reply Chris. > > How would you suggest displaying the current "home" directory for the user? > I've tried / and indeed the "real" directory name on that particular server. you could try '~/' (or maybe just'~') as the dir name which equates to the 'the current users homedir' when you in a shell - no idea whether that is even allowable when going in via ftp but might be worth a shot though - given what you have been saying in your thread one would hazard to guess that the ftp server your working with is a little borked (but that a gut feeling). > > Funnily enough, I've also just tried a generic php/ftp script tool, and it > works on a third party server into the one I'm trying to connect to, but not > from the server I'm working on! > > Is there anyway in which php needs configuring for certain connections? > > -Original Message- > From: chris smith [mailto:[EMAIL PROTECTED] > Sent: 27 June 2006 14:16 > To: James Nunnerley > Cc: php-general@lists.php.net > Subject: Re: [PHP] FTP Problems > > On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: >> I'm trying to create some functionality which requires FTPing onto another >> server, using the php functions. >> >> Doing the following comes up with a successful login, but cannot display > the >> current directory; yet when I FTP directory from the server which is > serving >> the php pages, it works fine. >> >> // set up basic connection >> $conn_id = ftp_connect($ftp_server, 21); >> ftp_pasv($conn_id, true); >> >> // login with username and password >> $login_result = ftp_login($conn_id, $username, $password); >> >> // check connection >> if ((!$conn_id) || (!$login_result)) { >> >> echo "FTP connection has failed!"; >> echo "Attempted to connect to $ftp_server for user $username"; >> exit; >> >> } else { >> >> echo "Connected to $ftp_server, for user $username"; >> >> } >> >> echo(ftp_pwd($conn_id).""); # Comes back with / >> >> $buff = ftp_nlist($conn_id,""); > > ftp_nlist requires a directory name. A blank string is not a directory name. > > http://au.php.net/ftp_nlist > -- 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] FTP Problems
Just tried that, and still the same result - I think it's the server - going to ask the server admin now! -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:19 To: PHP List Subject: Re: [PHP] FTP Problems James Nunnerley a écrit : > Nope - unfortunately, no change, still the same problems, logging in but no > ftp_nlist or indeed ftp_rawlist > > even with a pathname ? ftp_nlist($conn_id, "-a /") do you have any log on the server ? ( you can also sniff the network to watch what php sends). NF > Cheers > Nunners > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Thanks for the reply Chris. How would you suggest displaying the current "home" directory for the user? I've tried / and indeed the "real" directory name on that particular server. Funnily enough, I've also just tried a generic php/ftp script tool, and it works on a third party server into the one I'm trying to connect to, but not from the server I'm working on! Is there anyway in which php needs configuring for certain connections? -Original Message- From: chris smith [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:16 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] FTP Problems On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: > I'm trying to create some functionality which requires FTPing onto another > server, using the php functions. > > Doing the following comes up with a successful login, but cannot display the > current directory; yet when I FTP directory from the server which is serving > the php pages, it works fine. > > // set up basic connection > $conn_id = ftp_connect($ftp_server, 21); > ftp_pasv($conn_id, true); > > // login with username and password > $login_result = ftp_login($conn_id, $username, $password); > > // check connection > if ((!$conn_id) || (!$login_result)) { > > echo "FTP connection has failed!"; > echo "Attempted to connect to $ftp_server for user $username"; > exit; > > } else { > > echo "Connected to $ftp_server, for user $username"; > > } > > echo(ftp_pwd($conn_id).""); # Comes back with / > > $buff = ftp_nlist($conn_id,""); ftp_nlist requires a directory name. A blank string is not a directory name. http://au.php.net/ftp_nlist -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Nope - unfortunately, no change, still the same problems, logging in but no ftp_nlist or indeed ftp_rawlist Cheers Nunners -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:12 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] FTP Problems I had many troubles with ftp_nlist since I discovered the "-a" option. try this : $buff = ftp_nlist($conn_id,"-a"); N F James Nunnerley a écrit : > I'm trying to create some functionality which requires FTPing onto another > server, using the php functions. > > Doing the following comes up with a successful login, but cannot display the > current directory; yet when I FTP directory from the server which is serving > the php pages, it works fine. > > // set up basic connection > $conn_id = ftp_connect($ftp_server, 21); > ftp_pasv($conn_id, true); > > // login with username and password > $login_result = ftp_login($conn_id, $username, $password); > > // check connection > if ((!$conn_id) || (!$login_result)) { > > echo "FTP connection has failed!"; > echo "Attempted to connect to $ftp_server for user $username"; > exit; > > } else { > > echo "Connected to $ftp_server, for user $username"; > > } > > echo(ftp_pwd($conn_id).""); # Comes back with / > > $buff = ftp_nlist($conn_id,""); > > // close the FTP stream > ftp_close($conn_id); > > var_dump($buff); => comes back with bool(false) > > exit; > > Can anyone see what could be wrong? > > > Cheers > > Nunners > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP Problems
I'm trying to create some functionality which requires FTPing onto another server, using the php functions. Doing the following comes up with a successful login, but cannot display the current directory; yet when I FTP directory from the server which is serving the php pages, it works fine. // set up basic connection $conn_id = ftp_connect($ftp_server, 21); ftp_pasv($conn_id, true); // login with username and password $login_result = ftp_login($conn_id, $username, $password); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $username"; exit; } else { echo "Connected to $ftp_server, for user $username"; } echo(ftp_pwd($conn_id).""); # Comes back with / $buff = ftp_nlist($conn_id,""); // close the FTP stream ftp_close($conn_id); var_dump($buff); => comes back with bool(false) exit; Can anyone see what could be wrong? Cheers Nunners
[PHP] PHP Session
Hi Folks, Bit of an unusual question here, which is basically as a result of my lack of understanding as to how Sessions work. I've created a Captcha image solution for an application I look after, and when we came to look into something that required debugging, I realized I'm using sessions without understanding how they work. Basically, the login includes an image, and textbox for the captcha text. The image then generates a session with a variable name of x, and a value of the characters from the captcha image. The user then logs in, including the text on the graphic. ## IMAGE CODE: session_start(); $_SESSION['captcha_text'] = $randomly_generated_text; The login check page obviously checks the username and password, and also does the following: ## CHECK LOGIN CODE session_start(); if ($_SESSION['captcha_text']!=$_POST["captcha_text"]) { #FAIL LOGIN TEXT } session_destroy(); It works a treat, however what I want to understand is how the session is kept relevant to that particular user's session - mainly because my boss wants to check there's no security implication. We've thought this through and believe that in other applications, there is also a cookie or post/get variable set in the form, which includes a reference to the session name. Are we missing something, or is it really magic? Cheers Nunners
[PHP] [PHP5] safe_mode_exec_dir
Hi Folks, Should be a nice easy one - if running PHP5, how do I add more than one exec_dir into the list? i.e. what is the separator? Cheers Nunners
[PHP] file Upload - checking file size before uploading
Is there anyway to check the size of a file before it starts uploading it? For instance, if the file is huge, and takes ages to upload, and is then rejected by the server, the user will be somewhat annoyed! I'm not even sure this is a php question! Cheers Nunners
[PHP] Showing an image outside of the web folder
I'm creating a file manager application, from which I want the user to be able to edit/view files. On the text side of things, it's pretty easy, however from the image side of things, I'm not sure how to allow the user to view files outside of the web folder. Doing a "readfile ($file_location)" outputs the binary... can someone point me in the direction of being able to translate that binary into a viewable image file? Cheers Nunners
RE: [PHP] Array Sorting
I think I may have written down my variable structure incorrectly in the first place, which even has me confused... The $file_array[$filename] is I don't think a further array. The "sub" values are created as follows: $file_array[$filename]["Date"] = ... $file_array[$filename]["Size"] = ... Looking at usort, it will put the list of Dates in order (by doing a pure if is bigger or smaller...) but will loose the link between the particular filename and it's date properties. Does that make sense - or am I loosing the plot? Am I also making a mistake by not defining $file_array[$filename]? I don't think so, but would be happy to be corrected! Cheers Nunners -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: 04 May 2006 16:24 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] Array Sorting James Nunnerley wrote: >I've got an array which has the following properties: > >$file_array[$filename] = array ("Date" => $Date, "size" => $size, >"permissions" => $permissions); > >I can quite happily sort the array by filename (using natksort and >natkrsort), which I found on the php manual - and for reference have >included as a PS > >What I'm not sure about doing is sorting by say Size or Date? > >I've again had a look through the php manual but I'm not sure how to sort by >a property... > >Can anyone point me in a direction? > > http://php.net/usort <-- it be thataway! -Stut PS. Please start a new thread instead of just replying to someone elses and changing the subject - it screws up the threading in decent email clients. -- 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] Array Sorting
Hi All, I've got an array which has the following properties: $file_array[$filename] = array ("Date" => $Date, "size" => $size, "permissions" => $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for reference have included as a PS What I'm not sure about doing is sorting by say Size or Date? I've again had a look through the php manual but I'm not sure how to sort by a property... Can anyone point me in a direction? Cheers Nunners PS as promised! function natksort(&$aToBeSorted) { $aResult = array(); $aKeys = array_keys($aToBeSorted); natcasesort($aKeys); foreach ($aKeys as $sKey) { $aResult[$sKey] = $aToBeSorted[$sKey]; } $aToBeSorted = $aResult; return True; } function natkrsort(&$aToBeSorted) { $aResult = array(); $aKeys = array_keys($aToBeSorted); $aKeys = array_reverse(natcasesort($aKeys)); foreach ($aKeys as $sKey) { $aResult[$sKey] = $aToBeSorted[$sKey]; } $aToBeSorted = $aResult; return True; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forking a search - pcntl
Thanks for everyone's replies - but I'm a little uncertain as to what the reasons for not running the pcntl functions under the web browser are - is it down to security? cheers -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: 18 April 2006 22:52 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] Forking a search - pcntl On Tue, April 18, 2006 5:21 am, James Nunnerley wrote: > What we'd like to do is run the actual search query in the background > (i.e. > fork) while the viewable page shows a nice scrollie banner etc! fork is not the only solution for this, thank [insert deity here] > Due to various problems with the server we are using (Zeus) we can't > just > run an exec(). I've had a look around, and it would seem that pcntl > maybe > the way forward. NO WAY! pcntl should NOT be run in a web-hosted environment, according to the docs. I don't think Zeus' threading model is going to make it "okay" to use. > Does anyone have an example working script, or indeed a decent > tutorial on > how to use the functionality? The php manual has limited information > on > using the functions, and I just can't get my head around how it's > meant to > work?!!! pctnl should only be used from CLI/CGI The examples should be sufficient for that, but you don't really care, as it's not useful for what you want. Here is what *I* would recommend: Create a new table of "searches": create table search( search_id int(11) auto_increment unique not null primary key, status enum{0, 1, 2} default 0, search_pid int(11) default null, inputs text, results text ); 0 = new search 1 = in progress 2 = complete Now, when somebody wants you to do a search, just insert a record: $query = "insert into search(inputs) values('$CLEAN[inputs]')"; where $CLEAN is your sanitized validated $_REQUEST input, of course. $id = mysql_insert_id(); Your scrolling banner can than have a META Refresh of a few seconds/minutes/whatever, and embed the $id into the URL for that. See: http://php.net/mysql_insert_id Then, of course, you need something to actually PERFORM the searches, which is where a nice cron job comes in. That cron job can start a new search task which will do this: [in psuedo-code] $pid = getmypid(); // or something like that: UPDATE search set status = 1, search_pid = $pid where status = 0 LIMIT 1 SELECT id, inputs from search where search_pid = $pid $id = $row['id']; update search set status = 1 where id = $id //do the search //when done: update search set status = 2, results = '$search_results' where id = $id Doing it this way means you could even run several processes at once, each working on a different search. Note that the UPDATE marks the record as "in progress" and ties it to the process running, so that there is NO race condition. If MySQL does not support LIMIT 1 in an UPDATE, which I'm pretty sure it does, but not 100% certain, then you'd have to just update all the inputs available, and have the thread handle each search that it "took" in the UPDATE. You could still have an army of search processes, though, as new search inputs are coming in all the time, and each search process would handle however many were on the "To Do" (status 0) stack when they started. This is very scalable, and you could even buy more computers and throw them at it, with just one database, provided you tagged the process_id with a machine_id of some kind as well, to avoid duplciate process IDs on 2 computers. I'll leave that part as an exercise. -- Like Music? http://l-i-e.com/artists.htm -- 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] Forking a search - pcntl
I'm creating a search function as part of our webmail frontend, however I'm having big problems with timeout etc. What we'd like to do is run the actual search query in the background (i.e. fork) while the viewable page shows a nice scrollie banner etc! Due to various problems with the server we are using (Zeus) we can't just run an exec(). I've had a look around, and it would seem that pcntl maybe the way forward. Does anyone have an example working script, or indeed a decent tutorial on how to use the functionality? The php manual has limited information on using the functions, and I just can't get my head around how it's meant to work?!!! Cheers Nunners
[PHP] imap_search and multiple criteria
Does the imap_search support multiple criteria? I've got the following successfully returning the correct results: However, when you try and put them in the same search e.g. $search = "BODY \"test\" OR SUBJECT \"test\"" It fails... The only way in which I can see this can be done is by joining the various arrays that are returned. Is this best? Thanks Nunners
RE: [PHP] Improving a MySQL Search
r(255) NOT NULL default '', `mode` varchar(255) NOT NULL default '', `stage` varchar(255) NOT NULL default '', `dir` varchar(255) NOT NULL default '', `spi` varchar(255) NOT NULL default '', `old_status` varchar(255) NOT NULL default '', `new_status` varchar(255) NOT NULL default '', `passwd` varchar(255) NOT NULL default '', `sintf` varchar(255) NOT NULL default '', `dintf` varchar(255) NOT NULL default '', `saddr` varchar(255) NOT NULL default '', `daddr` varchar(255) NOT NULL default '', `schd` varchar(255) NOT NULL default '', `svr` varchar(255) NOT NULL default '', `act` varchar(255) NOT NULL default '', `nat` varchar(255) NOT NULL default '', `log` varchar(255) NOT NULL default '', `in_spi` varchar(255) NOT NULL default '', `out_spi` varchar(255) NOT NULL default '', `error` varchar(255) NOT NULL default '', `seqno` varchar(255) NOT NULL default '', `field` varchar(255) NOT NULL default '', `old` varchar(255) NOT NULL default '', `new` varchar(255) NOT NULL default '', `gateway` varchar(255) NOT NULL default '', `interface` varchar(255) NOT NULL default '', `old_device` varchar(255) NOT NULL default '', `old_distance` varchar(255) NOT NULL default '', `old_dst` varchar(255) NOT NULL default '', `new_device` varchar(255) NOT NULL default '', `new_distance` varchar(255) NOT NULL default '', `new_dst` varchar(255) NOT NULL default '', `device` varchar(255) NOT NULL default '', `distance` varchar(255) NOT NULL default '', `icmp_id` varchar(255) NOT NULL default '', `icmp_type` varchar(255) NOT NULL default '', `icmp_code` varchar(255) NOT NULL default '', PRIMARY KEY (`ID`), KEY `unixtime` (`unixtime`), KEY `subtype` (`subtype`), KEY `type` (`type`), KEY `src` (`src`), KEY `dst` (`dst`), KEY `dst_port` (`dst_port`), KEY `src_port` (`src_port`), KEY `srcname` (`srcname`)) TYPE=MyISAM AUTO_INCREMENT=1481721 ; Sorry for it being so long, but that's the table! Currently there are 1.5 million (1,500,00) records, and searching the table for the last 10 records is taking up to 40 seconds. e.g. select unixtime, type, subtype, src, dst, msg, pri from syslog where type='ips' ORDER BY unixtime DESC LIMIT 10 Does anyone have any suggestions for improving the search? Cheers James From: Gareth Williams [mailto:[EMAIL PROTECTED] Sent: Fri 04/03/2005 13:17 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] Improving a MySQL Search Create some indexes. I spend most of my day messing around with a table of 200 records, and indexes increased the speed from 40 seconds to 55 minutes for a query, down to the longest being less than 5 seconds. On 28 Feb 2005, at 16:42, James Nunnerley wrote: > I'm creating a serious of pages that show various aspects from a Syslog > output. > > The main information is currently stored in one MySQL table - which > after > having been run for about 2 and a bit months has got nearly 100 > records. > With this amount of information, it's taking a large time to carryout > even > the simplest query. > > > > Someone has suggested I look at setting up an archive, for slower > searches, > and a more recent table for quicker searching, but I'm reluctant to do > this, > as it would take quite a bit of time to copy all the information > across as > it stands, and then also to run a cron which transfers between the > live and > archive. > > > > Can anyone suggest some quick easy methods for speeding up the search? > > > > Cheers > > James > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Improving a MySQL Search
I'm creating a serious of pages that show various aspects from a Syslog output. The main information is currently stored in one MySQL table - which after having been run for about 2 and a bit months has got nearly 100 records. With this amount of information, it's taking a large time to carryout even the simplest query. Someone has suggested I look at setting up an archive, for slower searches, and a more recent table for quicker searching, but I'm reluctant to do this, as it would take quite a bit of time to copy all the information across as it stands, and then also to run a cron which transfers between the live and archive. Can anyone suggest some quick easy methods for speeding up the search? Cheers James
[PHP] [Pear] go-pear.php
Hi, I'm having two problems: Firstly, the new update of go-pear.php I believe is not working. Does anyone know when a new "fixed" one is being released? Also, I'm having problems signing up to the pear.php.net lists - again, anyone any ideas? Cheers Nunners
[PHP] Multiple POP accounts on Webmail Front
Hi All, Bit of a side question, but it's still php related. Does anyone know of a Webmail client, preferably open-source, that is able to support single login, to allow users to collect and use multiple POP3 or IMAP accounts? I'm currently using Ilohamail, and have used Squirrel in the past, but neither, I don't, think support multiple POP3 accounts on one login. Any ideas? Cheers James
[PHP] SQL sums
I'm trying to create a table, and ultimately a graph, out of some syslog data. I have a mysql table with the following info in it: Time (unixtime stamp), bytes rcvd and bytes sent I want to create a sql statement that group the data over a certain period of time, and produces the following table: Time Sent Rcvd >From x to y Total bytes sent during period x to y Total bytes rcvd during period x to y >From y to z Total bytes sent during period y to z Total bytes rcvd during period y to z >From z to a Total bytes sent during period z to a Total bytes rcvd during period z to a >From a to b Total bytes sent during period a to b Total bytes rcvd during period a to b Now to create this I've tried a horrible method of using php to call sql table, and then go through each one, and add it to each period of time as appropriate. it's messy and slow! What I want to do is have the mysql do this.is it possible? Cheers Nunners
RE: [PHP] Hinding URL
Will, This isn't really a PHP thing... you can do it a number of ways... probably the best is to use frames. If you only have one then just create a single frameset with one frame in it Have a look at a HTML help site... Nunners > -Original Message- > From: Will [mailto:[EMAIL PROTECTED] > Sent: 31 March 2004 14:38 > To: [EMAIL PROTECTED] > Subject: [PHP] Hinding URL > > > Hello all, > > I am hoping someone can help me. > > When someone brings up a page in the browser, is there a way to > hide the URL > in the browser bar to a set URL?? > > Example: I want them to see this URL in the browser: > http://domain.com/test.htm But, I want them to see the url of > http://domain.com in the browser bar. Is this possible?? I hope so!!! > > ~WILL~ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Display/Screen Size Parameters
Is there a function within PHP that picks up the screen/display size? I know of the one in JavaScript, however I want to pick it up in PHP Thanks Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Request domain name
$_SERVER["HTTP_HOST"] will get you the full domain name... Nunners -Original Message- From: Age Bosma [mailto:[EMAIL PROTECTED] Sent: 25 February 2004 14:13 To: [EMAIL PROTECTED] Subject: [PHP] Request domain name I would like to be able to request the domain name. How can this be achieved without hardcoding it? $_SERVER['REQUEST_URI'] doesn't provide me the domain name, it just provides me "/index.php?page=2000" instead of e.g. "www.blaat.com/index.php?page=2000" I can't seem to find anything on the php site to get the domain name as well. I prefer using absolute URI's. The reason why this is a problem for me is besause I'm working on a site which has two different URI's but both display the exact same site. Cheers, Age Bosma -- 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] UK Postcode Reg Exp
Hi Shaun, Not that I know of - although I have looked at various things like this myself. Would you be interested in a small open source project on this subject? I see you instigated the discussion on this earlier today. It might be something worth putting on PEAR, and somehow linking it with the Royal Mail Address search - assuming we can get through their login process! Any thoughts? James [EMAIL PROTECTED] -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: 17 February 2004 16:55 To: Shaun; [EMAIL PROTECTED] Subject: RE: [PHP] UK Postcode Reg Exp [snip] Has anyone written a regular expression for validating a UK Postcode? [/snip] Nope, but I did write a love note to a French woman. Sorry, couldn't resist. :) I'll be here all week. Can you provide several examples and perhaps we could formulate one? -- 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