[PHP] DATE Questions
Hello, I'm working on a project planning system and what i want to do is making a sort of table structure with an overview form today till a month later. All the projects that are between these dates must be viewed. Right now i have the following questions: - How can i determine how much days are between say 20 november and 20 december dynamically? - How can i make an array containing the values of these dates? - How do i make a for loop and print these values. I hope somone can help me out. Thanks. Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: \|/ $PHP_SELF
Any Ideas as to how I could be able to acomplish this? or How could I get the path of the main page and pass it on to the included file for processing?. thanks! Fred wrote: $PHP_SELF will always give the name and path of the main file, even if the variable is set in an included file. The reason is that the included file is included before the variable is evaluated. Fred -- Gerry Figueroa Dynamic Intermedia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: DATE Questions
If you are interested I can show you a script that will generate a monthly calendar based on the current date. It has links to go forward and backward by month. It is a fairly simple script that I found at hotscripts.com, but it has amazing potential. I have used it as the basis for some rather advanced database applications. Fred Sjoerd Van Oosten [EMAIL PROTECTED] wrote in message C9F89DA57491D511BDAF00E0180C348103BFE5@ESADM01">news:C9F89DA57491D511BDAF00E0180C348103BFE5@ESADM01... Hello, I'm working on a project planning system and what i want to do is making a sort of table structure with an overview form today till a month later. All the projects that are between these dates must be viewed. Right now i have the following questions: - How can i determine how much days are between say 20 november and 20 december dynamically? - How can i make an array containing the values of these dates? - How do i make a for loop and print these values. I hope somone can help me out. Thanks. Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] configure problem: --with-mysql=/what exactly?
Hi, Do you have msyql-dev (or similar) package installed? Arpi I have tried the following, each time removing config.cache beforehand: --with-mysql=/usr --with-mysql=/usr/include --with-mysql=/usr/include/mysql --with-mysql=/usr/lib According to a friend with mysql Debs installed it should be the first, yet PHP tells me each time it's using the bundled MySQL version and to be careful of running it with other mysql-using modules. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Download File Problem - text not appearing on downloaded file
Joe, I have been there:-) I use this scripts ? function detect_browser($variable) { if(eregi((msie) ([0-9]{1,2}.[0-9]{1,3}), $variable)) { $content = ie; } else { $content = nn; } return $content; } # Send the file to the downloaders browser # $file_dl = $base_dir.$file; if (detect_browser($HTTP_USER_AGENT) == ie) { Header(Content-type: application/force-download); } else { Header(Content-type: application/octet-stream); } Header(Content-Length: .filesize($file_dl)); Header(Content-Disposition: attachment; filename=$file); Header(Cache-Control: no-cache, must-revalidate);//HTTP/1.1 Header(Pragma: no-cache);//HTTP/1.0 readfile($file_dl); ? The first time I run this script, I works fine. The file downloads properly to the client machine with the right size and content. Most of the file is text file. After some times, I met the same problem as yours. The file size is 0. I don't know, perhaps I change the browser setting or my Admin change the Apache settings, PHP or some thing else. I ask everywhere, many mailing list. and I gave up. I just change it to Header(Location: $url.$filename); It works but there is a funny things. The file can be downloaded properly if the file (with such an extension) has been opened with notepad. If not, the file will opened in the browser. :-)...it's an experience. Gilijk - Original Message - From: Joe Van Meer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 19, 2001 10:43 PM Subject: [PHP] Download File Problem - text not appearing on downloaded file Hi there. I managed to get the prompt for a file download when a user clicks on a text link. The file downloads properly to the client machine, howevr, when I open up the file there is no content. What do I have to add to the following code to get the content sent back to the user? Thx Joe :) ?PHP header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=file.txt); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Name of file?
Here goes an easy one... I need a script that returns me the name of the page it is in. I mean, if this script is in a page called test3.php, then it should return test3.php, and if it is on a page called heynow.php it should return, you guessed it, heynow.php. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Bitwise
probably priority issue. try: if (($One $Two) == $One) - - in your example this means: ((0100 ) == 0100) (0100 == 0100) TRUE ...in other case 0100 ( == 0100) is 0100 0 is always 0 hope this helps Buchholz Fred wrote From: Fred [EMAIL PROTECTED] Date: Mon, 19 Nov 2001 18:02:53 -0800 Subject: [PHP] Bitwise I have 17 boolean variables which need to be stored in a MySQL database. I created a SET Column to store each of the boolean values as bits in the column. I should be able to test for the truth of a particular variable by checking if the corresponding bit is set. For example, if the first four variables are set (i.e. Column = a,b,c,d) then the numeric value of the column is 15 or . To test for c I would check to see if the third bit (4 or 100) is set. I chose to do the check this way: if ($One $Two == $One) echo True; This does not seem to work in many instances. Take the example above: 4 and 15 should equal 4 0100 and equals 0100 For some reason, my script gives as the result of 0100 and . It is fairly clear that this is not the correct behavior of the bitwise operator. Oddly enough, in some instances is works as expected: 16 and 17 should equal 16 1 and 10001 equals 1 My script has no problem generating the expected result here. Perhaps this problem arises from the loosely typed nature of PHP variables, but I do not see how it could. Any pointers would be appreciated. Fred -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] session variables in functions....
Somebody knows why I cannot reach the $HTTP_SESSION_VARS in a function For example, why does this not output the en-US string three times: ? session_register(LangID); $HTTP_SESSION_VARS[LangID] = en-US; echo($HTTP_SESSION_VARS[LangID]); echo(**); function CurrentLang(){ $language = $HTTP_SESSION_VARS[LangID]; echo($language); } CurrentLang(); echo(**); echo($HTTP_SESSION_VARS[LangID]); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] MySQL and GROUP BY
Hi All, I suspect this really can by done in my SQL query rather than afterwards in PHP but I haven't been able to find a way. I have a table with three fields: 1. First_Name 2. Last_Name 3. Business_Name A row that has a first and last name will not have a business name. A row with a business name will not have a first or last name set. I want to output the contents of this (with filtering as appropriate) into a select list in a form. At the moment I am doing something like this for my SQL statement (simplified for just the bit I need to figure out): SELECT * FROM My_Table ORDER BY Business_Name, Last_Name, First_Name; What I would _like_ to have happen is that the select list will end up sorted by business name as well as last name and then first name. At the moment this query is resulting in all business names (sorted) and then, following all business names, all last/first names (also sorted). I want them all integrated into a single alphabetical list. I don't seem to be making any headway searching the MySQL or PHP web sites for this... Thanks for any and all suggestions... CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: POST files with PHP
Never tried that, But i'm afraid that by reading a binary file like: join('', file('binfile')) will brake the file! try using fopen('binfile', 'rb') and fread() and filesize() good luck. Daniel Reichenbach [EMAIL PROTECTED] wrote in message 01c17111$02617a50$796010ac@danielmob">news:01c17111$02617a50$796010ac@danielmob... Hy, I'm trying to post image files to a php script with another php script. Don't ask why, it's a crazy project :) Now the file is around 28000 bytes but the post receiver only gets around 300 bytes. Has anybody experienced this behaviour? I use the following script: --- snap --- ? // the receiver of file $remote_page = http://www.server.com/post.php;; // the file to upload $file = /var/www/test/dummy.jpg; // the file location $con_type = image/jpg; // the file mime type $content_file = join(,file($file)); // define boundary srand((double)microtime()*100); $boundary = ---.substr(md5(rand(0,32000)),0,10); $data = --$boundary Content-Disposition: form-data; name=\userfile\; filename=\$file\ Content-Type: $con_type $content_file.--$boundary--\r\n\r\n; $msg = POST $remote_page HTTP/1.0 Content-Type: multipart/form-data; boundary=$boundary Content-Length: .strlen($data).\r\n\r\n; $f = fsockopen(www.server.com,80); fputs($f,$msg.$data); $result = fread($f,32000); fclose($f); print $result.\nbr; ? --- snap -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: session variables in functions....
Make it global or pass it as an argument: function CurrentLang(){ global $HTTP_SESSION_VARS; $language = $HTTP_SESSION_VARS[LangID]; echo($language); } Or: function CurrentLang($HTTP_SESSION_VARS){ $language = $HTTP_SESSION_VARS[LangID]; echo($language); } -- Julio Nobrega No matter where you go, this. Wim Van Houts [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Somebody knows why I cannot reach the $HTTP_SESSION_VARS in a function For example, why does this not output the en-US string three times: ? session_register(LangID); $HTTP_SESSION_VARS[LangID] = en-US; echo($HTTP_SESSION_VARS[LangID]); echo(**); function CurrentLang(){ $language = $HTTP_SESSION_VARS[LangID]; echo($language); } CurrentLang(); echo(**); echo($HTTP_SESSION_VARS[LangID]); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] odbc_num_rows always returns -1
Hi Everyone, As the subject says. I'm using 4.0.6 on IIS/win2k to a MSSQL 2000 database. I wish to check if a query returns any values, so the code I have is nothing more than: $numRows = odbc_num_rows($result); print ($numRowsbr); if ($numRows = 0) { print(Nothing to show); } Have I missed something.. with the result always being -1, it causes me some problems.. :) Thanks Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to check what country the user is comming from ?
thx Kamil Muszynski -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Name of file?
[EMAIL PROTECTED] (Jaime Iniesta Aleman) wrote: Here goes an easy one... I need a script that returns me the name of the page it is in. I mean, if this script is in a page called test3.php, then it should return test3.php, and if it is on a page called heynow.php it should return, you guessed it, heynow.php. use $PHP_SELF ? -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to check what country the user is comming from ?
On Tue, 20 Nov 2001, Fly wrote: thx Kamil Muszynski Practically, you can't. Technically, you can. Take the IP, run it through whois.arin.net. If that returns apnic, ripe etc, run it through those.. you might get the answer you want. Calls to apnic etc are probably blocking calls - slowing down your page load. Or make this a standalone daemon that feeds a DB. If there are built in PHP commands, I don't know of them. -- Sapere aude My mind not only wanders, it sometimes leaves completely. Never attribute to malice that which can be adequately explained by stupidity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Download textfile
When I link a textfile, the textfile is opened in the browser. I want the SaveAs box to be shown. Is this possible and if so how to do that? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Daemons (was: How to check what country the user is comming from ?)
Can you explain me, how to build a (standalone) daemon or point me to a good tutorial? Thank you for help in advance Stefan Rusterholz, [EMAIL PROTECTED] -- interaktion gmbh Stefan Rusterholz Zürichbergstrasse 17 8032 Zürich -- T. +41 1 253 19 55 F. +41 1 253 19 56 W3 www.interaktion.ch -- - Original Message - From: Duncan Hill [EMAIL PROTECTED] To: Fly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 12:56 PM Subject: Re: [PHP] How to check what country the user is comming from ? On Tue, 20 Nov 2001, Fly wrote: thx Kamil Muszynski Practically, you can't. Technically, you can. Take the IP, run it through whois.arin.net. If that returns apnic, ripe etc, run it through those.. you might get the answer you want. Calls to apnic etc are probably blocking calls - slowing down your page load. Or make this a standalone daemon that feeds a DB. If there are built in PHP commands, I don't know of them. -- Sapere aude My mind not only wanders, it sometimes leaves completely. Never attribute to malice that which can be adequately explained by stupidity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] File download results question
Hi there. I have a small php app that allows a user to download a txt file that's created 'on the fly' from a database. Everything is working great except for the actual results displayed on the file...it get results similar to the code below...it's insertng br tags (and square characters) all over the place. Could someone tell me the name of the function that removes this? Thx Joe :) Delete from databaseBRphpBR//connect to db br / $connectionToDB = odbc_connect(codesnipits, joecode, joecode); br / br / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Help with PHP_AUTH_USER needed.
Hi there!I want to know how to reload the following script of mine by using a cookie.If the cookie expires the user must lgin again.I can get it right to reload the authentication script This is my code im using in my secure pages : require_once(inc/db.inc); if(!isset($Cookie)){ include(quick_auth.php); unset($PHP_AUTH_USER); }else{ //echo brCookie is set; session_start(); //register session variables. session_register('userid'); session_register('username'); session_register('useremail'); } //Now get data from tables so that we can authenticate the users that has admin rights etc etc.: $query = SELECT user_type FROM staffinfo WHERE createdate = '$userid'; echo brUeserid = $userid; $row = db_array($query); if($row[0]) { $intcom_authtype = $row[0]; }else{ $intcom_authtype = x; }; //end if $row[0] $right['p'] = power user; $right['n'] = normal user; $right['x'] = no user; echo brThis user has .$right[$intcom_authtype]. rights; //END OF AUTHENTICATION/// This is my quick_auth.php : Its is basically the same as in the manual! //require_once(inc/db.inc); function recall() { Header(WWW-Authenticate: Basic realm=\Intranet Authentication\); Header(HTTP/1.0 401 Unauthorized); echo Sorry, you have to authenticate to gain access.\n; exit; } //end of function recall if(!isset($PHP_AUTH_USER)) { Header(WWW-Authenticate: Basic realm=\Intranet Authentication\); Header(HTTP/1.0 401 Unauthorized); echo Sorry, you have to authenticate to gain access.\n; exit; }else{ $email = $PHP_AUTH_USER; $password = $PHP_AUTH_PW; if(!strrchr($email,@)){$email=$email.@ford.co.za;} $query = SELECT createdate,lastupdate,password,email,name FROM staffinfo WHERE email = '$email'; $row = db_array($query); $createdate_t = $row[0]; $lastupdate_t = $row[1]; $password_t = strtolower($row[2]); $email_t = $row[3]; $name = $row[4]; $password = substr($password,0,20); if((strtolower($password)!=$password_t) || (!$password)) { recall(); }else{ $CookieString=$createdate_t..$email_t; SetCookie(Cookie,$CookieString,time()+10); //setting new cookie $userid = $createdate_t; //We use the creation date as our user id. $username = $name; $useremail = $email_t; //initiate session session_start(); //register session variables. session_register('userid'); session_register('username'); session_register('useremail'); }; //if password correct }; //if information submitted -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: odbc_num_rows always returns -1
Hi Peter, from what I hear (and what I've read) with sqlServer you'll always get a result of -1 for num_rows. To get an accurate count you'll have to use the count() on the db in a select query. That's one workaround, no doubt there are others. SELECT COUNT(my_id) FROM TABLE ... Cheers Joe :) Peter Lavender [EMAIL PROTECTED] wrote in message 017301c171b9$dab26f60$090ba8c0@winnie">news:017301c171b9$dab26f60$090ba8c0@winnie... Hi Everyone, As the subject says. I'm using 4.0.6 on IIS/win2k to a MSSQL 2000 database. I wish to check if a query returns any values, so the code I have is nothing more than: $numRows = odbc_num_rows($result); print ($numRowsbr); if ($numRows = 0) { print(Nothing to show); } Have I missed something.. with the result always being -1, it causes me some problems.. :) Thanks Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: odbc_num_rows always returns -1
Also (I forgot to tell you) you can use that -1 number. The fact that it is -1 tells you you have records that have been retrieved. Otherwise it will return 0. Cheers, Joe :) Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Peter, from what I hear (and what I've read) with sqlServer you'll always get a result of -1 for num_rows. To get an accurate count you'll have to use the count() on the db in a select query. That's one workaround, no doubt there are others. SELECT COUNT(my_id) FROM TABLE ... Cheers Joe :) Peter Lavender [EMAIL PROTECTED] wrote in message 017301c171b9$dab26f60$090ba8c0@winnie">news:017301c171b9$dab26f60$090ba8c0@winnie... Hi Everyone, As the subject says. I'm using 4.0.6 on IIS/win2k to a MSSQL 2000 database. I wish to check if a query returns any values, so the code I have is nothing more than: $numRows = odbc_num_rows($result); print ($numRowsbr); if ($numRows = 0) { print(Nothing to show); } Have I missed something.. with the result always being -1, it causes me some problems.. :) Thanks Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Download textfile
Arno [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... When I link a textfile, the textfile is opened in the browser. I want the SaveAs box to be shown. Is this possible and if so how to do that? I apologize for not having a complete answer, but I do have an explanation that may lead you on the correct path to solve this. The headers sent at the start of the transfer include the 'Content-Type: text/html; charset = US-ASCII' and this is what your browser associates with a text file, opening your default text editor to view. This is what allows Adobe Acrobat files to spawn the Acrobat reader instead of getting saved to the users filesystem. I *think* that you need to alter the header to be 'unknown', but I am not sure of the specific syntax or method to accomplish. Maybe another lister can continue...? -- Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: File download results question
I figured it out... strip_tags() function did the trick . Joe Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there. I have a small php app that allows a user to download a txt file that's created 'on the fly' from a database. Everything is working great except for the actual results displayed on the file...it get results similar to the code below...it's insertng br tags (and square characters) all over the place. Could someone tell me the name of the function that removes this? Thx Joe :) Delete from databaseBRphpBR//connect to db br / $connectionToDB = odbc_connect(codesnipits, joecode, joecode); br / br / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Regular Expressions.
I'm trying to port over some Perl to PHP and have come to a string of regular expressions like this. There are probably 30 of them: $message =~ s~\[color=([\w#]+)\](.*?)\[/color\]~font color=$1$2/font~isg; $message =~ s~\[black\](.*?)\[/black\]~font color=00$1/font~isg; $message =~ s~\[white\](.*?)\[/white\]~font color=FF$1/font~isg; How can I accomplish the same in PHP? $message = preg_match (\[color=([\w#]+)\](.*?)\[/color\], font color=$1$2/font) I was thinking that is how it would be done but I am getting errors. Jeff
[PHP] Re: File download results question
[EMAIL PROTECTED] (Joe Van Meer) wrote: I figured it out... strip_tags() function did the trick . use strip_tags with caution because it removes some valid text ex: something something will be something after using strip_tags on the text. -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Regular Expressions.
$message = preg_match (~\[color=([\w#]+)\](.*?)\[/color\]~, font color=$1$2/font); try with this - Original Message - From: Jeff Lewis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 3:37 PM Subject: [PHP] Regular Expressions. I'm trying to port over some Perl to PHP and have come to a string of regular expressions like this. There are probably 30 of them: $message =~ s~\[color=([\w#]+)\](.*?)\[/color\]~font color=$1$2/font~isg; $message =~ s~\[black\](.*?)\[/black\]~font color=00$1/font~isg; $message =~ s~\[white\](.*?)\[/white\]~font color=FF$1/font~isg; How can I accomplish the same in PHP? $message = preg_match (\[color=([\w#]+)\](.*?)\[/color\], font color=$1$2/font) I was thinking that is how it would be done but I am getting errors. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Regular Expressions.
I ran into that problem also when I first tried to script with PHP. 1. preg_match(/yourexpression/,$text,$matches); always set the / at beginning and end of the regex (as you did in perl) 2. preg_match(/\[/, this won't match the char [ because of the double-quotes () it escapes the [-char only one-time (don't know how to say that) to get it working as you know it from perl you have to escape it twice: preg_match(/\\[/... 3. AFAIK the pattern-modifier /g is always set! Use the LIMIT parameter to avoid /g there have been some more problems during my transition, but I don't remember all of them... read the user comments on the documention on php.net, they are very helpful hope I could help Stefan Rusterholz, [EMAIL PROTECTED] -- interaktion gmbh Stefan Rusterholz Zürichbergstrasse 17 8032 Zürich -- T. +41 1 253 19 55 F. +41 1 253 19 56 W3 www.interaktion.ch -- - Original Message - From: Jeff Lewis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:37 PM Subject: [PHP] Regular Expressions. I'm trying to port over some Perl to PHP and have come to a string of regular expressions like this. There are probably 30 of them: $message =~ s~\[color=([\w#]+)\](.*?)\[/color\]~font color=$1$2/font~isg; $message =~ s~\[black\](.*?)\[/black\]~font color=00$1/font~isg; $message =~ s~\[white\](.*?)\[/white\]~font color=FF$1/font~isg; How can I accomplish the same in PHP? $message = preg_match (\[color=([\w#]+)\](.*?)\[/color\], font color=$1$2/font) I was thinking that is how it would be done but I am getting errors. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] exporting
hey guys.. does anyone have any ideas on how to export information from a mysql database to microsoft word, excel, access, note pad or any other such application? There is a class on http://phpclasses.upperdesign.com/ That allows you to create a excel file from php. Should be fairly straightforward to pull the info using php and right to Excel file using the class Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Error Code for fsockopen()??? What it mean?
Hi! I use this script and I recieve an error code, what does this mean in english? I can understand the 0 or the 1, but 2 fsockopen (HOSTNAME, $errno, $errstr) or die($errno: $errstr); Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] WXFEED Weather Script
I am trying to locate a script called WXFEED by John Sanders. The only place this script seems to be located is on hotscripts but the link no longer works. So if any one has downloaded it and still has it around I would appreciate it if I could get a copy. Thank You Brian Paulson Sr. Web Developer [EMAIL PROTECTED] http://www.chieftain.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: File download results question
Is there another way to do this...I'd like to be able to display html code on my php pages (code examples) Thx Joe Henrik Hansen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... [EMAIL PROTECTED] (Joe Van Meer) wrote: I figured it out... strip_tags() function did the trick . use strip_tags with caution because it removes some valid text ex: something something will be something after using strip_tags on the text. -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] WXFEED Weather Script
I would like it as well. --- Brian Paulson [EMAIL PROTECTED] wrote: I am trying to locate a script called WXFEED by John Sanders. The only place this script seems to be located is on hotscripts but the link no longer works. So if any one has downloaded it and still has it around I would appreciate it if I could get a copy. Thank You Brian Paulson Sr. Web Developer [EMAIL PROTECTED] http://www.chieftain.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] = Dan McCullough --- Theres no such thing as a problem unless the servers are on fire! h: 603.444.9808 w: McCullough Family w: At Work __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Multiple Entry SELECT and JavaScript interaction
I have a curious problem that I don't have a clue how to solve that's probably simple but I can't find it documented anywhere. It might be the first PHP-induced limitation I've run into... In order to allow multiple entry on a SELECT form object, the name of the form has to end with the brackets [], but then when I do that I can't refer to it from within JavaScript because as a variable name it becomes illegal. I have to be able to refer to the SELECT object to change its contents based on another form object. I've tried all kinds of things to work around this, but I'm stuck. Any ideas out there? Thanks, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Display Problemo
I have a small php app that I'm building to display, insert, edit, etc... various types of code snipits (asp, php, html, etc...) in a db. I also have a download option that creates a text file with the code that they've selected. I have 2 problems...the first is that when I go to view the text file I have all sorts of BR tags within the text, this is due to the nl2br function I used prior to the db insertion. How would I get rid of those? The seond problem is when a user goes to view an html code example on the webpage, say with a hyperlink, the hyperlink is made active replacing the code with the actual a href tag. Thx in advance, Lerp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: kill a session...
session_start(); /unset any session variables session_unset(islogged); /kill the session session_destroy(); HTH Joe:) Romeo Manzur [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Somebody know how to kill a session when a user left the page??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] using php exec command
Hi, I would like to know how to use the exec command to assign a new system users. I have sent out this questions so many times, but doesn't get any reply. Does It means this is ridiculous to assign a new system user using PHP EXEC command. Thank you for your attentions, Mark Lo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] RE :[PHP] Multiple Entry SELECT and JavaScript interaction
In order to allow multiple entry on a SELECT form object, the name of the form has to end with the brackets [], but then when I do that I can't refer to it from within JavaScript because as a variable name it becomes illegal. I have to be able to refer to the SELECT object to change its contents based on another form object. Instead of referring in javascript to the select by name refer by reference ie: document.form[0].elements[1].selected Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Display Problemo
I see 2 possibilities to go and 1 warning: 1th way to go: you insert another field into your db called originalCode for example where you insert the code also but don't modify it at all. If someone wants to download the code you fetch the code from that field 2th way to go: you stay with only 1 field holding the code snippet and you don't change the code when inserting but you use nl2br when displaying. Needs a bit more processing time (I don't think it's a lot) but needs less disk space than 1th way warning: don't try to get rid of BR tags or other things afterwards because you could run into unsolvable problems (what when a coder has BR in his code? You could destroy it!) I hope I could help Stefan Rusterholz, [EMAIL PROTECTED] -- interaktion gmbh Stefan Rusterholz Zürichbergstrasse 17 8032 Zürich -- T. +41 1 253 19 55 F. +41 1 253 19 56 W3 www.interaktion.ch -- - Original Message - From: Lerp [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 5:27 PM Subject: [PHP] Display Problemo I have a small php app that I'm building to display, insert, edit, etc... various types of code snipits (asp, php, html, etc...) in a db. I also have a download option that creates a text file with the code that they've selected. I have 2 problems...the first is that when I go to view the text file I have all sorts of BR tags within the text, this is due to the nl2br function I used prior to the db insertion. How would I get rid of those? The seond problem is when a user goes to view an html code example on the webpage, say with a hyperlink, the hyperlink is made active replacing the code with the actual a href tag. Thx in advance, Lerp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Display Problemo
1. what do you want the br tags to be? a simple str_replace('br','',$text) will strip the tags... 2. use pre html text /pre jack Lerp wrote: I have a small php app that I'm building to display, insert, edit, etc... various types of code snipits (asp, php, html, etc...) in a db. I also have a download option that creates a text file with the code that they've selected. I have 2 problems...the first is that when I go to view the text file I have all sorts of BR tags within the text, this is due to the nl2br function I used prior to the db insertion. How would I get rid of those? The seond problem is when a user goes to view an html code example on the webpage, say with a hyperlink, the hyperlink is made active replacing the code with the actual a href tag. Thx in advance, Lerp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Multiple Entry SELECT and JavaScript interaction
You can't use brackets in this case. The Javascript won't reconize the name of the form element. Try using another caracter that can be reconized, like underscore. Sean Dougherty [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a curious problem that I don't have a clue how to solve that's probably simple but I can't find it documented anywhere. It might be the first PHP-induced limitation I've run into... In order to allow multiple entry on a SELECT form object, the name of the form has to end with the brackets [], but then when I do that I can't refer to it from within JavaScript because as a variable name it becomes illegal. I have to be able to refer to the SELECT object to change its contents based on another form object. I've tried all kinds of things to work around this, but I'm stuck. Any ideas out there? Thanks, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] language.variables.predefined.php
Good day, refering to /manual/en/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: \|/ $PHP_SELF
If you just need the filename of the include file you can set it in code by assigning it to a variable at design time. Something like $ThisPage = include.php. You could also do this for the entire path, but it would need to be changed whenever you put the script in a different place. Fred Gerry Figueroa Anadon [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Any Ideas as to how I could be able to acomplish this? or How could I get the path of the main page and pass it on to the included file for processing?. thanks! Fred wrote: $PHP_SELF will always give the name and path of the main file, even if the variable is set in an included file. The reason is that the included file is included before the variable is evaluated. Fred -- Gerry Figueroa Dynamic Intermedia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Multiple Entry SELECT and JavaScript interaction
I almost forgot that... you can refer to the form element by the objects array, like this: document.form[0].elements[1].value Sean Dougherty [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a curious problem that I don't have a clue how to solve that's probably simple but I can't find it documented anywhere. It might be the first PHP-induced limitation I've run into... In order to allow multiple entry on a SELECT form object, the name of the form has to end with the brackets [], but then when I do that I can't refer to it from within JavaScript because as a variable name it becomes illegal. I have to be able to refer to the SELECT object to change its contents based on another form object. I've tried all kinds of things to work around this, but I'm stuck. Any ideas out there? Thanks, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] language.variables.predefined.php
(Hey, bug in Evolution. Hope it works now.) Good Day, refering to /manual/en/language.variables.predefined.php you write If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $HTTP_*_VARS arrays. This feature should be used with care, and turned off if possible; if it should be used with care, you should introduce the apache variables from a few lines above as elements of the $HTTP_SERVER_VARS array, not as global variables. Markus Bertheau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] AddType x-httpd-php to Root Directory Fouls Authentication
Why would Apache foul up authentication requests when the following .htaccess file is placed in my root directory: AddType application/x-httpd-php html All users who enter any subdirectory with a .htaccess authentication requirement get a 401 error instead of the pop-up authentication request they should get (I use authmysql). The same thing happens if I try changing my Apache httpd.conf from: ErrorDocument 401 /needacct.html to ErrorDocument 401 /needacct.php Otherwise, PHP seems to be running without a hitch, doing a beautiful job as always. I've been running my same configuration for a year and a half without a problem, but I just tried doing this switch and ran into a wall. I also use the exact same .htaccess in some subdirectories without a problem -- the .html files are processed. I've been hammering at this for a day and really can't see where the error could be -- it's just too simple. I'm running: Apache/1.3.12 -- AuthMySQL/2.20 -- PHP/4.0.0 -- mod_ssl/2.6.4 -- OpenSSL/0.9.5a -- Debian kernel 2.2.16-RAID I know I should upgrade, but I've checked the various changelogs and haven't seen anything related. I've seen others with 404 redirects to PHP files, so this is most likely a problem on my end, but I'm at a loss where to look. Any suggestions? Thanks for any assist. Regards, Jeff Hill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: DATE Questions
Alright. I was recently writting an attendance application for a school. I wanted to beable to display attendance information from mysql in a calendar, but I did not want to have to write the calendar script from scratch. I must have looked at thirty or so calendar scripts before I found this one: http://www.stevenrebello.f2s.com/ . I chose this calendar because it looks nice, but is very simple and does not contain a bunch of stuff I don't need. I rewrote the script as a function and changed it to fit my needs. I will include the source here so that you can see how I made it work with mysql. There are two places where I made changes. First, you can see that I changed the code for generating the links to last month and next month. You will need to do this in order to pass the correct variables to the page that contains the function. I then added the code for priting my dadabase information. Most of the code for formatting the data for each day is in a seperate function that gets called once for each day on the calendar. You will notice that I have the database code in there twice. This is because I did things a little differently for the current day. This is not necessary, but you will have to rearrange the code a bit if you still want to highlight the current day. Good Luck. function AttendanceCalendar($mon,$year,$Student,$Class) { global $dates, $first_day, $start_day, $Attend; $first_day = mktime(0,0,0,$mon,1,$year); $start_day = date(w,$first_day); $res = getdate($first_day); $month_name = $res[month]; $no_days_in_month = date(t,$first_day); file://If month's first day does not start with first Sunday, fill table cell with a space for ($i = 1; $i = $start_day;$i++) $dates[1][$i] = ; $row = 1; $col = $start_day+1; $num = 1; while($num=31) { if ($num $no_days_in_month) break; else { $dates[$row][$col] = $num; if (($col + 1) 7) { $row++; $col = 1; } else $col++; $num++; }//if-else }//while $mon_num = date(n,$first_day); $temp_yr = $next_yr = $prev_yr = $year; $prev = $mon_num - 1; $next = $mon_num + 1; file://If January is currently displayed, month previous is December of previous year if ($mon_num == 1) { $prev_yr = $year - 1; $prev = 12; } file://If December is currently displayed, month next is January of next year if ($mon_num == 12) { $next_yr = $year + 1; $next = 1; } echo TABLE BORDER=\1\ WIDTH=\100%\ CELLSPACING=\0\ BORDERCOLOR=\cc\; echo \nTR ALIGN='center'TD BGCOLOR='white' . A HREF=\$PHP_SELF?Module=StudentStudent=$StudentClass=$Classmonth=$prevye ar=$prev_yr\ STYLE=\text-decoration: none\B/B/A /TD. TD COLSPAN=5 BGCOLOR='cc'BFONT Color='ff'.date(F,$first_day). .$temp_yr./B/FONT/TD. TD BGCOLOR='white' . A HREF=\$PHP_SELF?Module=StudentStudent=$StudentClass=$Classmonth=$nextye ar=$next_yr\ STYLE=\text-decoration: none\B/B/A /TD/TR; echo \nTR ALIGN='center'TDBSun/B/TDTDBMon/B/TDTDBTue/B/TD; echo TDBWed/B/TDTDBThu/B/TDTDBFri/B/TDTDBSat/B/TD /TR; echo TRTD COLSPAN=7 /TRTR ALIGN='center'; $end = ($start_day 4)? 6:5; for ($row=1;$row=$end;$row++) { for ($col=1;$col=7;$col++) { if ($dates[$row][$col] == ) $dates[$row][$col] = ; if (!strcmp($dates[$row][$col], )) $count++; $t = $dates[$row][$col]; file://If date is today, highlight it if (($t == date(j)) ($mon == date(n)) ($year == date(Y))) { file://echo \nTD BGCOLOR='cc'.$t./TD; echo \nTD bgcolor=\cc\;//.(($t == )? nbsp; :$t)./TD; $Result = mysql_query(SELECT Attend, Credit, Date FROM Attendance WHERE StudentID = \$Student\ AND SectionNo = \$Class\ AND MONTH(Date) = \$mon\ AND YEAR(Date) = \$year\ AND DAYOFMONTH(Date) = \$t\, MakeConn()) or die (mysql_error()); if (mysql_num_rows($Result) 0) { $DataRow = mysql_fetch_assoc($Result); extract ($DataRow); PrintDay($Attend,$Credit,$t,$mon,$year); mysql_free_result($Result); } echo /TD;} else { if ($t == ) { echo \nTD; echo /TD; }else{ file://If the date is absent ie after 31, print space echo \nTD width=\60\ height=\60\;//.(($t == )? nbsp; :$t)./TD; $Result = mysql_query(SELECT Attend, Credit, Date FROM Attendance WHERE StudentID = \$Student\ AND SectionNo = \$Class\ AND MONTH(Date) = \$mon\ AND YEAR(Date) = \$year\ AND DAYOFMONTH(Date) = \$t\, MakeConn()) or die (mysql_error()); if (mysql_num_rows($Result) 0) { $DataRow = mysql_fetch_assoc($Result); extract ($DataRow); PrintDay($Attend,$Credit,$t,$mon,$year); mysql_free_result($Result); } else { echo $t; } echo /TD;}} }// for -col if (($row + 1) != ($end+1)) echo /TR\nTR
Re: [PHP] floating point exception after php 4 upgrade on raq 2
Paul Schreiber [EMAIL PROTECTED] wrpte snip snip From /var/log/httpd/error: [Mon Nov 19 19:53:19 2001] [notice] child pid 30261 exit signal Floating point exception (8) # uname -a Linux www 2.0.34 #1 Thu Feb 25 21:04:19 PST 1999 mips unknown # gcc -v Reading specs from /usr/lib/gcc-lib/mipsel-redhat-linux/egcs-2.90.27/specs gcc version egcs-2.90.27 980315 (egcs-1.0.2 release) /snip snip What's going on / how do I fix this / what other information do you need? I believe it's related to a documented bug in PHP on the mips processor. Before you do ./configure edit line 105 in the PHP source distro of ext/standard/crypt.c and change it to: php_srand(time(0) * getpid() * (php_combined_lcg() * 1.0)); I've upgraded Apache/PHP/MySQL dozens (maybe hundreds) of times from sourrce on the RaQ1/2 so if you still have problems after that let me know. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySQL and GROUP BY
David Freeman [EMAIL PROTECTED] wrote: SELECT * FROM My_Table ORDER BY Business_Name, Last_Name, First_Name; What I would _like_ to have happen is that the select list will end up sorted by business name as well as last name and then first name. At the moment this query is resulting in all business names (sorted) and then, following all business names, all last/first names (also sorted). I want them all integrated into a single alphabetical list. This is really an SQL question so the MySQL mailing list would have been a better place to ask, but... You need to do an IF() to check whether to use Business_Name or a combo of Last_Name/First_Name, then you need to join Last_Name/First_Name if Business_Name is empty and name the column something and order by that column. SELECT IF( Business_Name'', 'Business_Name', CONCAT( Last_Name, ', ', First_Name ) ) AS mylist FROM My_Table ORDER BY mylist -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: DATE Questions
Fred thanks a lot, you really helped me out! Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -Oorspronkelijk bericht- Van: Fred [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 20 november 2001 18:18 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Re: DATE Questions Alright. I was recently writting an attendance application for a school. I wanted to beable to display attendance information from mysql in a calendar, but I did not want to have to write the calendar script from scratch. I must have looked at thirty or so calendar scripts before I found this one: http://www.stevenrebello.f2s.com/ . I chose this calendar because it looks nice, but is very simple and does not contain a bunch of stuff I don't need. I rewrote the script as a function and changed it to fit my needs. I will include the source here so that you can see how I made it work with mysql. There are two places where I made changes. First, you can see that I changed the code for generating the links to last month and next month. You will need to do this in order to pass the correct variables to the page that contains the function. I then added the code for priting my dadabase information. Most of the code for formatting the data for each day is in a seperate function that gets called once for each day on the calendar. You will notice that I have the database code in there twice. This is because I did things a little differently for the current day. This is not necessary, but you will have to rearrange the code a bit if you still want to highlight the current day. Good Luck. function AttendanceCalendar($mon,$year,$Student,$Class) { global $dates, $first_day, $start_day, $Attend; $first_day = mktime(0,0,0,$mon,1,$year); $start_day = date(w,$first_day); $res = getdate($first_day); $month_name = $res[month]; $no_days_in_month = date(t,$first_day); file://If month's first day does not start with first Sunday, fill table cell with a space for ($i = 1; $i = $start_day;$i++) $dates[1][$i] = ; $row = 1; $col = $start_day+1; $num = 1; while($num=31) { if ($num $no_days_in_month) break; else { $dates[$row][$col] = $num; if (($col + 1) 7) { $row++; $col = 1; } else $col++; $num++; }//if-else }//while $mon_num = date(n,$first_day); $temp_yr = $next_yr = $prev_yr = $year; $prev = $mon_num - 1; $next = $mon_num + 1; file://If January is currently displayed, month previous is December of previous year if ($mon_num == 1) { $prev_yr = $year - 1; $prev = 12; } file://If December is currently displayed, month next is January of next year if ($mon_num == 12) { $next_yr = $year + 1; $next = 1; } echo TABLE BORDER=\1\ WIDTH=\100%\ CELLSPACING=\0\ BORDERCOLOR=\cc\; echo \nTR ALIGN='center'TD BGCOLOR='white' . A HREF=\$PHP_SELF?Module=StudentStudent=$StudentClass=$Classmonth=$prevye ar=$prev_yr\ STYLE=\text-decoration: none\B/B/A /TD. TD COLSPAN=5 BGCOLOR='cc'BFONT Color='ff'.date(F,$first_day). .$temp_yr./B/FONT/TD. TD BGCOLOR='white' . A HREF=\$PHP_SELF?Module=StudentStudent=$StudentClass=$Classmonth=$nextye ar=$next_yr\ STYLE=\text-decoration: none\B/B/A /TD/TR; echo \nTR ALIGN='center'TDBSun/B/TDTDBMon/B/TDTDBTue/B/TD; echo TDBWed/B/TDTDBThu/B/TDTDBFri/B/TDTDBSat/B/TD /TR; echo TRTD COLSPAN=7 /TRTR ALIGN='center'; $end = ($start_day 4)? 6:5; for ($row=1;$row=$end;$row++) { for ($col=1;$col=7;$col++) { if ($dates[$row][$col] == ) $dates[$row][$col] = ; if (!strcmp($dates[$row][$col], )) $count++; $t = $dates[$row][$col]; file://If date is today, highlight it if (($t == date(j)) ($mon == date(n)) ($year == date(Y))) { file://echo \nTD BGCOLOR='cc'.$t./TD; echo \nTD bgcolor=\cc\;//.(($t == )? nbsp; :$t)./TD; $Result = mysql_query(SELECT Attend, Credit, Date FROM Attendance WHERE StudentID = \$Student\ AND SectionNo = \$Class\ AND MONTH(Date) = \$mon\ AND YEAR(Date) = \$year\ AND DAYOFMONTH(Date) = \$t\, MakeConn()) or die (mysql_error()); if (mysql_num_rows($Result) 0) { $DataRow = mysql_fetch_assoc($Result); extract ($DataRow); PrintDay($Attend,$Credit,$t,$mon,$year); mysql_free_result($Result); } echo /TD;} else { if ($t == ) { echo \nTD; echo /TD; }else{ file://If the date is absent ie after 31, print space echo \nTD width=\60\ height=\60\;//.(($t == )? nbsp; :$t)./TD; $Result = mysql_query(SELECT Attend, Credit, Date FROM Attendance WHERE StudentID = \$Student\ AND SectionNo = \$Class\ AND
[PHP] A tricky one?
Hi! I'm trying to make this form working with a mail() script. I made this form. Then the customer could write how many pizzas or hamburgers as he want. But how do I solve this without too much headache? Havent slept for days because of this problem : ) input type=text name=pizza input type=text name=chips input type=text name=hamburger script ?php /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = Order; /* message */ $message = I would like to order $?; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = From: Someone [EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] odbc with access on win2k
I just installed win2k to dual boot with 98 while I change over os's, I have a script that connects to an access 97 DB via odbc_connect, it works fine under win 98 but gives an error that it can't connect on win2000.(error follows) any ideas what I'm doing wrong, I have set up user and file dsn on the odbc applet. Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in c:\my documents\\links\hs~links.php on line 48 thanks in advance. Paul Roberts [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: A tricky one?
Thanks for answering. But this only works if the customer orders one of each. Do you know how to do it if, lets say the customer order 2 hamburgers and nothing else? Raymond Raymond LilleøDegåRd [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I'm trying to make this form working with a mail() script. I made this form. Then the customer could write how many pizzas or hamburgers as he want. But how do I solve this without too much headache? Havent slept for days because of this problem : ) input type=text name=pizza input type=text name=chips input type=text name=hamburger script ?php /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = Order; /* message */ $message = I would like to order $?; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = From: Someone [EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] include http problem
include (http://www.somesite.com/somepage.html;); Worked perfect on our unix box and our win98 machines but when we installed PHP on our Windows server it no longer worked and tottaly ignored the include unless we used the path instead like. include (somepage.html); [EMAIL PROTECTED]
RE: [PHP] Re: A tricky one?
how about... ? $message=; $header=From: $email; $to=[EMAIL PROTECTED]; $subject=burger me; while(list($var, $val) = each($HTTP_POST_VARS)) { if(($var !=email)($var !=SUBMIT)(isset($var)){$message .=$val $var were ordered \n;} } MAIL( $to, $subject, $message, $header ); ? Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 1:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: A tricky one? Thanks for answering. But this only works if the customer orders one of each. Do you know how to do it if, lets say the customer order 2 hamburgers and nothing else? Raymond Raymond LilleøDegåRd [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I'm trying to make this form working with a mail() script. I made this form. Then the customer could write how many pizzas or hamburgers as he want. But how do I solve this without too much headache? Havent slept for days because of this problem : ) input type=text name=pizza input type=text name=chips input type=text name=hamburger script ?php /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = Order; /* message */ $message = I would like to order $?; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = From: Someone [EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: DATE Questions
Glad to help. I'd be interested to know how it works out. Fred Sjoerd Van Oosten [EMAIL PROTECTED] wrote in message C9F89DA57491D511BDAF00E0180C348103BFF1@ESADM01">news:C9F89DA57491D511BDAF00E0180C348103BFF1@ESADM01... Fred thanks a lot, you really helped me out! Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -Oorspronkelijk bericht- Van: Fred [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 20 november 2001 18:18 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Re: DATE Questions Alright. I was recently writting an attendance application for a school. I wanted to beable to display attendance information from mysql in a calendar, but I did not want to have to write the calendar script from scratch. I must have looked at thirty or so calendar scripts before I found this one: http://www.stevenrebello.f2s.com/ . I chose this calendar because it looks nice, but is very simple and does not contain a bunch of stuff I don't need. I rewrote the script as a function and changed it to fit my needs. I will include the source here so that you can see how I made it work with mysql. There are two places where I made changes. First, you can see that I changed the code for generating the links to last month and next month. You will need to do this in order to pass the correct variables to the page that contains the function. I then added the code for priting my dadabase information. Most of the code for formatting the data for each day is in a seperate function that gets called once for each day on the calendar. You will notice that I have the database code in there twice. This is because I did things a little differently for the current day. This is not necessary, but you will have to rearrange the code a bit if you still want to highlight the current day. Good Luck. function AttendanceCalendar($mon,$year,$Student,$Class) { global $dates, $first_day, $start_day, $Attend; $first_day = mktime(0,0,0,$mon,1,$year); $start_day = date(w,$first_day); $res = getdate($first_day); $month_name = $res[month]; $no_days_in_month = date(t,$first_day); file://If month's first day does not start with first Sunday, fill table cell with a space for ($i = 1; $i = $start_day;$i++) $dates[1][$i] = ; $row = 1; $col = $start_day+1; $num = 1; while($num=31) { if ($num $no_days_in_month) break; else { $dates[$row][$col] = $num; if (($col + 1) 7) { $row++; $col = 1; } else $col++; $num++; }//if-else }//while $mon_num = date(n,$first_day); $temp_yr = $next_yr = $prev_yr = $year; $prev = $mon_num - 1; $next = $mon_num + 1; file://If January is currently displayed, month previous is December of previous year if ($mon_num == 1) { $prev_yr = $year - 1; $prev = 12; } file://If December is currently displayed, month next is January of next year if ($mon_num == 12) { $next_yr = $year + 1; $next = 1; } echo TABLE BORDER=\1\ WIDTH=\100%\ CELLSPACING=\0\ BORDERCOLOR=\cc\; echo \nTR ALIGN='center'TD BGCOLOR='white' . A HREF=\$PHP_SELF?Module=StudentStudent=$StudentClass=$Classmonth=$prevye ar=$prev_yr\ STYLE=\text-decoration: none\B/B/A /TD. TD COLSPAN=5 BGCOLOR='cc'BFONT Color='ff'.date(F,$first_day). .$temp_yr./B/FONT/TD. TD BGCOLOR='white' . A HREF=\$PHP_SELF?Module=StudentStudent=$StudentClass=$Classmonth=$nextye ar=$next_yr\ STYLE=\text-decoration: none\B/B/A /TD/TR; echo \nTR ALIGN='center'TDBSun/B/TDTDBMon/B/TDTDBTue/B/TD; echo TDBWed/B/TDTDBThu/B/TDTDBFri/B/TDTDBSat/B/TD /TR; echo TRTD COLSPAN=7 /TRTR ALIGN='center'; $end = ($start_day 4)? 6:5; for ($row=1;$row=$end;$row++) { for ($col=1;$col=7;$col++) { if ($dates[$row][$col] == ) $dates[$row][$col] = ; if (!strcmp($dates[$row][$col], )) $count++; $t = $dates[$row][$col]; file://If date is today, highlight it if (($t == date(j)) ($mon == date(n)) ($year == date(Y))) { file://echo \nTD BGCOLOR='cc'.$t./TD; echo \nTD bgcolor=\cc\;//.(($t == )? nbsp; :$t)./TD; $Result = mysql_query(SELECT Attend, Credit, Date FROM Attendance WHERE StudentID = \$Student\ AND SectionNo = \$Class\ AND MONTH(Date) = \$mon\ AND YEAR(Date) = \$year\ AND DAYOFMONTH(Date) = \$t\, MakeConn()) or die (mysql_error()); if (mysql_num_rows($Result) 0) { $DataRow = mysql_fetch_assoc($Result); extract ($DataRow); PrintDay($Attend,$Credit,$t,$mon,$year); mysql_free_result($Result); } echo /TD;}
[PHP] Re: include http problem
I may be wrong, but I believe that allow_url_fopen needs to be turned on in the config file for this to work. Fred Mike Webby [EMAIL PROTECTED] wrote in message 011001c171f6$26da0380$0200a8c0@nay">news:011001c171f6$26da0380$0200a8c0@nay... include (http://www.somesite.com/somepage.html;); Worked perfect on our unix box and our win98 machines but when we installed PHP on our Windows server it no longer worked and tottaly ignored the include unless we used the path instead like. include (somepage.html); [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Testing for the presence of HTML
My database contains a field which may or may not contain HTML code, depending on what a particular user enters when they enter the data. Here's the challenge: If there is HTML code in this field, then print the text with interpreted HTML. No problem at all. If there is no HTML code in the field, then I still want the data printed nice and neat; the users will probably use line returns to make their text look somewhat decent. So, assuming that $text contains the contents of this field, then what I want to do is this: if (!HTMLin$text) then $text = nl2br($text); What's the best way to check and see if HTML is present in the field? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: A tricky one?
It works after modifying it a little. BUT... :) It lists all the variables even if they aren't given any value. Is it possible to only get the defined ones? Regards Raymond Matthew Luchak [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... how about... ? $message=; $header=From: $email; $to=[EMAIL PROTECTED]; $subject=burger me; while(list($var, $val) = each($HTTP_POST_VARS)) { if(($var !=email)($var !=SUBMIT)(isset($var)){$message .=$val $var were ordered \n;} } MAIL( $to, $subject, $message, $header ); ? Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 1:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: A tricky one? Thanks for answering. But this only works if the customer orders one of each. Do you know how to do it if, lets say the customer order 2 hamburgers and nothing else? Raymond Raymond LilleøDegåRd [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I'm trying to make this form working with a mail() script. I made this form. Then the customer could write how many pizzas or hamburgers as he want. But how do I solve this without too much headache? Havent slept for days because of this problem : ) input type=text name=pizza input type=text name=chips input type=text name=hamburger script ?php /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = Order; /* message */ $message = I would like to order $?; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = From: Someone [EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: File download results question
[EMAIL PROTECTED] (Joe Van Meer) wrote: Is there another way to do this...I'd like to be able to display html code on my php pages (code examples) cant you use str_replace() or something? -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: A tricky one?
If you only want to show the ones variables that have values input by the user, you could do this with the while loop: while (list($var, $val) = each($HTTP_POST_VARS)) { if ((strlen($val) 0) ($var !=email) ($var !=SUBMIT) (isset($var)) { $message .= $val $var were ordered \n; } } This will make sure that the string length of $val (the value of the form element) is greater than 0; if not, it won't add it to the message. Joshua Hoover It works after modifying it a little. BUT... :) It lists all the variables even if they aren't given any value. Is it possible to only get the defined ones? Regards Raymond Matthew Luchak [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... how about... ? $message=; $header=From: $email; $to=[EMAIL PROTECTED]; $subject=burger me; while(list($var, $val) = each($HTTP_POST_VARS)) { if(($var !=email)($var !=SUBMIT)(isset($var)){$message .=$val $var were ordered \n;} } MAIL( $to, $subject, $message, $header ); ? Matthew Luchak Webmaster Kaydara Inc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Cookies and Variables
Consider this code, in page1.php: ?php setcookie(someWord,I am a cookie); ? ...and this code, in page2.php: ?php setcookie(someWord,$someWord); print (someWord says: $someWord); $someWord = I am a variable; print ( a href=\page2.php?someWord=$someWord\ Click here /a ); ? (In the actual code, the value of $someWord is passed via POST through a form, but the principle is the same.) The first time I load page2.php, the output should be: someWord says: I am a cookie Which, of course, works perfectly. But each subsequent time I load page2.php, I want the output to be: someWord says: I am a variable and then set the value of the cookie someWord to I am a variable. But that's not what happens. Everytime I load page2.php, someWord tells me that it is a cookie. How do I get the value of the variable to override the value of the cookie? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP Oracle9i
Is it possible to use Oci-functions with Oracle 9i database ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to detect if cookies are enable?
Does anyone know how to detect if the client browser allows cookies or not? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Testing for the presence of HTML
This may not actually be a problem. If you are expecting that users may enter links as html you can still use nl2br and get a decent result. The only time this would be a problem, would be if the users actually entered BR as they filled in the form. In my experience, it is highly unlikely that a user will write their own BR as they fill in a form, even if they do enter other html such as links. Fred Richard S. Crawford [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... My database contains a field which may or may not contain HTML code, depending on what a particular user enters when they enter the data. Here's the challenge: If there is HTML code in this field, then print the text with interpreted HTML. No problem at all. If there is no HTML code in the field, then I still want the data printed nice and neat; the users will probably use line returns to make their text look somewhat decent. So, assuming that $text contains the contents of this field, then what I want to do is this: if (!HTMLin$text) then $text = nl2br($text); What's the best way to check and see if HTML is present in the field? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Testing for the presence of HTML
If I understand the question correctly - came late to the thread - I think the easiest way to do this would be to check for the presence of / or as a minimum when the user submits the form. You could then pop up a confirmation dialog This text seems to contain HTML code is this correct? - Ah! my god, I'm advocating clippy :( ... You can then insert a boolean to mark the file according to their response. Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 4:29 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Testing for the presence of HTML Unfortunately, I also have users entering complex HTML code such as tables; which, if each tag of a table is on a separate line, renders badly with nl2br(). I mean, really badly. You have no idea. My users range from professional web developers to people who are still frightened by the idea of using a mouse. At 01:20 PM 11/20/2001, Fred wrote: This may not actually be a problem. If you are expecting that users may enter links as html you can still use nl2br and get a decent result. The only time this would be a problem, would be if the users actually entered BR as they filled in the form. In my experience, it is highly unlikely that a user will write their own BR as they fill in a form, even if they do enter other html such as links. Fred Richard S. Crawford [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... My database contains a field which may or may not contain HTML code, depending on what a particular user enters when they enter the data. Here's the challenge: If there is HTML code in this field, then print the text with interpreted HTML. No problem at all. If there is no HTML code in the field, then I still want the data printed nice and neat; the users will probably use line returns to make their text look somewhat decent. So, assuming that $text contains the contents of this field, then what I want to do is this: if (!HTMLin$text) then $text = nl2br($text); What's the best way to check and see if HTML is present in the field? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How do I convert from perl to php?
I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? - This message was sent using OlyPen's WebMail. http://www.olypen.com The original message was received at Tue, 20 Nov 2001 14:05:28 -0800 from mail.olypen.com [208.200.248.2] - The following addresses had permanent fatal errors - [EMAIL PROTECTED] (reason: 550 Host unknown) - Transcript of session follows - 550 5.1.2 [EMAIL PROTECTED]... Host unknown (Name server: lists.php.ne: host not found) Reporting-MTA: dns; relay1.olypen.com Received-From-MTA: DNS; mail.olypen.com Arrival-Date: Tue, 20 Nov 2001 14:05:28 -0800 Final-Recipient: RFC822; [EMAIL PROTECTED] Action: failed Status: 5.1.2 Remote-MTA: DNS; lists.php.ne Diagnostic-Code: SMTP; 550 Host unknown Last-Attempt-Date: Tue, 20 Nov 2001 14:05:28 -0800 ---BeginMessage--- how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? - This message was sent using OlyPen's WebMail. http://www.olypen.com ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Check contents of variable
How about: if (substr($url,0,7) http://;) $url = http://; . $url; Hi, which function would i use to check if a certain value is in the contents of a variable? I have a form where the users submits url's. I need the url with http:// in the beginning. Since there is more data after the http:// i can´t just do a simple if-statement. So what do i do? After i determined if there is a http:// in the variable or not i guess i just have to $url = http://; + $url; (?)... Regards # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | # -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: A tricky one?
Thank you very much guys! You really helped out with this one. I will sleep a lot better to night : ) Regards Raymond Matthew Luchak [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... try ($val!=) instead of (isset($var) Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 3:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: A tricky one? It works after modifying it a little. BUT... :) It lists all the variables even if they aren't given any value. Is it possible to only get the defined ones? Regards Raymond Matthew Luchak [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... how about... ? $message=; $header=From: $email; $to=[EMAIL PROTECTED]; $subject=burger me; while(list($var, $val) = each($HTTP_POST_VARS)) { if(($var !=email)($var !=SUBMIT)(isset($var)){$message .=$val $var were ordered \n;} } MAIL( $to, $subject, $message, $header ); ? Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 1:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: A tricky one? Thanks for answering. But this only works if the customer orders one of each. Do you know how to do it if, lets say the customer order 2 hamburgers and nothing else? Raymond Raymond LilleøDegåRd [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I'm trying to make this form working with a mail() script. I made this form. Then the customer could write how many pizzas or hamburgers as he want. But how do I solve this without too much headache? Havent slept for days because of this problem : ) input type=text name=pizza input type=text name=chips input type=text name=hamburger script ?php /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = Order; /* message */ $message = I would like to order $?; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = From: Someone [EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How do I convert from perl to php?
if(!(isset($name) isset($address) isset($phone)) { echo You left one empty.; } On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Check contents of variable
How about: if (substr($url,0,7) http://;) $url = http://; . $url; Thanks! That´s just the function i am looking for. I looked it up in the manual. Correct me if i am wrong - if i don´t set the second parameter in substr it just continues to read until the variable is finished? If i set it to 7 (as above) it stops reading after 7 characters? - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How do I convert from perl to php?
Try something like this: while (list($name, $value) = each($HTTP_POST_VARS)) { if ((strlen($value) 1) ($name == name || $name == address || $name == phone)) { $error .= You left $name empty br; } } if ($error) { echo $error; } That's one way to do it. Joshua Hoover I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? - This message was sent using OlyPen's WebMail. http://www.olypen.com The original message was received at Tue, 20 Nov 2001 14:05:28 -0800 from mail.olypen.com [208.200.248.2] - The following addresses had permanent fatal errors - [EMAIL PROTECTED] (reason: 550 Host unknown) - Transcript of session follows - 550 5.1.2 [EMAIL PROTECTED]... Host unknown (Name server: lists.php.ne: host not found) Reporting-MTA: dns; relay1.olypen.com Received-From-MTA: DNS; mail.olypen.com Arrival-Date: Tue, 20 Nov 2001 14:05:28 -0800 Final-Recipient: RFC822; [EMAIL PROTECTED] Action: failed Status: 5.1.2 Remote-MTA: DNS; lists.php.ne Diagnostic-Code: SMTP; 550 Host unknown Last-Attempt-Date: Tue, 20 Nov 2001 14:05:28 -0800 From: [EMAIL PROTECTED] Date: Tue Nov 20, 2001 05:08:17 PM US/Eastern To: [EMAIL PROTECTED] Subject: Converting from being a perl user how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? - This message was sent using OlyPen's WebMail. http://www.olypen.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Re: How do I convert from perl to php?
You could do something like this... there are lots of ways to validate your data... while( list($key, $value) = each($HTTP_POST_VARS) ) { if( empty($value) ) { print(Sorry, you left $key empty.); } } This is assuming the form method is POST. If it's GET, switch POST with GET above. -philip On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: So I would have to write a seperate if condition for each form input field i wanted to require? that doesn't make for a very dynamic script... if(!(isset($name) isset($address) isset($phone)) { echo You left one empty.; } On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How do I convert from perl to php?
Beauty! /mt At 02:08 PM 11/20/2001 -0800, Rasmus Lerdorf wrote: if(!(isset($name) isset($address) isset($phone)) { echo You left one empty.; } On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Process bar
Hello, I have to solve one problem - my script searches simply text document, so - if this document is big enought - i have to replace timeout of my script, besides - i have to make, that then this proceeds some kind of process bar must scroll until script finishes his job... so - any ideas ? Thnx anyway :)
Re: [PHP] Check contents of variable
Correct, the third parameter is for the number of characters to read, nothing means entire string. Function details can be found here: http://download.php.net/manual/en/function.substr.php How about: if (substr($url,0,7) http://;) $url = http://; . $url; Thanks! That´s just the function i am looking for. I looked it up in the manual. Correct me if i am wrong - if i don´t set the second parameter in substr it just continues to read until the variable is finished? If i set it to 7 (as above) it stops reading after 7 characters? - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Re: How do I convert from perl to php?
Now this looks like what I would want... brandon - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:22 PM Subject: [PHP] Re: Re: How do I convert from perl to php? You could do something like this... there are lots of ways to validate your data... while( list($key, $value) = each($HTTP_POST_VARS) ) { if( empty($value) ) { print(Sorry, you left $key empty.); } } This is assuming the form method is POST. If it's GET, switch POST with GET above. -philip On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: So I would have to write a seperate if condition for each form input field i wanted to require? that doesn't make for a very dynamic script... if(!(isset($name) isset($address) isset($phone)) { echo You left one empty.; } On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Re: How do I convert from perl to php?
What about this? $required = array('name','address','phone'); while ( list($key, $value) = each ($required) ) { if ( empty($value) ) { print(Sorry, you left $key empty.); } } - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:22 PM Subject: [PHP] Re: Re: How do I convert from perl to php? You could do something like this... there are lots of ways to validate your data... while( list($key, $value) = each($HTTP_POST_VARS) ) { if( empty($value) ) { print(Sorry, you left $key empty.); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: Re: [PHP] How do I convert from perl to php?
How about like this: $required = array(field1,field2,field3); for ($i=0;$icount($required);$i++) { $temp = $required[$i]; if (trim($$temp) == ) { echo You Missed One; continue; (break?) } } Something like that, I havn't acually tried it. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:21 PM Subject: Re: Re: [PHP] How do I convert from perl to php? So I would have to write a seperate if condition for each form input field i wanted to require? that doesn't make for a very dynamic script... if(!(isset($name) isset($address) isset($phone)) { echo You left one empty.; } On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote: I am a perl user trying to convert to php how would i turn this perl into php? use CGI; $name = param(name); $address = param(address); $phone = param(phone); @required = qw( name address phone ); foreach $key($required) { if (!$$key) { out(You left one empty.); } } ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Check contents of variable
You could also try: if(! ereg('^http://', $url)) $url = 'http://' . $url; -JAson Garber At 11:15 PM 11/20/2001 +0100, Daniel Alsén wrote: How about: if (substr($url,0,7) http://;) $url = http://; . $url; Thanks! That´s just the function i am looking for. I looked it up in the manual. Correct me if i am wrong - if i don´t set the second parameter in substr it just continues to read until the variable is finished? If i set it to 7 (as above) it stops reading after 7 characters? - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Re: Re: How do I convert from perl to php?
No, but this: $required = array('name','address','phone'); foreach( $required as $key ) { if( empty($HTTP_POST_VARS[$key]) ) { print(Sorry, you left key empty.); } } should work. On Tue, 20 Nov 2001, Brandon Lamb wrote: What about this? $required = array('name','address','phone'); while ( list($key, $value) = each ($required) ) { if ( empty($value) ) { print(Sorry, you left $key empty.); } } - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:22 PM Subject: Re: Re: How do I convert from perl to php? You could do something like this... there are lots of ways to validate your data... while( list($key, $value) = each($HTTP_POST_VARS) ) { if( empty($value) ) { print(Sorry, you left $key empty.); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Re: Re: How do I convert from perl to php?
Or.. $required = array($name,$addr,$phone); foreach($required as $x) { if(!$x) { print error; } } ~Ryan - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: Brandon Lamb [EMAIL PROTECTED] Cc: PHP List [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:37 PM Subject: [PHP] Re: Re: Re: How do I convert from perl to php? No, but this: $required = array('name','address','phone'); foreach( $required as $key ) { if( empty($HTTP_POST_VARS[$key]) ) { print(Sorry, you left key empty.); } } should work. On Tue, 20 Nov 2001, Brandon Lamb wrote: What about this? $required = array('name','address','phone'); while ( list($key, $value) = each ($required) ) { if ( empty($value) ) { print(Sorry, you left $key empty.); } } - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:22 PM Subject: Re: Re: How do I convert from perl to php? You could do something like this... there are lots of ways to validate your data... while( list($key, $value) = each($HTTP_POST_VARS) ) { if( empty($value) ) { print(Sorry, you left $key empty.); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Re: How do I convert from perl to php?
BUT, that code doesn't take into account that you may have other form parameters that you DON'T want to require. With that code below, you're requiring EVERY form element to be filled out. That's not what the original post requested. He asked for a way to require specific fields according to the way his Perl code reads. Joshua Hoover Now this looks like what I would want... brandon - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 2:22 PM Subject: [PHP] Re: Re: How do I convert from perl to php? You could do something like this... there are lots of ways to validate your data... while( list($key, $value) = each($HTTP_POST_VARS) ) { if( empty($value) ) { print(Sorry, you left $key empty.); } } This is assuming the form method is POST. If it's GET, switch POST with GET above. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Cookies and Variables
Keep it mind that EGPCS is in that order for a reason. Changing it can open up security problems... -JAson Garbr At 01:16 PM 11/20/2001 -0800, Fred wrote: If you want certain variables to over ride cookie variables you need to change the setting of the variables_order directive in php.ini: variables_order string Set the order of the EGPCS (Environment, GET, POST, Cookie, Server) variable parsing. The default setting of this directive is EGPCS. Setting this to GP, for example, will cause PHP to completely ignore environment variables, cookies and server variables, and to overwrite any GET method variables with POST-method variables of the same name. Fred Richard S. Crawford [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Consider this code, in page1.php: ?php setcookie(someWord,I am a cookie); ? ...and this code, in page2.php: ?php setcookie(someWord,$someWord); print (someWord says: $someWord); $someWord = I am a variable; print ( a href=\page2.php?someWord=$someWord\ Click here /a ); ? (In the actual code, the value of $someWord is passed via POST through a form, but the principle is the same.) The first time I load page2.php, the output should be: someWord says: I am a cookie Which, of course, works perfectly. But each subsequent time I load page2.php, I want the output to be: someWord says: I am a variable and then set the value of the cookie someWord to I am a variable. But that's not what happens. Everytime I load page2.php, someWord tells me that it is a cookie. How do I get the value of the variable to override the value of the cookie? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Conversion number two?
Here is the php version $required = array('name','address','phone'); Here is the perl version @required = qw( name address phone ); So is there an easy way in perl for us lazy people so i dont have to use commas and enter every variable name in single quotes? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: A tricky one?
Try This approach: $msg = I want to order: br; if(!empty($pizza)) { $msg .= $pizza.Pizzabr; } if(!empty($chips)) { $msg .= $chips.Chips br; } if(!empth($hamburgers)) { $msg .= $hamburgers. Hamburgersbr; } //Note: PHP has a one-line if statement, which slips my mind for the moment. You can use it, to minimize the code above. Nevetheless, the concept stays the same. /* Creates the example message I want to order: 2 pizza 4 chips 1 hamburger */ You can then send $msg as the message of the e-mail, or append it to some more text. __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com The world is waiting, are you ready? -+___+- On Tue, 20 Nov 2001, Matthew Luchak wrote: try ($val!=) instead of (isset($var) Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 3:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: A tricky one? It works after modifying it a little. BUT... :) It lists all the variables even if they aren't given any value. Is it possible to only get the defined ones? Regards Raymond Matthew Luchak [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... how about... ? $message=; $header=From: $email; $to=[EMAIL PROTECTED]; $subject=burger me; while(list($var, $val) = each($HTTP_POST_VARS)) { if(($var !=email)($var !=SUBMIT)(isset($var)){$message .=$val $var were ordered \n;} } MAIL( $to, $subject, $message, $header ); ? Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 1:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: A tricky one? Thanks for answering. But this only works if the customer orders one of each. Do you know how to do it if, lets say the customer order 2 hamburgers and nothing else? Raymond Raymond LilleøDegåRd [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I'm trying to make this form working with a mail() script. I made this form. Then the customer could write how many pizzas or hamburgers as he want. But how do I solve this without too much headache? Havent slept for days because of this problem : ) input type=text name=pizza input type=text name=chips input type=text name=hamburger script ?php /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = Order; /* message */ $message = I would like to order $?; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = From: Someone [EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Conversion number two?
Brandon Lamb [EMAIL PROTECTED] wrote: Here is the php version $required = array('name','address','phone'); Here is the perl version @required = qw( name address phone ); So is there an easy way in perl for us lazy people so i dont have to use commas and enter every variable name in single quotes? I think you mean PHP not perl, but there is a way. $required = explode( ' ', 'name address phone' ); The code above turns the space separated list into an array. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Conversion number two?
perhaps you want to do the following: function foo($str) { return explode(' ',$str); } $required = foo('name address phone'); regards, Philip Olson On Tue, 20 Nov 2001, Brandon Lamb wrote: Here is the php version $required = array('name','address','phone'); Here is the perl version @required = qw( name address phone ); So is there an easy way in perl for us lazy people so i dont have to use commas and enter every variable name in single quotes? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] A new exchange launches: Yachts boats for sale or charter, holidays afloat and more....
If you have any interest in yachting, boats, sailing or holidays afloat... Visit www.yacht-search.net the new international boat yacht charter sales system - FREE OF CHARGE FOR ALL USERS... Free advertising or enquires using $1.5 Million USD (£1M) of technology! CREATING NEW MARKETS WITH SEARCH MATCH SOFTWARE FROM SEARCH PLC (Brokers / owners / charterers) (We have been given your email address as someone who may be interested in the boating business; This email is a one off but if you have no interest in yachts or shipping and would like to be 100% sure that you will never receive an email from us again please simply mail [EMAIL PROTECTED] and type remove in the subject line - we apologize for bothering you.)
[PHP] textarea, carriage returns and formatting
Hi, Something ive been trying to find out but cant seem to get the wording right to find the answers in the archives. What I have is a mysql database, and in that DB I have a field which is just a 'text' field. What I want to be able to do is write whatever text is typed from the webforms textarea into the 'text' field, formatting in tact. For example if this was typed into a textarea -- This is some text ive typed I have some single and double carriage returns in there, and I want it to keep the formatting -- When I pull it back out of the DB, I want to be able to display it back in a textarea with the carriage returns in place exactly as it was typed in. Can anyone point me in the right direction. Is there a php function which can convert/reconvert on the display from/insert to the database, or am I missing something totally with this. Thanks Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Setting title via included file
I have a page that includes a file in the middle, but I wish to set the title of the page based on a variable set in the included file-- is this possible? PHP processes the page sequentially, so if I have $foo = Title in the included file, it is too late to use it for the title of the main document. I thought output buffering might be the key, but it doesn't seem to work. Should it? Basically, I was doing this for the output buffering: *** function fixtitle($buffer) { return (str_replace(XXX, $pagetitle, $buffer)); } ob_start(fixtitle); ? html titleXXX/title ... ? include(file_that_sets_pagetitle.inc) ? ... ?php ob_end_flush(); ? c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] auto form submit
hi all, if i pass data through a form (post) to a php script(script must be separate from form) is there a way that this php script can then forward that data to another script without attaching it to the end of the url? thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Cookies and Variables
$HTTP_COOKIE_VARS['someWord']; $HTTP_GET_VARS['someWord']; :P Mike Richard S. Crawford wrote: Consider this code, in page1.php: ?php setcookie(someWord,I am a cookie); ? ...and this code, in page2.php: ?php setcookie(someWord,$someWord); print (someWord says: $someWord); $someWord = I am a variable; print ( a href=\page2.php?someWord=$someWord\ Click here /a ); ? (In the actual code, the value of $someWord is passed via POST through a form, but the principle is the same.) The first time I load page2.php, the output should be: someWord says: I am a cookie Which, of course, works perfectly. But each subsequent time I load page2.php, I want the output to be: someWord says: I am a variable and then set the value of the cookie someWord to I am a variable. But that's not what happens. Everytime I load page2.php, someWord tells me that it is a cookie. How do I get the value of the variable to override the value of the cookie? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Address Standardization
Hello, Does anyone have a good function or ideas about address standardization? I need some form of it in a web-app I am trying to write, but I don't know where to begin. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] auto form submit
When POST data is sent to a page, it's as if somebody typed the text into a textarea and hit a submit button. Even though this is being done programmatically, the POST method will behave the same. SOmebody in their (your)code will have to write something similiar to: $postData = xVar= . rawurlencode( ?xml version=\1.0\sometag value=\some value\/xml ); PostToHost( http://www.domain.com; /phpfile.php, $postData ); then your script would access that XML data through the HTTP_POST_VARS['xVar'] or $xVar as normal /* not my function, found on some PHP site */ function PostToHost( $host, $path, $data_to_send ) { $cRetVal = ; $fp = fsockopen( $host, 80 ); fputs( $fp, POST $path HTTP/1.1\n ); fputs( $fp, Host: $host\n ); fputs( $fp, Content-type: application/x-www-form-urlencoded\n ); fputs( $fp, Content-length: . strlen($data_to_send) . \n ); fputs( $fp, Connection: close\n\n ); fputs( $fp, $data_to_send ); while( !feof( $fp )) { $cRetVal .= fgets( $fp, 128 ); } fclose( $fp ); return $cRetVal; } XML file is text file. If I open the file with php like call $fp, that is a long string with some special char. post method can send a long string to the server. how php can receive that long string is my problem. if can do that, php can parser the xml file send form remote computer. I want php parser the SOAP message -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com Johan Holst Nielsen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I think you understand my problem. I will use a client program to POST the XML data to a php file on the server base HTTP in php file will get the post request, the question is, how can i get the xml data in post request Hmm, I dont think I understand? Where do you want to do with the XML? Cant you just make a echo() in a xml document? please explain? ?xml version='1.0'? ... ... ?php echo $xmldatavar; ? ... ... ... Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] odbc with access on win2k
Paul, Use a System DSN. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Paul Roberts [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 1:48 PM To: [EMAIL PROTECTED] Subject: [PHP] odbc with access on win2k I just installed win2k to dual boot with 98 while I change over os's, I have a script that connects to an access 97 DB via odbc_connect, it works fine under win 98 but gives an error that it can't connect on win2000.(error follows) any ideas what I'm doing wrong, I have set up user and file dsn on the odbc applet. Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in c:\my documents\\links\hs~links.php on line 48 thanks in advance. Paul Roberts [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mail() function
I am new to PHP. I am trying to specify the email address in the From field. Right now it gives me my host name. Can anyone help? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail() function
@mail( [EMAIL PROTECTED], $subject, $body, From: $fromemail\nContent-Type: text/plain; charset=\windows-1250\ ); - Original Message - From: Ben Clumeck [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 21. studeni 2001 01:58 Subject: [PHP] mail() function I am new to PHP. I am trying to specify the email address in the From field. Right now it gives me my host name. Can anyone help? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail() function
@mail( [EMAIL PROTECTED], $subject, $body, From: $fromemail); - Original Message - From: Avdija A. Ahmedhodziæ [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 21. studeni 2001 02:06 Subject: Re: [PHP] mail() function @mail( [EMAIL PROTECTED], $subject, $body, From: $fromemail\nContent-Type: text/plain; charset=\windows-1250\ ); - Original Message - From: Ben Clumeck [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 21. studeni 2001 01:58 Subject: [PHP] mail() function I am new to PHP. I am trying to specify the email address in the From field. Right now it gives me my host name. Can anyone help? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail() function
See: http://www.php.net/manual/en/function.mail.php an example lives there. The key here is that additional headers, such as From: will go in the optional additional_headers parameter. Regards, Philip Olson On Tue, 20 Nov 2001, Ben Clumeck wrote: I am new to PHP. I am trying to specify the email address in the From field. Right now it gives me my host name. Can anyone help? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Authenticating Users with their Windows Login
Hi, First of all, my apologies if this question has been asked earlier. I am in a hurry and I haven't checked the archives (Actually, I am in the process of doing it but am trying to cover all the bases). I know that PHP has functions which will allow Users to be authenticated off a NIS Server or a LDAP server. Will it be possible to do something similar in PHP with the User IDs and Passwords stored in a NT or Windows 2000 server? I would appreciate it very much if anyone could point me to resources that could help me or share some sample scripts :) :) Thanks in Advance, Feroze === Jar Jar Binks will be Jedi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]