[PHP] strange problem with post method
Hi list! Yesterday I've installed PHP 4.3.4 and Apache 1.3.29 on my Linux Mandrake 9.1 machine with a standard procedure: 1. cd apache_1.3.29 2. ./configure 3. cd ../php-4.3.4 4. ./configure --with-apache=../apache_1.3.29 --enable-track-vars make make install 5. cd ../apache_1.3.29 6. ./configure --activate-module=src/modules/php4/libphp4.a 7. make make install 8. cd ../php-4.3.4 9. cp php.ini-dist /usr/local/lib/php.ini 10. In httpd.conf file: AddType application/x-httpd-php .php I've encounterd a problem with this snippet of code, where I fill a form and I pass the data to a php page that should visualize it. Here is the code: //Login.php html head titleTEST/title /head form method=post action=second.php brbrbr NAME : input type=text name=ident br PASSWORD :input type=password name=psw br input type=submit name=Submit value=Submit /form /body /html //second.php ?php echo NAME = $ident br PASSWORD = $psw; ? When I execute this code in my web page http://members.lycos.co.uk/ippo80/Login.php, or in another Apache server with PHP-4.2.3 not installed by me, the name and password are correctly visualized once I click the submit button: NAME = myname PASSWORD = mypassword , but on my recently installed server I obtain NAME = PASSWORD = indicating that variable values are not transmitted. Have you any idea about the reason of this behaviour? Thank you very much for the attention, Giuliano __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [SOLVED] Extract of a Paragraph
Oops, I forget to consider, what would happened with HTML tags. Thank you Justin. Finally I did a function similar to yours, but the addition of the TAG control is almost perfect solution. (To trunk a word of two or three words, does not worth. No need such complicated script (with dictionary) for that) Cheers! -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: jueves, 05 de febrero de 2004 0:59 To: Brian Paulson Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Extract of a Paragraph On Thursday, February 5, 2004, at 02:35 AM, Brian Paulson wrote: $string = substr($stringname,0,50); echo $string; http://www.php.net/substr No, that's 50 *characters* -- he wanted 50 *words*. A quick and reasonably accurate[1] solution would be this: Daniel, There's a few things you need to look out for. If there's tags (like b or a) in the text, and you chop the text inside an open tag, it will break your pages, cause them to be invalid, and make them look really strange. So the first thing you want to do with the text is strip the tags. I'd say the next issue is to only append the 'read more' link if the article is great than the teaser limit -- that way 'read more' only appears when it's correct. You should wrap it in a function so that you only ever write this code once too. Here's a stripped-down version of what I use: ? function chopper($input,$wordcount,$append='') { $input = trim(strip_tags($input)); $words = explode(' ',$input); $output = ''; for($i=0; $i=$wordcount; $i++) { $output .= $words[$i].' '; } trim($output); if( ($i == $wordcount) (!empty($append)) ) { $output .= $append; } return $output; } echo chopper($myText,50,... a href='foo'read more/a); ? [1]: It's reasonably accurate in that it breaks words on spaces, then glues them back together up to the limit. However, there are some words which you may consider to have a space in them, but still be considered one word. A perfect example would be Leonardo da Vinci which the above function will see as 3 words, and you may consider it to be 2. Justin French -- 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] Global.asa
Hello: Is there anything similar to 'global.asa' which is used in ASP applications in PHP. Can anybody provide me with some details. Sheni R Meledath [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange problem with post method
On Thursday 05 February 2004 16:41, Giuliano Ippoliti wrote: [snip] 9. cp php.ini-dist /usr/local/lib/php.ini Read the comments at the top of the file 'php.ini-recommended'. It is the same directory as the file 'php.ini-dist'. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The probability of a drink getting spilled into a console is directly propotional to the cost of the console -- Murphy's Laws of Broadcast Engineering n8 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using sessions with register globals off
PHP Manual: If register_globals is enabled, then each global variable can be registered as session variable. Upon a restart of a session, these variables will be restored to corresponding global variables. Since PHP must know which global variables are registered as session variables, users need to register variables with session_register() function. You can avoid this by simply setting entries in $_SESSION. just set the superglobal to the desired value. to remove when you're through you can use session_unregister('foo') or unset($_SESSION['foo']). do not unset $_SESSION itself!!! $_SESSION['foo'] = bar; ~pj I've looked through the docs and past posts but I'm still a bit confused. How do I translate the following into code that can be used with register_globals set off. Assuming there's a preceding page that has created the session 'name' and registered the var 'order' with the 'name' session. session_name('name'); session_register('order'); -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Development/Promotion Mac Consulting/Sales http://www.systame.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange problem with post method
--- Jason Wong [EMAIL PROTECTED] wrote: On Thursday 05 February 2004 16:41, Giuliano Ippoliti wrote: [snip] 9. cp php.ini-dist /usr/local/lib/php.ini Read the comments at the top of the file 'php.ini-recommended'. It is the same directory as the file 'php.ini-dist'. Thank you very much Jason: the problem was originated by register_globals = Off. I turned it into On and now it works. However in the future I'll use $_POST(...) to pass variables. Thank you very much again, Giuliano __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Turck MMcache installtion
Hi all, I m using Turck MMcache for php source encoding. Now the server where i will deploy those file need to have turck loader installed on it. And the procedure given in the site requires compiling the source and then including the TurckLoader.so extension in php.ini file . Now is it possible not to compile the turck source on client's server and simply include the extension TurckLoader.so(which i'll provide them) in php.ini i.e bypassing the compile face. Please let me know .. as this is very urgent and client is not a techy person. Thanks Binay
RE: [PHP] Re: MySQL: Order by
make your column of type int column -Original Message- From: Ben Ramsey [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 7:52 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Re: MySQL: Order by I assume number is a column name in your table. If so, I'm also guessing that it's probably of a varchar (or some other character type) datatype. Here's why: if it's a character, then ORDER BY will sort alphabetically. The way it sorts number alphabetically is rather odd, but it makes sense in an alphabetical way. If it is character data, then it should order like this: 1 10 11 12 13 2 3 4 .. To correct it, put a zero at the beginning of your single digits: 01 02 03 .. 10 11 12 That will order it correctly. Otherwise, change the number column to type int, and it should work just fine. Hope that answers your question, and, yes, this is more of a MySQL question. ;-) -Ben John Taylor-Johnston wrote: This is probably a MySQL question, and maybe an easy question, but I'm here to learn |:) When I order by number, it echoes 1,2,3,4,5,6,7,8,9,10 and hten jumps to 100...199 before it comes back to 11-19. Any way of ordering that differently? $sql = 'SELECT * FROM '.$table.' ORDER BY number desc;'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommendation on PHP encoder please
On 04/02/2004 at 09:35 Chris W wrote: Hi, my company's looking to buy a PHP encoder to secure the source code. The encoded scripts should be able to run on Solaris platform (Apache webserver), and should only require minimum changes to the server. I'm sorry I can't help you but I am curious as to what the point of this is. If you are running your php scripts on your servers, who are you trying to prevent from seeing your code? It doesn't get sent to the client, only the output of the script gets sent. So what is the point? We have a server that need to be as secure as possible, since it's containing some very sensitive personal data. We have hardened the box, setup very restrictive firewall rules to it, keeping up to date with the security patches, and so on. But just in case that a cracker still manage to break in, we'd like to make it a real hassle for him/her to read the content in the server. So I was tasked to create a PHP application which will enable the following scenario: # Webteam will still create contents in Dreamweaver # Once done, upload the contents to the server using the upload script. # The upload script will put and encrypt the contents in the server using the strongest encryption available # Users will access the content using the second script, which will decrypt the content on-the-fly; so the URL will be something like this: https://www.mydomain.com/view.php?file=/mydata/index.html As you can see, the content will be secured, but the script is now becoming the weak point since it'll store the encryption key needed to decrypt the content. So double-encoding it (using a PHP encoder) will make life finally very hard for said cracker. by the way, if anyone's interested on such application, I'm planning to release it as an open-source application, so you'll be able to utilise it as well. cheers, HS -- Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com Solusi canggih, bebas ikatan, dan bebas biaya v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recommendation on PHP encoder please
Hi Larry, many thanks for the recommendation. That will be just perfect. I've informed my manager about it, and I imagine he'd be happy for the fact that we'll be saving quite a lot of money as well. Also thanks for the other recommendations - but unfortunately, we need Solaris compatibility now. Thanks again! Harry On 04/02/2004 at 09:39 Larry Brown wrote: Check out ioncube.com. I use them and it was very easy to install and run. The best thing about it is that a problem with apache or apache configuration won't end up displaying the script contents by accident. (mysql log/pass info etc) It can be used to encode .inc files as well. Their site states compatability with Solaris. Have fun. Larry -Original Message- From: Harry Sufehmi [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 9:11 AM To: [EMAIL PROTECTED] Subject: [PHP] Recommendation on PHP encoder please Hi, my company's looking to buy a PHP encoder to secure the source code. The encoded scripts should be able to run on Solaris platform (Apache webserver), and should only require minimum changes to the server. I looked on Zend Encoder and was ready to suggest it when I realise that the US$ 960 tag is only for a year's license. And I don't think we have the budget to buy the perpetual license. Could anyone recommend other PHP encoder for us? Many thanks, Harry -- Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com Solusi canggih, bebas ikatan, dan bebas biaya v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Turck MMcache installtion
On Thursday 05 February 2004 19:00, Binay wrote: I m using Turck MMcache for php source encoding. Now the server where i will deploy those file need to have turck loader installed on it. And the procedure given in the site requires compiling the source and then including the TurckLoader.so extension in php.ini file . Now is it possible not to compile the turck source on client's server and simply include the extension TurckLoader.so(which i'll provide them) in php.ini i.e bypassing the compile face. It ought to be possible providing that you compile the extension on a server that is similar to the client's. Similar, meaning the same versions of support libraries, apache, php etc etc. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I find you lack of faith in the forth dithturbing. - Darse (Darth) Vader */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recommendation on PHP encoder please
On 05 February 2004 11:30, Harry Sufehmi wrote: ...SNIP... As you can see, the content will be secured, but the script is now becoming the weak point since it'll store the encryption key needed to decrypt the content. I hope you don't mean that literally. If you're really being security conscious, the encryption keys should be in an include file that lives *outside* the Web document tree. If your include path is given relative to the including script, a hacker also has to know the local pathname to the script in order to deduce the location of the included file containing the keys. On my site, the *only* PHP scripts visible to the Web server look like this: ?php ini_set('include_path', '../../relative/path/to/includes/'); require 'real_script.php'; ? ... and the only reason that the include_path is set there and not in php.ini or equivalent is that I'm not the admin of the server and don't have access to configuration files! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommendation on PHP encoder please
So double-encoding it (using a PHP encoder) will make life finally very hard for said cracker. No its not ... if I would badly need to get this encrypted page and have access to files ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] multi dimension array sort help
On 05 February 2004 04:33, Justin French wrote: Hi, I've read and re-read array_multisort(), but still can't get a grip on how to sort my array: Array ( [0] = Array ( [path_id] = 3 [year] = 2004 [month] = 02 [day] = 05 [hits] = 3 [path] = home ) ... etc. I'm pretty sure this is one where multisort() is not the best approach, and usort() (or one of its friends) is where to look. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5: class variables problem / array_push bug
hi at all, i've a very strange problem but i don't know if this a real bug or only my imcompetence?! it is a problem with class variables set by __constructor() function in PHP5... look at this code: ? class MyClass extends DomNode { // remove extends DomNode and everything is fine private $__arr = Array(); public function __construct() { //$this-__arr = Array(); // uncomment this line for testing $this-__setVar(value set inside constructor); } public function __setVar($classname) { print(\n\nexecuting __setVar()\n); print(trying to push \ . $classname . \ into \$this-__arr with array_push\n); // array_push only works in several cases... array_push($this-__arr, $classname); // comment following line for testing //$this-__arr[] = $classname; /* foreach($this-__arr as $parentClassname) { print($parentClassname . \n); } */ } } print(pre); $node = new MyClass(); print_r($node); $node-__setVar(value set outside object method); print_r($node); print(/pre); ? output: *** executing __setVar() trying to push value set inside constructor into $this-__arr with array_push MyClass Object ( [__arr:private] = Array ( ) ) executing __setVar() trying to push value set outside object method into $this-__arr with array_push MyClass Object ( [__arr:private] = Array ( [0] = value set outside object method ) ) *** ok, in my opinion the Array $this-_arr should have a value value set inside constructor after creating the object set by array_push (see output line 2)! But there are several cases in which this bug does not appear: - remove extends DomNode from code and it works fine ...but what does DomNode with my __construct() function?! - uncomment line 6 and it will work ...don't ask me why it works now?! - uncomment line 19 and it will work ...seens that array_push does not work correctly. by the way i'm using PHP5 cvs-version from 2004-05-02 10:30... maybe you could help me out of this dilemma.. another question for the php experts: is this information enough for sending a bug to php.bugs? thanks for your attention. bye vivi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recommendation on PHP encoder please
On 05/02/2004 at 11:48 Ford, Mike [LSS] wrote: On 05 February 2004 11:30, Harry Sufehmi wrote: As you can see, the content will be secured, but the script is now becoming the weak point since it'll store the encryption key needed to decrypt the content. I hope you don't mean that literally. If you're really being security conscious, the encryption keys should be in an include file that lives *outside* the Web document tree. Of course we'll do it like that. And anyway I was talking about if the cracker has actually gained (root) access to that server itself - which makes putting the keys outside the web directory irrelevant. cheers, HS -- Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com Solusi canggih, bebas ikatan, dan bebas biaya v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommendation on PHP encoder please
On 05/02/2004 at 14:07 Andrei Reinus wrote: So double-encoding it (using a PHP encoder) will make life finally very hard for said cracker. No its not ... if I would badly need to get this encrypted page and have access to files ... So there's a reasonably easy way to decrypt those encoded files then ? (despite those vendors' claim...) cheers, HS -- Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com Solusi canggih, bebas ikatan, dan bebas biaya v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recommendation on PHP encoder please
On 05 February 2004 13:10, Harry Sufehmi wrote: On 05/02/2004 at 11:48 Ford, Mike [LSS] wrote: On 05 February 2004 11:30, Harry Sufehmi wrote: As you can see, the content will be secured, but the script is now becoming the weak point since it'll store the encryption key needed to decrypt the content. I hope you don't mean that literally. If you're really being security conscious, the encryption keys should be in an include file that lives *outside* the Web document tree. Of course we'll do it like that. And anyway I was talking about if the cracker has actually gained (root) access to that server itself - which makes putting the keys outside the web directory irrelevant. OK, good -- I kind of assumed so, given your other precautions, but just thought I'd clarify for any novices coming upon this thread in the archives... ;) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort multidimensional array - ARGH!
I have been messing around now for some hours and Im going mad! Im pulling some heavy data from mySQL with count and grouping, after this I have to calculate som values and then sort the outcome. Therefore Im not able to let mySQL do the accuall sort. So i stuff it into an array, and I need to sort the array and thats where the problem occures. 1. I declare an array : $stats_unsorted = array(); for loop start ... 1. fetch mySQL data 2. calculate values array_push($stats_unsorted,$sum,$user); // Eks. array_push($stats_unsorted,10,Ola); // Eks. array_push($stats_unsorted,-5,Kaare); // Eks. array_push($stats_unsorted,203,Nils); // Eks. array_push($stats_unsorted,-20,Lars); for loop end ... We now have, e.g. this : Array ( [0] = Array ( [0] = 10 [1] = Ola ) [1] = Array ( [0] = -5 [1] = Kaare ) [2] = Array ( [0] = 203 [1] = Nils ) [3] = Array ( [0] = -20 [1] = Tone ) ) - - - - - - - - - - - - - - - - - - - - Then comes the sorting part, I want to sort by this : $stats_unsorted[x][0] meaning the numbers, ofcourse I would surely like to know how to sort by the names aswell, $stats_unsorted[x][1], but I would think that is easy if I could figure out the main command to sort this in the first place. Ive tried several times with array_multisort(); but I cant get this to work, :( Help would be appretiated! $stats_SORTED = ???; Thanks in advance! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sort multidimensional array - ARGH!
OK, typically when finally biting the dust and asking for help the answer comes falling down from above... I figured out that a simple : sort($stats_unsorted); This would infact sort the first field of the subarrays. This would mean by throwing the results back and forth between several arrays I would in the end be able to sort whatever I would need. I could also insert back into the SQL and sort it by a select statement, but I feel Arrays are there for a reason, and there should not be any reason to bother the SQL for such a trivial thing as sorting. If any of you have another sollution I would sure love to know it, since my array infact is multidimensional, and the sort() isnt, though it for some reason solved the problem aslong as Im sorting the first field. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sort multidimensional array - ARGH!
Hi, Thursday, February 5, 2004, 11:35:34 PM, you wrote: KS I have been messing around now for some hours and Im going mad! KS Im pulling some heavy data from mySQL with count and grouping, KS after this I have to calculate som values and then sort the outcome. KS Therefore Im not able to let mySQL do the accuall sort. KS So i stuff it into an array, and I need to sort the array and thats where KS the problem occures. KS 1. I declare an array : KS $stats_unsorted = array(); KS for loop start ... KS 1. fetch mySQL data KS 2. calculate values KS array_push($stats_unsorted,$sum,$user); KS // Eks. array_push($stats_unsorted,10,Ola); KS // Eks. array_push($stats_unsorted,-5,Kaare); KS // Eks. array_push($stats_unsorted,203,Nils); KS // Eks. array_push($stats_unsorted,-20,Lars); KS for loop end ... KS We now have, e.g. this : KS Array KS ( KS [0] = Array KS ( KS [0] = 10 KS [1] = Ola KS ) KS [1] = Array KS ( KS [0] = -5 KS [1] = Kaare KS ) KS [2] = Array KS ( KS [0] = 203 KS [1] = Nils KS ) KS [3] = Array KS ( KS [0] = -20 KS [1] = Tone KS ) KS ) KS - - - - - - - - - - - - - - - - - - - - KS Then comes the sorting part, I want to sort by this : KS $stats_unsorted[x][0] KS meaning the numbers, ofcourse I would surely like to know KS how to sort by the names aswell, $stats_unsorted[x][1], KS but I would think that is easy if I could figure out the KS main command to sort this in the first place. KS Ive tried several times with array_multisort(); but I cant get this KS to work, :( KS Help would be appretiated! KS $stats_SORTED = ???; KS Thanks in advance! KS -- KS Kim Steinhaug KS --- KS There are 10 types of people when it comes to binary numbers: KS those who understand them, and those who don't. KS --- You can use usort for multi dimension arrays: ?php function cmp($a, $b) { if ($a[0] == $b[0]) { return 0; } return ($a[0] $b[0]) ? -1 : 1; } $a = array( 0 = Array(0 = 10,1 = 'Ola'), 1 = Array(0 = -5,1 = 'Kaare'), 2 = Array(0 = 203,1 = 'Nils'), 3 = Array(0 = -20,1 = 'Tone')); usort($a, cmp); print_r($a); ? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi dimension array sort help
Assuming your array is called $array1: $paths = array(); foreach ($array1 as $data_ptr = $data) { if (!in_array($data['path'],$paths) $paths[] = $data; } sort($paths) foreach($paths as $path_to_check) { foreach($array1 as $data_ptr = $data) { if ($data['path'] == $path_to_check) { /** Do your stuff here **/ } } } It's a little cumbersome and probably has way too many loops, but processor time is cheap and memory is even cheaper. I've found PHP's array parsing to be fairly quick. Alternatively, use the path as the index for your array; i.e: $array1 = array(path = array(path_id = 3, year = 2004, month = 02, day = 05, hits = 3); When you're parsing your log (which is what I'm assuming you're doing), you would populate $array1 as follows: $array1 = array(); while (parsing()) { $array1[$path]['path_id'] = $path_id; $array1[$path]['year'] = $year; /** etc... **/ } $paths = array_keys($array1); sort($paths); foreach($paths as $path_to_check) { /** Do stuff with $array1[$path_to_check] **/ } Matt Array ( [0] = Array ( [path_id] = 3 [year] = 2004 [month] = 02 [day] = 05 [hits] = 3 [path] = home ) [1] = Array ( [path_id] = 2 [year] = 2004 [month] = 02 [day] = 05 [hits] = 1 [path] = plan ) [2] = Array ( [path_id] = 7 [year] = 2004 [month] = 02 [day] = 05 [hits] = 1 [path] = specials ) ) On Wed, 2004-02-04 at 23:33, Justin French wrote: Hi, I've read and re-read array_multisort(), but still can't get a grip on how to sort my array: Array ( [0] = Array ( [path_id] = 3 [year] = 2004 [month] = 02 [day] = 05 [hits] = 3 [path] = home ) [1] = Array ( [path_id] = 2 [year] = 2004 [month] = 02 [day] = 05 [hits] = 1 [path] = plan ) [2] = Array ( [path_id] = 7 [year] = 2004 [month] = 02 [day] = 05 [hits] = 1 [path] = specials ) ) In this case, I'd like to sort the entire array on [path]. Can anyone provide some tips or an example to start from? Justin French signature.asc Description: This is a digitally signed message part
[PHP] PHP5: __call() implementation
Hello, as you know there is a new callback function __call($method, $params) in php5. the __call() method of an object is called, if the method named $method is not declared in this class. i want this function simply call the method of another class with SomeClass::$method(...) but i'm getting into trouble (bit heavy programming!:) passing the arguments (stored as Array in $params) to the SomeClass::$method([arguments]) method... further, i think i'm getting problems with objects passed through the __call() method?! any suggestions? thanks vivi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5: __call() implementation
From: Vivian Steller [EMAIL PROTECTED] i want this function simply call the method of another class with SomeClass::$method(...) but i'm getting into trouble (bit heavy programming!:) passing the arguments (stored as Array in $params) to the SomeClass::$method([arguments]) method... further, i think i'm getting problems with objects passed through the __call() method?! Not saying that I can help you at all, but some short, example code is probably in order here. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Anyone have any ideas on a upload progress bar???
see my message (and patch) on this topic. try http://pdoru.from.ro -- Best regards, Doru Petrescu Senior Software Engineer Astral Telecom Bucuresti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic vs Static Builds
Hi, I've been working with a PHP for a few years now. I've always thought that on production servers, to have them working at peak efficiency, I should have the Apache and PHP compiled as a static build. I recently got into a debate with someone over whether this had any worthwhile savings. Can anyone tell me which is the best solution, or point me in the direction of a solution? I realise that it would vary from situation to situation, so I'll tell you that my situation is high load servers required to run as fast as possible. They get restarted once a day, and (ideally) only get php+apache rebuilt when there's new versions out. Thanks for any advice you can offer, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5: __call() implementation EXAMPLE
Vivian Steller wrote: Hello, as you know there is a new callback function __call($method, $params) in php5. the __call() method of an object is called, if the method named $method is not declared in this class. i want this function simply call the method of another class with SomeClass::$method(...) but i'm getting into trouble (bit heavy programming!:) passing the arguments (stored as Array in $params) to the SomeClass::$method([arguments]) method... further, i think i'm getting problems with objects passed through the __call() method?! any suggestions? thanks vivi ok, here is an example: hope you'll understand what i want... pre ?php class MyClass { function __call($method, $params) { // $params = Array(mixed var, mixed var, ...); print(request for . $method . ()\n); // how to get objects in this string?! // do i have to implement switch($type) { case object: ... } here?! $parameterstring = \ . $params[0] . \; eval(OtherClass:: . $method . ( . $parameterstring . );); } } class OtherClass { function OtherMethod($obj = false) { if(is_object($obj)) { // this method receives an object to show the difficulties with object passed through call... if(method_exists($obj, printSomething)) { $obj-printSomething(); } } else { print(Error: no object passed! ' . $obj . '\n); } } } class Whatever { function printSomething() { print(passing object through __call() is fine\n); } } $someObj = new Whatever(); // $someObj-printSomething(); $MyObj = new MyClass(); // this works perfectly $MyObj-OtherMethod(passing a string); // this is my problem... $MyObj-OtherMethod($someObj); ? /pre please, try and help :) vivi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recommendation on PHP encoder please
On 05/02/2004 at 13:17 Ford, Mike [LSS] wrote: On 05 February 2004 13:10, Harry Sufehmi wrote: On 05/02/2004 at 11:48 Ford, Mike [LSS] wrote: On 05 February 2004 11:30, Harry Sufehmi wrote: As you can see, the content will be secured, but the script is now becoming the weak point since it'll store the encryption key needed to decrypt the content. I hope you don't mean that literally. If you're really being security conscious, the encryption keys should be in an include file that lives *outside* the Web document tree. Of course we'll do it like that. And anyway I was talking about if the cracker has actually gained (root) access to that server itself - which makes putting the keys outside the web directory irrelevant. OK, good -- I kind of assumed so, given your other precautions, but just thought I'd clarify for any novices coming upon this thread in the archives... ;) It's always a good idea indeed :) cheers, HS -- Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com Solusi canggih, bebas ikatan, dan bebas biaya v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to search for a date
Sorry this is such a basic question - but I couldn't find it online. I have a date field in MySQL: -00-00. I'm trying to insert or search for the current date, and I can't find the way to state that in the SQL. This is wrong, can someone please tell me what's correct? INSERT INTO mytable (dateField) VALUE (CURRENT_DATE); SELECT * FROM mytable WHERE dateField = CURRENT_DATE; Thanks, - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommendation on PHP encoder please
On Thu, 2004-02-05 at 08:13, Harry Sufehmi wrote: So there's a reasonably easy way to decrypt those encoded files then ? (despite those vendors' claim...) There isn't a program to revert encoded files to their original state, but there is a disassembler[1]. However, assuming your encryption key is a string all one would need is to do strings filename on the encoded php file to get your encryption key. The real problem you are facing here is security through obscurity is not security. First of all, your method of encrypting these files and decrypting them before serving up pages is just going to slow down your web server. The key is stored in a file somewhere and therefore easily accessible if someone gained access comparable to the web server. Since the key is readily available the data is not really encrypted, just obfuscated. I assume you are not transmitting these pages over the Internet and even within your intranet are using SSL? If not then that is a much bigger security hole. If you are really dedicated to encrypting these files I have a possible suggestion (see below for big caveats!). Continue with your encryption, however do not store the password anywhere on the server. You could either require the password be typed by users to view the pages (and *don't* cache it in any way anywhere!) or write an extension to apache (or whichever web server you use) to request the password when apache starts. It would then securely store it in ram and use it to decrypt pages, similar to how encrypted SSL certificates are handled. This would not be a php based solution, if php were to have access to the password then all that would be required to retrieve it would be the ability to execute custom php on the system by the hacker. You could try writing a php extension that would handle this however you may have a few problems: 1.) Depending on the web server used the php library's lifetime in memory may be shorter than the web server, or there may be multiple copies of the php library in ram. This would require typing the password more than once per web server restart. 2.) You need to make sure it is not possible to access arbitrary parts of php's memory using documented or undocumented php functions, etc. If so a cracker could write a php script to obtain the password. 3.) You would need to disable the dl() function so a custom extension could not be loaded to grab the password, though php.ini could be modified and the web server restarted. Then all the cracker would need to do would be to wait for you to re-type the password. Additionally make sure core dumps are disabled on the server, otherwise forcing the web server to crash could put the password in the core file. You know, after writing all that I realized something else: these are web pages being served. If the attacker has root access to the system what would prevent him from just using lynx to view the pages directly form the web server? SSL won't stop him/her and usernames and passwords will most likely be available if you use web based authentication. Your best method would be to require the password be typed every time a page is viewed, which has its own set of problems. Hopefully this gives you something to think about. Regards, Adam [1] http://www.derickrethans.nl/vld.php -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP5: __call() implementation EXAMPLE
From: Vivian Steller [EMAIL PROTECTED] Vivian Steller wrote: Hello, as you know there is a new callback function __call($method, $params) in php5. the __call() method of an object is called, if the method named $method is not declared in this class. i want this function simply call the method of another class with SomeClass::$method(...) but i'm getting into trouble (bit heavy programming!:) passing the arguments (stored as Array in $params) to the SomeClass::$method([arguments]) method... further, i think i'm getting problems with objects passed through the __call() method?! any suggestions? thanks vivi ok, here is an example: hope you'll understand what i want... pre ?php class MyClass { function __call($method, $params) { // $params = Array(mixed var, mixed var, ...); print(request for . $method . ()\n); // how to get objects in this string?! // do i have to implement switch($type) { case object: ... } here?! $parameterstring = \ . $params[0] . \; eval(OtherClass:: . $method . ( . $parameterstring . );); Can't you just say: OtherClass::$method($params); here? } } class OtherClass { function OtherMethod($obj = false) { if(is_object($obj)) { // this method receives an object to show the difficulties with object passed through call... if(method_exists($obj, printSomething)) { $obj-printSomething(); } } else { print(Error: no object passed! ' . $obj . '\n); } } } class Whatever { function printSomething() { print(passing object through __call() is fine\n); } } $someObj = new Whatever(); // $someObj-printSomething(); $MyObj = new MyClass(); // this works perfectly $MyObj-OtherMethod(passing a string); // this is my problem... $MyObj-OtherMethod($someObj); ? /pre ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5: __call() implementation EXAMPLE
Vivian Steller wrote: ... class MyClass { function __call($method, $params) { // $params = Array(mixed var, mixed var, ...); print(request for . $method . ()\n); // how to get objects in this string?! // do i have to implement switch($type) { case $parameterstring = \ . $params[0] . \; eval(OtherClass:: . $method . ( . $parameterstring . );); } } ... ok, i'm sorry, but i found the solution for my own: on the top you see some snippet of my EXAMPLE Message before. you can implement the $parameterstring generation algorithm like this (and its very very easy!!) $parameterstring = ; for($i = 0; $i count($params); $i++) { if(!empty($parameterstring)) { $parameterstring .= , ; } $parameterstring .= \$params[ . $i . ]; } replace the line $parameterstring = \ . $params[0] . \; with this code snippet and it works... any way, thanks. vivi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to search for a date
From: Brian Dunning [EMAIL PROTECTED] Subject: [PHP] How to search for a date A date? Well, you could try Friendster or orkut to find date, or... oh wait... Sorry this is such a basic question - but I couldn't find it online. I have a date field in MySQL: -00-00. I'm trying to insert or search for the current date, and I can't find the way to state that in the SQL. This is wrong, can someone please tell me what's correct? INSERT INTO mytable (dateField) VALUE (CURRENT_DATE); SELECT * FROM mytable WHERE dateField = CURRENT_DATE; Sucks how missing one letter will jack things up. INSERT INTO mytable (dateField) VALUES (CURRENT_DATE); Missing the S in values. That'll cause you first query to fail which will cause your second query to fail since there's no matching row. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to search for a date
For MySQL you're still going to need NOW() instead of CURRENT_DATE though surely? John On Thu, 2004-02-05 at 15:57, John W. Holmes wrote: From: Brian Dunning [EMAIL PROTECTED] Subject: [PHP] How to search for a date A date? Well, you could try Friendster or orkut to find date, or... oh wait... Sorry this is such a basic question - but I couldn't find it online. I have a date field in MySQL: -00-00. I'm trying to insert or search for the current date, and I can't find the way to state that in the SQL. This is wrong, can someone please tell me what's correct? INSERT INTO mytable (dateField) VALUE (CURRENT_DATE); SELECT * FROM mytable WHERE dateField = CURRENT_DATE; Sucks how missing one letter will jack things up. INSERT INTO mytable (dateField) VALUES (CURRENT_DATE); Missing the S in values. That'll cause you first query to fail which will cause your second query to fail since there's no matching row. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5: __call() implementation
On Thu, 2004-02-05 at 09:22, Vivian Steller wrote: i want this function simply call the method of another class with SomeClass::$method(...) but i'm getting into trouble (bit heavy programming!:) passing the arguments (stored as Array in $params) to the SomeClass::$method([arguments]) method... further, i think i'm getting problems with objects passed through the __call() method?! You probably want to check out this for working with __call: http://www.php.net/overload And this for not having to use eval: http://www.php.net/call_user_func_array -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP5: __call() implementation EXAMPLE
John W. Holmes wrote: From: Vivian Steller [EMAIL PROTECTED] Vivian Steller wrote: ... pre ?php class MyClass { function __call($method, $params) { // $params = Array(mixed var, mixed var, ...); print(request for . $method . ()\n); // how to get objects in this string?! // do i have to implement switch($type) { case object: ... } here?! $parameterstring = \ . $params[0] . \; eval(OtherClass:: . $method . ( . $parameterstring . );); Can't you just say: OtherClass::$method($params); here? ... ---John Holmes... No, sorry that doesn't work. Interpreter is trying to acces static member $method .. and this member does not exist. The error message: Fatal error: Access to undeclared static property: OtherClass::$method in ... Thanks for your time. vivi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to search for a date
On Thursday 05 February 2004 15:45, Brian Dunning wrote: Sorry this is such a basic question - but I couldn't find it online. I have a date field in MySQL: -00-00. I'm trying to insert or search for the current date, and I can't find the way to state that in the SQL. This is wrong, can someone please tell me what's correct? INSERT INTO mytable (dateField) VALUE (CURRENT_DATE); SELECT * FROM mytable WHERE dateField = CURRENT_DATE; NOW() is the mysql function for the current date. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to search for a date
From: John McKerrell [EMAIL PROTECTED] INSERT INTO mytable (dateField) VALUES (CURRENT_DATE); For MySQL you're still going to need NOW() instead of CURRENT_DATE though surely? No. He has a DATE column, so why use NOW() which includes time informatin. Quote: CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE(). Take your pick. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Check to remove file that are older than 1 week
Hi, I want to delete files than are older than 1 week from a specific directory. Anyone mind to share their code? Can't anything on phpbuilder on this. Regards Nyon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to search for a date
apologies * scurries away and hides in a hole ;) John On Thu, 2004-02-05 at 16:16, John W. Holmes wrote: From: John McKerrell [EMAIL PROTECTED] INSERT INTO mytable (dateField) VALUES (CURRENT_DATE); For MySQL you're still going to need NOW() instead of CURRENT_DATE though surely? No. He has a DATE column, so why use NOW() which includes time informatin. Quote: CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE(). Take your pick. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] authentication using /etc/passwd
Hi, is there a way to authenticate a username/password someone enters in a form with what is in /etc/passwd? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Check to remove file that are older than 1 week
I want to delete files than are older than 1 week from a specific directory. Anyone mind to share their code? Can't anything on phpbuilder on this. If you're running PHP under unix: http://marc.theaimsgroup.com/?l=php-generalm=106002263306528w=2 - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic vs Static Builds
On Thu, 2004-02-05 at 16:12, vidyut luther wrote: Hi John, A couple of questions.. 1. Define high load. Er.. that's quite a personal question, apparently we get 58 million hits a month but some days will be much busier than others (we're a soccer site, match days are busiest). The load is split over 6 Dell Poweredge 1550 servers. 2. Why are the servers being restarted once a day ? There shouldn't be a need to restart unless something is going wrong. For cycling the logs, we've got scripts setup to sort them out each day - backing them up and suchlike, which restart the webserver. As for your main question.. I build php as a DSO module basically because I don't upgrade my PHP as often or whenever there is a new version out, unless it's got security fixes.. and even then I wait for everything to be tested. This helps out in the way that I don't have to upgrade or recompile two things whenever I want to update php , or apache. Secondly, it's easier to disable PHP this way, in case I have extremely high traffic and I only want to serve static content. But, to each their own. The main speed/performance difference will come more from how you write your code than wether it's dynamically or statically built. Also, if you need performance increases, look into Zend Accelerator or the ZPS Suite.. (it's kinda expensive, but WELL WORTH THE $$). Please note i have no links with Zend other than being a very happy customer. I get that the code is very important, some bits of our code are great for efficiency, some less so great, I'm basically looking to squeeze the best performance out of what we've got. (We use Zend Optimizer, not tried the Accelerator yet). John On Thu, 2004-02-05 at 09:28, John McKerrell wrote: Hi, I've been working with a PHP for a few years now. I've always thought that on production servers, to have them working at peak efficiency, I should have the Apache and PHP compiled as a static build. I recently got into a debate with someone over whether this had any worthwhile savings. Can anyone tell me which is the best solution, or point me in the direction of a solution? I realise that it would vary from situation to situation, so I'll tell you that my situation is high load servers required to run as fast as possible. They get restarted once a day, and (ideally) only get php+apache rebuilt when there's new versions out. Thanks for any advice you can offer, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic vs Static Builds
On Friday 06 February 2004 00:44, John McKerrell wrote: 2. Why are the servers being restarted once a day ? There shouldn't be a need to restart unless something is going wrong. For cycling the logs, we've got scripts setup to sort them out each day - backing them up and suchlike, which restart the webserver. Check out httplog. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Courage is grace under pressure. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL: Order by
John Taylor-Johnston mailto:[EMAIL PROTECTED] on Wednesday, February 04, 2004 9:48 PM said: When I order by number, it echoes 1,2,3,4,5,6,7,8,9,10 and hten jumps to 100...199 before it comes back to 11-19. Any way of ordering that differently? Sounds like your 'number' column is not actually a number but a string. Change it to type INT and that should fix it. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: authentication using /etc/passwd
Adam Williams wrote: Hi, is there a way to authenticate a username/password someone enters in a form with what is in /etc/passwd? Thanks! Yep, do a search on .htaccess from http://google.com Cheers, jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using sessions with register globals off
Ok, with register globals on, this works ('order' being a php object): session_name('name'); session_register('order'); $order-print_something(); With with register globals off, this fails: session_name('name'); $order = $_SESSION['order']; $order-print_something(); Get the errors: PHP Notice: Undefined variable: _SESSION PHP Fatal error: Call to undefined function: print_something() Meaning the _SESSION arr is not recognized and the $order obj variable has not been passed. What am I missing? PHP Manual: If register_globals is enabled, then each global variable can be registered as session variable. Upon a restart of a session, these variables will be restored to corresponding global variables. Since PHP must know which global variables are registered as session variables, users need to register variables with session_register() function. You can avoid this by simply setting entries in $_SESSION. just set the superglobal to the desired value. to remove when you're through you can use session_unregister('foo') or unset($_SESSION['foo']). do not unset $_SESSION itself!!! $_SESSION['foo'] = bar; ~pj I've looked through the docs and past posts but I'm still a bit confused. How do I translate the following into code that can be used with register_globals set off. Assuming there's a preceding page that has created the session 'name' and registered the var 'order' with the 'name' session. session_name('name'); session_register('order'); -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Development/Promotion Mac Consulting/Sales http://www.systame.com/ -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Development/Promotion Mac Consulting/Sales http://www.systame.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: authentication using /etc/passwd
On Friday 06 February 2004 01:13, Jas wrote: Adam Williams wrote: Hi, is there a way to authenticate a username/password someone enters in a form with what is in /etc/passwd? Yep, do a search on .htaccess from http://google.com I'm afraid you may be sending the OP on a wild goose chase. google php pam authentication may be more fruitful. OP, by /etc/passwd I presume you mean 'system password'? Most modern systems no longer store user passwords in /etc/passwd. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Oppernockity tunes but once. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using sessions with register globals off
Randall Perry wrote: Ok, with register globals on, this works ('order' being a php object): session_name('name'); session_register('order'); $order-print_something(); With with register globals off, this fails: session_name('name'); $order = $_SESSION['order']; $order-print_something(); Get the errors: PHP Notice: Undefined variable: _SESSION PHP Fatal error: Call to undefined function: print_something() Meaning the _SESSION arr is not recognized and the $order obj variable has not been passed. What am I missing? Where do you assign $_SESSION['order'] a value? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using sessions with register globals off
On Friday 06 February 2004 01:16, Randall Perry wrote: Get the errors: PHP Notice: Undefined variable: _SESSION PHP Fatal error: Call to undefined function: print_something() Meaning the _SESSION arr is not recognized and the $order obj variable has not been passed. What am I missing? A recent version of PHP? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* A pipe gives a wise man time to think and a fool something to stick in his mouth. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I run php 5 beta 3 on windows?
Can I update PHPTraid's php files? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Selling PHP Code? PHP Careers?
Never self-employ urself(aka don't work alone) - alote of mess and nobody is coming to buy your great stuff :) Work on a big compeny or start your own. But NEVER EVER work alone. Galen [EMAIL PROTECTED] ??? ??:[EMAIL PROTECTED] Hi PHP list, I seem to have a knack for really powerful, creative PHP code. With a little effort, I have yet to find any real limitations I cannot overcome with PHP/MySQL/PostgreSQL. Not that there aren't any, just that almost (emphasis on almost) anything web related, I can do. I'm pretty confident I could develop things as complex as Amazon.com and eBay and perhaps even improve on them. At least that's what I like to think :) I'm not the kind of person who likes to spend years on a project. I put lots of energy, creativity, and effort in, get an amazing result, then move onto something else. That's my tendency, although I can restrain myself a bit, especially if there is significant profit for me. Creative programming is my thing. I'm pretty good at graphic design (i.e. web page layouts) too... I keep developing PHP-related ideas I want to pursue. Some of them are fully implemented, others partially, and many not at all. Already I've developed a powerful fuzzy search system that most programmers find very impressive. Others projects go all up and down the spectrum of possibilities. I'm writing this to ask the collective advice of the php mailing list. As it stands, I'm a college student and working part-time on PHP development in Vancouver, Washington, USA. I've had excellent raises, now making over 60% more since September, but I'm probably not going to go much further in this small company. I'm thinking about other options - maybe self employment or going in with a business partner - or perhaps some more clear career paths. Does anyone have suggestions for me? I'm especially interested in anyone self-employed or working with a business partner - something I'm seriously considering - or in some kind of start up company. What are your thoughts and feelings? Do you like it? Feel free to reply off-list if you think this topic is off-topic and/or you don't want to blast your information to the whole world. Thanks, Galen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange results on Printer Friendly page
Hi, I have a printer friendly page that is passed a url param from the detail page. On the detail page I have a series of questions that appear as they should. However when I go to the printer friendly page I'm missing the first question. I get all the others. I can't seem to find a reason for this. The printer friendly page has a single condition that takes the url param and branches to the appropriate sql statement. The sql statements are almost identical. if($_SESSION['id'] == 4){ $query = SELECT convert(text,questions) as questions, qt_topics FROM SG_Questions as q, SG_Topics as t WHERE q.qt_id = t.qt_id AND q.qt_id = '$ques'; $result = MSSQL_QUERY($query) or die(Can not execute query $query. ); $myrow = mssql_fetch_array($result); $topic = $myrow['qt_topics']; [snip]... while($row = mssql_fetch_array($result)) { $question = $row['questions'] ; echo trtd$question/td/tr\n; } [snip]... mssql_close(); } else{ $query = SELECT convert(text, questions) as questions, sg_aof FROM SG_Questions as q, SG_AOF as a WHERE q.sg_id = a.sg_id AND a.sg_id = '$focus'; $result = MSSQL_QUERY($query) or die(Can not execute query $query. ); $myrow = mssql_fetch_array($result); $topic = $myrow['sg_aof']; [snip]... while($row = mssql_fetch_array($result)) { $question = $row['questions'] ; echo trtd$question/td/tr\n; } [snip]... mssql_close(); } alex ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
[PHP] Re: No tutorials/examples to be found on using PHP dbm-style functions with apache's mod_auth_db
Thanks for you reply. You were right, I went back to the Apache manual, where there are links to tutorials on setting this up. It seems that the tricky bits are more in the configuration of apache rather than the php code you use. I ended up switching to mod_auth_mysql instead just because of my greater familiarity with MySQL and it's working well now. thanks again -Colm Jerry Sievers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... [EMAIL PROTECTED] (Colm Ward) writes: Snip. Can anyone please tell me: - Is PHP + Apache database authentication a good approach here? PHP is my strongest language so I'd prefer to stick with it if I can. But the lack of online discussion about this topic makes me suspicious... Yes, in theory at least. - Are there any examples on websites, or in newsgroups postings, or anywhere else, that describes in detail, or even outlines the steps involved in getting this kind of security setup up and running? Somewhere on google I suppose. Sorry I can't be of more help on this. Even the slightest hint here would be most appreciated Thanks a million All right. Setting this up is simple and all the docs that you need are included with Apache and PHP. Keep a careful eye on your Apache error log while you are testing. There are no fewer than 5 different and somewhat incompatible versions of the DBM libs that you can build Apache and PHP with. My best advice to you is have a good look at the setup of both Apache and PHP and be prepared to recompile one or both if necessary. Good luck! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommendation on PHP encoder please
On 05/02/2004 at 10:46 Adam Bregenzer wrote: On Thu, 2004-02-05 at 08:13, Harry Sufehmi wrote: So there's a reasonably easy way to decrypt those encoded files then ? (despite those vendors' claim...) There isn't a program to revert encoded files to their original state, but there is a disassembler[1]. However, assuming your encryption key is a string all one would need is to do strings filename on the encoded php file to get your encryption key. [1] http://www.derickrethans.nl/vld.php Interesting :-) much thanks. The real problem you are facing here is security through obscurity is not security. First of all, your method of encrypting these files and decrypting them before serving up pages is just going to slow down your web server. My manager reckons that it's worth it. And it's causing very little traffic anyway. The key is stored in a file somewhere and therefore easily accessible if someone gained access comparable to the web server. Since the key is readily available the data is not really encrypted, just obfuscated. The key should be contained within the script itself, so it'll be scrambled by the encoder. I assume you are not transmitting these pages over the Internet and even within your intranet are using SSL? If not then that is a much bigger security hole. It's transmitted over the Internet using SSL. If you are really dedicated to encrypting these files I have a possible suggestion (see below for big caveats!). Continue with your encryption, however do not store the password anywhere on the server. You could either require the password be typed by users to view the pages (and *don't* cache it in any way anywhere!) Hmm... the users shouldn't know the password to the key really, they have problems already remembering just one password :-) more than that and they'll start writing it down on post-it notes... hehe or write an extension to apache (or whichever web server you use) to request the password when apache starts. It would then securely store it in ram and use it to decrypt pages, similar to how encrypted SSL certificates are handled. This would not be a php based solution, if php were to have access to the password then all that would be required to retrieve it would be the ability to execute custom php on the system by the hacker. This is the best solution I think, but unfortunately I don't think we have the resources to develop this. You could try writing a php extension that would handle this however you may have a few problems: 1.) Depending on the web server used the php library's lifetime in memory may be shorter than the web server, or there may be multiple copies of the php library in ram. This would require typing the password more than once per web server restart. That's why I'm planned to store it in the encoded script instead. 2.) You need to make sure it is not possible to access arbitrary parts of php's memory using documented or undocumented php functions, etc. If so a cracker could write a php script to obtain the password. 3.) You would need to disable the dl() function so a custom extension could not be loaded to grab the password, though php.ini could be modified and the web server restarted. Then all the cracker would need to do would be to wait for you to re-type the password. Additionally make sure core dumps are disabled on the server, otherwise forcing the web server to crash could put the password in the core file. You know, after writing all that I realized something else: these are web pages being served. If the attacker has root access to the system what would prevent him from just using lynx to view the pages directly form the web server? SSL won't stop him/her and usernames and passwords will most likely be available if you use web based authentication. Your best method would be to require the password be typed every time a page is viewed, which has its own set of problems. Bingo ! :-) Nice one Adam, you've found the hole in this scheme. Hopefully this gives you something to think about. Indeed... so for now looks like there's no elegant solution to this problem. I'll have to rethink everything now - well better now than later after the server's been cracked open :-) Thanks, it's been a very interesting discussion. cheers, HS -- Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com Solusi canggih, bebas ikatan, dan bebas biaya v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem identifying $_SERVER['HTTP_REFERER']
Hi all. I've got a simple mailer script that I wrote a few years ago that has been acting up over the past week. The problem is with the following check I perform at the very top of the script: if (!stristr($_SERVER['HTTP_REFERER'],unbc.ca)) { die(You can't access this script outside of our domain.); } The mailer is located in my personal webspace on the web.unbc.ca server and the calling forms are all located on www.unbc.ca. For some reason some people (apparently around 10 over the past week) are getting this error from two particular forms, but I know for certain that these forms are within our domain. Does anyone know why this would be happening other than someone making an illegal copy of the form and posting it on another domain (which I doubt is the case)? As I wrote earlier this script is about three years old, so at the time I didn't code using the $_SERVER and $_POST vars and just refered to them variable names explicitly. However, the PHP version on the machine hasn't changed for a long time (4.1.2) so I can't see why this would suddenly start happening now. To be safe I've just converted all the $_SERVER and $_POST vars in the script to use these references, so I'll be interested to see if the error goes away but I doubt it will. I was debating writing a simple regular expression to use instead of the stristr check but I don't really think it will make a difference as the only way the stristr check will fail is if the string 'unbc.ca' is NOT found in the referring page. Does anyone have any idea what could be causing this problem? Short of removing the check altogether I can't really see another way around it. Cheers and thanks much in advance, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem identifying $_SERVER['HTTP_REFERER']
First thing to do is figure out whether the problem is with the referrer var or with your code. Try adding a logger to dump all environment vars to a log file, then check it the next time one of these errors comes up. good luck. - Lucas On Thu, 5 Feb 2004, Pablo Gosse wrote: Hi all. I've got a simple mailer script that I wrote a few years ago that has been acting up over the past week. The problem is with the following check I perform at the very top of the script: if (!stristr($_SERVER['HTTP_REFERER'],unbc.ca)) { die(You can't access this script outside of our domain.); } The mailer is located in my personal webspace on the web.unbc.ca server and the calling forms are all located on www.unbc.ca. For some reason some people (apparently around 10 over the past week) are getting this error from two particular forms, but I know for certain that these forms are within our domain. Does anyone know why this would be happening other than someone making an illegal copy of the form and posting it on another domain (which I doubt is the case)? As I wrote earlier this script is about three years old, so at the time I didn't code using the $_SERVER and $_POST vars and just refered to them variable names explicitly. However, the PHP version on the machine hasn't changed for a long time (4.1.2) so I can't see why this would suddenly start happening now. To be safe I've just converted all the $_SERVER and $_POST vars in the script to use these references, so I'll be interested to see if the error goes away but I doubt it will. I was debating writing a simple regular expression to use instead of the stristr check but I don't really think it will make a difference as the only way the stristr check will fail is if the string 'unbc.ca' is NOT found in the referring page. Does anyone have any idea what could be causing this problem? Short of removing the check altogether I can't really see another way around it. Cheers and thanks much in advance, Pablo -- 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: Check to remove file that are older than 1 week
Hi Here's a little function I made up for this: ?php function delete_old_files($dir, $time_limit = 0){ if(!$time_limit) $time_limit = 7*24*60*60; if ($df = opendir($dir)) { while (false !== ($file = readdir($df))) { if ($file != . $file != ..) { $last_modified = filemtime($file); if(time()-$last_modified $time_limit){ unlink($file); } } } closedir($df); } } delete_old_files('.'); ? Hope that's what you need. Eric Yc Nyon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I want to delete files than are older than 1 week from a specific directory. Anyone mind to share their code? Can't anything on phpbuilder on this. Regards Nyon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL: Order by
Thanks all. That solved the problem. I should have realised it. Still learning ... :) -- John Taylor-Johnston http://compcanlit.ca/ Sounds like your 'number' column is not actually a number but a string. Change it to type INT and that should fix it. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using sessions with register globals off
it's this easy with register_globals off: $_SESSION['order'] = someValue; no need to name the session. ~Phillip John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Randall Perry wrote: Ok, with register globals on, this works ('order' being a php object): session_name('name'); session_register('order'); $order-print_something(); With with register globals off, this fails: session_name('name'); $order = $_SESSION['order']; $order-print_something(); Get the errors: PHP Notice: Undefined variable: _SESSION PHP Fatal error: Call to undefined function: print_something() Meaning the _SESSION arr is not recognized and the $order obj variable has not been passed. What am I missing? Where do you assign $_SESSION['order'] a value? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] performance of classes vs. functions for database connections
i have a function that does authentication of a user, whose user/pass are stored in an md5($var ) fashion. i query these from the mysql db in an authentication (if !$user || !pass) function checking against md5($pass). my thinking is that classes would be better suited to grab object properties, such as variable values, when doing things such as statistical calculations (top 5 most frequented pages/site or number/hits per page) rather than to perform the tasks normal functions could perform. my question is: what is the advantage of making this database function a class other than being able to instantiate it multiple times in the same script. being that i use mysql_pconnect() won't i see a performance hit on the db for successive connections? i would most likely just make a db connection/query class and pass it the auth querystring but would i do better to leave well enough alone with my existing function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multilingual website
hi, i'm looking here for some help with the design of a multilingual website. Everything in that website needs to change from a language to an other. I've made search on the web to find some examples but i couldn't find very interesting things about how to manage that, using php. What's best ? - Use a database and make a querry for each text i have to put on my pages? - Use an xml file for each language and parse it to get my text? - Use a .php file with a variable for each item i have on my website? Or is there an other possibility? Thanks for your help. Julien [EMAIL PROTECTED] _ MSN Search, le moteur de recherche qui pense comme vous ! http://search.msn.fr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multilingual website
i'm looking here for some help with the design of a multilingual website. Everything in that website needs to change from a language to an other. I've made search on the web to find some examples but i couldn't find very interesting things about how to manage that, using php. What's best ? - Use a database and make a querry for each text i have to put on my pages? - Use an xml file for each language and parse it to get my text? - Use a .php file with a variable for each item i have on my website? Are you using Apache, and are you serving up languages based on the user's language browser settings? Note that Apache gives you some flexibility with selecting files based on language preferences: http://httpd.apache.org/docs/mod/mod_mime.html#multipleext http://httpd.apache.org/docs/mod/mod_negotiation.html That may be helpful, though it depends on the specifics of your code. A typical way to deal with this is to separate out the variable pieces of text into some other file/location, and include one or another language setting files depending on preference. This is analogous to the old Mac filesystem's resource forks. How you actually implement this (xml, DB, php variables) depends on what you're doing elsewhere, and how you plan to maintain it. My inclination would be to just use the DB, have linked tables with languages and pieces of text in various languages. A single query could get a full language preference setting for a site, and a little array munging could turn it into a usable set of key/value pairs, where the key is the context of the text, and the value if the text itself. (Been thinking about this alot, since I'm being asked to develop a hybrid flash/html site that needs to be in Spanish and English) - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] multilingual website
My inclination would be to just use the DB, have linked tables with languages and pieces of text in various languages. A single query could get a full language preference setting for a site, and a little array munging could turn it into a usable set of key/value pairs, where the key is the context of the text, and the value if the text itself. (Been thinking about this alot, since I'm being asked to develop a hybrid flash/html site that needs to be in Spanish and English) Yes, I would also recommend the DB approach. The tables in your DB that contain language-sensitive information would probably have a languageId field which you could use to limit your result set to a specific language. HTH, Shaunak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] multilingual website
On Thu, 2004-02-05 at 15:46, Shaunak Kashyap wrote: My inclination would be to just use the DB, have linked tables with languages and pieces of text in various languages. A single query could get a full language preference setting for a site, and a little array munging could turn it into a usable set of key/value pairs, where the key is the context of the text, and the value if the text itself. (Been thinking about this alot, since I'm being asked to develop a hybrid flash/html site that needs to be in Spanish and English) Yes, I would also recommend the DB approach. The tables in your DB that contain language-sensitive information would probably have a languageId field which you could use to limit your result set to a specific language. InterJinn uses a mixed approach. When declaring the base template and source file to use to create a target page you can declare a set of language targets to create. When this is done InterJinn automatically retrieves the appropriate language based templates and source files to compile each language target page and when no such language specific content exists falls back on the default. In this way language specific content can be segregated into easily manageable templates. On the second level InterJinn supports a property system which can be language based. In this case the language of the page is used to determine which language specific property to retrieve (fallback is again to the site's default language when no such language specific property exists). Using this system developers can override the default language properties with language specific ones and the retrieval is transparent to the application. As part of the property system, InterJinn also supports properties which are set to the result set of a query. For simplicity when declring properties, some properties recognize an expandable [[LANG]] macro (configurable individually for each property if the developer needs some other macro) which is filled with the current language at query time. So then retrieving a dataset of language specific entries is as simple as desiging a table with a language field. This all sounds very heavy on processing, and it is, but the results are cached (unless the property is set to volatile which is rare) and so the expensive hit only occurs the first time. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multilingual website
From: Shaunak Kashyap [EMAIL PROTECTED] My inclination would be to just use the DB, have linked tables with languages and pieces of text in various languages. A single query could get a full language preference setting for a site, and a little array munging could turn it into a usable set of key/value pairs, where the key is the context of the text, and the value if the text itself. (Been thinking about this alot, since I'm being asked to develop a hybrid flash/html site that needs to be in Spanish and English) Yes, I would also recommend the DB approach. The tables in your DB that contain language-sensitive information would probably have a languageId field which you could use to limit your result set to a specific language. Databases are good, but you don't want to be pulling all the text for all of your pages out of the database every time. I'd combine a database administration / storage solution that let's you store different translations of text in combination with static pages or templates that are written from the data in the database. Depending on what your site is about, how it's organized, etc, the static pages could be written as plain HTML, text, PHP include files, or even PHP variables. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Website Architecture
I've got a directory structure similar to this: SiteRootDir index.php dirA index.php dirB funcs.php otherfuncs.php In the SiteRootDir/index.php, I've got: require_once( dirB/funcs.php ); in funcs.php, I've got: require_once( otherfuncs.php ); which works because SiteRootDir/index.php is the location from which files are looked for. However, in dirA/index.php, I've got: require_once( ../dirB/funcs.php ); and require_once( otherfuncs.php ) in funcs.php cannot be found. A solution I found was in dirA/index.php, to chdir( .. ); before the require_once, which moves the current directory to SiteRootDir and allows otherfuncs.php to be found ... is this the best way to solve this problem? A seperate, but related question funcs.php contains statements of the form: echo a href=\directoryname\linkname/abr; forming a relative URL. Again, this would point to a different location depending on whether dirA/index.php or SiteRootDir/index.php called the function containing this relative URL and I want them to point to the same location. I was able to find a solution by doing the following: function AFunction( $toRoot ) { $location = $toRoot . locationFromSiteRootDir; echo a href=\$location\linkname/abr; } So, from dirA/index.php, I would call AFunction like: AFunction( .. ); Is this the best way to solve this problem? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] multilingual website
the PHPNuke (Portal software used all over the world, http://phpnuke.org/) code uses selectable including of php files containing define statements; in a directory call language (usually) there are files named lang-.php where is the name of the language; the current language selection is stored in each users session such that; $lang = $_SESSION[lang]; // ie; $lang = english include_once(language/lang-.$lang..php);// ie; language/lang-english.php The included files contain define statements (defines are global constants and can't be accidentally updated by your code, I believe) define(_INPUTUSERID,Input User ID); define(_PASSWORD,Password); the french included file (language/lang-french.php) might look like; define(_INPUTUSERID,Eenpoot OOsair ahDee); define(_PASSWORD,Paas voord); // ok, so I flunked french You get the idea; then you need to go thru each html form and change every instance of text that appears on the form to a reference to one of these global values; echo tabletrtdfont class=content._INPUTUSERID.br .input type=text name=fuser/font/td/tr\n .trtdfont class=content._PASSWORD.br .input type=password name=fpswd/font/td/tr/table; Using the features of the language instead of a db access, means that the only time it takes to setup for each language is the time it takes to load and process the source include. I suspect this may be faster, has anyone timed other approaches? Note that this does not translate the data stored in your database, nor does it translate things coming from other sources such as directories, filenames, etc. When you provide both french and english input forms, you are likely to have some data stored in your database in french and some in english, potentially resulting in english forms with french data (and visa versa) on your website. hope this helps, Warren Vail -Original Message- From: julien dufourcq [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 12:24 PM To: [EMAIL PROTECTED] Subject: [PHP] multilingual website hi, i'm looking here for some help with the design of a multilingual website. Everything in that website needs to change from a language to an other. I've made search on the web to find some examples but i couldn't find very interesting things about how to manage that, using php. What's best ? - Use a database and make a querry for each text i have to put on my pages? - Use an xml file for each language and parse it to get my text? - Use a .php file with a variable for each item i have on my website? Or is there an other possibility? Thanks for your help. Julien [EMAIL PROTECTED] _ MSN Search, le moteur de recherche qui pense comme vous ! http://search.msn.fr -- 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: multilingual website
For some great information on how to internationalize a PHP application, I would suggest checking out: http://us3.php.net/manual/en/ref.gettext.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using sessions with register globals off
On Thu, Feb 05, 2004 at 02:32:49PM -0500, Phillip Jackson wrote: it's this easy with register_globals off: $_SESSION['order'] = someValue; no need to name the session. ~Phillip John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Randall Perry wrote: Ok, with register globals on, this works ('order' being a php object): session_name('name'); session_register('order'); $order-print_something(); With with register globals off, this fails: session_name('name'); $order = $_SESSION['order']; $order-print_something(); Get the errors: PHP Notice: Undefined variable: _SESSION PHP Fatal error: Call to undefined function: print_something() Meaning the _SESSION arr is not recognized and the $order obj variable has not been passed. What am I missing? Where do you assign $_SESSION['order'] a value? Everyone in this thread has forgotten to mention the all important 'start_session();' command. Without that, you do not have access to your session variables. -- Jim Kaufman Linux Evangelist public key 0x6D802619 http://www.linuxforbusiness.net --- Life is not one thing after another It's the same damn thing over and over! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-general list question - [Fwd: Delivery Report (failure) for php-general@lists.php.net]
I get one of these for almost every message I send, usually with a delay of a few days and always the same error. I see my posts come from the list to me and I see people replying to my messages so the list seems to be processing my posts. It's annoying however to keep getting these. Anybody else getting this? -Forwarded Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Delivery Report (failure) for [EMAIL PROTECTED] Date: Thu, 05 Feb 2004 20:39:26 + This report relates to your message: Subject: [PHP] Retrieving class names in a static method, Message-ID: [EMAIL PROTECTED], To: [EMAIL PROTECTED] of Thu, 5 Feb 2004 20:39:20 + Your message was not delivered to: [EMAIL PROTECTED] for the following reason: Diagnostic was Unable to transfer, Message timed out Information Message timed out The Original Message follows: __ Reporting-MTA: x400; mta dswu232-hme1 in /ADMD= /C=WW/ Arrival-Date: Mon, 2 Feb 2004 20:37:36 + DSN-Gateway: dns; dswu232.btconnect.com X400-Conversion-Date: Thu, 5 Feb 2004 20:39:26 + X400-Content-Correlator: Subject: [PHP] Retrieving class names in a static method, Message-ID: [EMAIL PROTECTED], To: [EMAIL PROTECTED] Original-Envelope-Id: [/ADMD= /C=WW/;[EMAIL PROTECTED] X400-Content-Identifier: (091)PHP(093)... X400-Encoded-Info: ia5-text Original-Recipient: rfc822; [EMAIL PROTECTED] Final-Recipient: x400; /RFC-822=php-general(a)lists.php.net/ADMD= /C=WW/ Action: failed Status: 4.4.7 Diagnostic-Code: Reason 1 (Unable-To-Transfer); Diagnostic 5 (Maximum-Time-Expired) X400-Supplementary-Info: Message timed out X400-Originally-Specified-Recipient-Number: 1 X400-Last-Trace: Mon, 2 Feb 2004 20:37:36 + __ Received: from gateway.btopenworld.com (actually host 185.136.40.217.in-addr.arpa) by dswu232 with SMTP-CUST (XT-PP) with ESMTP; Mon, 2 Feb 2004 20:37:36 + Received: from gateway (127.0.0.1) by gateway.btopenworld.com (Worldmail 1.3.167) for [EMAIL PROTECTED]; 2 Feb 2004 20:47:18 + Delivery-Date: Mon, 2 Feb 2004 20:35:21 + Received: from pb1.pair.com (actually host 4.131.92.216.in-addr.arpa) by dswu194 with SMTP (XT-PP); Mon, 2 Feb 2004 20:35:17 + Received: (qmail 67282 invoked by uid 1010); 2 Feb 2004 20:34:44 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:[EMAIL PROTECTED] Delivered-To: mailing list [EMAIL PROTECTED] Received: (qmail 67259 invoked by uid 1010); 2 Feb 2004 20:34:44 - Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] From: Adam Bregenzer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Content-Type: text/plain Message-Id: [EMAIL PROTECTED] Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Mon, 02 Feb 2004 15:32:56 -0500 Content-Transfer-Encoding: 7bit Subject: [PHP] Retrieving class names in a static method -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ Reporting-MTA: x400; mta dswu232-hme1 in /ADMD= /C=WW/ Arrival-Date: Mon, 2 Feb 2004 20:37:36 + DSN-Gateway: dns; dswu232.btconnect.com X400-Conversion-Date: Thu, 5 Feb 2004 20:39:26 + X400-Content-Correlator: Subject: [PHP] Retrieving class names in a static method, Message-ID: 1075753976.29947.43.camel@arcon, To: [EMAIL PROTECTED] Original-Envelope-Id: [/ADMD= /C=WW/;1075753976.29947.43.camel@arcon] X400-Content-Identifier: (091)PHP(093)... X400-Encoded-Info: ia5-text Original-Recipient: rfc822; [EMAIL PROTECTED] Final-Recipient: x400; /RFC-822=php-general(a)lists.php.net/ADMD= /C=WW/ Action: failed Status: 4.4.7 Diagnostic-Code: Reason 1 (Unable-To-Transfer); Diagnostic 5 (Maximum-Time-Expired) X400-Supplementary-Info: Message timed out X400-Originally-Specified-Recipient-Number: 1 X400-Last-Trace: Mon, 2 Feb 2004 20:37:36 + -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Website Architecture
The best way, IMHO, is to use absolute paths (from docroot, of course) whenever you include or require files. The same logic can be applied to the related problem of links. Shaunak -Original Message- From: Eric Gorr [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:35 PM To: [EMAIL PROTECTED] Subject: [PHP] Website Architecture I've got a directory structure similar to this: SiteRootDir index.php dirA index.php dirB funcs.php otherfuncs.php In the SiteRootDir/index.php, I've got: require_once( dirB/funcs.php ); in funcs.php, I've got: require_once( otherfuncs.php ); which works because SiteRootDir/index.php is the location from which files are looked for. However, in dirA/index.php, I've got: require_once( ../dirB/funcs.php ); and require_once( otherfuncs.php ) in funcs.php cannot be found. A solution I found was in dirA/index.php, to chdir( .. ); before the require_once, which moves the current directory to SiteRootDir and allows otherfuncs.php to be found ... is this the best way to solve this problem? A seperate, but related question funcs.php contains statements of the form: echo a href=\directoryname\linkname/abr; forming a relative URL. Again, this would point to a different location depending on whether dirA/index.php or SiteRootDir/index.php called the function containing this relative URL and I want them to point to the same location. I was able to find a solution by doing the following: function AFunction( $toRoot ) { $location = $toRoot . locationFromSiteRootDir; echo a href=\$location\linkname/abr; } So, from dirA/index.php, I would call AFunction like: AFunction( .. ); Is this the best way to solve this problem? Thank you. -- 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] Need a way to automate user logout
Damn stateless nature of HTTP, hey everyone, can someone point me or give me an idea on how I would automatically log out (destroy user sessions and make note of it in the database) on some type of schedule. I have designed a security system that depends upon people logging out to determine the amount of time they have accumalated on their accounts. Of course people do not always (never) do this, so I need a way to do it for them. We are running redhat linux, I am sure there is a way to say run a certain script at a certain time blah blah etc etc. But I am only a programmer, and am absolutely clueless on the finer points of nix. I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website Architecture
Eric Gorr wrote: A solution I found was in dirA/index.php, to chdir( .. ); before the require_once, which moves the current directory to SiteRootDir and allows otherfuncs.php to be found ... is this the best way to solve this problem? Qualify relative paths by prepending $_SERVER['DOCUMENT_ROOT'].'/' - I usually define a constant at the start of all scripts like so... define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].'/'); forming a relative URL. Again, this would point to a different location depending on whether dirA/index.php or SiteRootDir/index.php called the function containing this relative URL and I want them to point to the same location. Why can't you specify an absolute URL? Thank you. You're welcome. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need a way to automate user logout
One way is to save the time of last access every time a user requests a page, then poll to find users for whom now() - last_access_time TIMEOUT. - Lucas On Thu, 5 Feb 2004, Christian Calloway wrote: Damn stateless nature of HTTP, hey everyone, can someone point me or give me an idea on how I would automatically log out (destroy user sessions and make note of it in the database) on some type of schedule. I have designed a security system that depends upon people logging out to determine the amount of time they have accumalated on their accounts. Of course people do not always (never) do this, so I need a way to do it for them. We are running redhat linux, I am sure there is a way to say run a certain script at a certain time blah blah etc etc. But I am only a programmer, and am absolutely clueless on the finer points of nix. I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian -- 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: Need a way to automate user logout
Write the script in perl and chmod it to 755. Then use cron to schedule it. Here's a tutorial to show you how: http://www.unixgeeks.org/security/newbie/unix/cron-1.html Christian Calloway wrote: Damn stateless nature of HTTP, hey everyone, can someone point me or give me an idea on how I would automatically log out (destroy user sessions and make note of it in the database) on some type of schedule. I have designed a security system that depends upon people logging out to determine the amount of time they have accumalated on their accounts. Of course people do not always (never) do this, so I need a way to do it for them. We are running redhat linux, I am sure there is a way to say run a certain script at a certain time blah blah etc etc. But I am only a programmer, and am absolutely clueless on the finer points of nix. I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need a way to automate user logout
I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian you will want to use the cron command. run 'man cron' at a shell prompt to get the manual page that will explain the finer points. =) HTH, Craig -- 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] Need a way to automate user logout
Christian Calloway wrote: Damn stateless nature of HTTP, hey everyone, can someone point me or give me an idea on how I would automatically log out (destroy user sessions and make note of it in the database) on some type of schedule. I have designed a security system that depends upon people logging out to determine the amount of time they have accumalated on their accounts. Of course people do not always (never) do this, so I need a way to do it for them. We are running redhat linux, I am sure there is a way to say run a certain script at a certain time blah blah etc etc. But I am only a programmer, and am absolutely clueless on the finer points of nix. I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian Cron -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need a way to automate user logout
I am already doing this, but the problem is is if the user closes their browser and then comes back 2 days later, I have no choice but to debit that time. Lucas Gonze [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] One way is to save the time of last access every time a user requests a page, then poll to find users for whom now() - last_access_time TIMEOUT. - Lucas On Thu, 5 Feb 2004, Christian Calloway wrote: Damn stateless nature of HTTP, hey everyone, can someone point me or give me an idea on how I would automatically log out (destroy user sessions and make note of it in the database) on some type of schedule. I have designed a security system that depends upon people logging out to determine the amount of time they have accumalated on their accounts. Of course people do not always (never) do this, so I need a way to do it for them. We are running redhat linux, I am sure there is a way to say run a certain script at a certain time blah blah etc etc. But I am only a programmer, and am absolutely clueless on the finer points of nix. I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian -- 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: Need a way to automate user logout
awesome, thanks for the quick replies guys Christian Calloway [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Damn stateless nature of HTTP, hey everyone, can someone point me or give me an idea on how I would automatically log out (destroy user sessions and make note of it in the database) on some type of schedule. I have designed a security system that depends upon people logging out to determine the amount of time they have accumalated on their accounts. Of course people do not always (never) do this, so I need a way to do it for them. We are running redhat linux, I am sure there is a way to say run a certain script at a certain time blah blah etc etc. But I am only a programmer, and am absolutely clueless on the finer points of nix. I can write a script in perl, php, java, u name it, but how do I have it run on a set schedule? Thanks Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website Architecture
On Thu, Feb 05, 2004 at 09:48:22PM +, Stuart wrote: Eric Gorr wrote: A solution I found was in dirA/index.php, to chdir( .. ); before the require_once, which moves the current directory to SiteRootDir and allows otherfuncs.php to be found ... is this the best way to solve this problem? Qualify relative paths by prepending $_SERVER['DOCUMENT_ROOT'].'/' - I usually define a constant at the start of all scripts like so... define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].'/'); Why not use php's include_path setting? No need to define constants, no need to worry about the location of your script relative to the document root, and it works with more functions than just include() and require(). I have found it to be the cleanest, most reliable, and most portable way to deal with file paths. joel -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php-general list question - [Fwd: Delivery Report (failure) forphp-general@lists.php.net]
I get one of these for almost every message I send, usually with a delay of a few days and always the same error. I see my posts come from the list to me and I see people replying to my messages so the list seems to be processing my posts. It's annoying however to keep getting these. Anybody else getting this? Yeah, I am getting bundles of these as well... -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website Architecture
joel boonstra wrote: On Thu, Feb 05, 2004 at 09:48:22PM +, Stuart wrote: Eric Gorr wrote: A solution I found was in dirA/index.php, to chdir( .. ); before the require_once, which moves the current directory to SiteRootDir and allows otherfuncs.php to be found ... is this the best way to solve this problem? Qualify relative paths by prepending $_SERVER['DOCUMENT_ROOT'].'/' - I usually define a constant at the start of all scripts like so... define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].'/'); Why not use php's include_path setting? No need to define constants, no need to worry about the location of your script relative to the document root, and it works with more functions than just include() and require(). I have found it to be the cleanest, most reliable, and most portable way to deal with file paths. joel And if document root is different from include path? What if the include path is outside of document root? You CANNOT rely on include_path to accomplish this. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website Architecture
On Thu, Feb 05, 2004 at 04:35:14PM -0600, John Nichel wrote: snip And if document root is different from include path? What if the include path is outside of document root? You CANNOT rely on include_path to accomplish this. Sorry, I should have been more specific. I was implying that you would set the include_path to include your document_root for your whole site, using httpd.conf, .htaccess, or ini_set() (.htaccess probably being the easiest). # httpd.conf or .htaccess: php_value include_path '/path/to/document/root:.' # ini_set(): ini_set('include_path', {$_SERVER['DOCUMENT_ROOT']}:.); You could also modify the ini_set() method to append document_root to your current include_path setting, using the PHP_INCLUDE_PATH constant. I think. But you're right, you can't rely on the default include_path setting to contain anything useful. If you set it manually, though, it can contain whatever you want. Unless I'm misunderstanding what you're saying... joel -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-general list question - [Fwd: Delivery Report (failure) forphp-general@lists.php.net]
Me too, and im using the newsgroup, not even the mailing list!! :/ -- Luke Craig [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I get one of these for almost every message I send, usually with a delay of a few days and always the same error. I see my posts come from the list to me and I see people replying to my messages so the list seems to be processing my posts. It's annoying however to keep getting these. Anybody else getting this? Yeah, I am getting bundles of these as well... -Craig
Re: [PHP] Website Architecture
On Thu, Feb 05, 2004 at 05:42:54PM -0500, joel boonstra wrote: snip # ini_set(): ini_set('include_path', {$_SERVER['DOCUMENT_ROOT']}:.); Replying to myself, it appears that PHP = 4.3.0 has a family of functions specifically for tweaking include_path: http://www.php.net/manual/en/function.set-include-path.php When using ini_set() or something similar to tweak the include_path, I would recommend using it in conjunction with a file that is auto-prepended to all of your .php scripts (assuming you want all of your scripts to use the same include_path): # in .htaccess php_value auto_prepend_file path/to/init.php # init.php set_include_path('/new/include/path'); You can of course put other stuff that needs to apply to all .php files in init.php, too. joel -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-general list question - [Fwd: Delivery Report (failure) forphp-general@lists.php.net]
On Thu, 2004-02-05 at 17:50, Luke wrote: Me too, and im using the newsgroup, not even the mailing list!! :/ Hmm, that leads me to think this is a problem not related to php's mail server at all. (/me stops filling out a bug report) I sent a message to [EMAIL PROTECTED] If I find a solution I'll update this thread. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php-general list question - [Fwd: Delivery Report (failure) forphp-general@lists.php.net]
Adam Bregenzer mailto:[EMAIL PROTECTED] on Thursday, February 05, 2004 1:45 PM said: I get one of these for almost every message I send, usually with a delay of a few days and always the same error. I see my posts come from the list to me and I see people replying to my messages so the list seems to be processing my posts. It's annoying however to keep getting these. Anybody else getting this? Yeah this list seems to be the worst when it comes to messages of this sort. I suggest you just get used to it. :) Also understand that EVERYONE else gets the same stuff. (At least I think everyone else gets them...) Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need a way to automate user logout
Ben Ramsey typed this on 02/05/2004 01:55 PM: Write the script in perl and chmod it to 755. Then use cron to schedule it. Here's a tutorial to show you how: http://www.unixgeeks.org/security/newbie/unix/cron-1.html Why not do this in PHP cmdline instead? This is a PHP list right? :-p -- #--- # Robby Russell, | Sr. Administrator / Lead Programmer # Command Prompt, Inc. | http://www.commandprompt.com # [EMAIL PROTECTED] | Telephone: (503) 667.4564 #--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CVS style project system
Hi there, i have been asked to build a system for a project file space, where a list of users of different groups can start new projects for their group, add files for that project of the group and/or revise current files with different versions. It will be a cvs like system, but i dont think cvs would be apropriate for this, as they want to add titles to the project and comments etc. It will be database in Mysql. I was wondering how i could go about designing this system, and any ways to force people to sync up with the latest versions of the documents. Let me know thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CVS style project system
On Thu, 2004-02-05 at 18:21, [EMAIL PROTECTED] wrote: Hi there, i have been asked to build a system for a project file space, where a list of users of different groups can start new projects for their group, add files for that project of the group and/or revise current files with different versions. It will be a cvs like system, but i dont think cvs would be apropriate for this, as they want to add titles to the project and comments etc. It will be database in Mysql. I was wondering how i could go about designing this system, and any ways to force people to sync up with the latest versions of the documents. Let me know thanks. I would search around and see if there is anything out there that does what you want. CVS and repository systems are quite complex to write and for performance you probably dont want to write the system in php. The first thing down that long road would be to gather all the requirements of the project and go from there. Start a game plan on what needs to be done when. -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re: multilingual website
Hi, Friday, February 6, 2004, 7:44:15 AM, you wrote: EG For some great information on how to internationalize a PHP EG application, I would suggest checking out: EGhttp://us3.php.net/manual/en/ref.gettext.php My template class (yes another one) has the ability to use gettext for translation and you can even generate the .po files directly from the template. It's very small and pretty fast, you can check it out at http://kwiktemplates.com/ Documentation is still being worked on as I get time but it is straight forward to use. I can also supply a parser to generate the php needed to work with the template if needed. I'll put it on the site soon. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Japanese Language
Greetings i would just like to ask a favor regarding on php-mysql-excell format i'm using the php as my programming language with the following information: System SunOS repair-c 5.9 PHP Version 4.3.2 and for mysql as my database, its: mysqladmin Ver 8.23 Distrib 3.23.58 below is the php script that i used to get the data from the database and save it as excell document. my problem is the language from my database, they inputted some english and japanese language whenever i've open the file in staroffice, it can read the nihongo, however when i open it in microsoft office, it turns out that the nihongo are something like a garbage character. any suggestions would highly appreciated thanks and best regards erwin ?php //EDIT YOUR MySQL Connection Info: $DB_Server = ;//your MySQL Server $DB_Username = ; //your MySQL User Name $DB_Password = ;//your MySQL Password $DB_DBName = ;//your MySQL Database Name $DB_TBLName = ;//your MySQL Table Name //DEFINE SQL QUERY: //you can use just about ANY kind of select statement you want - //edit this to suit your needs! $sql = Select * from $DB_TBLName; //create MySQL connection $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) or die(Couldn't connect to MySQL:br . mysql_error() . br . mysql_errno()); //select database $Db = @mysql_select_db($DB_DBName, $Connect) or die(Couldn't select database:br . mysql_error(). br . mysql_errno()); //execute query $result = @mysql_query($sql,$Connect) or die(Couldn't execute query:br . mysql_error(). br . mysql_errno()); $count = mysql_num_fields($result); for ($i = 0; $i $count; $i++){ $header .= mysql_field_name($result, $i).\t; } while($row = mysql_fetch_row($result)){ $line = ''; foreach($row as $value){ if(!isset($value) || $value == ){ $value = \t; }else{ # important to escape any quotes to preserve them in the data. $value = str_replace('', '', $value); # needed to encapsulate data in quotes because some data might be multi line. # the good news is that numbers remain numbers in Excel even though quoted. $value = '' . $value . '' . \t; } $line .= $value; } $data .= trim($line).\n; } # this line is needed because returns embedded in the data have \r # and this looks like a box character in Excel $data = str_replace(\r, , $data); # Nice to let someone know that the search came up empty. # Otherwise only the column name headers will be output to Excel. if ($data == ) { $data = \nno matching records found\n; } # This line will stream the file to the user rather than spray it across the screen header(Content-type: application/octet-stream); # replace excelfile.xls with whatever you want the filename to default to header(Content-Disposition: attachment; filename=hello.xls); header(Pragma: no-cache); header(Expires: 0); echo $header.\n.$data; ? __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] thumbnail script
Hi, Anybody know of a thumbnail script which does either one of the following: 1.Support GIF,JPG,PNG, when called the first time it should show/create the thumbnail on the fly and save it. or 2.Support GIF,JPG,PNG and thumbnail image any new files uploaded, and save the thumb to another directory I have downloaded a bunch of classes from php classes, the only good one (or the one that worked with me) is img2thumb10a-2003-03-28, and that only works with GD2. Two problems, 1. the server that has GD2 is a different server from where the main site is. 2. This creates the thumb dynamically via an img tagbut does not save it...so everytime a visitor opens up the portfolio it generates the thumbwhich will be a load on the server in the long run, something that would be cut down a lot if after it first generated it, it saved the image in some directory. any ideas? or urls? (and yes, i tried hotscripts, google) Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CVS style project system
I would search around and see if there is anything out there that does what you want. CVS and repository systems are quite complex to write and for performance you probably dont want to write the system in php. The first thing down that long road would be to gather all the requirements of the project and go from there. Start a game plan on what needs to be done when. Most i have seen are code repositories etc , like gforge, mostly developer level. This is the exact model i need to do http://www.phpbuilder.com/columns/dhar20040108.php3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] thumbnail script
On Friday 06 February 2004 10:42, Ryan A wrote: 2. This creates the thumb dynamically via an img tagbut does not save it...so everytime a visitor opens up the portfolio it generates the thumbwhich will be a load on the server in the long run, something that would be cut down a lot if after it first generated it, it saved the image in some directory. manual imagejpeg() siblings -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Any fool can tell the truth, but it requires a man of sense to know how to lie well. -- Samuel Butler */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Novell and PHP
Can someone explain what this all means then http://forge.novell.com/modules/xfmod/project/?php Are they supporting php or are they planning to take over something that is impossible ? We have novell systems at work, if this means easier intergration with php on unix with novell products like ldap intergration, great :D. I think from what we know groupwise ldap is not a standard system which will work with openldap :\ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novell and PHP
On Thu, 2004-02-05 at 20:09, [EMAIL PROTECTED] wrote: Can someone explain what this all means then http://forge.novell.com/modules/xfmod/project/?php Are they supporting php or are they planning to take over something that is impossible ? We have novell systems at work, if this means easier intergration with php on unix with novell products like ldap intergration, great :D. I think from what we know groupwise ldap is not a standard system which will work with openldap :\ This is a project that allows for PHP integration on Novell NetWare systems. -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novell and PHP
This is a project that allows for PHP integration on Novell NetWare systems. I dont particularly know what exact netware systems we have but would this mean i could create sessions in my projects that will sync up the windows login system with the databased one ? Like i could personlise a session by their windows login ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml posts
Hello, On 02/04/2004 12:59 PM, Diana Castillo wrote: does anyone know why some xml applications that work when sent with active-x objects dont work when I send the xml with php instead? what can I do to make them arrive in the same way as they do when sent with active-x objects? What are you talking about? Do you mean sending HTTP requests with XML data? If so, try this class: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php