Re: [PHP] Re: Q. Adding line numbers to highlighted source
I suspect that is because of the regex code evaluation; but thanks for the suggestion anyway. BTW, I found a way to speed (my version) even more, something that I still forget to use on a regular basis but has been proven to be ~extremely~ good at boosting speed: replace: for ($i = 0; $i count($source); $i++) with: for ($i = 0, $_count = count($source); $i $_count; $i++) This simply prevents a continual reevaluation of count($source) (or whatever) and can provide some spectacular gains -- Alan John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This also works the same, for comparisons sake, but your solution benchmarks faster: $i=2; $fp = fopen($url,'r'); $file = fread($fp,filesize($url)); $file = highlight_string($file,TRUE); $file = str_replace('code','codespan style=color:black;1/span',$file); $file = preg_replace('/br \//e','sprintf(br /span style=\color:black;\%05d /span,$i++)',$file); echo hr; echo $file; Enjoy! ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Alan McFarlane [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 12:46 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Q. Adding line numbers to highlighted source Well I finally found a workable solution: $url = index.php; /* for example */ $source = explode(br /, preg_replace(`\/?code\`Ui, , highlight_file($url, true))); for ($i = 0; $i count ($source); $i++) $source[$i] = span style=\color:black;\ . str_pad($i, 5, 0, STR_PAD_LEFT) . /span . $source[$i]; echo code . implode(br /, $source) . /code; Alan McFarlane [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've been trying to add line-numbers to my source code, but can't seem to work out how to do it. As an example, I tried the following: ?php function addPrefix( $matches ) { static $line = 1; return $line++ . $matches[0]; } $url = split(\?, $_GET['url']); $source = highlight_file($url[0], true); $source = preg_replace_callback(`\br \/\`U, addPrefix, $source); echo $source; ? which is called whenever the use user on a link like a href=show-source.php?url=index.phpShow Source/a The problem is that my regex does not correcly match the lines. Anyone got any bright ideas? -- Alan McFarlane -- 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: Q. Adding line numbers to highlighted source
Well I finally found a workable solution: $url = index.php; /* for example */ $source = explode(br /, preg_replace(`\/?code\`Ui, , highlight_file($url, true))); for ($i = 0; $i count ($source); $i++) $source[$i] = span style=\color:black;\ . str_pad($i, 5, 0, STR_PAD_LEFT) . /span . $source[$i]; echo code . implode(br /, $source) . /code; Alan McFarlane [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've been trying to add line-numbers to my source code, but can't seem to work out how to do it. As an example, I tried the following: ?php function addPrefix( $matches ) { static $line = 1; return $line++ . $matches[0]; } $url = split(\?, $_GET['url']); $source = highlight_file($url[0], true); $source = preg_replace_callback(`\br \/\`U, addPrefix, $source); echo $source; ? which is called whenever the use user on a link like a href=show-source.php?url=index.phpShow Source/a The problem is that my regex does not correcly match the lines. Anyone got any bright ideas? -- Alan McFarlane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Q. Adding line numbers to highlighted source
I've been trying to add line-numbers to my source code, but can't seem to work out how to do it. As an example, I tried the following: ?php function addPrefix( $matches ) { static $line = 1; return $line++ . $matches[0]; } $url = split(\?, $_GET['url']); $source = highlight_file($url[0], true); $source = preg_replace_callback(`\br \/\`U, addPrefix, $source); echo $source; ? which is called whenever the use user on a link like a href=show-source.php?url=index.phpShow Source/a The problem is that my regex does not correcly match the lines. Anyone got any bright ideas? -- Alan McFarlane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing values from one script to another script
Have a look at the $_POST super global variable documentation. Chinmoy Barua [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everybody, I want to pass a value, which came from a HTML form, to another PHP script. How can i do this? e.g.: $login - the value of this varriable is came from LOGIN.HTML to LOGIN.PHP. How can i pass the value of $login from LOGIN.PHP to PROCESS.PHP? Thank you, Chinmoy - Do you Yahoo!? Yahoo! Web Hosting - establish your business online -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 'undef' as an argument value
function foo( $arg1, $arg2 = null ) { .. as before .. } -- Alan McFarlane Rodent Of Unusual Size [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... An odd request.. I want to have optional function arguments that *aren't* defined unless values are explicitly passed. Sorta the equivalent of function foo($arg1_required, $arg2_optional=undef) if (isset($arg2_optional)) { print explicit; } else { print not passed; } } Something like this is possible in Perl through the 'undef' construct; is anything like this available in PHP? -- #ken P-)} Ken Coar, Sanagendamgagwedweinini http://Golux.Com/coar/ Author, developer, opinionist http://Apache-Server.Com/ Millennium hand and shrimp! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: header() and frames
Nope, that didn't work... Jim Winstead [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Alan McFarlane [EMAIL PROTECTED] wrote: header(location: index.php; target: _top); header(Location: index.php); header(Window-target: _top); jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is flock necessary?
flock() may not be required - but I'm pretty sure it's damn sensible. As for using mySQL, well, these routines are part of a simple file-based cache system (specifically in my case used for caching mySQL data) Jtjohnston [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Group: Is flock even necessary? Allan: You look like you have Perled. It was necessary for Perl. Have you thought of MySQL instead? Alan McFarlane wrote: I've just written a couple of simple routines which read an write small text files to the server: function readData( $filename, $data ) { if (!$fd = @fopen($filename, r)) { return false; } flock($fd, LOCK_SH); $data = fread($fd, filesize($filename)); fclose($fd); return true; } function writeData( $filename, $data ) { if (!$fd = @fopen($filename, w)) { return false; } flock($fd, LOCK_EX); fwrite($fd, $data); fclose($fd); return true; } Now, the question is... How much time elapses between the fopen() statement and the flock() statements? Looking at the code, it would appear that two separate threads may call writeData() almost simultaneously giving the following execution: assume $filename = sample.txt; Thread #1 - $fd = fopen($filename, w); // succeeds Thread #2 - $fd = fopen($filename, w); // succeeds (I think) Thread #1 - flock($fd, LOCK_EX); // Does this succeed or fail? Thread #2 - flock($fd, LOCK_EX); // fails (I think) -- John Taylor-Johnston -- --- ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File/Directory Permissions
I've seen and successfully used the built-in function 'mkdir()' on several occasions, but I am having trouble understanding the mode parameter. I've seen 0771, 0775 and 0777 used on several occasions but I am never quite sure what to use. Since I write and normally run scripts on a Windows platform (NT WorkStation SP5), I'm pretty sure it does not affect me, but I would like my code to run without modification on a *nix platform. So, can anyone explain the mode parameter for me please? As a slight side note - can these permissions be applied to files - if so, when (and how) would it be done? -- Alan McFarlane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Use of flock()
I've just written a couple of simple routines which read an write small text files to the server: function readData( $filename, $data ) { if (!$fd = fopen($filename, r)) { return false; } flock($fd, LOCK_SH); $data = fread($fd, filesize($filename)); fclose($fd); return true; } function writeData( $filename, $data ) { if (!$fd = fopen($filename, w)) { return false; } flock($fd, LOCK_EX); fwrite($fd, $data); fclose($fd); return true; } Now, the question is... How much time elapses between the fopen() statement and the flock() statements? Looking at the code, it would appear that two separate threads may call writeData() almost simultaneously giving the following execution: assume $filename = sample.txt; Thread #1 - $fd = fopen($filename, w); // succeeds Thread #2 - $fd = fopen($filename, w); // succeeds (I think) Thread #1 - flock($fd, LOCK_EX); // Does this succeed or fail? Thread #2 - flock($fd, LOCK_EX); // fails (I think) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header() and frames
I've got a site where the administration facilities use frames. Now, as the authentication expires after a fixed period of no use, I check to see if we are an authenticated user. If not, I would like to redirect them to a non-framed page. I'm trying something like: header(location: index.php; target: _top); Anyone got any suggestions or pointers? -- Alan McFarlane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IE Combo Box File Selector
Sorry for being of topic, but I'm having great difficulty with this... The following code does NOT use a single border around the combo box as I would have expected. Any ideas as to why not? /* index.html */ select name=a style=border:solid 1px black; option value=11/option /select -- Alan McFarlane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php Projects
I've already got the steady supply of beer, but a backup? remind me - what's that word mean again... Alan McFarlane (Just after suffering a major NT dual server crash when the bac Nick Wilson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Arik Ashepa declared Hi. I was wondring... maybe you want to develop a project? have any ideas? Yes! How about a database backed set of scripts to create world peace and send a steady supply of beer to my house? - -- Nick Wilson Tel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8ZCmLHpvrrTa6L5oRAk63AKCIidIl7jTdl9weiRbnJau/YVwCKQCcCukg vfCBVeUKS8xMpnfderSjLXw= =UDHe -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Console, colors and stuff
Try 'echo'ing ansi control sequences? -- Alan Richard [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hey Boys, I'm using PHP CGI version on Win32 to write some scripts. Not for a website or anything, just some scripting at the console window. So now I want to change the text color, clear the screen, and the other usual stuff. Just like I can do with ncursus on the Linux version of PHP. Only, I can't find something similar on Win32. It's pretty boring this way. Does anyone know how to do it? Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Complex Version Checking
Does anyone know of a method of testing the minimum version of PHP required for a particular job? - Assume I'm developing a web-site for a customer who has PHP 4.0.5 installed. Now, I tend to use the latest version (4.1.1), so I have to be a little careful in certain aspects, but it would be useful if I could run a script across all .php files which would tell me what the minimum version required is. I suspect that this means writing a simple parser - coping with #defines, reading functions and class based functions, checking variables (like the new $_GET, _$POST etc) or is there an easier way - any regex gurus out there? Ideally, I should be able to run a script which produces a simple output - the minim version number required to run all of the passed scripts. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mktime() Algorithm
Most langauges have support for this type of function - i.e. the number of seconds since 1970. Check your language manual... David A Dickson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I need to create a function in another programming language that takes the same input as the php mktime() function and produces the exact same output as the php mktime() function. Does anybody out there know what the algorithm is? -- David A Dickson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Version checking
What's the best method for checking the PHP version number. I'm assuming that include() was available in all versions, so, from my main index.php script, I include a local script (common.php) : ?php // assume minimum version of PHP required is 4.0.5 if (phpversion() 4) { die(wrong version); } $ver = explode(., phpversion()); if ($ver[2] 5) { die(wrong version); } ? The problem I can see is that some of the earlier 4+ versions had a funny number scheme - i.e. 4.0.1pl2. Does anyone have a complete list of version numbers (or a better method of version checking)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending files to the user...?
The problem: How to I send a file to the user? Sounds simple but, assume I have a 'daily report' option from my main web page. When the user clicks on it, they are taken to the file 'generate_report.php' (sample included). Now, this code should generate the report, compress it if required and send it ot the user - i.e. a dialog box opens asking the user to open/save/run the incoming file. Question is, how? - I've toyed with Content-Disposition but I'm not sure of any reference materials for this. (Perhaps someone knows the RFC) The code: ?php /* file: generate_report.php */ // build the report $report = xml...; /* basically an xml document // compress if possible if (extension_loaded(zlib) (strlen($report) 1024)) { $report = gzcompress($report); $compress = true; } else { $compressed = false; } $length = strlen($report);// I presume this can handle binary data //header( something ); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sending files to the user...?
Oh, and BTW, after sending the file, I will be redirecting the user to a different page... Alan McFarlane [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The problem: How to I send a file to the user? Sounds simple but, assume I have a 'daily report' option from my main web page. When the user clicks on it, they are taken to the file 'generate_report.php' (sample included). Now, this code should generate the report, compress it if required and send it ot the user - i.e. a dialog box opens asking the user to open/save/run the incoming file. Question is, how? - I've toyed with Content-Disposition but I'm not sure of any reference materials for this. (Perhaps someone knows the RFC) The code: ?php /* file: generate_report.php */ // build the report $report = xml...; /* basically an xml document // compress if possible if (extension_loaded(zlib) (strlen($report) 1024)) { $report = gzcompress($report); $compress = true; } else { $compressed = false; } $length = strlen($report);// I presume this can handle binary data //header( something ); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pregenerating Script Once Again Putting this question
I tak you realise that according to your example interface, users will be browsing for files on their own system and ~not~ the server, are you sure this is what you want? After all, you'll never be able to verify the information contained within those files is viable, safe, legal etc. Karthikeyan [EMAIL PROTECTED] wrote in message 008501c1ab5a$60821a30$0600a8c0@aspire006">news:008501c1ab5a$60821a30$0600a8c0@aspire006... Hi Guys, I got some sweet responses like using cat and using Output Buffering functions. But then what i really want is to provide user with the interface like this : Pregeneration Program --- Step 1 - Choose you Header file [ ] [Browse] - here they will choose the header file Step 2 - Choose you Body file [ ] [Browse] - here they will choose the content body file Step 3 - Choose you Footer file [ ] [Browse] - here they will choose the footer file Step 4 - Please give the output File Name [ ] - The file can be saved in the same directory where this program is running [ Generate ] - This is a button When they press generate then step4 file should be created combining the step1, step2 and step3 files. Obviously this will take them to the next page where this operations will be carried out the then they will be shown the succes or failure. Hope now you understand what i really want. Environment - Win NT, PHP 4.0.6, Apache Note + I am working in win nt environment. So no Cat. + header, body, footer can be plain as well as html + no right now no php is not contained in the header, body and footer but may be in future. + Just a simple success and failure Looking forward for your response. karthikeyan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Can this be done in PHP?
Mmm - looks damn complex but it's really very simple - Get yourself a copy of phpAdsNew (from sourceforge.net) - It's an amazing banner thingy with all sorts of tricks for display adverts (text, graphics, flash, iframes, frames, layers, etc) and it's well documentated. Ed Lazor [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm trying to understand how this banner exchange works and whether it can be done in PHP. Here's the HTML you put on your web page: a href=http://rpgx.rpgconsortium.com/xchange/engage.cgi?advert=NonSSIpage=XX img src=http://rpgx.rpgconsortium.com/xchange/engage.cgi?id=atfantasypage=01; border=0 width=468 height=60/a It... - displays a random banner image - takes you to the site relating to the displayed image How does it do that? Any ideas on how to do this in PHP? -Ed This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] File Manager required
I'm just being damn lazy, but has anyone got (or seen) a nice file simple file manager writtin in PHP? Facilities should include upload/download, copy,move,rename,delete, possibly view image/source... Thanks -- Alan McFarlane [EMAIL PROTECTED] 'I hate re-inventing the wheel!' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Correct URL's
Please do not send HTML messages. Sorry, Outlook is crap and I'm just too lazy to buy (on Win you have to ??? Outlook does not ~need~ to send HTML messages, it can be configured to send text-only messages Sheesh, It's about time you guys started looking properly at your environments and learning how to use properly instead of just slanging MS David Robley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In article 007901c1a588$120a6150$3c01a8c0@quasimodo, [EMAIL PROTECTED] says... - Original Message - From: Alexander Weber [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 25, 2002 10:34 AM Subject: Re: [PHP] Correct URL's Stefan Rusterholz wrote SNIP Please do not send HTML messages. Sorry, Outlook is crap and I'm just too lazy to buy (on Win you have to buy almost everything) another e-mail client for my working machine. http://www.pegasus.org/ It's free and a bit more virus resistant than a certain M$ product (well, any M$ product) -- -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP and MYSQL Security`
If you know you are running on an apache server, you could try using a simple .htaccess file in a (say) etc directory which contains any or all files you wish to secure. ie: /index.php /etc/config.php /etc/.htaccess --index.php ?php include(etc/config.php); ... ? --etc/config.php $config['db_host']=sql; $config['db_name']=root; $config['db_pass']=hooray; ? --etc/.htaccess deny from all And that's it! Duky Yuen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... How can I secure my username and password? In 1 of my files, it contains the following: $conn = mysql_connect( 12.34.56.78, username, password); mysql_select_db(database,$conn); What should I do, so people can't get this information? Duky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Is it possible to bypass max time limit?
I've got a live script which occasional has to retrieve a file via ftp, download to the server, post-process it then display it. I use caching to check to see if I've already got the file, but if I don't I have to process the ftp_get operation which occasionally times out. So, is it possible to trap the time limit exceeded error and return a fail code? For example: function GetFileViaFTP( $filename ) { if (file_exists(cache/ . $filename)) { return true; } $ftp = ftp_connect(some host); ftp_login($ftp, some username, some password); ftp_chdir($ftp, some path); if (ftp_get($ftp, cache/ . $filename, $filename, FTP_BINARY)) // This will sometimes fail { ftp_quit($ftp); return true; } ftp_quit($ftp); return false; } function GetFile( $filename ) { if (file_exists(cache/ . $filename) || GetFileViaFTP($cache)) { return file(cache/ . $filename); } return Sorry, the file {$filename} could not be located; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Problem in mysql connection
What is the error message? (It will help us a lot G) Uma Shankari T. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I have installed php4 rpm in my machine.while connecting php with mysql it is giving fatal error.I have given like this mysql_connect($servername,$username,$password); Why it is so .. Is there any other files i have to install to access the database?? Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Calculate Directory Size
I suggest using an external tool - using PHP would probably be too slow esp. if you're hitting 1000+ users. (Plus, I think you would have to run a lot of clearstatcache()'s which may cause all sorts of problems)... If you do an ls or dir or similar then you could parse the output, however there must be a decent tool out there somewhere that runs nice and fast. Simon H [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On advice, I've moved this from the Pear list. I have a problem...hopefully someone can help, because I've no idea where to even start! I have a user database, with a table called Users, and fields as so: (it would be cool if this would work on both Linux and Windows) - User DiskUsage (Mb) Quota (Mb) HomeDirectory - jim 50 100 F:\users\jim \\ In Windows jim 50 100 /users/jim \\ In Linux - The database wouldn't be shared between Windows and Linux, just 1 or the other. What I would like to be able to do is, press a button on a php page, and scan the (MySQL or ODBC through Pear DB) database, and for each user, calculate the size of their HomeDirectory, and Update the DiskUsage in the DB accordingly. I'm wondering tho how this would work with say 1000's of users each with several hundred Mb's or even several Gb's each. The users will have subfolders too, so the function would have to recurse the dirs, if possible. Is this even possible with PHP? I appreciate any help I can get on this, because its waay beyond me presently. Thanks Simon H -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: upgrade problem
It sounds like an inconsisteny in the library versions. Try and get the latetst version of the GD library, (source if necessary), or if you have a tool that is capable of analyzing .so/.dll dependancies, use that. Chuck Barnett [EMAIL PROTECTED] wrote in message 002301c1a607$c3dff1e0$[EMAIL PROTECTED]">news:002301c1a607$c3dff1e0$[EMAIL PROTECTED]... Hi, I have been running 4.0.3 or so and I was upgrading to 4.1.1. I also upgraded gdlib to 1.8.4. I compiled php with jpeg support and gd support everything made and compiled ok. when I restart apache I get this: Setting up Web Service: Syntax error on line 58 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/libphp4.so into server: /etc/httpd/modules/libphp4.so: undefined symbol: gdImageCreateFromGif to get apache running again I have to copy my backup libphp4.so. I know it probably has something to do with an older version of gdlib but I'm not sure. My box is a Cobalt RAQ4. If anyone has any ideas please help :) Thanks, Chuck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: HELP! with PHP extension
Make sure you've copied the contents of the c:\php\dlls folder to your system directory (\windows\system, \winnt\system32, not sure 'bout 2K). Your extension_dir setting in php.ini should be extension_dir = c:/php/extensions/ And make sure you've copied your php.ini to your windows directory (\windows, \winnt, again not sure 'bout 2K) Andre Amaral [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, Here is the situation. I have Windows 2000 SP2, IIS5 running PHP 4.1.1 using CGI. My PHP folder is C:\php Extension Folder is: C:\php\extension PHP.INI file: extention_dir = C:\php\extension\ First problem that I have is loading extensions. Every time I try to uncomment an extension on PHP.INI I get the following message after restart IIS. [Unable to load dynamic library 'C:\php\extension\php_db.dll' - The specified procedure could not be found] I also want to mention that I tried the follwing in PHP.INI... extention_dir = .;C:\php\extension\ extention_dir = ,;C:\php\extension\ extention_dir = C:/php/extension/ Obs.: All DLL's the came with the original package are there. Second problem is that every single script I execute in my server it gives me the following error... [PHP Warning: Undefined property: blabla in c:\blabla\blabla] Obs.: The 'blablabla' is representing the propperty and the folder Thank you guys. I hope I get some good help. I need it really bad. I've been burning my brain on this for the past 2 weeks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Encryption
As far as I'm aware, as long as you use the same seed or salt value, encrypting material will always yield the same results. However, remember that not all servers have support for mcrypt... You may find it better to use something simpler like md5($seed . $data), where $seed is a unique (and hireable) value that you have created. Anas Mughal [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am totally new to encryption. My question is very simple. If I use the mcrypt module to encrypt and decrypt some data, would it guarantee to work consistently with future versions of the mcryp module (or PHP versions). (i.e. Would decription always give me the same result?) Thanks. = Anas Mughal [EMAIL PROTECTED] [EMAIL PROTECTED] Tel: 973-249-6665 __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Best way to get the remote IP address?
I'm trying to get the remote IP address of a user in a (PHP) version and server-software independant way, but am having a few problems. Obviously, I've seen $HTTP_SERVER_VARS['REMOTE_ADDR'], but Ive also seen references to $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']. Is there any generic solution to this problem (and if so, what is it?) Cheers -- Alan McFarlane [EMAIL PROTECTED] ICQ: 20787656 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] POSTing files
This is probably more of an HTML question, but... I would like to have the ability to upload files onto a site, however using the normal HTML input type=file... results in a somewhat disgusting looking control which I cannot seem to get to fit into my site's theme. Is there a better way - remembering of course that I still need the facility to browse the local system for a file Thanks -- Alan McFarlane [EMAIL PROTECTED] ICQ: 20787656 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: New to list
try: $result = ((0.416/$time)*60)*60); echo number_format($result, 2); or echo sprintf(%.2f, $result); Andrew [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello to you all! I am new to this list and I have a question that maybe someone can help with In a script I am working on I have a math's equation : ((0.416 / $time) * 60) * 60) this out but a figure at goes to a about 10 decimal places I only want 2 decimal places and just can not figure out how to do this Any ideas would be great Thanks Andrew Web Harper Graphics www.webharpergraphics.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Trouble with named session vars in classes
I'm having trouble with some session management code. What I'm after is a basic class which is capable of storing some data via the built-in session handling routines. The name of the session variable must be configurable at run-time. i.e: $object1 = new Object( 'object1_session_variable_name' ); $object2 = new Object( 'object2_session_variable_name' ); Unfortunately, I can't get this to work... [ -- END CODE SAMPLE -- ] class Test { var $sessvar; function Test( $sessvar ) { // set the name of the session variable to use for persistent storage $this-sessvar = $sessvar; } function Execute( ) { // get this instance's session data $container = $this-container(); // display the data echo container['sequence'] = . $container['sequence'] . br; echo container['signature'] = . $container['signature'] . br; // update the sequence # value $container['sequence']++; } function factory( $sessvar ) { static $instances; // generate the instance id $id = $sessvar; // if the instance already exists, return it if (isset($instances[$id])) { return $instances[$id]; } // create a new instance; $object = new Test($sessvar); // get the new instance's session data $container = $object-container(); // set it's signature $container['siganture'] = $sessvar; // store the newly created instance $instances[$id] = $object; // and return the new instance return $object; } function container( ) { static $container; if (!isset($container)) { if (session_is_registered($this-sessvar)) { if (ini_get(register_globals)) { $container = $GLOBALS[$this-sessvar]; } else if (function_exists(version_compare)) { $container = $_SESSION[$this-sessvar]; } else { $container = $HTTP_SESSION_VARS[$this-sessvar]; } } else { session_register($this-sessvar); $container = array ( 'sequence' = 1, 'signature' = ); } } return $container; } } session_start(); $test1 = Test::factory(test1_data); $test2 = Test::factory(test2_data); echo \$test1-Execute() reports: ; $test1-Execute(); echo \$test2-Execute() reports: ; $test2-Execute(); echo \$test1-Execute() reports: ; $test1-Execute(); [ -- END CODE SAMPLE -- ] Running this in a browser, I would expect to see the following: $test1-Execute reports: container['sequence'] = 1 container['signature'] = test1_data $test2-Execute reports: container['sequence'] = 1 container['signature'] = test2_data $test1-Execute reports: container['sequence'] = 2 container['signature'] = test1_data And on refreshing the browser: $test1-Execute reports: container['sequence'] = 3 container['signature'] = test1_data $test2-Execute reports: container['sequence'] = 2 container['signature'] = test2_data $test1-Execute reports: container['sequence'] = 4 container['signature'] = test1_data However... it doesn't! Any clues, suggestions, hints, tips, etc. would be most gratefully recieved as I'v been trying to get this code to work for some considerable time now. Oh and BTW, the code MUST be capable of running on PHP 4.0.0 but can take advantage of anything up-to and including PHP 4.1.0, and must use the standard built-in session handling routines. Thanks -- Alan McFarlane [EMAIL PROTECTED] ICQ: 20787656 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]