[PHP] Setting values of php.ini file at runtime
Dear All, I am wondering if anyone shed some light. i am thinking of setting value for php.ini variables like register_globals = ON/OFF at runtime (within our php script). Is there any function built-in in php?, or can we do it ourselves. Looking forward, Thanks Tariq -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
You cannot do it inside a script as the register_globals magic happens before the script starts executing, so toggling the setting at runtime is too late. -Rasmus On Mon, 25 Nov 2002, Tariq Murtaza wrote: > Dear All, > > I am wondering if anyone shed some light. > i am thinking of setting value for php.ini variables like > register_globals = ON/OFF at runtime (within our php script). > Is there any function built-in in php?, or can we do it ourselves. > > Looking forward, > Thanks > > Tariq > > > > -- > 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] Use PHP for reading binary files created by C software
Hi all, I would like to use PHP to read a binary file which contains a structure in C, such as: struct simple { int a; float b; }; with f.e. a = 2 and b = 1.5. Please notice that this is stored as *binary* data and not as text. I know it is possible to read binary files using fgets() in PHP 4.3.0 or higher but then I still don't have a clue how to actually *do* it... Is it even possible to read binary files created by C software and if so, how to do this in practice - examples would be very welcome. Thanks in advance, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File uploads...
Hi all, I am updating a site accounting for register_globals = off. I have a page which allows for the uploading of a number of files. The page sends these in an "array" of files. The destination script used to have: if ($AttachmentCount > 0) { foreach($userfile as $key => $value) { AddAttachment($BPFNo, $value, $userfile_name[$key], $userfile_size[$key], $userfile_type[$key]); } } Where attachmentcount was a variable which could be 0 (no uploads) or more (counting the number of $userfile[] variables there should be. AddAttachment is a function that actually saves the attachment into a database. How would I re-do this? What I would preferably do is have the script AddAttachment for each $_FILES[] there might be. If I need to change it from an array type ($userfile[]) in the calling script, I can easily do this. Can someone help me? Thanks David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: [EMAIL PROTECTED] web: www.BarloworldOptimus.com smime.p7s Description: application/pkcs7-signature
[PHP] Re: inserting preexisting image inside dynamic image
Eric Pierce wrote: > Hi there... > > Just wondering... when creating a dynamic image, is > there a way/fuction to insert an existing image using > x,y coordiantes for precision? Yes, there is...use imagecopy (http://www.php.net/imagecopy) Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dumb POST Array question
Hi all, I have a multiple select called Consultants[] In one page. On the target page, how would I reference it? Would it be: $_POST['Consultants'][0] $_POST['Consultants'][1] Etc Or something else? Thanks David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: [EMAIL PROTECTED] web: www.BarloworldOptimus.com smime.p7s Description: application/pkcs7-signature
[PHP] Re: Dumb POST Array question
David Russell wrote: > Hi all, > > I have a multiple select called Consultants[] In one page. > > On the target page, how would I reference it? Would it be: > > $_POST['Consultants'][0] > $_POST['Consultants'][1] > Etc Since $_POST['Consultants'] contains an array, you can indeed use the above syntax. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dumb POST Array question
On Monday 25 November 2002 16:48, David Russell wrote: > Hi all, > > I have a multiple select called Consultants[] In one page. > > On the target page, how would I reference it? Would it be: > > $_POST['Consultants'][0] > $_POST['Consultants'][1] If in doubt, print it out (TM): print_r($_POST); The best way to do it (IMHO) is to: foreach ($_POST['Consultants'] as $key => value) { print "$key: $value"; } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Make it myself? But I'm a physical organic chemist! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] URL Encode to send as form POSTed Items
Hi All, I would like to know if it's possible to use php to encode form variables as if they had come from a post form instead of a get form. I imagine I need to place them into a header but cannot find much to read that gives any information on this. I need to create form variables and than use header location to direct the user to another page that will process the form. I'm posting to another site which is why i have to use form variables. I would like to avoid using JavaScript as this takes longer, will not work on all machines. Thanks Zac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql
Hello, 1.How many tables can be created inside a database? There is a maximum number? 2.Is it possible to erase a table? Thanks, Adrian
Re: [PHP] Use PHP for reading binary files created by C software
php.net/unpack On Sun, 24 Nov 2002, Tim Molendijk wrote: > Hi all, > > I would like to use PHP to read a binary file which contains a structure in > C, such as: > struct simple { > int a; > float b; > }; > with f.e. a = 2 and b = 1.5. > Please notice that this is stored as *binary* data and not as text. > > I know it is possible to read binary files using fgets() in PHP 4.3.0 or > higher but then I still don't have a clue how to actually *do* it... > Is it even possible to read binary files created by C software and if so, > how to do this in practice - examples would be very welcome. > > Thanks in advance, > Tim > > > > -- > 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] URL Encode to send as form POSTed Items
You can't send POST data with a Location redirect. You can do it by connecting directly to port 80 of the remote server and sending the POST data. -R On Mon, 25 Nov 2002, Zac Hillier wrote: > Hi All, > > I would like to know if it's possible to use php to encode form variables as > if they had come from a post form instead of a get form. I imagine I need to > place them into a header but cannot find much to read that gives any > information on this. > > I need to create form variables and than use header location to direct the > user to another page that will process the form. > > I'm posting to another site which is why i have to use form variables. I > would like to avoid using JavaScript as this takes longer, will not work on > all machines. > > Thanks > > Zac > > > -- > 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] mysql
>From now on ask this on a MySQL list, please. > 1.How many tables can be created inside a database? There is a maximum > number? Only limit is how many files your file system will allow in one directory. > 2.Is it possible to erase a table? Yes ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem on OpenDir()
Dear all here is the path i want to open for reading files from it! path = "c:/pdf_reports/bills/Oct-02" i always got returned with these error : " Warning: OpenDir: Invalid argument (errno 22) in c:/page.php on line 21" "Warning: Supplied argument is not a valid Directory resource in c:/page.php line 22" but when i change the path to : "c:/pdf_reports/bills/" then it can list all the files within this folder "bills". I'm sure that the folder Oct-02 is exist inside bills directory! So i haven't go any idea! Could someone pls give me some hints! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Overloading Constructors
is it doable? ie class myClass { var $myInt; // default constructor function myClass() { } // overloaded constructor function myClass($newInt) { $this->myInt = $newInt; } } -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
Excuse me breaking in...somewhat similar problem: Have set up a client recently, preaching security persuaded them into updating so that could run Register_Globals=Off. Now they want to install a 'wiki' which requires (to my horror) Register_Globals=On. Short of two Apache/PHP servers, what is a logical way to structure things so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more securely? Please advise, =dn > You cannot do it inside a script as the register_globals magic happens > before the script starts executing, so toggling the setting at runtime is > too late. > > -Rasmus > > On Mon, 25 Nov 2002, Tariq Murtaza wrote: > > > Dear All, > > > > I am wondering if anyone shed some light. > > i am thinking of setting value for php.ini variables like > > register_globals = ON/OFF at runtime (within our php script). > > Is there any function built-in in php?, or can we do it ourselves. > > > > Looking forward, > > Thanks > > > > Tariq > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
a .htaccess file in the directory you want RG OFF (ie /wiki/) should do the trick: php_flag register_globals on This seems to work for me... on 25/11/02 10:37 PM, DL Neil ([EMAIL PROTECTED]) wrote: > Excuse me breaking in...somewhat similar problem: > > Have set up a client recently, preaching security persuaded them into > updating so that could run Register_Globals=Off. Now they want to install a > 'wiki' which requires (to my horror) Register_Globals=On. > > Short of two Apache/PHP servers, what is a logical way to structure things > so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more > securely? > > Please advise, > =dn > > >> You cannot do it inside a script as the register_globals magic happens >> before the script starts executing, so toggling the setting at runtime is >> too late. >> >> -Rasmus >> >> On Mon, 25 Nov 2002, Tariq Murtaza wrote: >> >>> Dear All, >>> >>> I am wondering if anyone shed some light. >>> i am thinking of setting value for php.ini variables like >>> register_globals = ON/OFF at runtime (within our php script). >>> Is there any function built-in in php?, or can we do it ourselves. >>> >>> Looking forward, >>> Thanks >>> >>> Tariq >>> >>> >>> >>> -- >>> 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 >> >> > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Overloading Constructors
Yes. http://www.sharksforum.com "Dan Field" <[EMAIL PROTECTED]> skrev i en meddelelse 1038221845.1245.144.camel@dsspc">news:1038221845.1245.144.camel@dsspc... > is it doable? > > ie > > class myClass { > var $myInt; > > // default constructor > function myClass() { > } > > // overloaded constructor > function myClass($newInt) { > $this->myInt = $newInt; > } > > } > > > -- > Dan Field > Systems Development Officer - Social Services Dept. > Ceredigion County Council. > > > > > Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, > yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. > Pe dderbynioch y neges hon mewn camgymeriad, byddwch > mor garedig a rhoi gwybod i'r rheolwr system. > > Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi > cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. > > > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
On Monday 25 November 2002 19:37, DL Neil wrote: > Excuse me breaking in...somewhat similar problem: > > Have set up a client recently, preaching security persuaded them into > updating so that could run Register_Globals=Off. Now they want to install a > 'wiki' which requires (to my horror) Register_Globals=On. > > Short of two Apache/PHP servers, what is a logical way to structure things > so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more > securely? Set it on a per directory basis. If using Apache something like: php_value register_globals 1 -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* There is nothing more silly than a silly laugh. -- Gaius Valerius Catullus */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
Justin, Neat! Don't limit thoughts to PHP when can solve it in Apache - thank you, =dn > a .htaccess file in the directory you want RG OFF (ie /wiki/) should do the > trick: > > > php_flag register_globals on > > > This seems to work for me... > > > on 25/11/02 10:37 PM, DL Neil ([EMAIL PROTECTED]) wrote: > > > Excuse me breaking in...somewhat similar problem: > > > > Have set up a client recently, preaching security persuaded them into > > updating so that could run Register_Globals=Off. Now they want to install a > > 'wiki' which requires (to my horror) Register_Globals=On. > > > > Short of two Apache/PHP servers, what is a logical way to structure things > > so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more > > securely? > > > > Please advise, > > =dn > > > > > >> You cannot do it inside a script as the register_globals magic happens > >> before the script starts executing, so toggling the setting at runtime is > >> too late. > >> > >> -Rasmus > >> > >> On Mon, 25 Nov 2002, Tariq Murtaza wrote: > >> > >>> Dear All, > >>> > >>> I am wondering if anyone shed some light. > >>> i am thinking of setting value for php.ini variables like > >>> register_globals = ON/OFF at runtime (within our php script). > >>> Is there any function built-in in php?, or can we do it ourselves. > >>> > >>> Looking forward, > >>> Thanks > >>> > >>> Tariq > >>> > >>> > >>> > >>> -- > >>> 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 > >> > >> > > > > Justin French > > http://Indent.com.au > Web Development & > Graphic Design > > > > -- > 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] Send multiple SQL staments in one query
Hi, I can't send multiple sql staments in one query, i always get an error saying that the sentece is incorrect, i thorw the sentece in a mysql console and works fine, i'm sepraing sentences with ; i try to separe using ;\n or ;\r\n but don't work Anyone can help me? :-) Miguel López Sánchez Programador Voz +34 902 014 945 E-mail: [EMAIL PROTECTED] Dinaweb Networks s.l. Rúa das Orfas 27 15703 Santiago de Compostela A Coruña Gz Sp ECC Voz +34 902 014 945 GMT+1 E-mail: [EMAIL PROTECTED] http://www.dinaweb.com http://www.dinahosting.com http://www.u-lo.com http://www.empregogalego.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does //commenting reduce performance?
Jason, ad infinitum, ad nauseum However it was your recent post that (sig file) quoted the Freudian: ontogency recapitulates phylogeny We should make them become more like us - even if we kill them in the process! =dn > On Sunday 24 November 2002 22:58, DL Neil wrote: > > Neatly done Ernest! > > Also in showing how these questions are best answered with five minutes on > > the PC, than a msg to the list... > > ... until someone else comes along and asks a similar question and you have to > show them again how it's best answered with five minutes on the PC, than a > msg to the list ... ad infinitum > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Who's on first? > */ > > > -- > 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] Send multiple SQL staments in one query
-- I can't send multiple sql staments in one query, i always get an error saying that the sentece is incorrect, i thorw the sentece in a mysql console and works fine, i'm sepraing sentences with ; i try to separe using ;\n or ;\r\n but don't work -- No, can't do it. Only one query per mysql_query() call. Not sure with other database interfaces, but it should be the same. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overloading Constructors
At 11:57 25.11.2002, Dan Field said: [snip] >is it doable? > >class myClass { > var $myInt; > > // default constructor > function myClass() { > } > > // overloaded constructor > function myClass($newInt) { > $this->myInt = $newInt; > } >} [snip] At least not with PHP 4.2: Results in: overloaded constructor A() overloaded constructor A(Test) thus bypassing the default constructor and calling the overloaded constructor both times. What you might do to distinguish which "overload" has been called: function A($string=null) { if (!isset($string)) echo "Default constructor A()\n"; else echo "Overloaded constructor A($string)\n"; } Hope this helps, -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Write Permission Errors - HELP! URGENT!!!
Hi I have the following code that breaks: // PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT $fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open " . $path . "/nicknames.txt"); chmod($path . "/nicknames.txt", 0755); fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID); $fileID = fopen($path . "/messages.txt", "a") or die("Could not open " . $path . "/messages.txt"); fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***"); fflush($fileID); fclose($fileID); I am getting the following error: Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission denied in /users/ppowell/web/chat/chat.php on line 163 I am attempting to write onto the files if they exist, if not, create them on the fly. I need the solution in the next 5 minutes - sorry, kind of an emergency! If anyone can help, please tell me what to do, the PHP manuals are not giving me a clear solution as to how to write to a file that does not yet exist that has to have the permissions of 0755 for both files. Thanx Phil
RES: RES: [PHP] RE: How to cache PHP on Apache
Hello! So, let me see if i understood: 1) Static content like Google´s logo(which i see every ten minutes :-) ) are cached with no problems. Actually, i´ve got that working. Does that always depend on the If-Modified-Since header? 2) Given that i send the proper header, could i receive as a response the 304 Not Modified for a dynamic content (GET something.php), just like the logo? If so, what would the proper header be? 3) Lets say that i got the php-response browser-cache working. Is it possible to store the cached response on my reverse proxy instead of the browser itself? Actually, thats what i would like to happen. Thank you for the help and best regards! Luanna -Mensagem original- De: Chris Shiflett [mailto:[EMAIL PROTECTED]] Enviada em: sexta-feira, 22 de novembro de 2002 18:40 Para: Luanna Silva; [EMAIL PROTECTED] Assunto: Re: RES: [PHP] RE: How to cache PHP on Apache Well, my explanation was not complete, because I wanted to make sure I was talking about the right thing. :-) One important thing I failed to mention is that caching applies to responses to GET and HEAD requests. If the response you showed us was a reply to a POST, it is not going to be cached. As far as the 304 responses are concerned, this depends in part on the Web browser. For example, if the browser sends a conditional GET request with an If-Modified-Since header (it has a date as a value), the Web server will make a decision. If the resource being requested has in fact been modified since the specified date, the entire resource is returned in a 200 OK response. If it has remained unchanged, a 304 Not Modified response is sent with no content, saving bandwidth. If you would like a good example to compare responses with, request an image from your Web server and notice the HTTP headers used. If you take a page such as Google as an example, your browser requests http://www.google/com first, receives the HTML from that, then notices the embedded image and requests http://www.google.com/images/logo.gif in a separate request. If you are like me and visit Google all the time, your browser has this image saved and rarely (usually only on holidays) gets anything but a 304 response from Google. So, for pages you make available via GET requests that you want to be cachable in the same way as Google's logo, you can start by mimicking what they do. Here is an example of the HTTP transactions required to see http://www.google.com/ (HTML and some headers edited for readability): -- GET / HTTP/1.1 Host: www.google.com User-Agent: Mozilla/5.0 (...) Accept: text/xml, ... Accept-Language: en-us, en;q=0.50 Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66 Keep-Alive: 300 Cache-Control: max-age=0 -- HTTP/1.1 200 OK Content-Length: 9390 Server: GWS/2.0 Date: Fri, 22 Nov 2002 20:31:18 GMT Content-Type: text/html Cache-control: private ... -- GET /images/logo.gif HTTP/1.1 Host: www.google.com User-Agent: Mozilla/5.0 (...) Accept-Language: en-us, en;q=0.50 Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66 Keep-Alive: 300 Accept: video/x-mng, ... Referer: http://www.google.com/ If-Modified-Since: Mon, 21 Oct 2002 02:32:25 GMT Cache-Control: max-age=0 -- HTTP/1.1 304 Not Modified Content-Length: 0 Server: GWS/2.0 Content-Type: text/html Date: Fri, 22 Nov 2002 20:31:19 GMT -- Hopefully that provides a little more information to get you going. Chris --- Luanna Silva <[EMAIL PROTECTED]> wrote: > For the moment, i want to cache the HTTP Response. So, if i´m > correct, the header that i sent to the list should do the job. > I thought that, if the responses were cached, the access.log file > would have 304 codes on the responses for php scripts. Is that > correct? Well, if it is, that´s not happening. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overloading Constructors
On Mon, 2002-11-25 at 10:57, Dan Field wrote: > is it doable? well I found a way. It's a bit of a hack but FYI heres how it works: function Form() { // a slight hack which allows us to overload // constructors by the number of args $name = "Form".func_num_args(); $arg_list = func_get_args(); $num_args = func_num_args(); switch($num_args) { case 0: $this->$name(); break; case 6: $this->$name( $arg_list[0], $arg_list[1], $arg_list[2], $arg_list[3], $arg_list[4], $arg_list[5]); break; default: echo "Wrong number of args for constructor!"; } } // pseudo-constructor for 0 args function Form0() { $this->formName = "myForm"; $this->formAction = $_SERVER['PHP_SELF']; $this->formMethod = "POST"; $this->formVersion = "xhtml"; $this->formLanguage = "en_gb"; $this->formStyle = "/styles/form.css"; $this->formElementCount = 0; } // pseudo-constructor for 6 args function Form6($formName, $formAction, $formMethod, $formVersion, $formLanguage, $formStyle) { $this->formName = $formName; $this->formAction = $formAction; $this->formMethod = $formMethod; $this->formVersion = $formVersion; $this->formLanguage = $formLanguage; $this->formStyle = $formStyle; $this->formElementCount = 0;// don't allow user to set this } -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions/Browser back button
I remember seeing threads debating this before, but is there anyway to disable/prevent a user from heading back in the browser and getting the "WARNING: Page has Expired" notice? Cheers Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Write Permission Errors - HELP! URGENT!!!
you must give the same permissions to the folder also. "Phil Powell" <[EMAIL PROTECTED]> wrote in message 0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6">news:0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6... Hi I have the following code that breaks: // PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT $fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open " . $path . "/nicknames.txt"); chmod($path . "/nicknames.txt", 0755); fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID); $fileID = fopen($path . "/messages.txt", "a") or die("Could not open " . $path . "/messages.txt"); fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***"); fflush($fileID); fclose($fileID); I am getting the following error: Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission denied in /users/ppowell/web/chat/chat.php on line 163 I am attempting to write onto the files if they exist, if not, create them on the fly. I need the solution in the next 5 minutes - sorry, kind of an emergency! If anyone can help, please tell me what to do, the PHP manuals are not giving me a clear solution as to how to write to a file that does not yet exist that has to have the permissions of 0755 for both files. Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Write Permission Errors - HELP! URGENT!!!
I did just that. Permissions are set the /chat folder as it is in all other folders. This is the first time I've ever done fopen with "w" and I can't get it to write, always getting "unable to access" errors. I want to be able to create the file if it does not exist. It works for me to do "r" in all other folders with the same permissions as /chat. Phil "Craig" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > you must give the same permissions to the folder also. > > > "Phil Powell" <[EMAIL PROTECTED]> wrote in message > 0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6">news:0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6... > Hi I have the following code that breaks: > > // PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT >$fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open " . > $path . "/nicknames.txt"); >chmod($path . "/nicknames.txt", 0755); >fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID); >$fileID = fopen($path . "/messages.txt", "a") or die("Could not open " . > $path . "/messages.txt"); >fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***"); > fflush($fileID); fclose($fileID); > > > I am getting the following error: > Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission > denied in /users/ppowell/web/chat/chat.php on line 163 > > I am attempting to write onto the files if they exist, if not, create them > on the fly. I need the solution in the next 5 minutes - sorry, kind of an > emergency! > > If anyone can help, please tell me what to do, the PHP manuals are not > giving me a clear solution as to how to write to a file that does not yet > exist that has to have the permissions of 0755 for both files. > > Thanx > Phil > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions/Browser back button
on 26/11/02 12:03 AM, Craig ([EMAIL PROTECTED]) wrote: > I remember seeing threads debating this before, but is there anyway to > disable/prevent a user from heading back in the browser and getting the > "WARNING: Page has Expired" notice? This is more like a diversion around the problem... It will either be relevant to your problem, or not :) In particular, I use this to prevent people from refreshing their page (and hence adding something to the DB twice for example). Lets say you have form.php, which submits to process.php... the aim is to have process.php as a server-only script (ie, nothing is sent to the browser), with a header() redirect to a thankyou.php page once I've added stuff to the DB, or whatever The point is, they'll never see a page expired message in this case, because the script receiving the POST information never gets to the browser. This may or may not help, depending on your problem :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert file into sql server binary field.
I would notice the difference, but computers don't understand text, it is just data for them, and they represent it the same way (there is no special file type for text and binary in filesystem either). The only difference is in case sensitivity - taken from mysql manual. You can also store binary objects in text. Chris Shiflett wrote: --- Marek Kilimajer <[EMAIL PROTECTED]> wrote: BLOB is like TEXT In what way? BLOB is binary large object. Text is ... text. One is binary, and the other is ASCII. The only similarity I can think of is that they both represent data. However, the format is completely different. Open up a binary file in a text editor, and then do the same with a regular text file. I think you will notice a significant difference. Or, consider the representation of 16 in binary versus ASCII: binary - 1 ascii - 0011000100110110 As Sterling mentioned, using addslashes() on binary data is a bad idea. The same can be said for any string operations intended for ASCII data. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Send multiple SQL staments in one query
Miguel lópez dinaweb dpto. programación wrote: Hi, I can't send multiple sql staments in one query, i always get an error saying that the sentece is incorrect, i thorw the sentece in a mysql console and works fine, i'm sepraing sentences with ; i try to separe using ;\n or ;\r\n but don't work Anyone can help me? :-) Miguel López Sánchez Programador Voz +34 902 014 945E-mail: [EMAIL PROTECTED] Dinaweb Networks s.l. Rúa das Orfas 27 15703 Santiago de Compostela A Coruña Gz Sp ECC Voz +34 902 014 945GMT+1 E-mail: [EMAIL PROTECTED] http://www.dinaweb.com http://www.dinahosting.com http://www.u-lo.com http://www.empregogalego.com Hi Miguel, Here's a function that I use to run multiple SQL statements at once - similar to running MySQL in batch mode. It relies on a semicolon to separate the SQL statements. function SendBatchQuery($db_host, $db_base, $db_user, $db_pw, $query) { $message = "Connection with server $db_host failed"; mysql_connect($db_host, $db_user, $db_pw) or die($message); $message = "Could not select database $db_base"; mysql_select_db($db_base) or die($message); $array = explode(';', $query); foreach($array as $value) { if(!$result = mysql_query($value)) { break; } } return $result; } Enjoy, Seth Remington SaberLogic, LLC 661-B Weber Drive Wadsworth, Ohio 44281 Phone: (330)335-6442 Fax: (330)336-8559 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: File Write Permission Errors - HELP! URGENT!!!
If you want to create a file, the directory must be writeable to the server proces, so if the directory is owned by you do chmod o+w chat Phil Powell wrote: I did just that. Permissions are set the /chat folder as it is in all other folders. This is the first time I've ever done fopen with "w" and I can't get it to write, always getting "unable to access" errors. I want to be able to create the file if it does not exist. It works for me to do "r" in all other folders with the same permissions as /chat. Phil "Craig" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... you must give the same permissions to the folder also. "Phil Powell" <[EMAIL PROTECTED]> wrote in message 0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6">news:0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6... Hi I have the following code that breaks: // PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT $fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open " . $path . "/nicknames.txt"); chmod($path . "/nicknames.txt", 0755); fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID); $fileID = fopen($path . "/messages.txt", "a") or die("Could not open " . $path . "/messages.txt"); fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***"); fflush($fileID); fclose($fileID); I am getting the following error: Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission denied in /users/ppowell/web/chat/chat.php on line 163 I am attempting to write onto the files if they exist, if not, create them on the fly. I need the solution in the next 5 minutes - sorry, kind of an emergency! If anyone can help, please tell me what to do, the PHP manuals are not giving me a clear solution as to how to write to a file that does not yet exist that has to have the permissions of 0755 for both files. Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions/Browser back button
Or if you use GET in your forms, instead of POST, you won't have this problem. ---John Holmes... - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Craig" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 8:15 AM Subject: Re: [PHP] Sessions/Browser back button > on 26/11/02 12:03 AM, Craig ([EMAIL PROTECTED]) wrote: > > > I remember seeing threads debating this before, but is there anyway to > > disable/prevent a user from heading back in the browser and getting the > > "WARNING: Page has Expired" notice? > > This is more like a diversion around the problem... It will either be > relevant to your problem, or not :) > > In particular, I use this to prevent people from refreshing their page (and > hence adding something to the DB twice for example). > > Lets say you have form.php, which submits to process.php... the aim is to > have process.php as a server-only script (ie, nothing is sent to the > browser), with a header() redirect to a thankyou.php page once I've added > stuff to the DB, or whatever > > The point is, they'll never see a page expired message in this case, because > the script receiving the POST information never gets to the browser. > > > This may or may not help, depending on your problem :) > > > Justin French > > http://Indent.com.au > Web Development & > Graphic Design > > > > -- > 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] Upgrade issues
Lo all, I upgraded from PHP 4.2.1 to 4.2.2, and now all of a sudden the following code is generating a WARNING??? if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { $modpath = "themes/$ThemeSel/"; } I don't get it? Warning: Unable to access themes/DeepBlue/modules/News/index.php in /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 Line 46 is the if statement :/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade issues
Hello, "Chris Knipe" <[EMAIL PROTECTED]> wrote: > Lo all, > > I upgraded from PHP 4.2.1 to 4.2.2, and now all of a sudden the following > code is generating a WARNING??? > > > if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { > $modpath = "themes/$ThemeSel/"; > } > > I don't get it? > > Warning: Unable to access themes/DeepBlue/modules/News/index.php in > /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 > > Line 46 is the if statement If you have using a new php.ini file, perhaps you can compare it with an old one and see if there's anything different--might give you a hint. Or, you might want to check the manual about error reporting and see what you can do about it: http://www.php.net/manual/en/function.error-reporting.php But then again, perhaps the problem is somewhere else... (i.e. file is not there, permissions, etc.) HTH, - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Send multiple SQL staments in one query
Hello, "Seth Remington" <[EMAIL PROTECTED]> wrote: [snip] > Here's a function that I use to run multiple SQL statements at once - [/snip] ...perhaps, a better way to put it is "run multiple SQL statements" _one after another_ :) It's a good approach though. ;) - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Send multiple SQL staments in one query
Hello, "1LT John W. Holmes" <[EMAIL PROTECTED]> wrote: [snip] > No, can't do it. Only one query per mysql_query() call. Not sure with other > database interfaces, but it should be the same. [/snip] Yes, you cannot do it in MySQL. But you can do it with others. (I think it was discussed before--about "sql injection" or something...) - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: image generation with PHP
Hello, Myrage wrote: > No luck > I have installed GD lib and zlib and all into c:\php\extensions bur i > still > get an error > > *Fatal error*: Call to undefined function: imagecreate() in > *c:\inetpub\wwwroot\image.php* on line *24* Run phpinfo() and check again (under GD). See if you can find some hints... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending POST vars to pop-up window - How?
Hello, "Monty" <[EMAIL PROTECTED]> wrote: > I'm writing a poll app. I want it to work this way: > > 1. On web page, user selects choice, clicks VOTE. > > 2. Clicking VOTE triggers a pop-up window. > > 3. PHP script running in pop-up records vote, displays results. > > Problem is, POSTed vars that come from forms aren't available in the popup > window if I make the FORM action = javascript:popWin('/poll.php'). > > Is setting the vote choice in a session var the only way to make this work, > or is there a way to pass vars via a form POST to the popup window? I think one way you can try is to use JavaScript's onClick() with submit.form. There was a discussion on a similar subject ("passing js values to php") not long time ago. Maybe you can check the archives... But, what if JavaScript is turned off? - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connection string and Monday Morning blues
Hello, There could be a lot of problems here but what *exactly* is the problem? No more coffee, perhaps? :) Post the error, if there's any. Or, take away the "@" sign and see what happens... - E "Paul Dionne" <[EMAIL PROTECTED]> wrote: > Ug, I hate Mondays. must drink more coffee. > > Anyway, got a problem I hope someone can help with or at least jumpstart my > brain. > > I wrote a few web pages, work fine on my machine. Uploaded them on Friday > and they don't seem to work. Looks like I am not connecting to the > database because every page I look at seems to end when it is suppose to > connect. > > //** > function ConnOpen($CheckForError) > { > > > > @ $db = mysql_pconnect("webserver", "username", "password"); > if (!$db) > { > $CheckForError= "Error: Could not connect to database. Ple > ase try again later."; > return $CheckForError; > exit; > } > mysql_select_db("database"); > > > > } > //** > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux Question
Just to add... Here's something that might interest you: http://www.alistapart.com/stories/alternate/ ... and here's another one: (Should be better than the one discussed above :) ) http://www.alistapart.com/stories/phpswitch/ - E "Marek Kilimajer" <[EMAIL PROTECTED]> wrote: > You might solve this by providing different style sheet to on linux > running browsers: > if(ereg('Linux',$_SERVER['HTTP_USER_AGENT'])) { > echo ''; > } else { > echo ''; > } > > > conbud wrote: > > >Hey. This really isnt a PHP question. but what fonts do you reccomend using > >so they look decent on linux. Mainly looking for a good font that will look > >nice in MoZilla and Galeon. Almost all the fonts Ive used so far appear > >really tiny or really bold and not very good to read. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php Search Engine
I am in need of a search engine. I'd rather do one in PhP. Is there one available that I can see or at least get the code for? I'm a newbie to php. :) Krystal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IIS and PHP with pass through authentication
Hi The problem I am having is as follows: I setup PHP with IIS and it seems to work fine. I am creating a Intranet site and would like to obtain the user logged on to the networks username. I have setup basic auth but when I visit the site it asks me for my username and password before I can get in. Integrated Windows Auth is turned off. When I turn it on and try to login it says login failed. I know that ASP can have a script added to the page to turn pass through auth but I need one for PHP. I am using $HTTP_SERVER_VARS["LOGON_USER"] to get the username and it works when I login. I just need to get rid of the login box. Thanks for your help in advance. Shaun Garriock *** The contents of this message are confidential and are intended for the addressee only. The views expressed in this message do not necessarily represent those of Robert Gordon's College. Electronic mail transmission is not guaranteed to be secure, therefore, Robert Gordon's College does not accept liability for the contents of this transmission. This message does not form a legal binding contract. ***
Re: [PHP] Browser going to page twice?
Hello, "Leif K-Brooks" <[EMAIL PROTECTED]> wrote: > I'm having a weird problem. I guess so. I don't understand what it is :) > When I submit a form on my site, it often > sends twice. Sends what twice? > I'm not sure if this is a client-side or server-side > problem, but it doesn't happen on other sites. Which sites? > Is this a common > problem, or am I making some dumb mistake? I'm not sure :) But perhaps you can post some code or something... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php Search Engine
Can you be a bit more specific as to what you need to search on? Is it a database, a set of web documents or do you want to create a search engine like Google, which crawls websites as needed? Let us know! Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! --- Begin Message --- I am in need of a search engine. I'd rather do one in PhP. Is there one available that I can see or at least get the code for? I'm a newbie to php. :) Krystal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php Search Engine
hotscripts.com <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am in need of a search engine. I'd rather do one in PhP. Is there one > available that I can see or at least get the code for? > > I'm a newbie to php. :) > > > Krystal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] enable-inline-optimization
Is it still possible to use enable-inline-optimization? Is it adviceable? I am using RedHat Linux 7.3 with all RPM's updated (i.e. GCC and so on), Php 4.2.3 and Apache 1.3.27 Regards Jacob http://www.sharksforum.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Send multiple SQL staments in one query
Hi, The problem is that i need to do only one mysql_query, i'm working whith a remote database and i have .5 seconds in response time, to one - four querys is less than two seconds Ok is fast but is i do 10 querys i need 5 seconds very slow. :-) Miguel López Sánchez Programador Voz +34 902 014 945 E-mail: [EMAIL PROTECTED] Dinaweb Networks s.l. Rúa das Orfas 27 15703 Santiago de Compostela A Coruña Gz Sp ECC Voz +34 902 014 945 GMT+1 E-mail: [EMAIL PROTECTED] http://www.dinaweb.com http://www.dinahosting.com http://www.u-lo.com http://www.empregogalego.com -Mensaje original- De: @ Edwin [mailto:[EMAIL PROTECTED]] Enviado el: lunes, 25 de noviembre de 2002 16:25 Para: Seth Remington; Miguel lópez dinaweb dpto. programación CC: [EMAIL PROTECTED] Asunto: Re: [PHP] Re: Send multiple SQL staments in one query Hello, "Seth Remington" <[EMAIL PROTECTED]> wrote: [snip] > Here's a function that I use to run multiple SQL statements at once - [/snip] ...perhaps, a better way to put it is "run multiple SQL statements" _one after another_ :) It's a good approach though. ;) - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux Question
On Mon, 2002-11-25 at 10:35, > > conbud wrote: > > > > >Hey. This really isnt a PHP question. but what fonts do you reccomend > using > > >so they look decent on linux. Mainly looking for a good font that will > look > > >nice in MoZilla and Galeon. Almost all the fonts Ive used so far appear > > >really tiny or really bold and not very good to read. If you use a range of fonts with a generic family you should be ok, for example: verdana, helvetica, arial, sans-serif Also, try to use relative sizes, if you use fixed sized like 10pt. you will have size discrepancies on different platforms. If you use a relative scheme like 12px it will render more consistently BTW: I bet you'd find the same issues if you looked at your pages on a MAC as well... -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sorting parsed XML
Hello, "Chris" <[EMAIL PROTECTED]> wrote: > I'm trying to write PHP code that will not only parse the XML but also > allow me to sort the parsed information by the values parsed. I'm not sure if I really understand but let me try... ...[snip code]... Adding echo ''; before this and > $xml_parser = xml_parser_create(); ...[snip code]... after this > xml_parser_free($xml_parser); echo ''; shows a good view that you have a table with two columns. If you'd like to sort these, then I think you might be able to do something like this: 1. Instead of printf()'ing your 's or 's inside the class/function, why don't you try "putting" it inside an array? (Maybe with array_push() or something.) Then, 2. If you already have an array, perhaps you can use one of the functions here for sorting: http://www.php.net/manual/en/ref.array.php HTH, - E ...[snip]... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php Search Engine
On Mon, 2002-11-25 at 08:31, [EMAIL PROTECTED] wrote: > I am in need of a search engine. I'd rather do one in PhP. Is there one > available that I can see or at least get the code for? This article might help. http://www.onlamp.com/pub/a/php/2002/10/24/simplesearchengine.html Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade issues
> > if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { > > $modpath = "themes/$ThemeSel/"; > > } > > > > I don't get it? > > > > Warning: Unable to access themes/DeepBlue/modules/News/index.php in > > /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 > > > > Line 46 is the if statement > > If you have using a new php.ini file, perhaps you can compare it with an old > one and see if there's anything different--might give you a hint. Yeah, and no. It's FreeBSD-Ports, my php.ini is unchanged. FreeBSD installs the new / updated ini files as ini-dist, so hence, nothing on my settings has changed. I did also check to verify this, and it is indeed the correct ini file, with the correct settings... > But then again, perhaps the problem is somewhere else... (i.e. file is not > there, permissions, etc.) Yes the file does not exist. But isn't that why file_exists() is there? -- me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie: ereg
I still havent found a site that shows what I need. I dont think php.net explain how ereg works. I only want to publish stuff from the stringvariable $text thats inside tags looking like this This shall be visible or This shall be visible too thanks Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP.net spam protection
Hello all, I have searched the archives and cannot find an answer to this question. I would like to implement the same type of white list spam protection (where you must send a confirmation to be accepted) that php.net is using at my company. Does anyone know what type of software packages are used to protect the @php.net addresses? Thanks in advance, Gene
Re: [PHP] Upgrade issues
"Chris Knipe" <[EMAIL PROTECTED]> wrote: > > > if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { > > > $modpath = "themes/$ThemeSel/"; > > > } > > > > > > I don't get it? > > > > > > Warning: Unable to access themes/DeepBlue/modules/News/index.php in > > > /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 > > > > > > Line 46 is the if statement > > > > If you have using a new php.ini file, perhaps you can compare it with an > old > > one and see if there's anything different--might give you a hint. > > Yeah, and no. It's FreeBSD-Ports, my php.ini is unchanged. FreeBSD > installs the new / updated ini files as ini-dist, so hence, nothing on my > settings has changed. I did also check to verify this, and it is indeed the > correct ini file, with the correct settings... > > > But then again, perhaps the problem is somewhere else... (i.e. file is not > > there, permissions, etc.) > > Yes the file does not exist. But isn't that why file_exists() is there? Right, I might be typing faster than I am thinking... :) Still, just make sure that PHP is using the php.ini file that you think it's using. The file that _you_ check didn't change but _php_ might be looking somewhere else... Of course, I could be wrong--haven't used FreeBSD/Ports--only linux. Perhaps, somebody else knows the answer... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Automajickally POST to a remote form
Heyas, Once upon a time I used to be able to POST form data to external sites with ASP and an MSXML (or something) server object on IIS and I'm wondering if there's a similar sort of technique using PHP. Would prefer it if I didn't have to use anything that isn't part of your typical PHP/Apache install (if there is such a thing) but will take what I can get. The easiest description of what I'm attempting is: user hits PHP page, page submits predefined search terms to Google and the results are displayed. The user wouldn't have interacted with the search at all (ie: no button clicks) as it's all performed by the PHP script. Thoughts? Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to obtain unique XML Elements
Hello, "David Pratt" <[EMAIL PROTECTED]> wrote: > Anyone have a simple technique for obtaining a unique list of elements from > an XML file? > > Am looking for something that will identify the first opening tag ie > and the single tag so that I get an array of tags > that I can print out. Having a bit of trouble with regex to get something > to work. > > Basic idea I had is to open file, read through each line with regex, add > matches to array, and then do unique elements of array and write to another > file. > > Is there a better way? Yes. Have you checked the manual? :) http://www.php.net/manual/en/ref.xml.php - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
Just set register_globals on in the wiki directory. Like this in your httpd.conf: php_admin_flag register_globals on -Rasmus On Mon, 25 Nov 2002, DL Neil wrote: > Excuse me breaking in...somewhat similar problem: > > Have set up a client recently, preaching security persuaded them into > updating so that could run Register_Globals=Off. Now they want to install a > 'wiki' which requires (to my horror) Register_Globals=On. > > Short of two Apache/PHP servers, what is a logical way to structure things > so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more > securely? > > Please advise, > =dn > > > > You cannot do it inside a script as the register_globals magic happens > > before the script starts executing, so toggling the setting at runtime is > > too late. > > > > -Rasmus > > > > On Mon, 25 Nov 2002, Tariq Murtaza wrote: > > > > > Dear All, > > > > > > I am wondering if anyone shed some light. > > > i am thinking of setting value for php.ini variables like > > > register_globals = ON/OFF at runtime (within our php script). > > > Is there any function built-in in php?, or can we do it ourselves. > > > > > > Looking forward, > > > Thanks > > > > > > Tariq > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Automajickally POST to a remote form
> Once upon a time I used to be able to POST form data to external sites > with > ASP and an MSXML (or something) server object on IIS and I'm wondering if > there's a similar sort of technique using PHP. Would prefer it if I > didn't > have to use anything that isn't part of your typical PHP/Apache install > (if > there is such a thing) but will take what I can get. > > The easiest description of what I'm attempting is: user hits PHP page, > page submits predefined search terms to Google and the results are > displayed. The user wouldn't have interacted with the search at all (ie: > no button clicks) as it's all performed by the PHP script. Yeah, I'm pretty sure that's against Google's policy. No help here... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
Thanks a lot, but do you know how to do the same with ereg_replace? I'm trying to learn PCRE, but until I do, I won't be able to add anything to this... \\2',$text); return $text; } print bbcode('[i]This[/i] is a [i]test[/i].'); ?> Works... -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
Thanks, but that doesn't allow nested tags (a [b] tag inside of an [i] tag, for example). Kyle Gibson wrote: Thanks a lot, but do you know how to do the same with ereg_replace? I'm trying to learn PCRE, but until I do, I won't be able to add anything to this... \\2',$text); return $text; } print bbcode('[i]This[/i] is a [i]test[/i].'); ?> Works... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sorting parsed XML
Sorry, use to using to a listserv that auto-plants the listserv address, not the responder's address on replies :P > From: @ Edwin [mailto:[EMAIL PROTECTED]] > If you'd like to sort these, then I think you might be able > to do something like this: 1. Instead of printf()'ing your > 's or 's inside the class/function, why don't you try > "putting" it inside an array? (Maybe with array_push() or > something.) Then, > 2. If you already have an array, perhaps you can use one of > the functions here for sorting: Aye, this is essentially what I need help with, is making the array. What I'm looking for is a way to put the data into an array and then sort it based on the user's want and then print it out in a table format. I've already got the xml info working as intended: http://www.rpgtimes.com/daoc/ But what I've tried with getting the data placed into an array so far hasn't worked. Not many parsed XML examples out there or anything the 10 odd books I have help me with this. Books, I've found, in general, can't help me with most of my array needs due to their very basic examples and descriptions. I am about to try doing an array as such: Instead of: function serverData($parser, $data) { if ($this->insideitem) { switch ($this->tag) { case "POPULATION": $this->ServerPopulation .= $data; break; case "STATUS": $this->ServerStatus .= $data; break; } } } Something to this affect: function serverData($parser, $data) { if ($this->insideitem) { switch ($this->tag) { case "POPULATION": $ServerArray[$this->ServerName][$this->ServerPopulation] = $data; break; case "STATUS": $ServerArray[$this->ServerName][$this->ServerStatus]= $data; break; } } } Course, I'm unsure how this will work (but I'll try it out) since $this->ServerName may not carry to the $this->insideitem check. I would then plan to use function endElement to determine the user's want and then print the HTML out based on that, such as wanting the current data sorted by population (default) or by server name, type, or status. Sorry, I'm new to dynamic web page creation and especially to XML, but I've got a love for programming and a head that just wants to learn more of it, so I create tons of web sites based around my hobbies so that I can practice and learn more. I'm glad I found this listserv and hope you guys don't mind my questions. Thanks for any help you can provide. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie: ereg
I still havent found a site that shows what I need. I dont think php.net explain how ereg works. I only want to publish stuff from the stringvariable $text thats inside tags looking like this This shall be visible or This shall be visible too thanks Martin Try the following: ]+>)([^<]+)(]+>)",'\\2',$text); return $text; } print format_text('This shall be visible.'); ?> -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP.net spam protection
On Tuesday 26 November 2002 00:02, Gene Bandy wrote: > Hello all, > > > > I have searched the archives and cannot find an answer to this question. Which archives did you search? Not the PHP ones I hope? > I would like to implement the same type of white list spam protection > (where you must send a confirmation to be accepted) that php.net is > using at my company. Does anyone know what type of software packages are > used to protect the @php.net addresses? Look at the headers of any of the posts to this mailing list, you'll see that this list is managed by something called ezmlm. It is something that runs in conjunction with qmail. Google for more details. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I have never been one to sacrifice my appetite on the altar of appearance. -- A.M. Readyhough */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade issues
> > > > if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { > > > > $modpath = "themes/$ThemeSel/"; > > > > } > > > > > > > > I don't get it? > > > > > > > > Warning: Unable to access themes/DeepBlue/modules/News/index.php in > > > > /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 > > > > > > > > Line 46 is the if statement > > > > > > If you have using a new php.ini file, perhaps you can compare it with an > > old > > > one and see if there's anything different--might give you a hint. > > > > Yeah, and no. It's FreeBSD-Ports, my php.ini is unchanged. FreeBSD > > installs the new / updated ini files as ini-dist, so hence, nothing on my > > settings has changed. I did also check to verify this, and it is indeed > the > > correct ini file, with the correct settings... > > > > > But then again, perhaps the problem is somewhere else... (i.e. file is > not > > > there, permissions, etc.) > > > > Yes the file does not exist. But isn't that why file_exists() is there? > > Right, I might be typing faster than I am thinking... :) > > Still, just make sure that PHP is using the php.ini file that you think it's > using. The file that _you_ check didn't change but _php_ might be looking > somewhere else... Of course, I could be wrong--haven't used > FreeBSD/Ports--only linux. As ridiculous as this sounds... Turning of safe mode made the warning go away. Now, I guess the question is, 1) is this a bug in the file_exists() function, or 2) does the default warning levels increase when operating under safe mode? Either way, this never happened to me before, and is only now happening since upgrading from 4.2.1 to 4.2.2... Rather peculiar I think... -- me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imagecopyresized
hi i'm having problems resizing jpegs. here's an e.g. using manual example. code used : and the result can be seen here. http://www.sitestogo.biz/temp/test.php i'm wondering if it's to do with the gd library installed.
Re: [PHP] php-4.3.0pre2, fgets and socket_get_status
Does anyone know of any significant changes to the fgets() function in php-4.3.0pre2 which might affect reading from a socket a single byte at a time in the way I describe below? I've had to change to using fread() instead, which is fine, but I'd like to know why I've had to do this, and whether this behaviour is a bug or intentional change in php-4.3.0pre2. Thanks, Stephen Stephen Grier wrote: > > An application I am developing contains something like the following: > > $this->socket = fsockopen($server, $port, $errnum, $errstr, "60"); > ... > while (!feof($this->socket)) { > > $char = fgets($this->socket,1); > > if (($char == "\n") || ($char == "\r")) > return $buffer; > } > $buffer .= $char; > } > return $buffer; > > This works fine upto php-4.2.x. However, I've recently built and > installed php-4.3.0pre2 and now the above code appears to hang. > > Substituting fread in place of fgets solves the problem. I know that > fgets is supposed to be 'binary safe' as of php-4.3 but I'm not sure if > this could be causing the above problem. > > Does anyone know of any changes to fgets in php-4.3.0 which might be > causing this? Are there any reasons why I should not use fread instead > of fgets here? > > Also, I am looking at using something like: > > $status = socket_get_status($this->socket); > if ($status["unread_bytes"] <= 0) > return false; > > However, $status["unread_bytes"] always returns 0 until the first call > to fgets($this->socket). Is this right? I'd like to check the status of > the socket before I try to read from it. > > Thanks, > > Stephen Grier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade issues
Check the owners of directories and files, they must be the same as for /usr/local/www/v-webs/games.savage.za.org/html/index.php, then it should work under safe mode too. Chris Knipe wrote: if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { $modpath = "themes/$ThemeSel/"; } I don't get it? Warning: Unable to access themes/DeepBlue/modules/News/index.php in /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 Line 46 is the if statement If you have using a new php.ini file, perhaps you can compare it with an old one and see if there's anything different--might give you a hint. Yeah, and no. It's FreeBSD-Ports, my php.ini is unchanged. FreeBSD installs the new / updated ini files as ini-dist, so hence, nothing on my settings has changed. I did also check to verify this, and it is indeed the correct ini file, with the correct settings... But then again, perhaps the problem is somewhere else... (i.e. file is not there, permissions, etc.) Yes the file does not exist. But isn't that why file_exists() is there? Right, I might be typing faster than I am thinking... :) Still, just make sure that PHP is using the php.ini file that you think it's using. The file that _you_ check didn't change but _php_ might be looking somewhere else... Of course, I could be wrong--haven't used FreeBSD/Ports--only linux. As ridiculous as this sounds... Turning of safe mode made the warning go away. Now, I guess the question is, 1) is this a bug in the file_exists() function, or 2) does the default warning levels increase when operating under safe mode? Either way, this never happened to me before, and is only now happening since upgrading from 4.2.1 to 4.2.2... Rather peculiar I think... -- me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommendations for PHP/MySQl calendar & on-line submission/votin g
Dave, et al -- ...and then Merritt, Dave said... % % I working with helping our local high school technical center set up a web % server/site. Went with the typical AMP solution (unfortunately on MSWin Hey, three out of four ain't bad :-) % though). The center is wanting to add an on-line calendar system. This If you'll consider perl, Maorong Zou's webcalendar (see http://www.ma.utexas.edu/~mzou/webCal/ and http://www.math.utexas.edu/pipermail/webcalendar/ for info) is quite mature. HTH & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg87273/pgp0.pgp Description: PGP signature
Re: [PHP] Re: BBCode?
On Tuesday 26 November 2002 01:42, Leif K-Brooks wrote: > Thanks, but that doesn't allow nested tags (a [b] tag inside of an [i] > tag, for example). If you want to deal with nested tags then it's probably best to replace each opening and closing tag individually. Otherwise you might end up with some fiendishly complicated regex. Did I say I preferred the PCRE functions to the EREG ones? Well using preg_replace() you can put all your search strings in one array and all the corresponding replacement strings in another and it'll replace all those tags for you in a single operation: $text = '[i]This[/i] is a [i]test[/i].'; $search_for_tags = array("/\[i\]/", "/\[\/i\]/"); $replace_with_tags = array("", ""); $text = preg_replace($search_for_tags, $replace_with_tags, $text); print $text; -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Ignorance must certainly be bliss or there wouldn't be so many people so resolutely pursuing it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade issues
All files are owened by my Apache user + Group, set to rw access on files and rwx on directories... I do a chown + chmod on my web server's tree every few minutes via cron for my development system. Just to proove my point... root@netsonic:~# ls -l /usr/local/www/v-webs/games.savage.za.org/html/index.php -rw-r- 1 www www 2512 Nov 24 22:16 /usr/local/www/v-webs/games.savage.za.org/html/index.php root@netsonic:~# cat /usr/local/etc/apache/httpd.conf|grep User User www - Original Message - From: "Marek Kilimajer" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 8:19 PM Subject: Re: [PHP] Upgrade issues > Check the owners of directories and files, they must be the same as for > /usr/local/www/v-webs/games.savage.za.org/html/index.php, then it should > work under > safe mode too. > > > Chris Knipe wrote: > > >if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) > > > > > >{ > > > > > >$modpath = "themes/$ThemeSel/"; > >} > > > >I don't get it? > > > >Warning: Unable to access themes/DeepBlue/modules/News/index.php in > >/usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 > > > >Line 46 is the if statement > > > > > If you have using a new php.ini file, perhaps you can compare it with > > > >an > > > > > >>>old > >>> > >>> > one and see if there's anything different--might give you a hint. > > > >>>Yeah, and no. It's FreeBSD-Ports, my php.ini is unchanged. FreeBSD > >>>installs the new / updated ini files as ini-dist, so hence, nothing on > >>> > >>> > >my > > > > > >>>settings has changed. I did also check to verify this, and it is indeed > >>> > >>> > >>the > >> > >> > >>>correct ini file, with the correct settings... > >>> > >>> > >>> > But then again, perhaps the problem is somewhere else... (i.e. file is > > > >>not > >> > >> > there, permissions, etc.) > > > >>>Yes the file does not exist. But isn't that why file_exists() is there? > >>> > >>> > >>Right, I might be typing faster than I am thinking... :) > >> > >>Still, just make sure that PHP is using the php.ini file that you think > >> > >> > >it's > > > > > >>using. The file that _you_ check didn't change but _php_ might be looking > >>somewhere else... Of course, I could be wrong--haven't used > >>FreeBSD/Ports--only linux. > >> > >> > > > >As ridiculous as this sounds... > > > >Turning of safe mode made the warning go away. Now, I guess the question > >is, 1) is this a bug in the file_exists() function, or 2) does the default > >warning levels increase when operating under safe mode? > > > >Either way, this never happened to me before, and is only now happening > >since upgrading from 4.2.1 to 4.2.2... > > > >Rather peculiar I think... > > > >-- > >me > > > > > > > > > > > -- > 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] sockets (again)
Hi, I really need some help here because I am going to lose my mind otherwise!! A script that was running fine Friday has decided not to work for no apparent reason today. The problem seems to be with a socket_create that just stops the script, so I created a simple test script as shown below to see what happens. When I run this is simply drops out at the socket_create, no error message, nothing. Again this worked fine Friday and nothing has changed on my machine. I am running 4.2.3 on Win2K... any ideas? Help!! G. $zone = "192.168.0.60"; $port = "1"; $command = "play"; echo('here'); $slip_socket = socket_create (AF_INET, SOCK_STREAM, 0); echo('here 2'); if ($slip_socket < 0) { echo "socket_create() failed: reason: " . socket_strerror ($slip_socket) . "\n"; } else { $result = socket_connect ($slip_socket, $zone, $port); if ($result < 0) { echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n"; } } $command=$command."\n"; echo('Sending command: '.$command.' for '.$zone.'\n'); socket_write ($slip_socket, $command, strlen ($command)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresized
On Tuesday 26 November 2002 02:10, [EMAIL PROTECTED] wrote: > hi > i'm having problems resizing jpegs. > here's an e.g. using manual example. > code used : > $new_w=395; > $new_h=297; > header("Content-type: image/jpeg"); > $dst_img=ImageCreate($new_w,$new_h); > $src_img=ImageCreateFromJpeg($name); > ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img), >ImageSY($src_img)); ImageJpeg($dst_img); > ?> > > and the result can be seen here. > http://www.sitestogo.biz/temp/test.php You may get a better response if you actually copy and paste the error message or whatever. If that's not possible at least give a brief description as to what the problem is. Having to make people go through extra steps to help you is not a very good idea. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Too much is just enough. -- Mark Twain, on whiskey */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sorting parsed XML
This seems to me to be more easily handled by XSLT. (Not the only option but a good one). XSLT lets you select only the nodes you want and also sort them as well. @ Edwin wrote: Hello, "Chris" <[EMAIL PROTECTED]> wrote: I'm trying to write PHP code that will not only parse the XML but also allow me to sort the parsed information by the values parsed. I'm not sure if I really understand but let me try... ...[snip code]... Adding echo ''; before this and $xml_parser = xml_parser_create(); ...[snip code]... after this xml_parser_free($xml_parser); echo ''; shows a good view that you have a table with two columns. If you'd like to sort these, then I think you might be able to do something like this: 1. Instead of printf()'ing your 's or 's inside the class/function, why don't you try "putting" it inside an array? (Maybe with array_push() or something.) Then, 2. If you already have an array, perhaps you can use one of the functions here for sorting: http://www.php.net/manual/en/ref.array.php HTH, - E ...[snip]... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sockets (again)
Hi, You have to choose a protocol for AF_INET sockets. Try getprotobyname() with tcp and udp to get one. bye On Mon, 25 Nov 2002 10:24:46 -0800 [EMAIL PROTECTED] (Gareth Thomas) wrote: > Hi, > > I really need some help here because I am going to lose my mind otherwise!! > A script that was running fine Friday has decided not to work for no > apparent reason today. The problem seems to be with a socket_create that > just stops the script, so I created a simple test script as shown below to > see what happens. When I run this is simply drops out at the socket_create, > no error message, nothing. Again this worked fine Friday and nothing has > changed on my machine. I am running 4.2.3 on Win2K... any ideas? Help!! > > > G. > > $zone = "192.168.0.60"; > $port = "1"; > $command = "play"; > > echo('here'); > > $slip_socket = socket_create (AF_INET, SOCK_STREAM, 0); > > echo('here 2'); > > if ($slip_socket < 0) { >echo "socket_create() failed: reason: " . socket_strerror ($slip_socket) > . "\n"; > } else { >$result = socket_connect ($slip_socket, $zone, $port); >if ($result < 0) { > echo "socket_connect() failed.\nReason: ($result) " . > socket_strerror($result) . "\n"; >} > } > > $command=$command."\n"; > echo('Sending command: '.$command.' for '.$zone.'\n'); > socket_write ($slip_socket, $command, strlen ($command)); > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresized
On Mon, 25 Nov 2002, adrian [EMAIL PROTECTED] wrote: > hi > i'm having problems resizing jpegs. > here's an e.g. using manual example. > code used : > $new_w=395; > $new_h=297; > header("Content-type: image/jpeg"); > $dst_img=ImageCreate($new_w,$new_h); > $src_img=ImageCreateFromJpeg($name); > >ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); > ImageJpeg($dst_img); > ?> > > and the result can be seen here. > http://www.sitestogo.biz/temp/test.php > i'm wondering if it's to do with the gd library installed. Try it with ImageCreateTruecolor(), since ImageCreate() produces 8-bit indexed-color images... If that function doesn't exist, you're using a pre-2.x GD, and those can't do 24-bit images at all... Good luck! -- Morgan Hughes C programmer and highly caffeinated mammal. [EMAIL PROTECTED] ICQ: 79293356 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap
Can I user php to create IMAP mailboxes? I'm using Cyrus and php and apache are running on the same computer as Cyrus. Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
This will replace all versions (open and close) of bold, italicize and underline tags with brackets using preg_replace. $text = preg_replace("/\[(\/)?([biu])\]/","<\\1\\2>",$text) ; - find [ = "\[" - match IF slash exists = "(\/)?" - match one of the following = "([biu])" - find ] = "\]" - matches get put into 'memory' (\\1 \\2) even if not found (ie. slash didn't exist). - replace with "< 'first match' 'second match' >" - NOTE : in PCRE regexs, brackets and forward-slashes are special characters and must be escaped (preceded with a back-slash) when looking for them as regular characters. Even if you do not know PCRE yet, don't hamstring yourself looking for a solution that is too complicated and time-consuming. EREG does not work very well on this type of problem. Buck up, learn PCRE and use this type of solution (if you find something that works for you, use it...by no means does the code above cover every tag you 'may' want to use). Builder.com has a pretty good regular expression checker for PERL-style regexs that make PCRE pretty easy. http://builder.com -> Go To: Web Scripting (left menu) -> Cool Tools (right menu) -> Regular Expression Inspector (2/3 way down page) .mike === Michael Geier CDM Sports, Inc. Systems Administration email: [EMAIL PROTECTED] phone: 314.991.1511 x 6505 --- This email sent using CDM Sports Webmail v3.1 [ http://webmail.cdmsports.com ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresized
sorry.i included the link so you can see the result it's difficult to explain what it looks like without including attachments - which is a worse idea i think! there are no errors it just looks bad. i didn't know that imagecreate() produces 8-bit images. this implies that with older versions of gd (< 2.x) you can't manipulate jpegs? gd is my only option. adrian - Original Message - From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 6:26 PM Subject: Re: [PHP] imagecopyresized > On Tuesday 26 November 2002 02:10, [EMAIL PROTECTED] wrote: > > hi > > i'm having problems resizing jpegs. > > here's an e.g. using manual example. > > code used : > > > $new_w=395; > > $new_h=297; > > header("Content-type: image/jpeg"); > > $dst_img=ImageCreate($new_w,$new_h); > > $src_img=ImageCreateFromJpeg($name); > > ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img), > >ImageSY($src_img)); ImageJpeg($dst_img); > > ?> > > > > and the result can be seen here. > > http://www.sitestogo.biz/temp/test.php > > You may get a better response if you actually copy and paste the error message > or whatever. If that's not possible at least give a brief description as to > what the problem is. Having to make people go through extra steps to help you > is not a very good idea. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Too much is just enough. > -- Mark Twain, on whiskey > */ > > > -- > 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] Continuing Session Within Socket
Hi. I'm working on a project where I need to send a user an e-mail whose content is identical to an already existing PHP-generated web page. (This web page relies on session data to do its work.) The mail function in PHP requires that I save the HTML of this page into a variable and send it along as the third parameter. The simplest way to retrieve the HTML is through a socket connection, correct? The problem I'm suffering from, however, is that when I try to GET a page and send along with it ?session_name()=session_id(), the browser hangs for an indeterminate amount of time. Here's the code I've been working with. $fp = fsockopen ("www.example.com", 80, $errno, $errstr); fputs ($fp, "GET /itemizeFoods.php?" . session_name() . "=" . session_id() . " HTTP/1.0\n\n"); while (! feof ($fp)) { $message .= fgets ($fp, 128); } mail ($target_email, "Food Reports", $message, "From: " . $row["userFullName"] . " <" . $source_email . ">\n" . "Reply-To: " . $source_email . "\n" . "X-Mailer: PHP/" . phpversion() . "\n" . "Content-type: text/html; charset=iso-8859-1\n" ); I've also tried just passing the query string as ?id=session_id() and including at the top of the the PHP-generated page the following. session_id($id); session_start(); That also causes the browser to hang. If I open a new browser and manually type itemizeFoods.php?PHPSESSID=396 (or whatever the ID happens to be of my current session) or link to itemizeFoods.php?396 the session continues just fine. The page loads properly and session variable values are consistent. It's only when I try to retrieve a page through a socket that the problems arises. Others have referred me to the curl library, but the installation of PHP I have to work with was not compiled with curl. If you have any ideas as to how I might fix of circumvent my problem, please let me know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Continuing Session Within Socket
Hi. I'm working on a project where I need to send a user an e-mail whose content is identical to an already existing PHP-generated web page. (This web page relies on session data to do its work.) The mail function in PHP requires that I save the HTML of this page into a variable and send it along as the third parameter. The simplest way to retrieve the HTML is through a socket connection, correct? The problem I'm suffering from, however, is that when I try to GET a page and send along with it ?session_name()=session_id(), the browser hangs for an indeterminate amount of time. Here's the code I've been working with. $fp = fsockopen ("www.example.com", 80, $errno, $errstr); fputs ($fp, "GET /itemizeFoods.php?" . session_name() . "=" . session_id() . " HTTP/1.0\n\n"); while (! feof ($fp)) { $message .= fgets ($fp, 128); } mail ($target_email, 'Food Reports', $message, "From: $source_email\n" . "Reply-To: $source_email\n" . 'X-Mailer: PHP/' . phpversion() . "\n" . "Content-type: text/html; charset=iso-8859-1\n" ); I've also tried just passing the query string as ?id=session_id() (not PHPSESSID=session_id() and including at the top of the the PHP-generated page the following. session_id($id); session_start(); That also causes the browser to hang. If I open a new browser and manually type itemizeFoods.php?PHPSESSID=396 (or whatever the ID happens to be of my current session) or link to itemizeFoods.php?396 the session continues just fine. The page loads properly and session variable values are consistent. It's only when I try to retrieve a page through a socket that the problems arises. Others have referred me to the curl library, but the installation of PHP I have to work with was not compiled with curl. If you have any ideas as to how I might fix of circumvent my problem, please let me know. -- Chris Johnson Dyton Media, Inc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Automajickally POST to a remote form
--- Kris Williams <[EMAIL PROTECTED]> wrote: > Once upon a time I used to be able to POST form data to external > sites with ASP and an MSXML (or something) server object on IIS > and I'm wondering if there's a similar sort of technique using > PHP. You can post with PHP using cURL or doing it yourself manually. Search the archives for this, as the previous answers to this are more complete than what I have time to explain now. Here is a quick example of the manual approach: http://shiflett.org/tutorials/php_post.txt > The easiest description of what I'm attempting is: user hits PHP > page, page submits predefined search terms to Google and the > results are displayed. Since Google's search uses GET, your question about POST doesn't matter anyway. The following URL will display the search results of a Google search on PHP: http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=PHP&btnG=Google+Search If you are wanting to display the search results on your own page, you should use Google's API. I believe parsing their HTML results violates the terms of use, so you might want to read that if you do not want to use the API. The API can be found here: http://www.google.com/apis/ A low-level demonstration of how the API works is given here (I plan to improve this when I have time): http://shiflett.org/tutorials/google.php Hope that helps. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap
On Tuesday 26 November 2002 03:14, Greg wrote: > Can I user php to create IMAP mailboxes? I'm using Cyrus and php and > apache are running on the same computer as Cyrus. Thanks! The short answer is, yes. The long answer is, if you have to ask then no. Try searching the archives for something along the lines of "create mail account using php". -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I'm going to live forever, or die trying! -- Spider Robinson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: imap
On Mon, 25 Nov 2002 14:14:54 -0500 [EMAIL PROTECTED] (Greg) wrote: > Can I user php to create IMAP mailboxes? I'm using Cyrus and php and apache > are running on the same computer as Cyrus. Thanks! > -Greg > > Maybe something like that would fit your needs: http://www.delouw.ch/linux/web-cyradm/ Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array manipulations
Can anyone suggest an ELEGANT way to find out if an array is made of empty strings or not? example $a = Array( '' , '' , '' ); //ok $b = Array( '' , '' , 'error' ); // not ok $c = Array( 'error' , '' , 'error' ); // not ok tia Mattia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form trouble
Hi, After I submited a query, if I use back then forward again the form will resubmit itself. Which I do not want. Does anyone have a solution for this problem? Thanks, David __ Do you Yahoo!? Yahoo! Mail Plus Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form trouble
When the form is submitted check the database with the info that is being submitted. If a record matches the data being submitted then don't do the insert. If there is not a record there, then insert the record.. HTH Clint -Original Message- From: David H [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 2:21 PM To: [EMAIL PROTECTED] Subject: [PHP] Form trouble Hi, After I submited a query, if I use back then forward again the form will resubmit itself. Which I do not want. Does anyone have a solution for this problem? Thanks, David __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- 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: Newbie: ereg
I don't know if I got it right bu try echo htmlentities('This shall be visible'); htmlentities() will translate your string in 'This shall be visible' > This shall be visible > or > This shall be visible too -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php_value disable_functions sintax?
Hi, I'm trying to use disable_functions inside an Apache's VirtualHost, like this: php_value disable_functions basename,chgrp,chmod,phpinfo I tried both with and without " but the functions are not disabled. I'm using php_flag safe_mode on in the same virtual host. Any help on what I'm doing wrongly is appreciated. Thanks. Rodolfo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecopyresized
On Mon, 25 Nov 2002, adrian [EMAIL PROTECTED] wrote: > sorry.i included the link so you can see the result > it's difficult to explain what it looks like without including > attachments - which is a worse idea i think! > there are no errors it just looks bad. > i didn't know that imagecreate() produces 8-bit images. > this implies that with older versions of gd (< 2.x) you can't > manipulate jpegs? gd is my only option. > adrian You can read and produce JPEGs with GD < 2.x, but any JPEG you read is stripped to 8-bit, with as many colors as the reader can allocate. Any JPEG you produce will be 8-bit as well. GD stayed at 2.0.1 for quite a while (a year or more), which was a beta and had some serious bugs, but now it's being maintained again, and is up to 2.0.8... Unfortunately the PHP extension is broken and requires specific patches, so GD 2 support probably won't be widespread with ISPs until it's sorted out and stable... So you'll have to wait, or look into something like ImageMagick. -- Morgan Hughes C programmer and highly caffeinated mammal. [EMAIL PROTECTED] ICQ: 79293356 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form trouble
> When the form is submitted check the database with the info that is > being submitted. If a record matches the data being submitted then don't > do the insert. If there is not a record there, then insert the record.. Either that or, if you are using mySQL, instead of using "INSERT INTO..." use "REPLACE INTO...". Though, there are a few cases where this might not work. Read the docs on "REPLACE". Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form trouble
But what about updates to the database...? Is there away not to have the information send to the server at all? Thanks, David --- Clint Tredway <[EMAIL PROTECTED]> wrote: > When the form is submitted check the database with > the info that is > being submitted. If a record matches the data being > submitted then don't > do the insert. If there is not a record there, then > insert the record.. > > HTH > Clint > > -Original Message- > From: David H [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 25, 2002 2:21 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Form trouble > > > Hi, > > After I submited a query, if I use back then forward > again the form will resubmit itself. Which I do not > want. Does anyone have a solution for this problem? > > Thanks, > David > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up > now. > http://mailplus.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > __ Do you Yahoo!? Yahoo! Mail Plus Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Sorting parsed XML
Unavailable as I am reading an XML file produced by another web site and it dynamically updates the information on the sheet every 5 minutes or so. At least to my knowledge of what XSLT can do. > From: Geoff Hankerson [mailto:[EMAIL PROTECTED]] > > This seems to me to be more easily handled by XSLT. (Not the > only option > but a good one). > XSLT lets you select only the nodes you want and also sort > them as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php_value disable_functions sintax?
You can't disable functions in your httpd.conf. That particular directive is probably the only one that is server-wide and can only be set in your php.ini file. The reason is that it is too expensive to disable and re-enabled functions on a per-request basis which is what we would need to do if we allowed you to set it per-dir or per-vhost. -Rasmus On Mon, 25 Nov 2002, Rodolfo Gonzalez wrote: > Hi, > > I'm trying to use disable_functions inside an Apache's VirtualHost, like > this: > > php_value disable_functions basename,chgrp,chmod,phpinfo > > I tried both with and without " but the functions are not disabled. I'm > using php_flag safe_mode on in the same virtual host. Any help on what I'm > doing wrongly is appreciated. > > > Thanks. > Rodolfo. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
Thanks, but that doesn't allow nested tags (a [b] tag inside of an [i] tag, for example). Nested tags? Do you mean [ib] ? Or [i[b]]? If you mean [ib], then I'm afraid what you want cannot be done in ereg_replace. As far as I am aware, that is. -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form trouble
Not really. The back button uses the browers history to go back.. And there is no way to disable the back button. -Original Message- From: David H [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 2:33 PM To: Clint Tredway; [EMAIL PROTECTED] Subject: RE: [PHP] Form trouble But what about updates to the database...? Is there away not to have the information send to the server at all? Thanks, David --- Clint Tredway <[EMAIL PROTECTED]> wrote: > When the form is submitted check the database with > the info that is > being submitted. If a record matches the data being > submitted then don't > do the insert. If there is not a record there, then > insert the record.. > > HTH > Clint > > -Original Message- > From: David H [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 25, 2002 2:21 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Form trouble > > > Hi, > > After I submited a query, if I use back then forward > again the form will resubmit itself. Which I do not > want. Does anyone have a solution for this problem? > > Thanks, > David > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up > now. > http://mailplus.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- 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] Form trouble
There is one common method used to avoid this that is pretty reliable. 1. http://example.org/1.php submits to http://example.org/2.php 2. http://example.org/2.php processes the form, then uses a Location header to redirect to http://example.org/3.php. For example: header("Location: http://example.org/3.php";); >From the user's perspective, there are only two URLs involved, http://example.org/1.php and http://example.org/3.php. Clicking back from 3.php brings the user to 1.php and clicking forward simply brings the user to 3.php. It is impossible without clicking the submit button again to execute 2.php again. Thus, 2.php does not display anything but just processes the form and redirects the user to the appropriate URL. That's one technique, anyway. Chris --- David H <[EMAIL PROTECTED]> wrote: > But what about updates to the database...? Is there > away not to have the information send to the server at > all? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php_value disable_functions sintax?
On Mon, 25 Nov 2002, Rasmus Lerdorf wrote: > You can't disable functions in your httpd.conf. That particular directive > is probably the only one that is server-wide and can only be set in your > php.ini file. The reason is that it is too expensive to disable and > re-enabled functions on a per-request basis which is what we would need to > do if we allowed you to set it per-dir or per-vhost. Hmm, that's a pitty, now I have two choices: disable user access and modification of files on the server or modify the sources commenting out the functions I want to disable (because having 3 Apache and PHP instances is not well worth for just 2 poll scripts in two virtual hosts). I guess I'll disable access to users. Thanks anyway. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php