php-general Digest 28 Apr 2005 09:08:33 -0000 Issue 3423
php-general Digest 28 Apr 2005 09:08:33 - Issue 3423 Topics (messages 214043 through 214062): Re: Simple Question: Reading exec(locate) results into an array 214043 by: John Nichel Re: editor that typesets the php code 214044 by: Rob Agar 214049 by: Richard Lynch What's changed between version 4.2.2 and 4.3.4 regarding POSTing? 214045 by: mwestern.sola.com.au 214046 by: Matthew Weier O'Phinney temp tables 214047 by: Cima 214048 by: Richard Lynch 214052 by: Joshua D. Drake Avoiding Error : Maximum execution time of 30 seconds exceeded 214050 by: Andri Heryandi 214057 by: Richard Lynch Re: Retrieving query from MSSQL Table 214051 by: Richard Lynch Re: LDAP and .htaccess 214053 by: Richard Lynch Re: Mac OS X compilation problem 214054 by: Richard Lynch Re: beginner volunteer 214055 by: Richard Lynch Re: Product details not being displayed, based on passed id 214056 by: Richard Lynch 214058 by: Mark Sargent User Logout system advice needed... 214059 by: William Stokes 214060 by: Petar Nedyalkov Skipping function arguments! 214061 by: Vedanta Barooah Global Variables 214062 by: Dan Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Karl Fry wrote: Hello all, I'm sure this is very rudimentary, sorry if this sounds ignorant. I've only dabbled a bit in other languages and I'm working with a small knowledge of php since I only use it on-and-off at my job. I scribbled up this script today at work off the top of my head for a customer who was looking for a printout of my company's PEAR location. I wanted something quick and easy that would be adaptable to find other items. I was surprised it even worked since I haven't really had a chance to dig into PHP yet: ?php $temp = exec(which pear); $temp2 = exec(locate pear); echo which = $temp BRBR locate = $temp2; ? When executing the commands directly within Unix, without the php script: 'which' yields 1 line: the path to the pear module for PHP 'locate' yields dozens of lines, paths to everything with 'pear' in it. However, this is the printout when running the script from a browser (same via command line) : --- which = /usr/local/bin/pear locate = /usr/ports/www/pear-HTTP_Upload/pkg-descr --- It's only printing out a single line for locate. I'm assuming i'd need to run a loop to read all the lines of locate from an array. My question is: what sort of general syntax can I use to get the results from locate stored in an array so it can be read out? I don't need a script written for me; a general nudge in the right direction or the right website would be incredibly helpful. I've had trouble finding anything relevant thus far. http://us4.php.net/manual/en/function.shell-exec.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] ---End Message--- ---BeginMessage--- hi Dasmeet From: Dasmeet Singh I have just completed coding for a script... i want to take a printout of the code.. but the code is very hotch potch.. Is there any software to automatically set the code with proper spacing/tabs extra..and possibly give colors to it too...?? Check out the PEAR PHP_Beautifier package http://pear.php.net/package/PHP_Beautifier R ---End Message--- ---BeginMessage--- On Wed, April 27, 2005 5:09 pm, Rob Agar said: hi Dasmeet From: Dasmeet Singh I have just completed coding for a script... i want to take a printout of the code.. but the code is very hotch potch.. Is there any software to automatically set the code with proper spacing/tabs extra..and possibly give colors to it too...?? Check out the PEAR PHP_Beautifier package http://pear.php.net/package/PHP_Beautifier You may also want to investigate http://php.net/syntax_highlight and friends. Or just copy your hodgepodge.php to pretty.phps and surf to that. -- Like Music? http://l-i-e.com/artists.htm ---End Message--- ---BeginMessage--- I've used the simple password script in the past to password protect pages with a session. http://www.phpbuddy.com/article.php?id=23 Now that I have installed Fedora Core 2 and 3 the new version of php (4.3.4) doesn't like this script any more. Any ideas why? Thanks Matthew ---End Message--- ---BeginMessage--- * [EMAIL PROTECTED] [EMAIL PROTECTED]: I've used the simple password script in the past to password protect pages with a session. http://www.phpbuddy.com/article.php?id=23 Now that I have installed Fedora Core 2 and 3 the new version of php (4.3.4) doesn't like this script any more. Any ideas why? Yes. It's using the global arrays HTTP_POST_VARS and HTTP_SESSION_VARS arrays, and 4.3.x has
Re: [PHP] User Logout system advice needed...
On Thursday 28 April 2005 08:48, William Stokes wrote: Hello, I need to write some sort of a user logout system for my web application. It needs to be a solid system so that if the user presses the Logout button there's no way of returning to the password protected area without logging in again. At the moment my system only tries to close browser window with javascript. This doesn't work if the user has more than one tab open in the browser and in Firefox it doesn't even close the active tab :-) I use a cookie based session id so this probably needs to be deleted. Is there a way to delete all variables stored by the application or do I need to unset them one by one? No, you just need to destroy the session (session_destroy()). This way all session associated data will be destroyed. Any other things I might be missing here? Thanks a Lot -Will -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpjRjJhikW4q.pgp Description: PGP signature
[PHP] Skipping function arguments!
Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, how do i xcheive this m totally lost ! :(( Thanks, Vedanta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Global Variables
Hi all. I taught myself PHP before the frenzy over register_globals. After a reasonable break from the language, I'm back for more. I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that? Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Athentication with defined users in linux
Dear Friends, I am just subscribe to this interesting list. I have a question about authenticating mechanisms. I want to implement login page which authenticate users against defined users on Linux Redhat 9.0 on the server machine. I don't want to define the users(in plain text or ...). If possible ,please provide me with sample codes or any references. Regards, Hesam Montazeri __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: editor that typesets the php code
Dasmeet Singh wrote: Hi! I have just completed coding for a script... i want to take a printout of the code.. but the code is very hotch potch.. Is there any software to automatically set the code with proper spacing/tabs extra..and possibly give colors to it too...?? Thanks in advance :) ActiveState's Komodo ( http://www.activestate.com ) is very good. It handles Perl, PHP, HTML, XML, Python, and a whole lot of other things too. It does Perl and PHP debuggin, which is a godsend. I *think* it's about $25 for a 'home' type of license, which covers you for making open-source stuff. Otherwise you need a commercial license. I know a lot of people kick up a stink about non-free software, but ActiveState are pretty good as companies come, and Komodo really is cool. It's based on Mozilla, and cross-platform ( a little - Win32 and Linux, no OS-X ). Otherwise, there's bluefish ( gtk2-based ) , which does a very nice job of syntax highlighting etc, and it's open-source. I used it for ages until I decided a needed a debugger that didn't suck. Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Variables
session_start(); $_SESSION['somevar'] = foo; u could also check out pear's HTTP_Session package. On 28/04/2005, at 7:06 PM, Dan wrote: Hi all. I taught myself PHP before the frenzy over register_globals. After a reasonable break from the language, I'm back for more. I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that? Dan -- 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] PHP Athentication with defined users in linux
On 28/04/2005, at 7:16 PM, Hesam Montazeri wrote: Dear Friends, I am just subscribe to this interesting list. I have a question about authenticating mechanisms. I want to implement login page which authenticate users against defined users on Linux Redhat 9.0 on the server machine. I don't want to define the users(in plain text or ...). If possible ,please provide me with sample codes or any references. Correct me if I am wrong here you should check out either using htaccess htpasswd which uses a PAM link or LDAP. Or trying using pear's Auth package which connects to ldap. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Variables
As far as I know, it's not true you can't use session variables if register_globals is off, the difference is that you must acces session variables using $_SESSION['variablename'], that's is an assurance that a session variable is a REAL session variable, and that it is not set using for example a faked form. hope this is a correct answer and it helps you, Giulio Il giorno 28/apr/05, alle 11:06 AM, Dan ha scritto: Hi all. I taught myself PHP before the frenzy over register_globals. After a reasonable break from the language, I'm back for more. I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that? Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Cantoberon Multimedia srl http://www.cantoberon.it Tel. 06 39737052
[PHP] Restricting browser's a password manager pop-up
Hi, Is there a way to restrict a password manager (Save password for this site...) window pop-up? I have a form which shows a user a lost login if correct password and some other data was provided and browser asks user if it is necessary to save this password entry. Obviously, there is no need to save any password in this case and I want to avoid this dialog appear. Is it possible? Thanks in advance. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restricting browser's a password manager pop-up
Hello Michael, Thursday, April 28, 2005, 11:01:48 AM, you wrote: MK Is there a way to restrict a password manager (Save password for MK this site...) window pop-up? I have a form which shows a user a MK lost login if correct password and some other data was provided MK and browser asks user if it is necessary to save this password MK entry. MK Obviously, there is no need to save any password in this case and MK I want to avoid this dialog appear. Is it possible? Yes and no - the no part is that you cannot force the browser to not show this window, you just don't have that level of control. The yes part is that it only appears based on the browsers intelligence in scanning the name of your form fields. Change username and password to something, well.. more obtuse, and it often gets rid of the problem. Give it a shot and see which combination works for you. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Code stoped working after upgrading from 4 to 5
Hi, I have this simple piece of code that worked like a chram in PHP 4.x Now that i've moved to PHP 5 it doesn't work anymore. I always get 0 for $form_ok even if all fields are filled. The variables come from a form in a previous page. Any ideas on where the problem might be ? I have register_globals = Off in php.ini Any help would be apreciated. // test if all fields were filled if (($email == '') || ($name == '') || ($pass == '') || ($pass2 == '') || ($magic_number == '') || ($answer == '')) $form_ok = 0; Warm Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code stoped working after upgrading from 4 to 5
Do you set this vars before somewhere in the code? Because if you get some datas from a from you have to use $_POST/$_GET to get the values... Hi, I have this simple piece of code that worked like a chram in PHP 4.x Now that i've moved to PHP 5 it doesn't work anymore. I always get 0 for $form_ok even if all fields are filled. The variables come from a form in a previous page. Any ideas on where the problem might be ? I have register_globals = Off in php.ini Any help would be apreciated. // test if all fields were filled if (($email == '') || ($name == '') || ($pass == '') || ($pass2 == '') || ($magic_number == '') || ($answer == '')) $form_ok = 0; Warm Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code stoped working after upgrading from 4 to 5
-Original Message- From: Mário Gamito [mailto:[EMAIL PROTECTED] Sent: 28 April 2005 11:36 To: php-general@lists.php.net Subject: [PHP] Code stoped working after upgrading from 4 to 5 Hi, I have this simple piece of code that worked like a chram in PHP 4.x Now that i've moved to PHP 5 it doesn't work anymore. I always get 0 for $form_ok even if all fields are filled. The variables come from a form in a previous page. Any ideas on where the problem might be ? I have register_globals = Off in php.ini Any help would be apreciated. // test if all fields were filled if (($email == '') || ($name == '') || ($pass == '') || ($pass2 == '') || ($magic_number == '') || ($answer == '')) $form_ok = 0; Warm Regards, You have answered your own question really, haven't you - if you have register globals off then you are not going to get globally registered variables - it really is that simple. HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Code stoped working after upgrading from 4 to 5
Mário Gamito wrote: Hi, I have this simple piece of code that worked like a chram in PHP 4.x Now that i've moved to PHP 5 it doesn't work anymore. I always get 0 for $form_ok even if all fields are filled. The variables come from a form in a previous page. Any ideas on where the problem might be ? I have register_globals = Off in php.ini Any help would be apreciated. // test if all fields were filled if (($email == '') || ($name == '') || ($pass == '') || ($pass2 == '') || ($magic_number == '') || ($answer == '')) $form_ok = 0; Warm Regards, you've said it yourself already, you have register_globals OFF, while your code only works with register_globals ON. This url might help you: http://www.php.net/manual/en/security.globals.php To fix your code, you'd need to make sure that you call upon the $_GET/$_POST/$_REQUEST values instead of the (supposedly) derived variables $mail, $name, $pass, etc. Since those don't exist anymore after turning OFF register_globals. - tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Athentication with defined users in linux
Dear Friends, Correct me if I am wrong here you should check out either using htaccess htpasswd which uses a PAM link or LDAP. Or trying using pear's Auth package which connects to ldap. Thanks Dan for your answer but I could not understand the comments. If possible, please provide me the sample code or references, or any links which I could solve the problem. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
Wow, nice to hear from the guy who created PHP! :) I need to make 2 things clearer though: 1. First I want to know how to make the actual binary file that is written, to be encoded as UTF-8. This is my PRIMARY question. 2. How to have fwrite write the file without the BOM. (to make it more compatible with certain XML parsers -per the W3C's recommendation). No matter what I do to the strings to encode them in whatever format before using fwrite, it ALWAYS seems to end up writing the actual file in iso-8859-1. Isn't the encoding of the characters in PHP's strings, and the encoding of the actual binary file on your hard drive, two totally different things? Or am I just misinformed? Example: When I open up Windows Notepad, then I type some stuff into it, and then I choose file, save as, encoding: UTF-8, then I click save. So how do I do this SAME thing using PHP? Could someone give me a actual code example of how to do that? I'm just s lost. How do you actually control the way the binary file itself is written, and not just the text that is saved in the file? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jon M. wrote: Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, April 21, 2005 5:07 pm, Jon M. said: I am trying to have a file that I generated with PHP saved as UTF-8 without the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner with PHP, but very technically experienced otherwise. I'm talking about the FILE encoding here -just to be clear. e.g. fopen(what_ever_file, a+) now I want PHP save the file itself with UTF-8, NOT system default. I have searched for hours to find an answer, but have not found any info on the subject. Does PHP have any ability to create a text file saved in UTF-8 encoding??? Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and http://php.net/fwrite it, you're gonna get what you want... Dunno about the Byte-Order-Mark part, but I guess you could strip it out of the UTF-8 encoded data before writing, if you wanted to. -- Like Music? http://l-i-e.com/artists.htm That was the first thing I tried, and it doesn't seem to work (it always saves in windows default encoding). Unless I missing something about what you can do with fwrite. Did you actually test that before you replied, and found that it would? If so, how? The Byte Order Mark is a part of the binary file that is written, how would one go about stripping it out?? BTW, note to PHP developers: If fwrite had a encoding parameter, e.g. UTF-8, that would be REALLY handy. Strings in PHP are binary-safe and character-encoding neutral. fwrite doesn't have a clue what it is writing, it just writes what is in memory. I'd question why you would want to strip the BOM. Any modern system deals with the byte-order-mark correctly. But you can simply strip it manually if it is present in the first 2 bytes before your fwrite if you really need to get rid of it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problems using chr() in an Object
I have an object class in which I'm doing chr() calls, especifically in the definition of some variables, and when loading the class I get this error: Parse error: parse error, unexpected '(', expecting ',' or ';' in Ticket.inc on line 51 Line 51 has: var $textoInicio = chr(27) . chr(64); If I eliminate all the lines that initializa text variables with chr() everything works OK, else I get these errors. Any idea on whey this is happening? -- 09:01:41 up 26 days, 17:30, 3 users, load average: 1.18, 0.80, 0.54 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, php does not support this. you can workaround this using: function add($a = null,$b = null, $c = null){ if(is_null($a)) $a = 1; if(is_null($b)) $b = 2; if(is_null($c)) $c = 3; return $a + $b + $c; } add(1, null, 1); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
function add ($a=1, $b=2, $c=3) { return $a + $b + $c; } add(1, null, 1); will do just fine r., Bostjan On Thursday 28 April 2005 14:16, Marek Kilimajer wrote: Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, php does not support this. you can workaround this using: function add($a = null,$b = null, $c = null){ if(is_null($a)) $a = 1; if(is_null($b)) $b = 2; if(is_null($c)) $c = 3; return $a + $b + $c; } add(1, null, 1); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Bostjan Skufca @ domenca.com wrote: function add ($a=1, $b=2, $c=3) { return $a + $b + $c; } add(1, null, 1); will do just fine returns 2, OP wants 4 IMO r., Bostjan On Thursday 28 April 2005 14:16, Marek Kilimajer wrote: Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, php does not support this. you can workaround this using: function add($a = null,$b = null, $c = null){ if(is_null($a)) $a = 1; if(is_null($b)) $b = 2; if(is_null($c)) $c = 3; return $a + $b + $c; } add(1, null, 1); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/pear question
I'm trying to get pear up and running, and I can't get it to work. I've tried it on a couple of different systems: fedora c2 and c3 with php 4.3.10 I can run pear from the shell, install new modules (pager, html_quickform,...) but when ever I try using any pear code in a php script with the appropriate includes/require (require_once 'DB.php';) nothing in the php block of the script gets executed. No error is thrown, and there is nothing in any of the server log files to indicate what the problem might be. I suspect that the include path is the problem. But even with setting the include path via the php script making the pear reference, still no joy. Has anyone ever run into this? Any suggestions for an alternative to pear if it continues to be problematic? I've looked into phplib, but it seems dated and I've read where it looks like there is or was plans to merge phplib into pear. Thanks in advance, Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/pear question
El Jue 28 Abr 2005 17:23, Kelly Meeks escribió: I'm trying to get pear up and running, and I can't get it to work. I've tried it on a couple of different systems: fedora c2 and c3 with php 4.3.10 I can run pear from the shell, install new modules (pager, html_quickform,...) but when ever I try using any pear code in a php script with the appropriate includes/require (require_once 'DB.php';) nothing in the php block of the script gets executed. No error is thrown, and there is nothing in any of the server log files to indicate what the problem might be. What does your php.ini file have in include_path? Try seeing local and global configuration with php_info(). -- 09:29:03 up 26 days, 17:57, 3 users, load average: 1.19, 0.76, 0.60 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems using chr() in an Object
Martín Marqués wrote: I have an object class in which I'm doing chr() calls, especifically in the definition of some variables, and when loading the class I get this error: Parse error: parse error, unexpected '(', expecting ',' or ';' in Ticket.inc on line 51 Line 51 has: var $textoInicio = chr(27) . chr(64); you can only assign 'basic' values (types) to vars in the class definition (so no function calls) . e.g: class T { var $a = 'a'; var $b = 2; var $c = array('whatisthis' = 'er?'); var $d = false; } what you want to do should be done in the constructor (aka ctor) class T { var $textInicio; /* ctor - * if you're using php5 you should call this function __construct() */ function T() { $this-textInicio = chr(27) . chr(64); // etc } } If I eliminate all the lines that initializa text variables with chr() everything works OK, else I get these errors. Any idea on whey this is happening? yes! hopefully you do to now :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Variables
Giulio wrote: As far as I know, it's not true you can't use session variables if register_globals is off, the difference is that you must acces session variables using ALWAYS CALL session_start() BEFORE TRYING TO USE THE $_SESSION SUPERGLOBAL! also I don't quite see the connection with register_globals, but anyway var sent by POST/GET can be found in the $_POST and $_GET superglobal vars $_SESSION['variablename'], that's is an assurance that a session variable is a REAL session variable, and that it is not set using for example a faked form. hope this is a correct answer and it helps you, Giulio Il giorno 28/apr/05, alle 11:06 AM, Dan ha scritto: Hi all. I taught myself PHP before the frenzy over register_globals. After a reasonable break from the language, I'm back for more. I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that? Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Cantoberon Multimedia srl http://www.cantoberon.it Tel. 06 39737052 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems using chr() in an Object
El Jue 28 Abr 2005 09:42, Jochem Maas escribió: Martín Marqués wrote: I have an object class in which I'm doing chr() calls, especifically in the definition of some variables, and when loading the class I get this error: Parse error: parse error, unexpected '(', expecting ',' or ';' in Ticket.inc on line 51 Line 51 has: var $textoInicio = chr(27) . chr(64); you can only assign 'basic' values (types) to vars in the class definition (so no function calls) . e.g: Yes, that's how I solved it just a minute ago, even though I didn't understand why. Thanks for the enlightenment. :-) BTW does PHP5 let you assign function values in the variable definition (like C++)? -- 09:42:14 up 26 days, 18:11, 3 users, load average: 0.40, 0.49, 0.60 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving query from MSSQL Table
On 4/28/05, Richard Lynch [EMAIL PROTECTED] wrote: I'm betting dollars to doughnuts that you've got a newline at the end of $sql1 which is messing you up. You're right! Give that man a doughnut! When I tested the query in Query Analyzer. I hit [Enter] to format the query and make it readable, then copy-and-paste into the form. I have tried: str_replace(\n,,$sql1); and preg_replace(\n,,$sql1); to pull the new line out plus a few other variations. Those failed. I'll keep at, but any pointers are always appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems using chr() in an Object
Martín Marqués wrote: El Jue 28 Abr 2005 09:42, Jochem Maas escribió: Martín Marqués wrote: I have an object class in which I'm doing chr() calls, especifically in the definition of some variables, and when loading the class I get this error: Parse error: parse error, unexpected '(', expecting ',' or ';' in Ticket.inc on line 51 Line 51 has: var $textoInicio = chr(27) . chr(64); you can only assign 'basic' values (types) to vars in the class definition (so no function calls) . e.g: Yes, that's how I solved it just a minute ago, even though I didn't understand why. Thanks for the enlightenment. :-) BTW does PHP5 let you assign function values in the variable definition (like C++)? no. I believe the reasoning is that allowing you to define class vars with return vals from functions opens the door to endless possibilities of weird side effects when you load in the class. e.g: class T { var $reconfigured = sometimesCompletelyReconfigureTheWebserver(); var $filesystemdeleted = recursiveDel('/'); } you can imagine what kind of havoc the 2 imaginary functions may cause just by loading the class T - I believe that the php devs want to avoid nightmares/confusion (especially for 'average' php coders) by not allowing this kind of syntax/[var-]definition. besides which there are probably scope issues - imagine you want to pass a var to sometimesCompletelyReconfigureTheWebserver() ... what is the scope of the var, where does it come from? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to save a file with UTF-8 encoding and noBOM using PHP?
1. First I want to know how to make the actual binary file that is written, to be encoded as UTF-8. This is my PRIMARY question. I think this part is the key. If the string originated from your text editor, then your text editor needs to be in UTF-8 mode. If you are importing the data from a file or database then you need to be sure that the data is UTF-8 encoded. If you know that the encoding is instead ISO-8859-1 then you can convert it to UTF-8 with the php function utf_encode. fwrite will then write out the bytes that you presented to it. I guess the same applies in reverse when you read the file back in to the application that will view the text. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Product details not being displayed, based on passed id
Mark Sargent wrote: big snip Hi All, ok, so let me understand this. To be able to use GET/POST and some others, I need this turned on, yes..? Do you all have it set to on..? If no, how do you get around this..? Cheers. No. With globals off, php just doesn't _magically_ transform mydomain.com/script.php?foo=bar into a variable named $foo with a value of bar. The data is still there. For something passed in the query (URL) string, use the $_GET array... $_GET['foo'] For something passed by a form with the post method, use the $_POST array... $_POST['foo'] -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] please help me send html email from php scripts instead of simple text
Hello, can you please help me send an html email using php instead of just simple text output. I'm trying to have the user fill out a form ( https://www.smilerochester.com/medical_form.html ) and have the exact same form emailed to me with the same pretty format of a form instead of just a variable name and the value. Do you think you can give me a hand? Thank you so much for the help. Joe
Re: [PHP] Global Variables
Dan wrote: Hi all. I taught myself PHP before the frenzy over register_globals. After a reasonable break from the language, I'm back for more. I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that? Use the super-global _SESSION array... session_start(); // -- Some code -- // $_SESSION['foo'] = 'bar'; -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] please help me send html email from php scripts instead of simple text
Hello Giuseppe, Thursday, April 28, 2005, 2:22:20 PM, you wrote: CG Hello, can you please help me send an html email using php instead of CG just simple text output. I'm trying to have the user fill out a form ( CG https://www.smilerochester.com/medical_form.html ) and have the exact CG same form emailed to me with the same pretty format of a form instead of CG just a variable name and the value. Save yourself some hassle and use the excellent free PHPMailer class library. http://phpmailer.sourceforge.net Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] please help me send html email from php scripts instead of simple text
Carraccia, Giuseppe wrote: Hello, can you please help me send an html email using php instead of just simple text output. I'm trying to have the user fill out a form ( https://www.smilerochester.com/medical_form.html ) and have the exact same form emailed to me with the same pretty format of a form instead of just a variable name and the value. Do you think you can give me a hand? Google can... http://www.google.com/search?q=php+send+html+email -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int deref]) if you look at the 4th and the 6th arguments to the function attributes is an array while sizelimit is an int, i want to pass the sixth element without passing the 4th and the 5th ... how do i do that?? i tried these options: # this does not work, $rs=ldap_search($con,o=vodoo.com,(objectClass*),array(),0,500); # this wont works :(( $rs=ldap_search($con,o=vodoo.com,(objectClass*),' ',0,500); # this also goofs! $rs=ldap_search($con,o=vodoo.com,(objectClass*),NULL,0,500); here that 5th arg works if i pass a zero as ... 0 means the default behaviour!! any ideas ... clues ? Thanks, Vedanta Barooah On 4/28/05, Marek Kilimajer [EMAIL PROTECTED] wrote: Bostjan Skufca @ domenca.com wrote: function add ($a=1, $b=2, $c=3) { return $a + $b + $c; } add(1, null, 1); will do just fine returns 2, OP wants 4 IMO r., Bostjan On Thursday 28 April 2005 14:16, Marek Kilimajer wrote: Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, php does not support this. you can workaround this using: function add($a = null,$b = null, $c = null){ if(is_null($a)) $a = 1; if(is_null($b)) $b = 2; if(is_null($c)) $c = 3; return $a + $b + $c; } add(1, null, 1); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~* Vedanta Barooah YM! - vedanta2006 Skype - vedanta2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
btw! saying: add($a=null,$b=null,$c=null) is as good as saying: add($a,$b,$c) thanks, vedanta On 4/28/05, Vedanta Barooah [EMAIL PROTECTED] wrote: Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int deref]) if you look at the 4th and the 6th arguments to the function attributes is an array while sizelimit is an int, i want to pass the sixth element without passing the 4th and the 5th ... how do i do that?? i tried these options: # this does not work, $rs=ldap_search($con,o=vodoo.com,(objectClass*),array(),0,500); # this wont works :(( $rs=ldap_search($con,o=vodoo.com,(objectClass*),' ',0,500); # this also goofs! $rs=ldap_search($con,o=vodoo.com,(objectClass*),NULL,0,500); here that 5th arg works if i pass a zero as ... 0 means the default behaviour!! any ideas ... clues ? Thanks, Vedanta Barooah On 4/28/05, Marek Kilimajer [EMAIL PROTECTED] wrote: Bostjan Skufca @ domenca.com wrote: function add ($a=1, $b=2, $c=3) { return $a + $b + $c; } add(1, null, 1); will do just fine returns 2, OP wants 4 IMO r., Bostjan On Thursday 28 April 2005 14:16, Marek Kilimajer wrote: Vedanta Barooah wrote: Hello All, Cosider this : function add($a=1,$b=2,$c=3){ return $a + $b + $c; } how do i skip the second argument while calling the function, is there a process like this: echo add(1,,1); # where i expect 2 to be printed, php does not support this. you can workaround this using: function add($a = null,$b = null, $c = null){ if(is_null($a)) $a = 1; if(is_null($b)) $b = 2; if(is_null($c)) $c = 3; return $a + $b + $c; } add(1, null, 1); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~* Vedanta Barooah YM! - vedanta2006 Skype - vedanta2006 -- *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~* Vedanta Barooah YM! - vedanta2006 Skype - vedanta2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Vedanta Barooah wrote: btw! saying: add($a=null,$b=null,$c=null) is as good as saying: add($a,$b,$c) No, it's not. Because in this case $a, $b and $c are all uninitialized variables and (if this is a function definition) then you *have* to supply $a $b and $c parameters. Even if you were just calling add() this wouldn't be wise. Consider the possibility that your server uses register_globals. In that case I can browse to: http://yoursite.com/yourpage.php?a=25b=20c=1234567890 Not to mention the code injection possibilities. thanks, vedanta On 4/28/05, Vedanta Barooah [EMAIL PROTECTED] wrote: Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int deref]) if you look at the 4th and the 6th arguments to the function attributes is an array while sizelimit is an int, i want to pass the sixth element without passing the 4th and the 5th ... how do i do that?? i tried these options: # this does not work, $rs=ldap_search($con,o=vodoo.com,(objectClass*),array(),0,500); $rs = ldap_search($con, o=vodoo.com, (objectClass*), null, null, 500); # this wont works :(( $rs=ldap_search($con,o=vodoo.com,(objectClass*),' ',0,500); # this also goofs! $rs=ldap_search($con,o=vodoo.com,(objectClass*),NULL,0,500); here that 5th arg works if i pass a zero as ... 0 means the default behaviour!! any ideas ... clues ? Thanks, Vedanta Barooah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
the code below was talking of function declarations ... reffer to the thread. will code injection in case of function declarations work? I am not sure!! ;) ?php function add($a,$b,$c){ return $a+$b+$c ; } echo add(2,null,3); # even if you pass the value of $b in the url as a get or post param... it wont work. ? thanks, vedanta On 4/28/05, Jason Barnett [EMAIL PROTECTED] wrote: Vedanta Barooah wrote: btw! saying: add($a=null,$b=null,$c=null) is as good as saying: add($a,$b,$c) No, it's not. Because in this case $a, $b and $c are all uninitialized variables and (if this is a function definition) then you *have* to supply $a $b and $c parameters. Even if you were just calling add() this wouldn't be wise. Consider the possibility that your server uses register_globals. In that case I can browse to: http://yoursite.com/yourpage.php?a=25b=20c=1234567890 Not to mention the code injection possibilities. thanks, vedanta On 4/28/05, Vedanta Barooah [EMAIL PROTECTED] wrote: Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int deref]) if you look at the 4th and the 6th arguments to the function attributes is an array while sizelimit is an int, i want to pass the sixth element without passing the 4th and the 5th ... how do i do that?? i tried these options: # this does not work, $rs=ldap_search($con,o=vodoo.com,(objectClass*),array(),0,500); $rs = ldap_search($con, o=vodoo.com, (objectClass*), null, null, 500); # this wont works :(( $rs=ldap_search($con,o=vodoo.com,(objectClass*),' ',0,500); # this also goofs! $rs=ldap_search($con,o=vodoo.com,(objectClass*),NULL,0,500); here that 5th arg works if i pass a zero as ... 0 means the default behaviour!! any ideas ... clues ? Thanks, Vedanta Barooah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~* Vedanta Barooah YM! - vedanta2006 Skype - vedanta2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Please do not reply to me personally. I will usually read your responses in the newsgroup. Vedanta Barooah wrote: the code below was talking of function declarations ... reffer to the thread. will code injection in case of function declarations work? I am not sure!! OK. But even so add($a,$b,$c) !== add($a = null, $b = null, $c = null) ;) ?php function add($a,$b,$c){ These arguments ($a, $b, and $c) are all *required* arguments. If you definition was: function add($a, $b = null, $c = null) Then you don't have to pass *any* arguments *except* for the first one. return $a+$b+$c ; } echo add(2,null,3); # even if you pass the value of $b in the url as a get or post param... it wont work. ? The variables inside a function are not in the global scope so you are ok here. However if you ever plan on calling this function with uninitialized variables then it is quite likely some fool is going to do what I previously suggested, i.e. ?php /** Page called with ?a=22 appended to URL */ function add($a,$b,$c) { return $a+$b+$c; } $total = add($first, $second, $third); /** You think this will be 0, but with register_globals this is actually 22 */ echo $total; ? thanks, vedanta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Skipping function arguments!
Hello Jason, Thursday, April 28, 2005, 3:25:10 PM, you wrote: JB ?php JB /** Page called with ?a=22 appended to URL */ JB function add($a,$b,$c) { JBreturn $a+$b+$c; JB } JB $total = add($first, $second, $third); JB /** You think this will be 0, but with register_globals this is actually JB 22 */ JB echo $total; As that code stands, even with register globals on, it will not echo 22. At least on PHP 4.3.11 on my server this is the case. I guess RG makes all variables global, but not super-global, which leaves the above safe as the null of $total overrides whatever may have been set. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[3]: [PHP] Skipping function arguments!
RD As that code stands, even with register globals on, it will not echo RD 22. At least on PHP 4.3.11 on my server this is the case. I guess RG RD makes all variables global, but not super-global, which leaves the RD above safe as the null of $total overrides whatever may have been set. Err, replace $total with $first in my comment above. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Global Variables
* Dan [EMAIL PROTECTED]: I taught myself PHP before the frenzy over register_globals. After a reasonable break from the language, I'm back for more. I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that? Use of session_register() is deprecated in favor of direct access to the $_SESSION array -- which is present if session_start() has been called: ?php session_start(); $_SESSION['foo'] = 'bar'; // retrieve a session variable $bar = $_SESSION['bar']; // set a session variable ? -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Richard Davey wrote: RD As that code stands, even with register globals on, it will not echo RD 22. At least on PHP 4.3.11 on my server this is the case. I guess RG RD makes all variables global, but not super-global, which leaves the RD above safe as the null of $total overrides whatever may have been set. Err, replace $total with $first in my comment above. Best regards, Richard Davey Indeed... and replace ?a=22 with ?first=22 in my message as well. :-/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Skipping function arguments!
Hello Jason, Thursday, April 28, 2005, 4:23:43 PM, you wrote: JB Indeed... and replace ?a=22 with ?first=22 in my message as well. JB :-/ Heh.. ok :) No worries, demonstrated to me that RegGlobs aren't quite as destructive as popular myth would lead you to believe (not that it'll make me start using them mind you) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templating engines
Hi all, What templating engines do you use with php and why? Ive been using smarty (http://smarty.php.net) Clive. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templating engines
On 4/28/05, Clive Zagno [EMAIL PROTECTED] wrote: What templating engines do you use with php and why? I use eval(). Because it works. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Richard Davey wrote: Hello Jason, Thursday, April 28, 2005, 4:23:43 PM, you wrote: JB Indeed... and replace ?a=22 with ?first=22 in my message as well. JB :-/ Heh.. ok :) No worries, demonstrated to me that RegGlobs aren't quite as destructive as popular myth would lead you to believe (not that it'll make me start using them mind you) Best regards, Richard Davey You're right. The truth is that you *can* code securely with register_globals on, but it is more difficult than having it turned off. AFAIK the main problem with it is that if you forget to initialize your global variables for something (which might include some $user_auth type variable) then users can easily send bogus information. And even with this the order in which global variables get initialized can affect register_globals. So instead we just scare all of the new PHP coders by telling them about the RegGlobs boogie man. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Templating engines
Clive Zagno wrote: Hi all, What templating engines do you use with php and why? Ive been using smarty (http://smarty.php.net) Clive. PHP itself is a templating engine, i.e. it can be used to filter input and format it into output. But Smarty is nice if you want your people to be able to create a template without giving them all of the additional PHP coding abilities. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templating engines
Greg Donald wrote: On 4/28/05, Clive Zagno [EMAIL PROTECTED] wrote: What templating engines do you use with php and why? I use eval(). Because it works. I'm a big fan of include(). ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Templating engines
* Clive Zagno [EMAIL PROTECTED]: What templating engines do you use with php and why? Ive been using smarty (http://smarty.php.net) Just FYI, you've opened the door for a holy war, as temlating and template engines are a fairly volatile topic, with many people holding very extreme opinions on the subject. (me? I use Smarty.) -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restricting browser's a password manager pop-up
The yes part is that it only appears based on the browsers intelligence in scanning the name of your form fields. Change username and password to something, well.. more obtuse, and it often gets rid of the problem. Give it a shot and see which combination works for you. You may also try adding autocomplete=Off in your password input tag. -k. __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templating engines
Greg Donald wrote: On 4/28/05, Clive Zagno [EMAIL PROTECTED] wrote: What templating engines do you use with php and why? I use eval(). Because it works. Myself, I'm partial to include(). ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Restricting browser's a password manager pop-up
Hello -k., Thursday, April 28, 2005, 5:11:26 PM, you wrote: k You may also try adding autocomplete=Off into your password input k tag. Yes.. providing you have no intention of making your markup validate (as transitional or strict) - but I guess lots of people don't, so it's a valid method. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Hi, I dont mind seeing php and html together, but designer generally hate it, so I would want to seperate php code from html as much as possible. clive Jason Barnett wrote: Clive Zagno wrote: Hi all, What templating engines do you use with php and why? Ive been using smarty (http://smarty.php.net) Clive. PHP itself is a templating engine, i.e. it can be used to filter input and format it into output. But Smarty is nice if you want your people to be able to create a template without giving them all of the additional PHP coding abilities. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templating engines
I'm a big fan of include(). ;) Ditto! -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Ive been using smarty (http://smarty.php.net) Just FYI, you've opened the door for a holy war, as temlating and template engines are a fairly volatile topic, with many people holding very extreme opinions on the subject. (me? I use Smarty.) -- Matthew Weier O'Phinney So just because you use smarty you think you are smart and have the right to be smart..who the hell do you think you are?? Sorry, just giving an example of how a jackass with extreme opinions would write on this holy war's volatile topic. no offense meant :-) Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Ryan A wrote: So just because you use smarty you think you are smart and have the right to be smart..who the hell do you think you are?? Sorry, just giving an example of how a jackass with extreme opinions would write on this holy war's volatile topic. no offense meant :-) Cheers, Ryan I would go for a xml-style template engine (start flaming right below this thread) grt, Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On 4/28/2005 7:08:00 PM, Evert | Rooftop Solutions ([EMAIL PROTECTED]) wrote: Ryan A wrote: So just because you use smarty you think you are smart and have the right to be smart..who the hell do you think you are?? Sorry, just giving an example of how a jackass with extreme opinions would write on this holy war's volatile topic. no offense meant :-) I would go for a xml-style template engine (start flaming right below this thread) Flaming??? who has time to start flaming after reading what you wrote? am busying banging my head against the wall. :-p Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: editor that typesets the php code
well, i'm not sure what to do after your code is done, but as far as editors go, theres a free one out there that does syntax highlighting for a ton of languages (php included) called Vim... it comes with a graphical version called gvim that i do all of my coding on. no debugging features for php (afaik) but you can set up debuggers through vim (never tried though). http://www.vim.org -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On Thu, 2005-04-28 at 13:20, Ryan A wrote: On 4/28/2005 7:08:00 PM, Evert | Rooftop Solutions ([EMAIL PROTECTED]) wrote: Ryan A wrote: So just because you use smarty you think you are smart and have the right to be smart..who the hell do you think you are?? Sorry, just giving an example of how a jackass with extreme opinions would write on this holy war's volatile topic. no offense meant :-) I would go for a xml-style template engine (start flaming right below this thread) Flaming??? who has time to start flaming after reading what you wrote? am busying banging my head against the wall. To state the obvious... the above is in actuality a flame disguised as an excuse. I use InterJinn, smarty, and PHP as template engines depending on what the client wants and how much work they want done, and how much elegance, modularity, and maintainability they want. Of the three I like smarty the least which is probably why I wrote my own engine :) Oh wait, I've also used eztemplate which by far takes the cake of horrible horrible templating. While PHP is itself usable as a templating engine, it's not what I would call clear and concise when used that way (but maybe that's because I've come across too many instances where the previous developer mixed business logic with display logic and then I had to rework the functionality which was a nightmare :). When using InterJinn I save the overhead of run-time includes incurred by using PHP as a templating engine, and I save the overhead of cache checks incurred by systems like smarty since InterJinn compiles to PHP source code and does not use a cache (although it can be set to automatically recompile pages when dependencies change). At any rate I don't generally post about InterJinn here anymore since some of the regulars tend to get annoyed ;) Mind you I don't post much at all anymore since I became a father a year and a half ago... priorities you know :) 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] Re: Templating engines
Ive been using smarty (http://smarty.php.net) Just FYI, you've opened the door for a holy war, as temlating and template engines are a fairly volatile topic, with many people holding very extreme opinions on the subject. (me? I use Smarty.) So just because you use smarty you think you are smart and have the right to be smart..who the hell do you think you are?? I don't use smarty... I do it all with vi macros!!! vi rocks! *wink* :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Skipping function arguments!
Vedanta Barooah wrote: Well that was simple, but this is what i am trying to solve: if you refer to the php documentation for ldap_open() function it says: resource ldap_search ( resource link_identifier, string base_dn, string filter [, array attributes [, int attrsonly [, int sizelimit [, int timelimit [, int deref]) if you look at the 4th and the 6th arguments to the function attributes is an array while sizelimit is an int, i want to pass the sixth element without passing the 4th and the 5th ... how do i do that?? you can do it only with user defined functions. so the answer is no, you can't do that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: editor that typesets the php code
well, i'm not sure what to do after your code is done, but as far as editors go, theres a free one out there that does syntax highlighting for a ton of languages (php included) called Vim... it comes with a graphical version called gvim that i do all of my coding on. no debugging features for php (afaik) but you can set up debuggers through vim (never tried though). http://www.vim.org Open up the file in vim and type: gg=G Turns this: function str_pad_html($strInput = , $intPadLength, $strPadString = nbsp;) { if (strlen(trim(strip_tags($strInput))) intval($intPadLength)) { switch ($intPadType) { // STR_PAD_LEFT case 0: $offsetLeft = intval($intPadLength - strlen(trim(strip_tags($strInput; $offsetRight = 0; break; // STR_PAD_RIGHT case 1: $offsetLeft = 0; $offsetRight = intval($intPadLength - strlen(trim(strip_tags($strInput; break; } unset($strInput, $offsetLeft, $offsetRight); return $strPadded; } else { return $strInput; } } into this: function str_pad_html($strInput = , $intPadLength, $strPadString = nbsp;) { if (strlen(trim(strip_tags($strInput))) intval($intPadLength)) { switch ($intPadType) { // STR_PAD_LEFT case 0: $offsetLeft = intval($intPadLength - strlen(trim(strip_tags($strInput; $offsetRight = 0; break; // STR_PAD_RIGHT case 1: $offsetLeft = 0; $offsetRight = intval($intPadLength - strlen(trim(strip_tags($strInput; break; } unset($strInput, $offsetLeft, $offsetRight); return $strPadded; } else { return $strInput; } } -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
I would go for a xml-style template engine (start flaming right below this thread) Flaming??? who has time to start flaming after reading what you wrote? am busying banging my head against the wall. To state the obvious... the above is in actuality a flame disguised as an excuse. Hey Rob, I sorry for the mix up but the above (however obvious) was *not* meant to be a flame, I was *only* joking with the guy. Is it just me or is joking becoming outlawed on the list? Most of us are geeks or classified as geeks on the lista little geek humour please? programming is a serious business and i find myself getting quite stressed sometimesusing a little humour or reading others humourous replies helps IMHO. Cheers, -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
/* Mind you I don't post much at all anymore since I became a father a year and a half ago... priorities you know :) */ Almost forgot, congrats on your kid. Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templating engines
At 5:43 PM -0800 4/28/05, Clive Zagno wrote: Hi all, What templating engines do you use with php and why? Ive been using smarty (http://smarty.php.net) I've used include(), and smarty, but now use Expression Engine http://www.pmachine.com. EE which is more of a CMS than just a templating system, but it has a world class templating system; and that rocks. One of are other programs swears by smarty, but I'd go with includes if I wasn't using EE. Alnisa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Is it just me or is joking becoming outlawed on the list? Most of us are geeks or classified as geeks on the lista little geek humour please? programming is a serious business and i find myself getting quite stressed sometimesusing a little humour or reading others humourous replies helps IMHO. Humor is on my TODO list. Clearly the creators of PHP have a sense of humor... I mean who puts a picture of a bunny that shows up as an easter egg on (what else) Easter? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On 4/28/2005 8:05:31 PM, John Nichel ([EMAIL PROTECTED]) wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. hehe used to be on mine too, then I finally made a TODO list and now I have a TODO reminder to do the things on my TODO list. :-p Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Templating engines
[snip] Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. [/snip] Now, I know that we all love to discuss small dogs from Kansas, but I've too much to do right now. TYVM! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On Thursday 28 April 2005 02:05 pm, John Nichel wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] Just out of curiosity, are there any templating engines out there that would automatically generate and then fill in values for a TODO list? IATOL, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and Ajax?
Does anyone have any references on using PHP and Ajax? I caught the news on PHP Architect about the webcast they are doing in May and it sounds like an interesting technology, but I can't wait, of course :)... and I wanted to learn as much as I could before their presentation. Any pointers? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Andre Dubuc wrote: On Thursday 28 April 2005 02:05 pm, John Nichel wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] Just out of curiosity, are there any templating engines out there that would automatically generate and then fill in values for a TODO list? IATOL, Andre Not yet, but it is non my TODO list grt, Ever -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and Ajax?
Jeremiah Johnson mailto:[EMAIL PROTECTED] on Thursday, April 28, 2005 11:28 AM said: Does anyone have any references on using PHP and Ajax? I caught the news on PHP Architect about the webcast they are doing in May and it sounds like an interesting technology, but I can't wait, of course :)... and I wanted to learn as much as I could before their presentation. Any pointers? If you want to learn as much as I could then you should first learn to query google. Try the second result. HTH! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Notice: Undefined index
Hello, This is a new install of PHP 5.0.4 on XP, I'm testing if it's installed correctly with the usual test.htm: form action=action.php method=POST Your name: input type=text name=name / Your age: input type=text name=age / input type=submit /form Action.php: ?php echo $_POST['name']; echo $_POST['age']; ? Results: C:\NCCaction.php Notice: Undefined index: name in C:\NCC\action.php on line 2 Notice: Undefined index: age in C:\NCC\action.php on line 3 C:\NCC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Ryan A wrote: I would go for a xml-style template engine (start flaming right below this thread) Hey Rob, I sorry for the mix up but the above (however obvious) was *not* meant to be a flame, I was *only* joking with the guy. Is it just me or is joking becoming outlawed on the list? Most of us are geeks or classified as geeks on the lista little geek humour please? programming is a serious business and i find myself getting quite stressed sometimesusing a little humour or reading others humourous replies helps IMHO. Cheers, -Ryan Yes, and that's how I read this reply =) About the subject, I'm working on a xml-based templating system, which caches all the steps it does, so it overcomes the slowness =) And ofcource because I like xml and all the neith things you can do with it. grt, Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Notice: Undefined index
From: Rob Kapfer [mailto:[EMAIL PROTECTED] Hello, This is a new install of PHP 5.0.4 on XP, I'm testing if it's installed correctly with the usual test.htm: form action=action.php method=POST Your name: input type=text name=name / Your age: input type=text name=age / input type=submit /form Action.php: ?php echo $_POST['name']; echo $_POST['age']; ? Results: C:\NCCaction.php Notice: Undefined index: name in C:\NCC\action.php on line 2 Notice: Undefined index: age in C:\NCC\action.php on line 3 C:\NCC That's correct behavior. As you're simply running action.php on its own, it sees that $_POST['name'] and $_POST['age'] don't exist and outputs a notice for each. To avoid the notices, ensure that those keys exist before calling something like echo on them: ?php if (!empty($_POST['name'])) { echo $_POST['name']; } else { echo 'Name not set'; } if (!empty($_POST['age'])) { echo $_POST['age']; } else { echo 'Age not set'; } ? HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Evert | Rooftop Solutions wrote: Yes, and that's how I read this reply =) About the subject, I'm working on a xml-based templating system, which caches all the steps it does, so it overcomes the slowness =) And ofcource because I like xml and all the neith things you can do with it. grt, Evert OK so besides the geek factor involved, what makes an xml-based template system that much better? The main benefit that I've ever heard was it can make it easier for producing output for heterogenous displays... http://www.w3.org/MarkUp/Forms/ The most obvious answer example that comes to my mind is Mozilla / IBM, but then again XForms is also on my Little Dog Too list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Notice: Undefined index
Also see: http://php.net/manual/en/function.array-key-exists.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On 4/28/2005 8:18:28 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote: On Thursday 28 April 2005 02:05 pm, John Nichel wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] Just out of curiosity, are there any templating engines out there that would automatically generate and then fill in values for a TODO list? Nope, but I am planning to make oneits on my TODO list. IATOL, Whats IATOL? Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Notice: Undefined index
Rob Kapfer wrote: Hello, This is a new install of PHP 5.0.4 on XP, I'm testing if it's installed correctly with the usual test.htm: form action=action.php method=POST Your name: input type=text name=name / Your age: input type=text name=age / input type=submit /form Action.php: ?php echo $_POST['name']; echo $_POST['age']; ? Results: C:\NCCaction.php Notice: Undefined index: name in C:\NCC\action.php on line 2 Notice: Undefined index: age in C:\NCC\action.php on line 3 C:\NCC Did you give any value to name and age in your form? Check to see if a variable exists before trying to do something with it... if ( isset ( $_POST['name'] ) ) { echo ( $_POST['name'] ); } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
/* I'm working on a xml-based templating system, which caches all the steps it does, so it overcomes the slowness =) And ofcource because I like xml and all the neith things you can do with it. */ Sounds like you are pretty good with xml... i know very little of XML, do you have a link I can read up on to learn the language? My knowledge of the subject is pretty shameful :-( Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Templating engines
[snip] Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. [/snip] Now, I know that we all love to discuss small dogs from Kansas, but I've too much to do right now. TYVM! Hey Jay, Just wanted to tell youone of your snip tags are open :-D Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On Thursday 28 April 2005 03:21 pm, Ryan A wrote: On 4/28/2005 8:18:28 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote: On Thursday 28 April 2005 02:05 pm, John Nichel wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] Just out of curiosity, are there any templating engines out there that would automatically generate and then fill in values for a TODO list? Nope, but I am planning to make oneits on my TODO list. IATOL, Whats IATOL? Cheers, Ryan Aha! A bite! 'IATOL' = 'Ignorance At The Outer Limits' (derivative of my usual tagline: Ignorance is a way of life) Hth, : Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Ajax?
There is a good intro to the whole XMLHttpRequest (Ajax) process on Webmonkey right now: http://webmonkey.wired.com/webmonkey/05/16/index4a.html Good for those of us slower on the uptake... jason sweeney jason.designshift.com Chris W. Parker wrote: Jeremiah Johnson mailto:[EMAIL PROTECTED] on Thursday, April 28, 2005 11:28 AM said: Does anyone have any references on using PHP and Ajax? I caught the news on PHP Architect about the webcast they are doing in May and it sounds like an interesting technology, but I can't wait, of course :)... and I wanted to learn as much as I could before their presentation. Any pointers? If you want to learn as much as I could then you should first learn to query google. Try the second result. HTH! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Templating engines
[snip] [snip] Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. [/snip] Now, I know that we all love to discuss small dogs from Kansas, but I've too much to do right now. TYVM! Hey Jay, Just wanted to tell youone of your snip tags are open :-D [/snip] Note the coding style of the open snip tag, I believe that would be Jason's Gestooberhanken! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
/* I'm working on a xml-based templating system, which caches all the steps it does, so it overcomes the slowness =) And ofcource because I like xml and all the neith things you can do with it. */ Sounds like you are pretty good with xml... i know very little of XML, do you have a link I can read up on to learn the language? My knowledge of the subject is pretty shameful :-( http://www.w3schools.com/default.asp links on the left are a decent start... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Templating engines
[snip] and box of bending straws. [/snip] Nice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
Jay Blanchard wrote: snip Note the coding style of the open snip tag, I believe that would be Jason's Gestooberhanken! /snip Btt. Awww, sorry, but you do not win the grand prize. However, we do have some nice parting gifts for you. Tell him what he's won Chuck. Well John, for Jay we have a year's supply of post-processed fecal matter, and box of bending straws. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Round to the nearest X
I realize this is a dumb question but I just can't come up with an equation that will do this and I don't see an internal PHP function (for version 4.3) that will do this... Basically I need to come up with an equation/algorithm that will round any number up/down to the nearest X. I tried using y +/- (y mod x) but after I started putting in some test numbers, it didn't always work. For example, 37678 + ( 37678 % 500 ) did not round up to the nearest 500. Any ideas? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Round to the nearest X
On 4/28/05, Chris Boget [EMAIL PROTECTED] wrote: I realize this is a dumb question but I just can't come up with an equation that will do this and I don't see an internal PHP function (for version 4.3) that will do this... Basically I need to come up with an equation/algorithm that will round any number up/down to the nearest X. #!/usr/bin/php ?php $num = isset( $_SERVER[ 'argv' ][ 1 ] ) ? $_SERVER[ 'argv' ][ 1 ] : 0; do { $num++; } while( $num % 500 ); echo $num; ? ./round.php 499 500 ./round.php 501 1000 -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] anchr tag replace
Its a long story, but basically, theres some code we cannot get around that is taking anchor tags such as a href=#sat and turning them into a href=http://host.com/folder/file.html?var=varvar2=var2#sat. I need to undo this action with a pattern match on a large body of content with . Can this be done. Here are further details: I need a regular expression that will recognize the following where #anchor can be anything such as #sat or #sunday or #lastpage: a*href=http://*#anchor* And turn it into this: a*href=#anchor* What I am doing is removing the http://host/.../.../file.html?variablevariable that immediately precedes the #anchor. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Round to the nearest X
I think the formula you are looking for is something like this: round( y/x, 0) * x With y being your number and x being the nearest increment number to round to. On Apr 28, 2005, at 4:10 PM, Chris Boget wrote: I realize this is a dumb question but I just can't come up with an equation that will do this and I don't see an internal PHP function (for version 4.3) that will do this... Basically I need to come up with an equation/algorithm that will round any number up/down to the nearest X. I tried using y +/- (y mod x) but after I started putting in some test numbers, it didn't always work. For example, 37678 + ( 37678 % 500 ) did not round up to the nearest 500. Any ideas? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anchr tag replace
On Thu, 28 Apr 2005, php wrote: Its a long story, but basically, theres some code we cannot get around that is taking anchor tags such as a href=#sat and turning them into a href=http://host.com/folder/file.html?var=varvar2=var2#sat. I need to undo this action with a pattern match on a large body of content with . Can this be done. Here are further details: I need a regular expression that will recognize the following where #anchor can be anything such as #sat or #sunday or #lastpage: a*href=http://*#anchor* And turn it into this: a*href=#anchor* What I am doing is removing the http://host/.../.../file.html?variablevariable that immediately precedes the #anchor. Hmm... $str = ereg_replace('(a[^]*href=)http://[^#]*(#[^]*)', '$1$2', $str); Completely untested and assumes lowercase tags and the use of double quotes and that a single a href tag fits on a single line... But it's a start. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Round to the nearest X
On 4/28/05, Greg Donald [EMAIL PROTECTED] wrote: do { $num++; } while( $num % 500 ); Actually that fails for the base number 500. This works for everything: #!/usr/bin/php ?php $num = isset( $_SERVER[ 'argv' ][ 1 ] ) ? $_SERVER[ 'argv' ][ 1 ] : 0; if( $num % 500 ) { do { $num++; } while( $num % 500 ); } echo $num; ? ./round.php 0 ./round.php 499 500 ./round.php 500 500 ./round.php 501 1000 -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Round to the nearest X
I realize this is a dumb question but I just can't come up with an equation that will do this and I don't see an internal PHP function (for version 4.3) that will do this... Basically I need to come up with an equation/algorithm that will round any number up/down to the nearest X. I tried using y +/- (y mod x) but after I started putting in some test numbers, it didn't always work. For example, 37678 + ( 37678 % 500 ) did not round up to the nearest 500. 37678 + 500 - (37678 % 500) Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mini CMS
im looking for a small tutorial/cms script without all the fluff. something to create pages (static preferably) doesn't even need an admin/user interface. i could write my own, but don't have the time at the moment. if anyone knows of such a small script let me know. cheers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On Thu, 2005-04-28 at 13:53, Ryan A wrote: I would go for a xml-style template engine (start flaming right below this thread) Flaming??? who has time to start flaming after reading what you wrote? am busying banging my head against the wall. To state the obvious... the above is in actuality a flame disguised as an excuse. Hey Rob, I sorry for the mix up but the above (however obvious) was *not* meant to be a flame, I was *only* joking with the guy. Sorry, I meant to put a smiley at the end of the my comment :) I knew you were just joking *heheh*. Cheers, Rob. Is it just me or is joking becoming outlawed on the list? Most of us are geeks or classified as geeks on the lista little geek humour please? programming is a serious business and i find myself getting quite stressed sometimesusing a little humour or reading others humourous replies helps IMHO. Cheers, -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005 -- .. | 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
[PHP] Search Agents...
I have a request from a client that has me a little confounded. He wants to have a system where when someone posts a public request with certain criteria, that criteria is then used to find established profiles/agents that fit the criteria. Then emails are sent out to the people corresponding to those profiles/agents. An example: Someone posts an ad saying they have a car for sale: MODEL: Chevy MAKE: Silverado YEAR: 2005 Meanwhile, potential clients have saved search agents so that when a car is posted if the description meets their criteria they are sent an email. Thus, you could have three people, each with agents such as these: PERSON1 MODEL: Chevy MAKE: Silverado YEAR (Newer than): 2003 PERSON2 MODEL: Chevy MAKE: Any YEAR (Newer than): 2004 PERSON3 MODEL: Any MAKE: Any YEAR (Newer than): 2000 You would like all of these people to be emailed after the ad is posted, but how? This won't work: SELECT * FROM agents WHERE mymodel = Chevy AND mymake = Silverado AND myyear = 2005 It will limit the results too much. But neither will this: SELECT * FROM agents WHERE mymodel = Chevy OR mymake = Silverado OR myyear = 2005 That will give too many results. If you had a profile such as: PERSON4 MODEL: Chevy MAKE: Corvette YEAR (Newer than): 2003 They would be sent the email, too. But they aren't looking for trucks. Two options I see would be to: 1) Do it in reverse. Each time a new ad is posted to then loop through the agents doing a search for the criteria and limiting the search to only the previously posted ad, such as: SELECT * FROM ads WHERE admodel = Chevy AND admake = Silverado AND adyear = 2003 AND adid = 8 2) Create some crazily complex query with nested ands and ors out the wazoo. Is there something I'm not seeing? Is there a better way? If not, which of these seems like less of a strain on the server? TIA. Hopefully I'm not just being an idiot here. Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: What's changed between version 4.2.2 and 4.3.4 regarding POSTing?
Yes. It's using the global arrays HTTP_POST_VARS and HTTP_SESSION_VARS arrays, and 4.3.x has the directive register_globals set to off by default. It's safer to leave it off. You can easily update the script by replacing these with $_POST and $_SESSION, respectively. Again I appreciate the pointer. I also changed the $HTTP_SERVER_VARS to $_SERVER and it still didn't work.I then went through the script and checked for where it was trying to register the global user name and it was assuming that the global vars was turned on. Changed the line to read: // $adb_password = $admin_password; // $user = $u_name; $_SESSION['adb_password'] = $admin_password; $_SESSION['user'] = $u_name; And it works now. Thanks piles for the help. Regards Matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php