Re: [PHP] windows file permission
Chris Williams wrote: I am using PHP on Windows NT CGI/FastCGI and am trying to create a text file and then write some data to it. $some_text = HelloWorld; $new_file = fopen(myfile.txt, w); fputs($new_file, $some_text); fclose($new_file); However I am getting Warning: fopen(myfile.txt): failed to open stream: Permission denied in... I don't usually work on Windows but I checked the file permissons on this folder and they seem to be 777 or drwxrwxrwx In IIS -- you have to set the permissions to write for the folder that you want to your script to be able to write to (from the IIS manager) -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com --- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Command line output
* Thus wrote Shawn McKenzie ([EMAIL PROTECTED]): Guess no ones has a clue. I didnt get a RTFM or anything. Try running php like so: php -doutput_buffering=0 phpfile.php Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [PHP or maybe JavaScript or CSS] protecting my PHP from bad input
#The problem: This is about protecting my PHP from bad input (e.g.: letters instead of numbers). ## Is there a way to prevent user from even inputting a letter in a text box? Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prefilled forms (solved)
On Tue, Nov 18, 2003 at 06:00:12PM -0800, b b wrote: : : No I am saying that if you have: : input type name = w1 value = lkjlkjlj : input type ... name =w2 : : and you click submit then if you click back to see : the form the value you set w2 will be blank. If you : reverse the order however then you will see what you : entered in w2 This is a client caching issue and is beyond your control, unless you want to delve into the depths of JavaScript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP or maybe JavaScript or CSS] protecting my PHP from bad input
On Wed, Nov 19, 2003 at 08:18:32AM +0100, Miroslav I. wrote: : : #The problem: : This is about protecting my PHP from bad input (e.g.: letters instead : of numbers). Good idea. You need to make sure user-inputted data is valid. : ## : Is there a way to prevent user from even inputting a letter in a text : box? There's two general ways to do data validation: client-side and server-side. PHP is server-side. JavaScript is client-side. With PHP, you allow the user to enter any data in the textbox, then code in logic to check for illegal characters (e.g. no letters in a textbox for one's phone number). Of course you must also code a nice response to let the user know when the data is found to be illegal, repost the form, etc. With JavaScript, you can do data validation as they press the submit button, or even disallow illegal characters as they type in a textbox. The response is far more immediate and thus far more effective, IMHO. Of course, if the user's web browser isn't running JavaScript, bad data may still slip through. Then you must use PHP and do server-side data validation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP or maybe JavaScript or CSS] protecting my PHP from bad input
Thanks Eugen, I'm familiar with the concepts, but I've seen sites with textboxes that would not show any letter typed - only numbers are displayed in the textbox. This is what I like but don't know how to achieve. :-) : #The problem: : This is about protecting my PHP from bad input (e.g.: letters instead : of numbers). Good idea. You need to make sure user-inputted data is valid. : ## : Is there a way to prevent user from even inputting a letter in a text : box? There's two general ways to do data validation: client-side and server-side. PHP is server-side. JavaScript is client-side. . . . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP or maybe JavaScript or CSS] protecting my PHP from bad input
On Wed, Nov 19, 2003 at 10:21:16AM +0100, Miroslav I. wrote: : : I'm familiar with the concepts, but I've seen sites with textboxes : that would not show any letter typed - only numbers are displayed in : the textbox. This is what I like but don't know how to achieve. :-) Base on what I mentioned earlier, it sounds like you're looking for JavaScript-based data validation. Your best bet is to look at examples of JavaScript code. Here's a link to HotScript.com: http://www.hotscripts.com/JavaScript/Scripts_and_Programs/Forms/index.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session trubles
PHP Version: 4.2.2 Hi I had a problem with my session name. In the php.ini, was set the default name PHPSESSID from the default installation. Now i have the problem, that i use the name audience for my webapplikations with PHPope (http://www.phpope.org) I Set the name in the script with the following code: session_name(audience); session_set_cookie_params(time()+999, /, $config[default][cookiedomain]); session_cache_limiter('no_cache'); session_start(); Now i had the problem, that i lost the session after login. The server forgave me a new session which called PHPSESSID and not audience :-( Now i have changed the value session.name in my php.ini to audience and it works! What's the problem here? A bug? I have enabled session.auto_start. Mit freundlichen Grüssen Markus Graf Hauptstrasse 80 9434 Au 0041 (0)79 / 261 16 37 [EMAIL PROTECTED] -- Software is like sex, it's better when it's free! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MS SQL Connectivity from Linux
Hi everyone, What is the quickest and easiest way to enable access to a MS SQL database from a Linux server (using PHP functions ofcourse), seeing as the MSSQL extension is available on Win32 systems only. Thanks Fern -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS SQL Connectivity from Linux
Fernando Melo wrote: Hi everyone, What is the quickest and easiest way to enable access to a MS SQL database from a Linux server (using PHP functions ofcourse), seeing as the MSSQL extension is available on Win32 systems only. ODBC -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com --- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] language selection with xml
Hi there, I would like to create a multilanguage website with php. I heared the easiest way is to create an xml file and use this package: http://freshmeat.net/projects/php-xml/?topic_id=92%2C96%2C914 This still looks complicated for me, beside the fact that it depends on an external package. Is there not a possibility to do this without an external package, just with php? Thanx for any info on that, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] language selection with xml
Merlin wrote: Hi there, I would like to create a multilanguage website with php. I heared the easiest way is to create an xml file and use this package: http://freshmeat.net/projects/php-xml/?topic_id=92%2C96%2C914 This still looks complicated for me, beside the fact that it depends on an external package. Is there not a possibility to do this without an external package, just with php? The package seems to be just php. If you don't want it to be external, you can include it with you webapp. Other options are constants (most widely used), variables and gettext. Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MS SQL Connectivity from Linux
I use PEAR db http://pear.php.net/manual/en/package.database.php http://pear.php.net/manual/en/package.database.db.intro-dsn.php this is included with the php distibution and makes swapping databases a doddle pete Fernando Melo wrote: Hi everyone, What is the quickest and easiest way to enable access to a MS SQL database from a Linux server (using PHP functions ofcourse), seeing as the MSSQL extension is available on Win32 systems only. Thanks Fern -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session trubles
mgraf wrote: PHP Version: 4.2.2 Hi I had a problem with my session name. In the php.ini, was set the default name PHPSESSID from the default installation. Now i have the problem, that i use the name audience for my webapplikations with PHPope (http://www.phpope.org) I Set the name in the script with the following code: session_name(audience); session_set_cookie_params(time()+999, /, $config[default][cookiedomain]); session_cache_limiter('no_cache'); session_start(); Now i had the problem, that i lost the session after login. The server forgave me a new session which called PHPSESSID and not audience :-( Now i have changed the value session.name in my php.ini to audience and it works! What's the problem here? A bug? I have enabled session.auto_start. This is the problem, the session is started before your script executes and sets the session name. Disable session.auto_start -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session trubles
PHP Version 4.3.3 Ok i have disabled the autostart. Now is my problem, that php us the transparent sessions, because it append it in the URL. After the login, all works fine, but after 5-6 clicks, i loose the session. It send me a Cookie : Set-Cookie: audience=a01b3fcf7cb587eee3ac61bc83edebe4; expires=Wed, 25-Dec-1901 16:01:15 GMT; path=/; domain=www.privatmarkt.com My mozilla is adjusted to accept all cookies. I'm confused. What is with the time? 25-Dec-1901 16:01:15 GMT!! I set the time in the futur with the following code: session_set_cookie_params(time()+999, /, $config[default][cookiedomain]); On Wed, 19 Nov 2003, Marek Kilimajer wrote: mgraf wrote: PHP Version: 4.2.2 Hi I had a problem with my session name. In the php.ini, was set the default name PHPSESSID from the default installation. Now i have the problem, that i use the name audience for my webapplikations with PHPope (http://www.phpope.org) I Set the name in the script with the following code: session_name(audience); session_set_cookie_params(time()+999, /, $config[default][cookiedomain]); session_cache_limiter('no_cache'); session_start(); Now i had the problem, that i lost the session after login. The server forgave me a new session which called PHPSESSID and not audience :-( Now i have changed the value session.name in my php.ini to audience and it works! What's the problem here? A bug? I have enabled session.auto_start. This is the problem, the session is started before your script executes and sets the session name. Disable session.auto_start -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Mit freundlichen Grüssen Markus Graf Hauptstrasse 80 9434 Au 0041 (0)79 / 261 16 37 [EMAIL PROTECTED] -- Software is like sex, it's better when it's free! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I cannot run a .php file on a IIS
Dear All, I was going to ask you how can I run a .php file using IIS. IIS and PHP, and a virtual directory are already installed. Thanks, Christos Papadogoulas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easy and simple way to read xml into array
Maybe this will help. I just made it: class XMLParser { var $depth = 0; var $parser; var $text; var $cdata = array(); function XMLParser() { $this-parser = xml_parser_create(); xml_set_object($this-parser, $this); xml_parser_set_option($this-parser, XML_OPTION_CASE_FOLDING, 0); xml_set_element_handler($this-parser, 'startElement', 'endElement'); xml_set_character_data_handler($this-parser, 'characterData'); } function parse($xml) { $error = xml_parse($this-parser,$xml,true); if ($error === false) { die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($this-parser)), xml_get_current_line_number($this-parser))); } $this-text = '$arr = '.substr($this-text, 0, strlen($this-text)-2).;\n; eval($this-text); return $arr; } function startElement($parser, $name, $attrs) { $attrStr = ''; $this-depth++; $this-cdata[$this-depth] = ''; foreach($attrs as $key = $value) { $attrStr .= '$key' = '$value', ; } $this-text .= array(\n'name' = '$name', 'attributes' = array($attrStr), ; } function endElement($parser, $name) { $this-text .= 'cdata' = '.$this-cdata[$this-depth].'),\n; $this-depth--; } function characterData($parser, $data) { $this-cdata[$this-depth] .= $data; } } $parser = new XMLParser(); $arr = $parser-parse(file_get_contents('sample.xml')); print_r($arr); Victor spång arthursson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 2003-11-17 kl. 17.06 skrev Chris Hayes: Need to read a xml-file into an array, but searching around I havent found a way that's easy and simple Arent there an easy way in PHP to accomplish this? have you been at http://se.php.net/xml ? Well, I've, and I also have to say that the XML-support in PHP lacks any usability 2 pages code later I still cannot get it to work, and the manual is pretty thin on this chapter... For example, I've the following XML: ingrediens ingrediensnummer1234/ingrediensnummer maengde3,4/maengde enhedkg/enhed /ingrediens Here I thought that the startelementfunction should be called upon every start tag, the character_data_handler on every text string and the endelement function on every endelement. But what seems to happen is that the character data handler is called to randomly number of times, and if I output the current element every time it gets called I get the following output for the xml above: ingrediens ingrediens ingrediens ingrediensnummer ingrediensnummer ingrediensnummer ingrediensnummer maengde maengde maengde maengde enhed enhed enhed enhed enhed enhed What I expected to get was: ingrediensnummer maengde enhed So, couldnt anyone please bring some clarity into this matter? Sincerely Victor= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easy and simple way to read xml into array
The 'sample.xml' file: ?xml version=1.0? root ingrediens no=1 ingrediensnummer1234/ingrediensnummer maengde3,4/maengde enhedkg/enhed /ingrediens ingrediens no=2 ingrediensnummer x=212345/ingrediensnummer maengde3,1/maengde enhedt/enhed /ingrediens /root Victor spång arthursson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 2003-11-17 kl. 17.06 skrev Chris Hayes: Need to read a xml-file into an array, but searching around I havent found a way that's easy and simple Arent there an easy way in PHP to accomplish this? have you been at http://se.php.net/xml ? Well, I've, and I also have to say that the XML-support in PHP lacks any usability 2 pages code later I still cannot get it to work, and the manual is pretty thin on this chapter... For example, I've the following XML: ingrediens ingrediensnummer1234/ingrediensnummer maengde3,4/maengde enhedkg/enhed /ingrediens Here I thought that the startelementfunction should be called upon every start tag, the character_data_handler on every text string and the endelement function on every endelement. But what seems to happen is that the character data handler is called to randomly number of times, and if I output the current element every time it gets called I get the following output for the xml above: ingrediens ingrediens ingrediens ingrediensnummer ingrediensnummer ingrediensnummer ingrediensnummer maengde maengde maengde maengde enhed enhed enhed enhed enhed enhed What I expected to get was: ingrediensnummer maengde enhed So, couldnt anyone please bring some clarity into this matter? Sincerely Victor= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I cannot run a .php file on a IIS
[snip] I was going to ask you how can I run a .php file using IIS. IIS and PHP, and a virtual directory are already installed. [/snip] I was going to give you an answer. Have you read and followed the directions here http://us2.php.net/windows ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easy and simple way to read xml into array
Maybe this will help. Just made it (nedded it myself) and I saw your post. ?php class XMLParser { var $depth = 0; var $parser; var $text; var $cdata = array(); function XMLParser() { $this-parser = xml_parser_create(); xml_set_object($this-parser, $this); xml_parser_set_option($this-parser, XML_OPTION_CASE_FOLDING, 0); xml_set_element_handler($this-parser, 'startElement', 'endElement'); xml_set_character_data_handler($this-parser, 'characterData'); } function parse($xml) { $error = xml_parse($this-parser,$xml,true); if ($error === false) { die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($this-parser)), xml_get_current_line_number($this-parser))); } $this-text = '$arr = '.substr($this-text, 0, strlen($this-text)-2).;\n; eval($this-text); return $arr; } function startElement($parser, $name, $attrs) { $attrStr = ''; $this-depth++; $this-cdata[$this-depth] = ''; foreach($attrs as $key = $value) { $attrStr .= '$key' = '$value', ; } $this-text .= array(\n'name' = '$name', 'attributes' = array($attrStr), ; } function endElement($parser, $name) { $this-text .= 'cdata' = '.$this-cdata[$this-depth].'),\n; $this-depth--; } function characterData($parser, $data) { $this-cdata[$this-depth] .= $data; } } $parser = new XMLParser(); $arr = $parser-parse(file_get_contents('sample.xml')); print_r($arr); ? Victor spång arthursson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 2003-11-17 kl. 17.06 skrev Chris Hayes: Need to read a xml-file into an array, but searching around I havent found a way that's easy and simple. Arent there an easy way in PHP to accomplish this? have you been at http://se.php.net/xml ? Well, I've, and I also have to say that the XML-support in PHP lacks any usability. 2 pages code later I still cannot get it to work, and the manual is pretty thin on this chapter... For example, I've the following XML: ingrediens ingrediensnummer1234/ingrediensnummer maengde3,4/maengde enhedkg/enhed /ingrediens Here I thought that the startelementfunction should be called upon every start tag, the character_data_handler on every text string and the endelement function on every endelement. But what seems to happen is that the character data handler is called to randomly number of times, and if I output the current element every time it gets called I get the following output for the xml above: ingrediens ingrediens ingrediens ingrediensnummer ingrediensnummer ingrediensnummer ingrediensnummer maengde maengde maengde maengde enhed enhed enhed enhed enhed enhed What I expected to get was: ingrediensnummer maengde enhed So, couldnt anyone please bring some clarity into this matter? Sincerely Victor= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
Hi, This is probably more of a javascript question but thought someone here might have an answer. I have a form in a pop up windoe I want this form data to be submited to the window that opened the popup - how can I do this? I have tried setting the target attribute on the form tag to window.opener() but that just opens a new window. Any ideas? Thanks _ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the key of a specific index of array?
Wouter Van Vliet [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] First of all, you said to use the first three values of the array for anoter reason .. well the, what I'd do is this: $FirstThree = array_splice($_POST, 0, 3); Which will give you the first three elements of the array, and leave you with a $_POST array you can do foreach with. Great! Thanks! I think it will be very useful. Second, to manually loop through an array, use: http://nl.php.net/manual/en/function.prev.php http://nl.php.net/manual/en/function.next.php http://nl.php.net/manual/en/function.current.php http://nl.php.net/manual/en/function.reset.php http://nl.php.net/manual/en/function.end.php Yes, I know these functions, but I'm still wondering if there's a DIRECT way to move an array's internal pointer to a specific position and/or key. Third, don't rely on the order your array elements are given to you by post data. Rather just use foreach() and (ignore|do something else with) the key-value pairs you don't want for this thing. But if these required three keys are messed up into the $_POST array, Is there a direct way to shift off elements at a specified key or index to remove them from an array? (I mean without a batch process) Something like: array_shift($array, $index) which of course is incorrect Although now I know I can write a code to search for a key and then splice it out from $_POST into another one. Thanks! Fourth, I hope I'm not spoiling Jay Blanchard statement on how uncredibly great this online PHP Manual is since you could probably find all the answers to array related questions right here: http://nl.php.net/manual/en/ref.array.php Thanks... I'm reading the online manual and many other sites before posting to newsgroups, As you can see, I'm not an expert programer but just a beginner. I'm trying to make a lightweight any-form-to-email script. The first 3 keys of the associative array ($_POST) are recipient, reply_email and subject. All other NAMED form elements will be mailed with this format: FORM NAME (key): FORM VALUE (value) - PhiSYS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms
[snip] This is probably more of a javascript question but thought someone here might have an answer. I have a form in a pop up windoe I want this form data to be submited to the window that opened the popup - how can I do this? I have tried setting the target attribute on the form tag to window.opener() but that just opens a new window. Any ideas? [/snip] There are several in archives as this question comes up once a week or more often http://marc.theaimsgroup.com/?l=php-general -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Matthew Oatham wrote: Hi, This is probably more of a javascript question but thought someone here might have an answer. I have a form in a pop up windoe I want this form data to be submited to the window that opened the popup - how can I do this? I have tried setting the target attribute on the form tag to window.opener() but that just opens a new window. Any ideas? Thanks It is JavaScript. You're on the right track with window.opener(), but that can't be the target. I believe you're going to have to do something with an onSubmit(), and pass the data that way. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session trubles
mgraf wrote: PHP Version 4.3.3 Ok i have disabled the autostart. Now is my problem, that php us the transparent sessions, because it append it in the URL. After the login, all works fine, but after 5-6 clicks, i loose the session. It send me a Cookie : Set-Cookie: audience=a01b3fcf7cb587eee3ac61bc83edebe4; expires=Wed, 25-Dec-1901 16:01:15 GMT; path=/; domain=www.privatmarkt.com My mozilla is adjusted to accept all cookies. I'm confused. What is with the time? 25-Dec-1901 16:01:15 GMT!! I set the time in the futur with the following code: session_set_cookie_params(time()+999, /, $config[default][cookiedomain]); The first parameter is relative to the current time. I would recomend for security reasons to leave this to the default, 0 - until the browser is closed. Otherwise this could lead to session hijacking - when the bad guy uses your site and gets a cookie with long lifetime, he knows that the cookie with session id will be used for other users using the same browser. Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to get the key of a specific index of array?
On 19 November 2003 12:59, David Strencsev contributed these pearls of wisdom: Wouter Van Vliet [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] First of all, you said to use the first three values of the array for anoter reason .. well the, what I'd do is this: $FirstThree = array_splice($_POST, 0, 3); Which will give you the first three elements of the array, and leave you with a $_POST array you can do foreach with. Great! Thanks! I think it will be very useful. Second, to manually loop through an array, use: http://nl.php.net/manual/en/function.prev.php http://nl.php.net/manual/en/function.next.php http://nl.php.net/manual/en/function.current.php http://nl.php.net/manual/en/function.reset.php http://nl.php.net/manual/en/function.end.php Yes, I know these functions, but I'm still wondering if there's a DIRECT way to move an array's internal pointer to a specific position and/or key. As someone else said before, I feel you may be thinking in the wrong direction. If you could give us a couple of examples of data you might expect to see in your $_POST aray, and what you wish to produce from it -- e.g. a sample of the final results from the provided data -- we might be able to provide the *real* solution to your problem, not try to shoehorn it into what might be an inappropriate one. In short, give us (a) sample input and (b) desired output, and see what suggestions come up for getting from (a) to (b) -- you might be surprised at how different they are from what you expect! ;) Cheers! Mike -- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easy and simple way to read xml into array
Well, I've, and I also have to say that the XML-support in PHP lacks any usability I am sorry to say this but the above comments indicates a lack of understanding about xml, xml parsing and PHP. The php xml parser is based on expat. expat was written by james clark a person who worked on some of the XML specs. 2 pages code later I still cannot get it to work, and the manual is pretty thin on this chapter... That's because the manual assumes you have the background on xml, maybe you might want to head off to w3schools etc to get this. Have you looked at the articles on phpbuilder on xml parsing with php? But what seems to happen is that the character data handler is called to randomly number of times, and if I output the current element every time it gets called I get the following output for the xml above: according to the specs the character data handler may be called more than once for each start element. Wheter you use c, php, java c++ or perl. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easy and simple way to read xml into array
So what do I need hearing it for ? I just answered the guy (what he needed was help, not punches slaps from wiseguys). Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well, I've, and I also have to say that the XML-support in PHP lacks any usability I am sorry to say this but the above comments indicates a lack of understanding about xml, xml parsing and PHP. The php xml parser is based on expat. expat was written by james clark a person who worked on some of the XML specs. 2 pages code later I still cannot get it to work, and the manual is pretty thin on this chapter... That's because the manual assumes you have the background on xml, maybe you might want to head off to w3schools etc to get this. Have you looked at the articles on phpbuilder on xml parsing with php? But what seems to happen is that the character data handler is called to randomly number of times, and if I output the current element every time it gets called I get the following output for the xml above: according to the specs the character data handler may be called more than once for each start element. Wheter you use c, php, java c++ or perl. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] =sessions / J. Meloni Textbook=
Thanks again but here's what happens when I run that. The form box appears. I select an option. I hit submit. The page that loads says: Warning: Invalid argument supplied for foreach() in c:\apache\htdocs\session_yyy.php on line 13 I then hit the link: Back to content page. The form box appears. I select _another_ option. I hit submit. The page that loads now has the _second_ value I have submitted but not the first. Like: 1. 2. Hal 2000 Is there a way to get the first option into the array? If you get a chance please try the code. Thanking you for your time. TR .. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Mail handler?
Dear All Is there a mail function or object that I can use on my PHP sites that does the same as the CDONTS object in ASP? Where can I find some tutorials on this subject? Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stepping through alphabet
I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Mail handler?
[snip] Is there a mail function or object that I can use on my PHP sites that does the same as the CDONTS object in ASP? Where can I find some tutorials on this subject? [/snip] The manual works fine for most http://www.php.net/mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stepping through alphabet
Maybe you can try this for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; Hope this helps Steve Buehler wrote: I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
[snip] I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... [/snip] Create an alphabet array and loop through it ... $arrayAlphabet = ('A', 'B', 'C', , 'Z'); for($i = 0; $i 25; $i++){ echo a href=\?action=$arrayAlphabet[$i]\$arrayAlphabet[$i]/a\n; } Or something like that. The HTML is probably a little of in my example, but you should be able to work with this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Matthew Oatham wrote: Hi, This is probably more of a javascript question but thought someone here might have an answer. I have a form in a pop up windoe I want this form data to be submited to the window that opened the popup - how can I do this? I have tried setting the target attribute on the form tag to window.opener() but that just opens a new window. Any ideas? The simplest way is to name your main window with javascript: window.name = 'domainMainWindow'; Then you can use the name as target in your form. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session trubles
Thanks that was my problem :-) On Wed, 19 Nov 2003, Marek Kilimajer wrote: The first parameter is relative to the current time. I would recomend for security reasons to leave this to the default, 0 - until the browser is closed. Otherwise this could lead to session hijacking - when the bad guy uses your site and gets a cookie with long lifetime, he knows that the cookie with session id will be used for other users using the same browser. Mit freundlichen Grüssen Markus Graf Hauptstrasse 80 9434 Au 0041 (0)79 / 261 16 37 [EMAIL PROTECTED] -- Software is like sex, it's better when it's free! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] images and charset
I put some text from my mysql-db into images(jpeg and png) that I build on the fly. When I do this I have som problem with norwegian spesial charakter, they dont show properly in the images. If I put the same text directly to the browser window this will show correctly. What do I need to do to get this right? thanks egil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP Authentication thru PHP
hello all , I'm able to get successfully http authenticated from my php scripts Ex : $header = POST /myscript.php HTTP/1.0\r\nAuthorization: Basic ; $header .= base64_encode($username:$password).\r\n; $header .= Content-type: application/x-www-form-urlencoded\r\n; $fp = fsockopen($IP, $PORT, $errno, $errstr); if ($fp) { fputs($fp, $header . $request); while (!feof($fp)) { $response .= fgets($fp, 128); } } But the above is not working when the $username contains a trailing semicolon or when the $password is starting with a semicolon, Ex: what if the $username =chandu: Is there any solution for this ? /Chandu
Re: [PHP] stepping through alphabet
Sophie Mattoug wrote: Maybe you can try this for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; Hope this helps The for loop is backwards for ($letter = 'A'; $letter = 'Z'; $letter++) However, I don't think that will work, you probably need to do something like this (untested) for ( $letter = 'A', $i = 0; $i = 25; $letter++, $i++ ) Steve Buehler wrote: I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
[snip] for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; [/snip] I tested this and found two small problems. The code works if you do this (I was myself amazed that letters would increment) for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } The problem seems to be that you cannot use ='Z' for some reason, as the array becomes quite lengthy, as if 'Z' doesn't work properly. But, if I do this for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } echo $letter . \n; The second echo statement echos the 'Z' properly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTTP Authentication thru PHP
Hi, But the above is not working when the $username contains a trailing semicolon or when the $password is starting with a semicolon, Ex: what if the $username =chandu: Is there any solution for this ? You could use str_replace to strip those before they get used. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP Authentication thru PHP
I think I can remember semi-colon is not allowed in apache logins or passwords... Chandu Nannapaneni wrote: hello all , I'm able to get successfully http authenticated from my php scripts Ex : $header = POST /myscript.php HTTP/1.0\r\nAuthorization: Basic ; $header .= base64_encode($username:$password).\r\n; $header .= Content-type: application/x-www-form-urlencoded\r\n; $fp = fsockopen($IP, $PORT, $errno, $errstr); if ($fp) { fputs($fp, $header . $request); while (!feof($fp)) { $response .= fgets($fp, 128); } } But the above is not working when the $username contains a trailing semicolon or when the $password is starting with a semicolon, Ex: what if the $username =chandu: Is there any solution for this ? /Chandu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTTP Authentication thru PHP
[snip] I think I can remember semi-colon is not allowed in apache logins or passwords... But the above is not working when the $username contains a trailing semicolon or when the $password is starting with a semicolon, Ex: what if the $username =chandu: [/snip] Or colons. It is a Bad Practice[tm] to use any special characters in user names and/or passwords. It is not universally allowed from OS to OS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
Yes, I found that the loop was written kind of backwards and would create a never ending loop. I never thought to try setting $letter='A' before. I didn't think you could loop through the Alphabet like that. But I did a little changing to your loop and it works fine like this now: $letter='A'; for($i=0;$i=25;$i++){ echo $letter++. ; } Thank You So Much Steve At 08:24 AM 11/19/2003, you wrote: [snip] for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; [/snip] I tested this and found two small problems. The code works if you do this (I was myself amazed that letters would increment) for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } The problem seems to be that you cannot use ='Z' for some reason, as the array becomes quite lengthy, as if 'Z' doesn't work properly. But, if I do this for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } echo $letter . \n; The second echo statement echos the 'Z' properly. -- 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] stepping through alphabet
YES That is the kind of code that I was looking for. I never thought you could do it like that either. Meaning putting 2 things to do ($letter++ and $i++) into the loop in this fashion. This looks so much cleaner to me. Here is my final function now. for($letter = 'A', $i = 0; $i = 25; $letter++, $i++ ){ echo a href=\?action=alphabetletter=$letter\$letter/a ; } Thank You So Much Steve At 08:27 AM 11/19/2003, you wrote: Sophie Mattoug wrote: Maybe you can try this for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; Hope this helps The for loop is backwards for ($letter = 'A'; $letter = 'Z'; $letter++) However, I don't think that will work, you probably need to do something like this (untested) for ( $letter = 'A', $i = 0; $i = 25; $letter++, $i++ ) Steve Buehler wrote: I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
I was hoping for something that looked (at least to me) a little cleaner. Someone else gave me the answer and here is my final code that works out just great for me. for($letter = 'A', $i = 0; $i = 25; $letter++, $i++ ){ echo a href=\?action=alphabetletter=$letter\$letter/a ; } Amazing what I learned today. :) I love this list and its people. Thanks for your help Steve At 08:15 AM 11/19/2003, you wrote: Create a $letters array and the loop through it like this: $letters=array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); foreach($letters as $letter) { echo a href=\?action=alphabetletter=$letter\$letter/a\n; } Luis -Original Message- From: Steve Buehler [mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 8:03 AM To: PHP Subject: [PHP] stepping through alphabet I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- PHP General Mailing List (http://www.php.net/http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phphttp://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP Authentication thru PHP
Jay Blanchard wrote: Or colons. It is a Bad Practice[tm] to use any special characters in user names and/or passwords. It is not universally allowed from OS to OS I disagree with this : special characters are useful to have better passwords (more difficult to crack), but as apache stores the souples login:password_crypt, of course : is the only really forbidden character. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stepping through alphabet
I tested this and found two small problems. The code works if you do this (I was myself amazed that letters would increment) But is that a bug? Or a feature? You could also do this, which would probably be more universal: // 65 through 90 for upper case // 97 through 122 for lower case for( $i = 65; $i = 90; $i++ ) { echo chr( $i ); } Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP Authentication thru PHP
its probably because its possible to authenticate with an url ? eg http://name:[EMAIL PROTECTED] Chandu Nannapaneni wrote: hello all , I'm able to get successfully http authenticated from my php scripts Ex : $header = POST /myscript.php HTTP/1.0\r\nAuthorization: Basic ; $header .= base64_encode($username:$password).\r\n; $header .= Content-type: application/x-www-form-urlencoded\r\n; $fp = fsockopen($IP, $PORT, $errno, $errstr); if ($fp) { fputs($fp, $header . $request); while (!feof($fp)) { $response .= fgets($fp, 128); } } But the above is not working when the $username contains a trailing semicolon or when the $password is starting with a semicolon, Ex: what if the $username =chandu: Is there any solution for this ? /Chandu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML email problem
Hi all, I m sendig out HTML email, using mimemail class which encodes the whole message to be sent in base64 and Content-Transfer-Encoding: is also specified as base64 only. Now one of my client is complaining that he is getting garbage in the email (shown below) after the sign up process in the site. // ** his is a MIME encoded message. --b159a63cb0da408dc58f11f5895832e92 Content-Type: text/html Content-Transfer-Encoding: base64 PEhUTUw+DQoJCQkJCSAJPPEI+TE9HSU4gSU5GT1JNQVRJT04gPC9URD48L1RSPg0KCQkJCQkJPFRSP jxURD48Zm9udCBmYWNlPWFyaWFsIHNpemU9Mj5Vc2VybmFtZSA6 IDwvVEQ+PFREPjxmb250IGZhY2U9YXJpYWwgc2l6ZT0yPmJpbmF5QG9saXZlaW50ZXJuZXQuY29t PC9URD48L1RSPg0KCQkJCQkJPFRSPjxURD48Zm9udCBmYWNlPWFyaWFsIHNpemU9Mj5QYXNzd29y ZCA6IDwvVEQ+PFREPjxmb250IGZhY2U9YXJpYWwgc2l6ZT0yPm9saXZlPC9URD48L1RSPg0KCQkJ CQkJPC9UQUJMRT4NCgkJCQkJCTwvQk9EWT4NCgkJCQkJIDwvSFRNTD4= --b159a63cb0da408dc58f11f5895832e92-- // *** I figured out why this is happening as his(client's) email programme does not support base64 encoding hence could not able to decode the message. I can't send the text email as it contains links and other html stuff.. Please suggest me what i can do? Is there any mail class which takes care of this problem? Thanks in advance Binay
Re: [PHP] mcrypt libraries?
Evan Nemerson wrote: On Tuesday 18 November 2003 01:13 pm, Jas wrote: Curt Zirzow wrote: * Thus wrote Jas ([EMAIL PROTECTED]): I am not sure if I should post my question here but I will anyways. Ok, I have compiled the mcrypt libraries on a Redhat 9 box running apache 2 with php4. And I need to know the next step(s) in getting php to use the libmcrypt libraries. If anyone has set this up in the past or has some pointers (other than reading the manual) I would appreciate it. Did you read the next step: Installation http://php.net/mcrypt Curt Yes I have and I guess I was looking for a method of using the libmcrypt library without having to recompile php. Sorry for the confusion. Have you tried using phpize? Actually I have not, not sure what phpize is but I will look it up. If you know of a URL where some fairly detailed instructions on compiling PHP with the mcrypt libraries are please post it. Thanks again, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I cannot run a .php file on a IIS
From: Papadogoulas Christos [EMAIL PROTECTED] I was going to ask you how can I run a .php file using IIS. IIS and PHP, and a virtual directory are already installed. I would suggest you actually make an attempt at installing PHP according to the directions in the manual... http://www.php.net/ ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Counting elements in an array
How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Counting elements in an array
$i = 0; foreach ($fruit as $k) if ('prange' == $k) $i++; (The result is $i, of course) Jeff McKeon wrote: How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Counting elements in an array
[snip] How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? [/snip] http://www.php.net/array_keys -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-Only Polling Script?
Can anyone recommend a good, simple PHP-only polling script? I have a non-profit with no money that wants people to be able to select one from a range of candidates, and then see the total number of votes, the percentage breakdown and probably a histogram or a bar graph showing the most popular selections. They are not worried about anyone scamming them, thinking that as many people would vote sixty times for Blue as would vote sixty times for Green. It wouldn't have to be secure, wouldn't have to support a bunch of cookies, wouldn't have to validate users, etc. etc. They don't have any money, so I don't have any time. I just need a good, cheap, low-hours-to-live, no-database, no-money poll. Anyone know of one? Mark D Hiatt Better Documentation Through Science -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Custom Session usind MySQL
thanks all for your help, will try it out now manisha Manisha Sathe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want the session to be accessed from different websites, so i got the answer in this forum only to make use of customised session with mysql. I searched the web and came to know that 'session.save_handler' of php.ini needs to be as 'user' but instead, on my server it is 'files'. As server is a shared server so i may not be able to change it, what can i do to resolve this ? Thanks in advance Manisha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Counting elements in an array
On Wednesday 19 November 2003 23:24, Jeff McKeon wrote: How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? array_count_values() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* They also surf who only stand on waves. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array_diff question
Hi: I read on the docs that array_diff and array_intersect were broken on 4.0.4. Does this mean that there is a best method to do it? Manu. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
On 19 November 2003 14:25, Jay Blanchard contributed these pearls of wisdom: [snip] for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; [/snip] I tested this and found two small problems. The code works if you do this (I was myself amazed that letters would increment) Well, it's mentioned (briefly) in the manual (http://uk.php.net/manual/en/language.operators.increment.php), so maybe you shouldn't be so amazed. for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } The problem seems to be that you cannot use ='Z' for some reason, as the array becomes quite lengthy, as if 'Z' doesn't work properly. The problem is not that 'Z' doesn't work properly, but that that PHP's idea of properly is different from yours: 'Z'+1 is defined to be 'AA' (it says that in the manual, too!), so your loop has to be: for($letter = 'A'; $letter = 'AA'; $letter++){ echo $letter . \n; } Cheers! Mike -- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
[snip] 'Z'+1 is defined to be 'AA' (it says that in the manual, too!), so your loop has to be: for($letter = 'A'; $letter = 'AA'; $letter++){ echo $letter . \n; } [/snip] Run this, you'll be surprised at what you get. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
On 19 November 2003 16:15, Jay Blanchard contributed these pearls of wisdom: [snip] 'Z'+1 is defined to be 'AA' (it says that in the manual, too!), so your loop has to be: for($letter = 'A'; $letter = 'AA'; $letter++){ echo $letter . \n; } [/snip] Run this, you'll be surprised at what you get. OK, my bad -- I let my fingers do the talking without proper monitoring from my brain. This is what I actually use in more than a few scripts: for ($c='A'; $c!='AA'; $c++): echo $c; endfor; I just forgot to change the comparison from = to != I guess this behaviour of ++ is a two-edged sword -- sometimes it's very useful, but in this instance it's a bit of a pain in the neck! Cheers! Mike -- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
[snip] OK, my bad -- I let my fingers do the talking without proper monitoring from my brain. This is what I actually use in more than a few scripts: for ($c='A'; $c!='AA'; $c++): echo $c; endfor; I just forgot to change the comparison from = to != I guess this behaviour of ++ is a two-edged sword -- sometimes it's very useful, but in this instance it's a bit of a pain in the neck! [/snip] :) Exactly! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mailing multilple addresses...?
Below is some code, I've written, where I'm trying to do the following... 1. Display a text box, for a user to enter a number of email addresses, seperated by a comma. 2. take that value, split it based on the comma and place that vlaue into an array. 3. Count the No of elements in the array 4. with a while loop, send to each address in turn 5. Display each successful address on screen afterwards. I think my prob', is in my use of the array, and I can't seem to fathom why...? Can anyone shed any light on this one for me... I'm a real fan of figuring out this stuff on my own, but time is against me today... See below... = if ($action == 'send') { $fimail[] = explode(,, $list); $count = count($fimail[]); $show = bUsers that have been mailed:/bbr; $i = 1; while ($count $i) { mail($fimail[], Subject, $message, $headers); $show .= br$fimail; $i++; } } else if ($action == '') { $show = bUsers to be mailed:/bbr; $show .= form method=\post\ action=\$PHP_SELF\ textarea name=\list\ style=\width:300px;height:150px;\/textarea input type=\hidden\ name=\action\ value=\send\ input type=\submit\ value=\Send Mails gt;gt;\ /form ; } = * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
RE: [PHP] Counting elements in an array
Jason Wong wrote: On Wednesday 19 November 2003 23:24, Jeff McKeon wrote: How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? array_count_values() That gives me: Warning: array_count_values(): Can only count STRING and INTEGER values! The values of the array elements should be integer. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Counting elements in an array
On Thursday 20 November 2003 00:33, Jeff McKeon wrote: Jason Wong wrote: On Wednesday 19 November 2003 23:24, Jeff McKeon wrote: How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? array_count_values() That gives me: Warning: array_count_values(): Can only count STRING and INTEGER values! Well, so change your array definition so that it holds an array of strings rather than constants. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Hello. I know the divorce rate among unmarried Catholic Alaskan females!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mailing multilple addresses...?
[snip] if ($action == 'send') { $fimail[] = explode(,, $list); $count = count($fimail[]); $show = bUsers that have been mailed:/bbr; $i = 1; while ($count $i) { mail($fimail[], Subject, $message, $headers); $show .= br$fimail; $i++; } } else if ($action == '') { $show = bUsers to be mailed:/bbr; $show .= form method=\post\ action=\$PHP_SELF\ textarea name=\list\ style=\width:300px;height:150px;\/textarea input type=\hidden\ name=\action\ value=\send\ input type=\submit\ value=\Send Mails gt;gt;\ /form ; } [/snip] First of all, $i is always going to be greater than 1 you have set up an infinite loop. Then if ($action == 'send') { $fimail = explode(,, $list); $count = count($fimail); $show = bUsers that have been mailed:/bbr; for($i = 0; $i $count; $i++){ mail($fimail[$i], Subject, $message, $headers); $show .= br$fimail; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mailing multilple addresses...?
You have started a new thread by taking an existing posting and replying to it while you changed the subject. That is bad, because it breaks threading. Whenever you reply to a message, your mail client generates a References: header that tells all recipients which posting(s) your posting refers to. A mail client uses this information to build a threaded view (tree view) of the postings. With your posting style you successfully torpedoed this useful feature; your posting shows up within an existing thread it has nothing to do with. Always do a fresh post when you want to start a new thread. To achieve this, click on New message instead of Reply within your mail client, and enter the list address as the recipient. You can save the list address in your address book for convenience. On Thursday 20 November 2003 00:26, [EMAIL PROTECTED] wrote: Below is some code, I've written, where I'm trying to do the following... 1. Display a text box, for a user to enter a number of email addresses, seperated by a comma. 2. take that value, split it based on the comma and place that vlaue into an array. [snip] -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Either I'm dead or my watch has stopped. -- Groucho Marx's last words */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Counting elements in an array
[snip] $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? [/snip] From http://www.php.net/array_keys with additions; $array = array(blue, red, green, blue, blue); $countArray = count((array_keys($array, blue))); echo $countArray . \n; 3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mailing multilple addresses...?
Not a problem... I do try and be thorough when I create mails... I'll be more list friendly in the future... cheers for the heads up! Nw, if I can only solve my prob, I can go home ;-) Jason Wong [EMAIL PROTECTED] 19/11/2003 16:42 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Subject Re: [PHP] mailing multilple addresses...? You have started a new thread by taking an existing posting and replying to it while you changed the subject. That is bad, because it breaks threading. Whenever you reply to a message, your mail client generates a References: header that tells all recipients which posting(s) your posting refers to. A mail client uses this information to build a threaded view (tree view) of the postings. With your posting style you successfully torpedoed this useful feature; your posting shows up within an existing thread it has nothing to do with. Always do a fresh post when you want to start a new thread. To achieve this, click on New message instead of Reply within your mail client, and enter the list address as the recipient. You can save the list address in your address book for convenience. On Thursday 20 November 2003 00:26, [EMAIL PROTECTED] wrote: Below is some code, I've written, where I'm trying to do the following... 1. Display a text box, for a user to enter a number of email addresses, seperated by a comma. 2. take that value, split it based on the comma and place that vlaue into an array. [snip] -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Either I'm dead or my watch has stopped. -- Groucho Marx's last words */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
[PHP] R: [PHP] mailing multilple addresses...?
try this: if ($action == 'send') { $fimail = explode(,, $list); $count = count($fimail); $show = bUsers that have been mailed:/bbr; $i = 1; while ($count $i) { mail($fimail[$i], Subject, $message, $headers); $show .= br$fimail; $i++; } } else if ($action == '') { $show = bUsers to be mailed:/bbr; $show .= form method=\post\ action=\$PHP_SELF\ textarea name=\list\ style=\width:300px;height:150px;\/textarea input type=\hidden\ name=\action\ value=\send\ input type=\submit\ value=\Send Mails gt;gt;\ /form ; } cheers, alessandro -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Inviato: mercoledi 19 novembre 2003 17.27 A: [EMAIL PROTECTED] Oggetto: [PHP] mailing multilple addresses...? Below is some code, I've written, where I'm trying to do the following... 1. Display a text box, for a user to enter a number of email addresses, seperated by a comma. 2. take that value, split it based on the comma and place that vlaue into an array. 3. Count the No of elements in the array 4. with a while loop, send to each address in turn 5. Display each successful address on screen afterwards. I think my prob', is in my use of the array, and I can't seem to fathom why...? Can anyone shed any light on this one for me... I'm a real fan of figuring out this stuff on my own, but time is against me today... See below... = if ($action == 'send') { $fimail[] = explode(,, $list); $count = count($fimail[]); $show = bUsers that have been mailed:/bbr; $i = 1; while ($count $i) { mail($fimail[], Subject, $message, $headers); $show .= br$fimail; $i++; } } else if ($action == '') { $show = bUsers to be mailed:/bbr; $show .= form method=\post\ action=\$PHP_SELF\ textarea name=\list\ style=\width:300px;height:150px;\/textarea input type=\hidden\ name=\action\ value=\send\ input type=\submit\ value=\Send Mails gt;gt;\ /form ; } = * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Memory Size Help Please
Hi all, Can anyone spot the problem here and point me in the right direction? I have a script that goes and fetches the xml at weblogs.com (http://www.weblogs.com/changes.xml). It then extracts the urls of the updated blogs and goes and uses file() to read each of them and extract some more stuff. It's probably not too surprising that I'm getting fatal errors becuase of memory... but what can I do? Many thanks! -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] R: [PHP] mailing multilple addresses...?
Cheers to everyone, it works great! Easy when I look at it now, but ant it the way... I'm off to the pub now.. later... Tris... Alessandro Vitale [EMAIL PROTECTED] 19/11/2003 16:50 To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject [PHP] R: [PHP] mailing multilple addresses...? try this: if ($action == 'send') { $fimail = explode(,, $list); $count = count($fimail); $show = bUsers that have been mailed:/bbr; $i = 1; while ($count $i) { mail($fimail[$i], Subject, $message, $headers); $show .= br$fimail; $i++; } } else if ($action == '') { $show = bUsers to be mailed:/bbr; $show .= form method=\post\ action=\$PHP_SELF\ textarea name=\list\ style=\width:300px;height:150px;\/textarea input type=\hidden\ name=\action\ value=\send\ input type=\submit\ value=\Send Mails gt;gt;\ /form ; } cheers, alessandro -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Inviato: mercoledi 19 novembre 2003 17.27 A: [EMAIL PROTECTED] Oggetto: [PHP] mailing multilple addresses...? Below is some code, I've written, where I'm trying to do the following... 1. Display a text box, for a user to enter a number of email addresses, seperated by a comma. 2. take that value, split it based on the comma and place that vlaue into an array. 3. Count the No of elements in the array 4. with a while loop, send to each address in turn 5. Display each successful address on screen afterwards. I think my prob', is in my use of the array, and I can't seem to fathom why...? Can anyone shed any light on this one for me... I'm a real fan of figuring out this stuff on my own, but time is against me today... See below... = if ($action == 'send') { $fimail[] = explode(,, $list); $count = count($fimail[]); $show = bUsers that have been mailed:/bbr; $i = 1; while ($count $i) { mail($fimail[], Subject, $message, $headers); $show .= br$fimail; $i++; } } else if ($action == '') { $show = bUsers to be mailed:/bbr; $show .= form method=\post\ action=\$PHP_SELF\ textarea name=\list\ style=\width:300px;height:150px;\/textarea input type=\hidden\ name=\action\ value=\send\ input type=\submit\ value=\Send Mails gt;gt;\ /form ; } = * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
RE: [PHP] Memory Size Help Please
[snip] Can anyone spot the problem here and point me in the right direction? [/snip] Nope, not enough info to spot the problem. I could point you in a direction, but that wouldn't help I am afraid. Wait, hold that thought, I have a direction to point you in. Please provide us with relevant detail, code snippets, OS info, etc. that might help us to help you. [snip] It's probably not too surprising that I'm getting fatal errors becuase of memory... but what can I do? [/snip] Uhm, add more memory? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] retrieving ENUM description from MySQL
Hi all, This is a bit wierd so don't flame please. Imagine a database table, field defined as ENUM with a list of allowed types such as Mr, Mrs, Miss, Dr, Prof, etc - you get the idea. I've read the MySQL manual and by using SHOW COLUMNS FROM table_name LIKE enum_column_name; I can get a result. But the string of ENUMs is not an array. It is returned as a string with all types in one string. Anyone got any ideas about how to retrieve it in a better way - else I'll need to start exploding the string... Thanks in advance Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory Size Help Please
hi How about using fopen() and reading line by line. And for xml parsing if you are using DOM switch to SAX that will always help. Nick Wilson wrote: Hi all, Can anyone spot the problem here and point me in the right direction? I have a script that goes and fetches the xml at weblogs.com (http://www.weblogs.com/changes.xml). It then extracts the urls of the updated blogs and goes and uses file() to read each of them and extract some more stuff. It's probably not too surprising that I'm getting fatal errors becuase of memory... but what can I do? Many thanks! -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory Size Help Please
* and then Jay Blanchard declared Nope, not enough info to spot the problem. I could point you in a Spare me the sarcasm. Here's the code if anyone can help, thanks. ? $xml=file('http://www.weblogs.com/changes.xml'); $xml=implode(\n, $xml); // Pattern match string $urlpattern = '/((http|https|ftp):\/\/|www)[a-z0-9\-\._]+\/?[a-z0-9_\.\-\?\+\/~=#;,]*[a-z0-9\/]{1}/si'; $p=xml_parser_create(); xml_parse_into_struct($p, $xml, $vals, $index); xml_parser_free($p); print(h1Starting/h1); print(ol); foreach($vals as $key = $val) { /* if its the correct tag, do stuff... */ if($val['tag']==WEBLOG $val['attributes']['WHEN']120) { /* print the url so I can keep track */ print(li.$val['attributes']['URL']./li\n); /* Changed this from file() to fopen() to see... */ $pagehandle=fopen($val['attributes']['URL'],r); $page=fread($pagehandle,3); fclose($pagehandle); preg_match_all($urlpattern, $page, $matches); unset($page); foreach($matches[0] as $pageurl) { $parsedurl=parse_url($pageurl); if($parsedurl['host']=='amazon') { $urlfile=fopen('urls.txt',a); fwrite($urlfile,$pageurl.\n); fclose($urlfile); } } unset($matches); unset($pageurl); unset($parsedurl); } } print(/ol); print(h1Done!/h1); ? -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mailing multilple addresses...?
[EMAIL PROTECTED] wrote: Not a problem... I do try and be thorough when I create mails... I'll be more list friendly in the future... cheers for the heads up! Nw, if I can only solve my prob, I can go home ;-) When you go home, don't forget to turn on your out of office autoreply, everyone loves to receive it. Cheers, Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mailing multilple addresses...?
It should be off...! I went away for two weeks recently, and left my subscription runing ot he list... sorry... I'll be more careful... It's been a funny few weeks... ;-) Tris... Marek Kilimajer [EMAIL PROTECTED] 19/11/2003 17:17 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP] mailing multilple addresses...? [EMAIL PROTECTED] wrote: Not a problem... I do try and be thorough when I create mails... I'll be more list friendly in the future... cheers for the heads up! Nw, if I can only solve my prob, I can go home ;-) When you go home, don't forget to turn on your out of office autoreply, everyone loves to receive it. Cheers, Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] Memory Size Help Please
Hi, Jay's comment was a fair one. It's not always possible to help without full info. You could try writing your data directly to disk instead of keeping them in memory as your code seems to be doing. In that case your regex function might need to go into the character data handler. Nick Wilson wrote: * and then Jay Blanchard declared Nope, not enough info to spot the problem. I could point you in a Spare me the sarcasm. Here's the code if anyone can help, thanks. ? $xml=file('http://www.weblogs.com/changes.xml'); $xml=implode(\n, $xml); // Pattern match string $urlpattern = '/((http|https|ftp):\/\/|www)[a-z0-9\-\._]+\/?[a-z0-9_\.\-\?\+\/~=#;,]*[a-z0-9\/]{1}/si'; $p=xml_parser_create(); xml_parse_into_struct($p, $xml, $vals, $index); xml_parser_free($p); print(h1Starting/h1); print(ol); foreach($vals as $key = $val) { /* if its the correct tag, do stuff... */ if($val['tag']==WEBLOG $val['attributes']['WHEN']120) { /* print the url so I can keep track */ print(li.$val['attributes']['URL']./li\n); /* Changed this from file() to fopen() to see... */ $pagehandle=fopen($val['attributes']['URL'],r); $page=fread($pagehandle,3); fclose($pagehandle); preg_match_all($urlpattern, $page, $matches); unset($page); foreach($matches[0] as $pageurl) { $parsedurl=parse_url($pageurl); if($parsedurl['host']=='amazon') { $urlfile=fopen('urls.txt',a); fwrite($urlfile,$pageurl.\n); fclose($urlfile); } } unset($matches); unset($pageurl); unset($parsedurl); } } print(/ol); print(h1Done!/h1); ? -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory Size Help Please
* and then Raditha Dissanayake declared Hi, Jay's comment was a fair one. It's not always possible to help without full info. I beg to differ, the point was valid but the manner unfriendly at best. You could try writing your data directly to disk instead of keeping them in memory as your code seems to be doing. In that case your regex function might need to go into the character data handler. Thanks very much. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String matching for sample code doesn't work....
Hi Everyone! I'm not really sure why does this simple script not work. When I run the code, the loop kept going until it timed out. I'll enclose the simple code here... --snip-- $res_str = Dog NameWhoof/Dog Name![CDATA[Whose Dog is that??]]; for ($i=0;$i100;$i++) { if (substr($res_str, $i, 9) == ![CDATA[) { echo You got it; } } --snip-- This one should work but it doesn't, but I noticed that it does work if I use this instead... --snip-- if (substr($res_str, $i, 7) == [CDATA[) --snip-- So, the problem had to do with either the '' character or the '!' character that doesn't match. I thought maybe an escape character would work, like '\' but it doesn't do anything. So, anyone know how to fix that problem? Thanks, Scott F. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: About iMail Help
It look like a email software called, 'imail' D. Jame [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Anyone know about imail.? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Counting elements in an array
Jeff McKeon wrote: How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is orange? Thanks, Jeff $temp = array_keys ( $fruit, orange ); echo ( sizeof ( $temp ) ); -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
On 19-Nov-2003 Steve Buehler wrote: Amazing what I learned today. :) I love this list and its people. How about one more? (ver 4.1.0): foreach(range('A', 'Z') as $letter) { echo $letter, \n; } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: String matching for sample code doesn't work....
Never mind that! It work now Been working on it for a few hours though Scott Fletcher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Everyone! I'm not really sure why does this simple script not work. When I run the code, the loop kept going until it timed out. I'll enclose the simple code here... --snip-- $res_str = Dog NameWhoof/Dog Name![CDATA[Whose Dog is that??]]; for ($i=0;$i100;$i++) { if (substr($res_str, $i, 9) == ![CDATA[) { echo You got it; } } --snip-- This one should work but it doesn't, but I noticed that it does work if I use this instead... --snip-- if (substr($res_str, $i, 7) == [CDATA[) --snip-- So, the problem had to do with either the '' character or the '!' character that doesn't match. I thought maybe an escape character would work, like '\' but it doesn't do anything. So, anyone know how to fix that problem? Thanks, Scott F. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and java
Ok, First, let me say, I have looked at the manual and searched the past posts but still can't get this to work. I also should say that this is my first time trying to bridge php and java so this may be a stupid questionI have a java class(DateUtil) in a package (testphp). I then took the package and created a jar file from it and put the location of the jar file in my php.ini file with the java settings. In my php code, this code works fine: $java = new Java(testphp); $currentTime=$java-currentTimeMillis(); echo The Time is:. $currentTime; but if I try to access my class, I get errors that it can't instantiate non-existent class: $mydate=new DateUtil(testphp); Am I doing something blatantly wrong? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comparing 2 strings.
I currently store text from a MySQL blob field in a string $orig_text. I need to compare that with something someone type in from a form stored in $new_text. How would I go about comparing them to see if they are different or exactly the same? strcmp doesn't look like it will handle this too well. I can't go by the number of characters in the string either. Someone may be able to use new words but keep the length of the string the same. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP syntax error or javascript mistake?
Greetings: I can't decide if my problem is PHP or Javascript, but I've been staring at this line of code for too long without being able to see why it's behaving the way it is I'm trying to open a new window on top of the current window, and it does that, but the original (bottom) window changes to read Object Window ... I can get back to the original with the Back button but of course don't want to ask that of the user ... I simply want a new window to appear on top of the original, after which the user can close the top window and be back where he started what the heck am I doing wrong? Oh, here's the code: echo a href='javascript:window.open(\$fg_id\,\\,\height=400,width=300,left=80,top=80,scrollbars=1\)'; Thanks VERY much in advance ... KM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing 2 strings.
From: Ed Curtis [EMAIL PROTECTED] I currently store text from a MySQL blob field in a string $orig_text. I need to compare that with something someone type in from a form stored in $new_text. How would I go about comparing them to see if they are different or exactly the same? strcmp doesn't look like it will handle this too well. Why would you say that when strcmp() is exactly what you need to use?? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about video (PHP unrealted)
I know this is bad but this is the only listserver/newgroup thingy I use because I am php challenged. Any how, I want to embed windows media player in my php pages (which I have done successfully), but I need help: I was wondering which is the best format for demand downloading of video files (not streaming) that work with media player. Also, I have my sample video created in a quicktime .mov format also and avi format and an mp4 format. How can I get this converted to a asf or wmv format? Any tips? Any free software that can convert files? Thanks and sorry for the off topic distraction. Frank __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing 2 strings.
I guess I did miss that it says that the comparison is case sensitive and binary safe. Thanks, Ed On Wed, 19 Nov 2003, CPT John W. Holmes wrote: From: Ed Curtis [EMAIL PROTECTED] I currently store text from a MySQL blob field in a string $orig_text. I need to compare that with something someone type in from a form stored in $new_text. How would I go about comparing them to see if they are different or exactly the same? strcmp doesn't look like it will handle this too well. Why would you say that when strcmp() is exactly what you need to use?? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about video (PHP unrealted)
Frank Tudor mailto:[EMAIL PROTECTED] on Wednesday, November 19, 2003 11:26 AM said: I know this is bad but this is the only listserver/newgroup thingy I use because I am php challenged. Actually you have (nearly) the entire internet at your beck and call. Me: Frank, google. Google, Frank. Google: Hi Frank. Pleased to make your aquaintence. Frank: What's a google? That's a joke! haha... Try converting mov to wmv in google and see what you get. Otherwise I have no information for you. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to create a function and return two parameters????
Hi Everyone! I wanted to know how do I return two parameters within a function. I'm not having much luck with it. I kept getting errors... --snip-- function CBC_XML_BreakUp($strResponse_XML, $strResponse_HTML) { global $res_str; $strResponse_XML = substr($res_str, 0, 100); $strResponse_HTML = substr($res_str, 200, 100); return $strResponse_XML,$strResponse_HTML; } --snip-- Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why is the php loop, 'for()', so slow????
Hi Everyone! Why does the for() loop for PHP so slow when it is digesting a large amount of data? Is there a way to make the loop go faster? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to create a function and return two parameters????
Scott Fletcher mailto:[EMAIL PROTECTED] on Wednesday, November 19, 2003 12:07 PM said: I wanted to know how do I return two parameters within a function. I'm not having much luck with it. I kept getting errors... [snip] return $strResponse_XML,$strResponse_HTML; That's because it doesn't work like that. :) Three solutions: 1. pass a value by reference i.e. function myfunction($value) {} AND return something 2. don't return anything and pass both values by reference 3. stick both values in an array and return the array (easiest) Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why is the php loop, 'for()', so slow????
Scott Fletcher mailto:[EMAIL PROTECTED] on Wednesday, November 19, 2003 12:11 PM said: Why does the for() loop for PHP so slow when it is digesting a large amount of data? Is there a way to make the loop go faster? Show us your loop. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP syntax error or javascript mistake?
Kenn Murrah wrote: I'm trying to open a new window on top of the current window, and it does that, but the original (bottom) window changes to read Object Window ... I can get back to the original with the Back button but of course don't want to ask that of the user ... I simply want a new window to appear on top of the original, after which the user can close the top window and be back where he started Oh, here's the code: echo a href='javascript:window.open(\$fg_id\,\\,\height=400,width=300,left=80,top=80,scrollbars=1\)'; Browser follows the link, you need to return false after opening the window: a href='javascript:window.open(\$fg_id\,\\,\height=400,width=300,left=80,top=80,scrollbars=1\); return false;' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String matching for sample code doesn't work....
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]): Hi Everyone! --snip-- $res_str = Dog NameWhoof/Dog Name![CDATA[Whose Dog is that??]]; for ($i=0;$i100;$i++) { if (substr($res_str, $i, 9) == ![CDATA[) um.. lookup this function: http://www.php.net/strpos Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to create a function and return two parameters????
Ummm, look like I'll stick with number two. Didn't know about the value to pass value back and forth in PHP Thanks, Scott F. Chris W. Parker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Scott Fletcher mailto:[EMAIL PROTECTED] on Wednesday, November 19, 2003 12:07 PM said: I wanted to know how do I return two parameters within a function. I'm not having much luck with it. I kept getting errors... [snip] return $strResponse_XML,$strResponse_HTML; That's because it doesn't work like that. :) Three solutions: 1. pass a value by reference i.e. function myfunction($value) {} AND return something 2. don't return anything and pass both values by reference 3. stick both values in an array and return the array (easiest) Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php