[PHP] Working with files
Hello! If I have a text file like; FindThisBeginning Here goes several text... FindThisEnd FindThisOtherBeginning Here goes other text... FindThisOtherEnd and so on... How can I retrieve the portion of the text between those kind of tags (FindThisBeginning, FindThisEnd, etc), and transfer them into variables or arrays? Thanks Teo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and drop down boxes
hi... i have a few things i need and dont know where to go to get some ideas/examples of how to do some things: 1. i need to know how to take info from a mysql db load it into a dropdown box and then select as the default choice whatever value was in the db: i.e. i have a combo box with the month/year. the drop down boxes option values for the month and year are numbers: for the month 1-12 and for the year: 2004-2038. now when lets say i have the variables: $edit['Month'] and $edit[Year'] which hold month/year values from the db...now how would i make those variables the default select choice in the combo boxes?? 2. i need to make a combo box of jan-dec and view all. the values for the drop down box will be 1-12 and 0 (0 is for view all). now the combo box will need to go to a db search for all relevant records on the month selected and show them on a page (the only catche is the combo box needs to be visible on all pages)... anybody know where i can go to find out how to do all of this?? any searches i tried to do all come back with loading dynamic content into a box but i dont need that...they never talk about making a default selected state with php and stuff... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload progress
Eric Wood wrote: - Original Message - I posted about this the other day. I was directed to look at megaupload http://www.raditha.com/megaupload/ It works pretty well, I believe it uses Apache::Request to get the raw post info. I recently began to use megaupload, it relies on perl cgi to measure the bits, then hands it off to your regular file copy($_FILES[]) script. Kind of tricky to get in place to a real website but not bad. The one thing is that you might have to add a BASE HREF=xxx tag your upload script since cgi-bin is changed as the relative dir and image links will break. But my customers really love the progress bar. -eric wood Thanks for the comments. As someone mentioned earlier, since access to raw post data is not available to php this will have to do for the moment. :-) -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and drop down boxes
Well, here's the long way of doing it that I ended up using! For my 'tournament' date (for a football web site) I have three stored values: $tournamentDay, $tournamentMonth, $tournamentYear which are evaluated for each drop-down. I might work on a neater solution actually! Cheers Richard tr thTournament Date : /th tdselect name=tournamentDay option/option ?php for ($i = 1; $i = 31; $i++) { $day = sprintf(%02d, $i); if ($day == $tournamentDay) { echo(option selected$day/option\n); } else { echo(option$day/option\n); } } ? /select select name=tournamentMonth option/option ?php $months = array(, January, February, March, April, May, June, July, August, September, October, November, December); for ($i = 1; $i = 12; $i++) { $month = sprintf(%02d, $i); if ($month == $tournamentMonth) { echo(option value=\$month\ selected . $months[$i] . /option); } else { echo(option value=\$month\ . $months[$i] . /option); } } ? /select select name=tournamentYear option/option ?php for ($i = 2001; $i = 2005; $i++) { if ($i == $tournamentYear) { echo(option selected$i/option\n); } else { echo(option$i/option\n); } } ? /select /td /tr -Original Message- From: Andy B [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 07:38 To: [EMAIL PROTECTED] Subject: [PHP] php and drop down boxes hi... i have a few things i need and dont know where to go to get some ideas/examples of how to do some things: 1. i need to know how to take info from a mysql db load it into a dropdown box and then select as the default choice whatever value was in the db: i.e. i have a combo box with the month/year. the drop down boxes option values for the month and year are numbers: for the month 1-12 and for the year: 2004-2038. now when lets say i have the variables: $edit['Month'] and $edit[Year'] which hold month/year values from the db...now how would i make those variables the default select choice in the combo boxes?? 2. i need to make a combo box of jan-dec and view all. the values for the drop down box will be 1-12 and 0 (0 is for view all). now the combo box will need to go to a db search for all relevant records on the month selected and show them on a page (the only catche is the combo box needs to be visible on all pages)... anybody know where i can go to find out how to do all of this?? any searches i tried to do all come back with loading dynamic content into a box but i dont need that...they never talk about making a default selected state with php and stuff... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regular expression
hey, professionals out there: i need to write a parser for an email-header to retrieve the email of the 'To:'-field. there are 2 possibilities: 'To: [EMAIL PROTECTED]' or 'To: first foo [EMAIL PROTECTED]' i would only need the email-adress! does anyone know the regular expression that can handle both possibilities? (i give up!) thanx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zlib.output_compression - Problem
Hi everybody, I initially posted this on a german php-list, then i tried on php-install on php.net but did not get one single answer yet. I hope there is somebody on this list that can help me: I am having a problem with zlib-compression-settings in php.ini and the sending of 'normal' files with handcrafted headers that i can't pin down. As it should not be my code (worked well on other servers) i hope this is the right list for it. I am currently using php4.3.4 on a Apache 1.3.26, both compiled myself on a debian woody-server (compiled php with --with-zlib=/usr/local where it was found). My initial problem was, that on our website i am using phpCMS (some templatesystem) and it does have a function to use gzip-compression on all webpages it produces which used to work fine on a different server. Now on this server as long as i have zlib.output_compression activated in php.ini it takes nearly half a minute for the server to create and send a small html-file. This is also the case if i tell phpCMS to not use gzip-compression - possibly a error in that templatesystem? Well i don't really need that so i deactivated zlib.output-compression in php.ini so now our website is as fast as expected again. BUT: On the server i also have our intranet. There i produce some pdfs (using fpdf) and also sometimes just create a textfile and want it to be sent for downloading (VCS-Files are Calendarentries that are simple Textfiles). Both don't work anymore if accessed with the Internet Explorer - they still work with Opera. (IE tells the user it cannot find the page). Unfortunately all our users have IE, so whenever somebody needs some pdf or vcs created they come to me ;( The relevant part in fpdf as well as in my scripts is: snip if (!empty($HTTP_USER_AGENT) (strpos($HTTP_USER_AGENT, 'MSIE 5.5') || strpos($HTTP_USER_AGENT, 'Opera'))) { header('Content-Type: application/dummy'); } else { header('Content-Type: application/octet-stream'); } header('Content-Length: ' . strlen($text)); header('Content-Disposition: attachment;filename=urlaub.vcs'); echo $text; /snip So as you can see there is no mentioning of compression there, i don't have any idea why this should not work with IE and zlib.output_compression off. I would allready be thankful for hints were to start looking for pinpointing the Problem. -- Mike Beck mike.beck_at_ibmiller.de www.ibmiller.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regular expression
preg_match(/To: ([^]+)?([^]+)??/i,$string,$matches); returns email in $matches[1] in the first instance and name in $matches[1] and email in $matches[2] in the second. -Original Message- From: Robert Kornfeld [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 09:32 To: [EMAIL PROTECTED] Subject: [PHP] regular expression hey, professionals out there: i need to write a parser for an email-header to retrieve the email of the 'To:'-field. there are 2 possibilities: 'To: [EMAIL PROTECTED]' or 'To: first foo [EMAIL PROTECTED]' i would only need the email-adress! does anyone know the regular expression that can handle both possibilities? (i give up!) thanx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Legal Disclaimer:- Internet communications are not secure and therefore the Barclays Group does not accept legal responsibility for the contents of this message. Although the Barclays Group operates anti-virus programmes, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Barclays Group. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons. Barclays Bank PLC trading as Shopsmart from Barclaycard. Registered Office: 54 Lombard Street London EC3P 3AH Registered in England, Registration No. 1026167. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expression
Alright, first of all, in E-Mail Headers every param needs to be written in a seperate line, therefore following will work even with multiple recipients: $recipients = array(); $header = explode( \n , $header ); foreach ( $header AS $param ) { $param = trim ( $param ); if ( strtolower( substr( $param , 0 , 3 ) ) == 'to:' ) { $recipients[] = trim ( substr( $param , 3 ) ); } } This will match every of these: 'TO:[EMAIL PROTECTED]' ' TO: [EMAIL PROTECTED]' ' TO:Mr Baz [EMAIL PROTECTED]' ' TO:[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]' etc. pp -- red PS: I'm not sure about wether 'TO :' is allowed or not - sad thing :-) Am Mittwoch, 7. April 2004 11:28 schrieb Simon Hayward: preg_match(/To: ([^]+)?([^]+)??/i,$string,$matches); returns email in $matches[1] in the first instance and name in $matches[1] and email in $matches[2] in the second. -Original Message- From: Robert Kornfeld [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 09:32 To: [EMAIL PROTECTED] Subject: [PHP] regular expression hey, professionals out there: i need to write a parser for an email-header to retrieve the email of the 'To:'-field. there are 2 possibilities: 'To: [EMAIL PROTECTED]' or 'To: first foo [EMAIL PROTECTED]' i would only need the email-adress! does anyone know the regular expression that can handle both possibilities? (i give up!) thanx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Legal Disclaimer:- Internet communications are not secure and therefore the Barclays Group does not accept legal responsibility for the contents of this message. Although the Barclays Group operates anti-virus programmes, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Barclays Group. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons. Barclays Bank PLC trading as Shopsmart from Barclaycard. Registered Office: 54 Lombard Street London EC3P 3AH Registered in England, Registration No. 1026167. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assign mysql query to a variable first or not
Hello Andy, Wednesday, April 7, 2004, 4:09:59 AM, you wrote: AB is it better to give the mysql query string to a variable AB instead of directly doing it with mysql_query? AB i.e. AB $query=select * from table;//is this a better way? AB $query=mysql_query(select * from table);//or is this way AB //better? AB mysql_query(select * from table);//not a good idea i dont think... Most people here probably use some kind of database abstraction layer already (ADOdb, a Pear lib, or a home-grown one, etc). While you are not doing this at the moment, if you hold the query in a string before passing to MySQL it means you could implement a database handler in the future with minimal code changes and not have to re-do every single query. There are other benefits, but that one strikes me as the most important at the moment. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assign mysql query to a variable first or not
One of the greatest benefits is the fact, that you can easily display your actual query without copying it, passing it to a variable and then display it's content: $result = mysql_query( ); would first become: $var = ; $result = mysql_query( ); echo $var ; now if the query fails, you have to rewrite the Query, copy it to the variable again etc. pp When doing $var = . ; $result = mysql_query( $var ); echo $var ; you just have to rewrite one query instead of two. This way of working only helps you to debug a little faster. [...] AB is it better to give the mysql query string to a variable AB instead of directly doing it with mysql_query? AB i.e. AB $query=select * from table;//is this a better way? AB $query=mysql_query(select * from table);//or is this way AB //better? AB mysql_query(select * from table);//not a good idea i dont think... Most people here probably use some kind of database abstraction layer already (ADOdb, a Pear lib, or a home-grown one, etc). While you are not doing this at the moment, if you hold the query in a string before passing to MySQL it means you could implement a database handler in the future with minimal code changes and not have to re-do every single query. There are other benefits, but that one strikes me as the most important at the moment. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP security in a hosting environment
hi. one of my clients whom we host a website for has expressed interest in writing their own php/mySQL applications for their site. i've been looking in to the security implications of offering this service. My concerns are that the client *could* use a php script to access parts of the file system, registry (this is a Win32 environment), or other such things. I found a good article at http://www.securityfocus.com/infocus/1706 - it details some of the settings in the php config that can be used to prevent malicious scripting. Does anyone here have experience of securing a php server, and might have any advice on what else to watch out for? Any help appreciated. Thanks. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Validating form field text input to be a specific v ariable type
On 07 April 2004 03:03, [EMAIL PROTECTED] wrote: From: Merritt, Dave [EMAIL PROTECTED] Okay seems to makes sense, but when I do the following it doesn't appear to be working correctly, or I'm viewing my logic incorrectly one: if ( (int)$PageOptions['Default'] == $PageOptions['Default'] ) { This works: if(strcmp((int)$PageOptions['Default'],$PageOptions['Default'])==0) This does too: if ((string)(int)$PageOptions['Default'] === $PageOptions['Default']) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] confused big time
On Tue, 2004-04-06 at 20:09, Chris W. Parker wrote: Chris W. Parker on Tuesday, April 06, 2004 5:01 PM said: let me expand both of my points in an attempt to be more verbose. 1. write readable queries. 2. always put single quotes around array keys. $array['key'] here is how i would write your query: ?php $sql = insert into $EventsTable values( NULL , '{$_SESSION['add']['type]}' , '{$_SESSION['add']['start_date']}' , '{$_SESSION['add']['end_date']}' , '{$_SESSION['add']['name']}' , '{$_SESSION['add']['county']}' , '{$_SESSION['add']['discription']}' , '{$_SESSION['add']['StartingDay']}' , '{$_SESSION['add']['StartingMonth']}' , '{$_SESSION['add']['StartingYear']}' , '{$_SESSION['add']['EndingDay']}' , '{$_SESSION['add']['EndingMonth']}' , '{$_SESSION['add']['EndingYear']}'; $sql = insert into $GuestbookTable values( NULL , '{$_SESSION['add']['date']}' , '{$_SESSION['add']['name']}' , '{$_SESSION['add']['email']}' , '{$_SESSION['add']['website']}' , '{$_SESSION['add']['referred']}' , '{$_SESSION['add']['comments']}'); I don't advise this type of insert query. If you ever add a new field to the table all of your queries will break since this style requires ordered matching of values to table fields for every field in the table. You should use the field names in the query: $sql = INSERT INTO $guestbookTable ( field1, field2, field3 ) VALUES ( '$value1', '$value2', '$value3' ) ; Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: assign mysql query to a variable first or not
[EMAIL PROTECTED] (Andy B) wrote in news:[EMAIL PROTECTED]: hi... is it better to give the mysql query string to a variable instead of directly doing it with mysql_query? i.e. $query=select * from table;//is this a better way? $query=mysql_query(select * from table);//or is this way //better? mysql_query(select * from table);//not a good idea i dont think... It's useful for debugging - you can then just echo your query and in conjunction with mysql_error() determine where problems lie. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP security in a hosting environment
My suggestion would be to run the PHP Web Server on a different server to where you are retrieving your files. The file server can then define its own polices of what you can read/write to etc. Your web server can then map a drive to the file server, and anybody writing PHP scripts won't be able to modify read-only scripts. Hope that's clear! Richard -Original Message- From: Ben Joyce [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 11:30 To: [EMAIL PROTECTED] Subject: [PHP] PHP security in a hosting environment hi. one of my clients whom we host a website for has expressed interest in writing their own php/mySQL applications for their site. i've been looking in to the security implications of offering this service. My concerns are that the client *could* use a php script to access parts of the file system, registry (this is a Win32 environment), or other such things. I found a good article at http://www.securityfocus.com/infocus/1706 - it details some of the settings in the php config that can be used to prevent malicious scripting. Does anyone here have experience of securing a php server, and might have any advice on what else to watch out for? Any help appreciated. Thanks. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stuck with simple query..... Plz have a look
[snip] We have two tables [/snip] Please do not cross-post, send only to the list where needed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specific variable type
Instead of doing a lot of casting, you can use is_numeric() to see if a variable is a number or a numeric string. -William El mar, 06-04-2004 a las 14:19, John W. Holmes escribió: Well, if (int)$string == $string, then the value is an integer. Same for (float)$string == $string for a real number. Boolean would be easy, just strtolower($string) as compare to 1, 0, 'true', or 'false'. Date/time validation will probaby require a regular expression or breaking it up to validate days/month, etc. That can get a little hairy. If they say text, well, anything goes, right? Maybe just make sure it's not empty()? Let me know if you need more details. There are probably a ton of different ways to do this. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
From: William Lovaton [EMAIL PROTECTED] Instead of doing a lot of casting, you can use is_numeric() to see if a variable is a number or a numeric string. Yeah, but the OP wanted to be able to tell an integer from a real number from a string. is_numeric() is going to validate 5, 5.5, and 5.05E6, for example. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP security in a hosting environment
Ben Joyce wrote: hi. one of my clients whom we host a website for has expressed interest in writing their own php/mySQL applications for their site. i've been looking in to the security implications of offering this service. My concerns are that the client *could* use a php script to access parts of the file system, registry (this is a Win32 environment), or other such things. If you are really concerned about security you should not be in a shared hosting enviorenment. Seconly you may want to switch to a more secure operating system. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP security in a hosting environment
From: Ben Joyce [EMAIL PROTECTED] one of my clients whom we host a website for has expressed interest in writing their own php/mySQL applications for their site. i've been looking in to the security implications of offering this service. My concerns are that the client *could* use a php script to access parts of the file system, registry (this is a Win32 environment), or other such things. What web server are you going to use? Either way, PHP runs as a specific user (IUSR_computer_name with IIS, for example). This user shouldn't be able to access anything in the filesystem except what's in the webroot (ensure this is true for your machine). This assumes an NTFS filesystem, btw. In order to protect things under the webroot, that's where safe_mode, openbasedir, etc, come into play as explained in the article you linked to. You're right to be concerned, but it can be done safely. In addition to all of the above, get something IN WRITING stipulating what the user is allowed to do, terms of service, etc. That way if you catch them doing something, you'll be safe legally to go after them. IANAL ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error messages configuration
Hi all! I would like to know if it is possible to change the format of error and warning messages that PHP shows. Now my error notifications look like: [Fatal error | Warning | ...]: error in file on line line. It would be helpful for me that those messages included some additional information, like the output of print_r(debug_backtrace()). Is there any way to change those messages? Thank you, Germán -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error messages configuration
From: Germán M. Rivera [EMAIL PROTECTED] I would like to know if it is possible to change the format of error and warning messages that PHP shows. Now my error notifications look like: [Fatal error | Warning | ...]: error in file on line line. It would be helpful for me that those messages included some additional information, like the output of print_r(debug_backtrace()). Is there any way to change those messages? You can use set_error_handler() to capture and reformat some of them. http://us2.php.net/manual/en/function.set-error-handler.php Note: The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and E_COMPILE_WARNING. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Validating form field text input to be a specificvariable type
Hello John, Wednesday, April 7, 2004, 2:05:22 PM, you wrote: JWH Yeah, but the OP wanted to be able to tell an integer from a real number JWH from a string. is_numeric() is going to validate 5, 5.5, and 5.05E6, for JWH example. What about is_integer() ? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Graphical Map of My Web Site
Hi Gang, I'm looking for a way to produce a graphical walk of my web site (ie following the links around). Does anybody know anything free I can use to do this? I also have an area that you login to, which then stores a session ID value, so how would I get over that element?! Cheers Richard == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. ==
RE: [PHP] Re: Weird variable issue encountered... help needed!
Thanks again everyone for your assistance. I found an un-related bug in the PHP bugs database here: http://bugs.php.net/bug.php?id=18648 (which was for an earlier version than 4.3.4, which I was running) and applied that band-aid patch to some of the places where this was happening, and it seemed to fix the problem. I also upgraded to php 4.3.5 and have not seen the problem since. Thanks again everyone! Regards, Geoff Varosky -Original Message- From: Ben Ramsey [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 3:58 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Weird variable issue encountered... help needed! Just don't use register globals and use if ($_POST) instead of if($action=='post') so you don't have to include that ?action=post in the query string of your action. Dvdmandt wrote: Accutually, I intented ?action=post, and if($action=='post'), just forgot to add method=post.. :p -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] smarty
I use Smarty for most of my commericial and non commercial websites, it makes it very easy to share and re-use code because the appliciation logic is separate from the presentation logic. It also makes it possible to encode the scripts using Zend Encoder, Turck MMCache or similar projects which leaving the site owner the ability to change their template files where encoding scripts that contained the HTML inline would make this impossible. I use PHPDocumentor to give them API documentation so they can add additional pages, functionality to their site whether it has been encoded or not. It also keeps people out of where they shouldn't be (for example users tend to introduce parse errors when editing PHP files) and gives them an easy to understand interface to their site. I also use Smarty template caching, and end user caching and output compression, resulting in lightening fast websites for the user on most internet connections. I've tried other templating engines including FastTemplate and haven't been as impressed as I am with Smarty, of course the power comes with the price that you are slowing execution slightly but the increased development speed and other benefits usually outweigh the costs in my case. Jason -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 9:33 AM To: [EMAIL PROTECTED] Subject: [PHP] smarty hi all has anyone used smarty before? what do you think of it? I think it's pretty nice to seperate your script (code) from your design. i would like to hear your comments and if you have any alternatives let me know. Angelo Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphical Map of My Web Site
Hawkes, Richard wrote: Hi Gang, I'm looking for a way to produce a graphical walk of my web site (ie following the links around). Does anybody know anything free I can use to do this? I also have an area that you login to, which then stores a session ID value, so how would I get over that element?! If I am the intended recipient for this message this is the answer. If i am not the intended recipient please ignore my answer: Answer follows: If you are trying to simulate the effects of a user browsing through your site - check out the jakarta jmeter. If you also want to play this back 'graphically' you need a very expensive software if you are on windows but you can use the recorder if you are on a linux desktop. (in this case you don't need jmeter). Cheers Richard == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == you might want to leave this out from newsgroup/message board postings. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] large file uploads
Hello! Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. Thanks, Arthur Looking for a job!? Use the smart search engine!! Find a Job from Millions WorldWide... http://search.jobsgrabber.com
Re: Re[2]: [PHP] Validating form field text input to be a specificvariable type
Hi, El mi? 07-04-2004 a las 08:38, Richard Davey escribió: Hello John, Wednesday, April 7, 2004, 2:05:22 PM, you wrote: JWH Yeah, but the OP wanted to be able to tell an integer from a real number JWH from a string. is_numeric() is going to validate 5, 5.5, and 5.05E6, for JWH example. What about is_integer() ? No way, it checks for data types too and it won't match because the data in the $_REQUEST is always a string. is_integer(5) will always be false. is_integer(5) will return true -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] large file uploads
[snip] Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. [/snip] http://us3.php.net/features.file-upload The manual is your fried, read it, love it, use it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Arthur Radulescu wrote: Hello! Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. http://www.radinks.com/upload/config.php will tell you all the parameters that you need to change. http://www.raditha.com/megaupload/upload.php will tell you how to get past the upload restrictions if you don't have access to the php.ini file. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Jay Blanchard wrote: [snip] Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. [/snip] http://us3.php.net/features.file-upload The manual is your fried, read it, love it, use it. And it is served with a heaping serving of home fries, and covered with a delicious white country gravy. (Low calorie fried manuals available upon request). Sorry...couldn't resist. ;) -- *** * _ __ __ __ _ * John Nichel * * | |/ /___ __ \ \/ /__ _ _| |__ ___ __ ___ _ __ * 716.856.9675 * * | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ ' \ * 737 Main St. * * |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150 * * |___/ * Buffalo, NY * * http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] large file uploads
[snip] ...fried... And it is served with a heaping serving of home fries, and covered with a delicious white country gravy. (Low calorie fried manuals available upon request). Sorry...couldn't resist. ;) [/snip] Thanks, I needed that! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
El mi? 07-04-2004 a las 08:05, John W. Holmes escribió: From: William Lovaton [EMAIL PROTECTED] Instead of doing a lot of casting, you can use is_numeric() to see if a variable is a number or a numeric string. Yeah, but the OP wanted to be able to tell an integer from a real number from a string. is_numeric() is going to validate 5, 5.5, and 5.05E6, for example. well, an integer is a float too, the real problem is when you type 5.5 in a variable that is expected to be integer. In this case is_numeric() won't do the trick. May be using regexps ([0-9]) will be enough to check integer values but I think it is a bit slower. It is always better to use native functions instead of regexps where possible. -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. Arthur - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: John Nichel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 5:05 PM Subject: RE: [PHP] large file uploads [snip] ...fried... And it is served with a heaping serving of home fries, and covered with a delicious white country gravy. (Low calorie fried manuals available upon request). Sorry...couldn't resist. ;) [/snip] Thanks, I needed that! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] large file uploads
[snip] I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. [/snip] Did you restart your web server? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Yes I restarted the server and then the computer... No success... The page timeouts after a while but the file does not gets uploaded Arthur Looking for a job!? Use the smart search engine!! Find a Job from Millions WorldWide... http://search.jobsgrabber.com - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Arthur Radulescu [EMAIL PROTECTED]; John Nichel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 5:12 PM Subject: RE: [PHP] large file uploads [snip] I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. [/snip] Did you restart your web server? !DSPAM:40740ae1152691248315722! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] large file uploads
[snip] Yes I restarted the server and then the computer... No success... The page timeouts after a while but the file does not gets uploaded [/snip] Please trim your replies, and please do not top post. Can we see your upload code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
The code is below (pieces of it). The folders have write permissions. It works just fine with smaller files but nothing happens with larger files if(!is_uploaded_file($_FILES['file']['tmp_name'])){ $ERR['file']=1; } if(!sizeof($ERR)){ $try=copy_file($_FILES['file']['tmp_name'], $TO_FILE); // copy_file makes the upload using copy or move_uploaded_file if($try==copy_err){ echo copy_err; } else{ echo copy_success; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
An RegExp will work but is not as fast as native functions, but you could use something like: $len1 = strlen ( $input ); $len2 = strspn ( $input , 1234567890,. ); if ( $len1 == $len2 ) { echo 'yuuhooo'; } else { echo 'd\'oh'; } [...] From: William Lovaton [EMAIL PROTECTED] Instead of doing a lot of casting, you can use is_numeric() to see if a variable is a number or a numeric string. Yeah, but the OP wanted to be able to tell an integer from a real number from a string. is_numeric() is going to validate 5, 5.5, and 5.05E6, for example. well, an integer is a float too, the real problem is when you type 5.5 in a variable that is expected to be integer. In this case is_numeric() won't do the trick. May be using regexps ([0-9]) will be enough to check integer values but I think it is a bit slower. It is always better to use native functions instead of regexps where possible. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] radio buttons checked or not
hi... i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
On Wednesday 07 April 2004 22:14, Arthur Radulescu wrote: The code is below (pieces of it). The folders have write permissions. It works just fine with smaller files but nothing happens with larger files 1) What are your upload-related settings in php.ini? 2) Have you enabled FULL error reporting? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Uniforms only come in two sizes, too small and too large -- Murphy's Bush Fire Brigade Laws n6 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] radio buttons checked or not
[snip] i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... [/snip] Check for the value assigned to each if(Annual == $_POST['eventtype']){ ... do stuff ... } elseif(OneTime == $_POST['eventtype']){ ... do other stuff ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] smarty
Kelly Hallman said: Going even one step further (the beauty of Smarty: always another level), just extend the Smarty object itself. Then, instead of making all your templates includes other templates (such as a header or a footer), you can make your overall page be a template, and the extended Smarty object can be given extra functionality to control the page: {* MyPage.tpl -- Smarty template for the entire page *} ...header... {include file=$content} ...footer... // mypage.php -- extended Smarty object class MyPage extends Smarty { var $tmpl = 'MyPage.tpl'; function render($x) { $this-assign('content',$x); $this-display($this-tmpl); } } // actualphpcode.php -- called by the browser $pt = new MyPage; $pt-render('pagecontent.tpl'); Sorry, I'm feeling better now but still don't understand what you're telling me/us. Could you please expound? What functionality does this afford? /dev/idal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
I guess that works but every possible solution posted in this thread is a lot of lines of code to perform a simple validation. PHP should offer/modify the appropriate API to do this. I remember that is_numeric() didn't exist before. Something like: is_float_string(mixed value) or modify is_numeric() to explictly perform an integer validation: is_numeric(mixed value [, bool is_integer = false]) is_numeric(5.5, true) == false, 5.5 is not an integer string is_numeric(10, true) == true May be filing a bug report will do the trick. ;-) -William El mi? 07-04-2004 a las 10:25, Red Wingate escribió: An RegExp will work but is not as fast as native functions, but you could use something like: $len1 = strlen ( $input ); $len2 = strspn ( $input , 1234567890,. ); if ( $len1 == $len2 ) { echo 'yuuhooo'; } else { echo 'd\'oh'; } [...] From: William Lovaton [EMAIL PROTECTED] Instead of doing a lot of casting, you can use is_numeric() to see if a variable is a number or a numeric string. Yeah, but the OP wanted to be able to tell an integer from a real number from a string. is_numeric() is going to validate 5, 5.5, and 5.05E6, for example. well, an integer is a float too, the real problem is when you type 5.5 in a variable that is expected to be integer. In this case is_numeric() won't do the trick. May be using regexps ([0-9]) will be enough to check integer values but I think it is a bit slower. It is always better to use native functions instead of regexps where possible. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons checked or not
From: Andy B [EMAIL PROTECTED] i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... Assuming $old['Type'] somehow comes from $_REQUEST['eventtype'] (or is related to it), then yeah, that'll work. Another way: $checked[$old['Type']] = ' checked'; echo input type=\radio\ name=\eventtype\ value=\Annual\ {$checked['Annual']}Yes; echo input type=\radio\ name=\eventtype\ value=\OneTime\ {$checked['OneTime']}No; This method works even better when you have an array('Annual' = 'Yes', 'OneTime' = 'No') that you use to build the checkboxes. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validating form field text input to be aspecificvariable type
[snip] May be filing a bug report will do the trick. ;-) [/snip] Maybe filing a feature request would be better, since this is not a bug. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be aspecificvariable type
From: William Lovaton [EMAIL PROTECTED] I guess that works but every possible solution posted in this thread is a lot of lines of code to perform a simple validation. PHP should offer/modify the appropriate API to do this. I remember that is_numeric() didn't exist before. Something like: is_float_string(mixed value) or modify is_numeric() to explictly perform an integer validation: is_numeric(mixed value [, bool is_integer = false]) is_numeric(5.5, true) == false, 5.5 is not an integer string is_numeric(10, true) == true May be filing a bug report will do the trick. ;-) Don't add more bloat to the code. Don't be afraid of actually using a couple of lines to accomplish something instead of demanding a built-in function. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); //later in the code i have this: while($old=mysql_fetch_array($query)){ //do stuff } when i run the page i get: warning: supplied argument to mysql_fetch_array is not a valid mysql resource type on line 98 im lost i wrote this code hundreds of times and it always works... the query looks right : echo $EditQuery; output: select * from rnjresort.events where Id='1' and that is exactly what i want (i ran that exact string in mysql client) and it gave me what i was looking for... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] smarty
From: Chris de Vidal [EMAIL PROTECTED] Kelly Hallman said: Going even one step further (the beauty of Smarty: always another level), just extend the Smarty object itself. Then, instead of making all your templates includes other templates (such as a header or a footer), you can make your overall page be a template, and the extended Smarty object can be given extra functionality to control the page: {* MyPage.tpl -- Smarty template for the entire page *} ...header... {include file=$content} ...footer... // mypage.php -- extended Smarty object class MyPage extends Smarty { var $tmpl = 'MyPage.tpl'; function render($x) { $this-assign('content',$x); $this-display($this-tmpl); } } // actualphpcode.php -- called by the browser $pt = new MyPage; $pt-render('pagecontent.tpl'); Sorry, I'm feeling better now but still don't understand what you're telling me/us. Could you please expound? What functionality does this afford? If I can take first shot, since this was posted to the list... :) It's basically a wrapper around Smarty to automatically load the header-content-footer template and dynamically fill in the content based on what's passed to render. So, displaying all of your different pages would be as simple as: $pt = new MyPage; $pt-render('contact.tpl'); $pt -render('prices.tpl'); $pt-render('index.tpl'); etc... The wrapper automatically loads the master template with the header and footer, and then replaces the {content} tag with the content of the appropriate template that render() was passed. Just one method of many. If I'm interpreting it right, that is. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
[snip] i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); [/snip] You forgot the connection string arguement in mysql_query -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
On Wednesday 07 April 2004 22:56, Andy B wrote: i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); //later in the code i have this: while($old=mysql_fetch_array($query)){ //do stuff } when i run the page i get: warning: supplied argument to mysql_fetch_array is not a valid mysql resource type on line 98 Apparently $query contains something invalid, find out what it is and WHY. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* It's hard to think of you as the end result of millions of years of evolution. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons checked or not
Assuming $old['Type'] somehow comes from $_REQUEST['eventtype'] (or is related to it), then yeah, that'll work. no its coming from a db result from fetch_array() of which im having an interesting problem with right now but thats in another post -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
Andy B wrote: i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); //later in the code i have this: while($old=mysql_fetch_array($query)){ //do stuff } when i run the page i get: warning: supplied argument to mysql_fetch_array is not a valid mysql resource type on line 98 im lost i wrote this code hundreds of times and it always works... the query looks right : echo $EditQuery; output: select * from rnjresort.events where Id='1' and that is exactly what i want (i ran that exact string in mysql client) and it gave me what i was looking for... Did you select a database to run you query on? -- *** * _ __ __ __ _ * John Nichel * * | |/ /___ __ \ \/ /__ _ _| |__ ___ __ ___ _ __ * 716.856.9675 * * | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ ' \ * 737 Main St. * * |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150 * * |___/ * Buffalo, NY * * http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Merge 2 XML files using PHP 4
Hello all, Does anyone here add some good experience of writing PHP script which is merging 2 XML files. example: --- file 1: = XML NODE name=aaa value=old_value / NODE name=bbb value=hello all / /XML file 2: = XML NODE name=aaa value=NEW_value / NODE name=ccc value=PHP_is_good / /XML expected merge result: === XML NODE name=aaa value=NEW_value / NODE name=bbb value=hello all / NODE name=ccc value=PHP_is_good / /XML Thanks, Gal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
From: Andy B [EMAIL PROTECTED] i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); //later in the code i have this: while($old=mysql_fetch_array($query)){ //do stuff } when i run the page i get: warning: supplied argument to mysql_fetch_array is not a valid mysql resource type on line 98 You must be overwriting $query somewhere before you use it in mysql_fetch_array(). Do a var_dump() on $query just before you try to retrieve rows from it. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can I get varaibles from an include file without exectuting it?
I have a script that is run with a cronjob and would like to fetch some variables from it, using another file, without the script executing. I could resort to putting the variables in a third file, or reading the script as a text file and reconstructing the variables. But, I was hoping there is a better way. Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can I get varaibles from an include file without exectuting it?
pipe the infomation from the script that is run by crond directly into the second script at run-time Dave -Original Message- From: Al [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 4:13 PM To: [EMAIL PROTECTED] Subject: [PHP] Can I get varaibles from an include file without exectuting it? I have a script that is run with a cronjob and would like to fetch some variables from it, using another file, without the script executing. I could resort to putting the variables in a third file, or reading the script as a text file and reconstructing the variables. But, I was hoping there is a better way. Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
[snip] i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); [/snip] You forgot the connection string arguement in mysql_query even after putting in my standard mysql_connect(.) stuff it still fails now the interesting thing here: normally i can do any mysql valid functions in php and append ||die(//whatever); after it... but for some really odd reason mysql_query has a fit when i do that and for some reason it thinks im appending the litteral string warning: to the query itself... anybody know why that is or what the deal is... i had to modify the query set to read: mysql_connect(...)||die(mysql_error())//works $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery);//||die(mysql_error()) //taken out (bug or something??) mysql_error();//have no clue why its even there it will //never get ran... im running php 4.3.3 if it makes any difference on that part -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] update mysql from php web page
Daniel Clark [EMAIL PROTECTED] wrote on 04/06/2004 03:27:34 PM: I think you need a WHERE clause for the UPDATE, otherwise it will update ALL the records. e.g. WHERE OwnerName='$result' Then perhaps a redirect to another page. Thanks for the reminder. I set that, and found the problem that caused the page to not load at all - no closing double-quote on the update statement. Now the page loads properly but when I press the submit button nothing happens, it's a dead button. -- if(isset($submit)): $query1 = update warranty set VesselName='$vessel',OwnerName='$owner',OwnerStreet='$address',OwnerCity='$city',OwnerState='$state',OwnerZip='$zip',OwnerCountry='$country',DateInstalled='$DateInstalled',DealerName='$Dealer',DealerStreet='$DealerAddress',DealerCity='$DealerCity',DealerState='$DealerState',DealerZip='$DealerZip',DealerCountry='$DealerCountry',Model='$Parts',SN='$PartsSN',VesselType='$vesseltype',VesselLength='$length',InstalledOn='$construction',VesselTypeOther='$vesseltypeother') where OwnerName = $OwnerName; $result1 = mysql_query($query1); mysql_query($query1); else: $query = select * from warranty WHERE OwnerName='$result'; $results = mysql_query($query); $row = mysql_fetch_array($results); ? ... lots of code ... pcenterinput type=submit name=submit value=Update Data/center/p ... more code ... /table ? endif; ? /body /html - I don't see any reason for the submit button to not work at all. What should I look for now? Thanks for the help, Chip I probably need to use if(isset($submit)): and an update statement, but my attempt just causes the web page to display completely blank. This is what I tried - if(isset($submit)): $query1 = update warranty set VesselName='$vessel',OwnerName='$owner',OwnerStreet='$address', OwnerCity='$city',OwnerState='$state',OwnerZip='$zip', OwnerCountry='$country',DateInstalled='$DateInstalled', DealerName='$Dealer',DealerStreet='$DealerAddress', DealerCity='$DealerCity',DealerState='$DealerState', DealerZip='$DealerZip',DealerCountry='$DealerCountry', Model='$Parts',SN='$PartsSN',VesselType='$vesseltype', VesselLength='$length',InstalledOn='$construction', VesselTypeOther='$vesseltypeother') ; $result1 = mysql_query($query1); mysql_query($query1); else: $query = select * from warranty WHERE OwnerName='$result'; $results = mysql_query($query); $row = mysql_fetch_array($results); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
* Thus wrote William Lovaton ([EMAIL PROTECTED]): or modify is_numeric() to explictly perform an integer validation: is_numeric(mixed value [, bool is_integer = false]) um.. ctype_digit(). Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I get varaibles from an include file without exectuting it?
From: Al [EMAIL PROTECTED] I have a script that is run with a cronjob and would like to fetch some variables from it, using another file, without the script executing. I could resort to putting the variables in a third file, or reading the script as a text file and reconstructing the variables. But, I was hoping there is a better way. Put them in a third file. It's obvious they're needed for more than one script. Save yourself the headache and separate them. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] warning:supplied argument to mysql_fetch_array not valid resource type?
On Wednesday 07 April 2004 23:16, Andy B wrote: anybody know why that is or what the deal is... i had to modify the query set to read: mysql_connect(...)||die(mysql_error())//works $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery);//||die(mysql_error()) //taken out (bug or something??) mysql_error();//have no clue why its even there it will //never get ran... im running php 4.3.3 if it makes any difference on that part Please post the *full* and *concise* code which illustrates your problem. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* It's a funny thing that when a woman hasn't got anything on earth to worry about, she goes off and gets married. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP based Voice Chat Module
Hello everyone, I was wondering if anyone has used any PHP/MySQL based voice chat system. (for MAC OS X Platform) thanks in advance Pushpinder -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be aspecificvariable type
That's not bloat. And using a lot of lines of code to do a simple validation like this is not fun. -William El mi? 07-04-2004 a las 09:54, John W. Holmes escribió: Don't add more bloat to the code. Don't be afraid of actually using a couple of lines to accomplish something instead of demanding a built-in function. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stuck with simple query..... Plz have a look
We have two tables Table1: - ID |Name 1 |name1 2 |name2 3 |name3 4 |name4 Table2: --- PL | PC |PA| Description --- 1| 2 | 4| Some description for Project 1 2| 3 | 1| Some description for Project 2 1| 2 | 4| Some description for Project 3 4| 1 | 3| Some description for Project 4 3| 1 | 4| Some description for Project 5 2| 3 | 1| Some description for Project 6 I need the output like.. - PL-Name| PC-Name| PA-Name - name1 | name2 |name4 name2 | name3 |name1 name1 | name2 |name4 name4 | name1 |name3 name3 | name1 |name4 name2 | name3 |name1 Please guide me how can i achieve this kind of result set. Regards, Tariq
RE: [PHP] warning:supplied argument to mysql_fetch_array not vali d resource type?
On 07 April 2004 15:56, Andy B wrote: i have this query set: $EditQuery=select * from $EventsTable where Id='$edit'; $query=mysql_query($EditQuery)||die(mysql_error()); Don't use || for this, use or -- they have different precedence, and it *matters*. //later in the code i have this: while($old=mysql_fetch_array($query)){ //do stuff } Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
Hi Curt, El mi? 07-04-2004 a las 10:29, Curt Zirzow escribió: * Thus wrote William Lovaton ([EMAIL PROTECTED]): or modify is_numeric() to explictly perform an integer validation: is_numeric(mixed value [, bool is_integer = false]) um.. ctype_digit(). Very nice! it works fine. The only issue is that it will return true if the parameter is an empty string (). Nothing that an empty() can't fix. -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validating form field text input to be a specificvariab le type
On 07 April 2004 15:48, William Lovaton wrote: I guess that works but every possible solution posted in this thread is a lot of lines of code to perform a simple validation. Uh -- how are: if(strcmp((int)$PageOptions['Default'],$PageOptions['Default'])==0) if ((string)(int)$PageOptions['Default'] === $PageOptions['Default']) a lot of lines of code? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Arthur Radulescu wrote: I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. The error message is in your log file. Arthur -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Merge 2 XML files using PHP 4
Gal wrote: Hello all, Does anyone here add some good experience of writing PHP script which is merging 2 XML files. Looks like this should go into an algorithms mailing list :-) in the mean time you might want to start looking at sax parser functions, and associated arrays in the php manual. file 1: = XML NODE name=aaa value=old_value / NODE name=bbb value=hello all / /XML file 2: = XML NODE name=aaa value=NEW_value / NODE name=ccc value=PHP_is_good / /XML expected merge result: === XML NODE name=aaa value=NEW_value / NODE name=bbb value=hello all / NODE name=ccc value=PHP_is_good / /XML -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP based Voice Chat Module
Pushpinder Singh wrote: Hello everyone, I was wondering if anyone has used any PHP/MySQL based voice chat system. (for MAC OS X Platform) What kind of voice chat are you talking about? are you refering to one user saying something into the microphone that the other users hears? If so php is not the best way to do it. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] confused big time
I always found this way of inserting data into a database messy. Here is a handy function to do array inserts and it builds the sql for you. function arrayINSERT($a,$tablename) { $sql = INSERT INTO $tablename (; foreach($a as $key = $value) { $sql .= $key .,; } $sql[strlen($sql)-1] = ')'; $sql .= VALUES (; foreach($a as $key = $value) { if (gettype($value) == 'string') { $sql .= '. addslashes($value) .',; } else { $sql .= $value .,; } } $sql[strlen($sql)-1] = ')'; return $sql; } if you do this : $a['field1'] = $blah; $a['field2'] = $here; $a['field3'] = $etc; $sql = arrayINSERT($a,tablename); it builds the sql statement for you. It covers 99.9% of the inserts your likely to need. I use an update and insert function like this all the time. :-) Mark Richard Davey wrote: $sql = INSERT INTO tablename ( field1, field2, field3 ) VALUES ( '$blah', $here', '$etc' ) ; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Merge 2 XML files using PHP 4
Raditha Dissanayake wrote: Gal wrote: Hello all, Does anyone here add some good experience of writing PHP script which is merging 2 XML files. Looks like this should go into an algorithms mailing list :-) in the mean time you might want to start looking at sax parser functions, and associated arrays in the php manual. I will check the SAX functions. I know PHP very well. But I think that there is a lake of utilities and libs used in version 4. At least PHP 5 has the simple_xml module better DOM XML support. file 1: = XML NODE name=aaa value=old_value / NODE name=bbb value=hello all / /XML file 2: = XML NODE name=aaa value=NEW_value / NODE name=ccc value=PHP_is_good / /XML expected merge result: === XML NODE name=aaa value=NEW_value / NODE name=bbb value=hello all / NODE name=ccc value=PHP_is_good / /XML -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP based Voice Chat Module
Thanks Raditha, Yes we are primarily looking at a PHP chat module which will allow us conduct an audio conference. I know there are Flash Voice Chat versions but they are all for Windoze... we are primarily a MAC environment and our hosting company uses LINUX. Please advise on the best course of action // Thanks again --Pushpinder On Wednesday, April 7, 2004, at 12:06 PM, Raditha Dissanayake wrote: Pushpinder Singh wrote: Hello everyone, I was wondering if anyone has used any PHP/MySQL based voice chat system. (for MAC OS X Platform) What kind of voice chat are you talking about? are you refering to one user saying something into the microphone that the other users hears? If so php is not the best way to do it. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] confused big time
From: Mark Ackroyd [EMAIL PROTECTED] I always found this way of inserting data into a database messy. Here is a handy function to do array inserts and it builds the sql for you. function arrayINSERT($a,$tablename) { $sql = INSERT INTO $tablename (; foreach($a as $key = $value) { $sql .= $key .,; } $sql[strlen($sql)-1] = ')'; $sql .= VALUES (; foreach($a as $key = $value) { if (gettype($value) == 'string') { $sql .= '. addslashes($value) .',; } else { $sql .= $value .,; } } $sql[strlen($sql)-1] = ')'; return $sql; } To get your list of columns, you could do this: $column_list = implode(',',array_keys($a)); $sql = INSERT INTO $tablename ($column_list) VALUES ; That way you only have to loop through $a once. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP based Voice Chat Module
Sorry I did not answer your question in my earlier reply, Thats right the user will use a headset and microphone to communicate. Thanks Pushpinder On Wednesday, April 7, 2004, at 12:06 PM, Raditha Dissanayake wrote: What kind of voice chat are you talking about? are you refering to one user saying something into the microphone that the other users hears? If so php is not the best way to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] confused big time
Hello Mark, Wednesday, April 7, 2004, 5:16:04 PM, you wrote: MA it builds the sql statement for you. It covers 99.9% of the inserts MA your likely to need. I use an update and insert function like this all MA the time. :-) That .1% of the time being when you need to insert a value as now() ? (which will break the string check as it'll wrap it with '' which will cause MySQL to insert -00-00 00:00:00) or if it's an enum field with a numeric allowed value? :) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP based Voice Chat Module
Pushpinder, 1 message is enough! (i recieved 6 messages from you 3 copies each of two messages.) As as i said PHP is not the best option you will have to look at varius commercial voice chat systems. possibly on google. Pushpinder Singh wrote: Sorry I did not answer your question in my earlier reply, Thats right the user will use a headset and microphone to communicate. Thanks Pushpinder On Wednesday, April 7, 2004, at 12:06 PM, Raditha Dissanayake wrote: What kind of voice chat are you talking about? are you refering to one user saying something into the microphone that the other users hears? If so php is not the best way to do it. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF Page Pulling
I need to be able to pull a certain page out of a multi-page PDF, and then be able to save that single page to it's own PDF file. Anyone know how to do this with free tools? Thanks. -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] update mysql from php web page
For the submit button to work it has to be in a form. FORM ACTION=blah_blah.php METHOD=post INPUT TYPE=submit /FORM Hope this helps. Daniel Clark pcenterinput type=submit name=submit value=Update Data/center/p ... more code ... /table ? endif; ? /body /html - I don't see any reason for the submit button to not work at all. What should I look for now? Thanks for the help, Chip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] confused big time
RD That .1% of the time being when you need to insert a value as now() ? RD (which will break the string check as it'll wrap it with '' which will RD cause MySQL to insert -00-00 00:00:00) or if it's an enum field RD with a numeric allowed value? :) Not really, since you usally format a timestamp into something thats db friendly. How many times have you written code where the date 02-01-2004 means the 2nd of Jan or the 1st of Feb?. On a MS SQL BOX the best format is '01-MAR-2004 12:00:00' which is eval'ed as a string. On mysql it's '2004-03-01 12:00:00' if you get into the habbit of *always* converting the date into a db friendly string, then you'll never have date insert problems and it can be used in the function without issues. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP security in a hosting environment
--- Ben Joyce [EMAIL PROTECTED] wrote: one of my clients whom we host a website for has expressed interest in writing their own php/mySQL applications for their site. i've been looking in to the security implications of offering this service. How are you not offering it now? Can the client not write CGI scripts, PHP, or anything like that now? So, only static content? My concerns are that the client *could* use a php script to access parts of the file system, registry (this is a Win32 environment), or other such things. Not to be cute, but Windows isn't fundamentally a multi-user operating system. I doubt offering PHP services is going to affect your server security more than your choice of operating system already has. You can restrict what PHP can do with things like safe_mode, but it is very important to realize that this only affects scripts written in PHP. It doesn't protect your environment; it only takes PHP out of the picture. Security Corner is the latest issue of php|architect (http://www.phparch.com/issue.php?mid=26) discusses the issue of shared hosting in more detail. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] confused big time
Hello Mark, Wednesday, April 7, 2004, 6:19:31 PM, you wrote: RD That .1% of the time being when you need to insert a value as now() ? RD (which will break the string check as it'll wrap it with '' which will RD cause MySQL to insert -00-00 00:00:00) or if it's an enum field RD with a numeric allowed value? :) MA Not really, since you usally format a timestamp into something thats db MA friendly. How many times have you written code where the date 02-01-2004 But now() IS a DB friendly format for MySQL and is the recommended way of inserting the current time into a datetime or timestamp field. Converting it to a timestamp/datetime locally first is a waste of processing time IMHO and opens you up to a potential (although slight) code error. But, to get your function working, I can see the point :) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can someone with list access please remove these two?
Hi, Subject says it all - they're causing auto-responder junk to any list poster and it's annoying: Information Desk [EMAIL PROTECTED] Advance Credit Suisse Bank [EMAIL PROTECTED] -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] confused big time
RD But now() IS a DB friendly format for MySQL and is the recommended RD way of inserting the current time into a datetime or timestamp RD field. But what about MsSQL, Oracle and postgres to name a few. I have worked on a few projects where you read from one db and load into another db. Dates then become the spawn of satan. RD Converting it to a timestamp/datetime locally first is a waste of RD processing time IMHO and opens you up to a potential RD slight) True that it wastes CPU time, but in todays climate, having developers churning out manageable , readable code is better then something that looks like the perl DeCSS program. If you need the nano seconds that much buy a better box !. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] smarty
John W. Holmes said: From: Chris de Vidal [EMAIL PROTECTED] Kelly Hallman said: Going even one step further (the beauty of Smarty: always another level), just extend the Smarty object itself. Then, instead of making all your templates includes other templates (such as a header or a footer), you can make your overall page be a template, and the extended Smarty object can be given extra functionality to control the page: {* MyPage.tpl -- Smarty template for the entire page *} ...header... {include file=$content} ...footer... // mypage.php -- extended Smarty object class MyPage extends Smarty { var $tmpl = 'MyPage.tpl'; function render($x) { $this-assign('content',$x); $this-display($this-tmpl); } } // actualphpcode.php -- called by the browser $pt = new MyPage; $pt-render('pagecontent.tpl'); Sorry, I'm feeling better now but still don't understand what you're telling me/us. Could you please expound? What functionality does this afford? If I can take first shot, since this was posted to the list... :) No!!! Well, OK. :) It's basically a wrapper around Smarty to automatically load the header-content-footer template and dynamically fill in the content based on what's passed to render. So, displaying all of your different pages would be as simple as: $pt = new MyPage; $pt-render('contact.tpl'); $pt -render('prices.tpl'); $pt-render('index.tpl'); etc... The wrapper automatically loads the master template with the header and footer, and then replaces the {content} tag with the content of the appropriate template that render() was passed. Just one method of many. If I'm interpreting it right, that is. :) Ahh OK, that makes sense, 'cept now you've introduced new confusion (sorry, I must be dense today). What's with loading all of your pages (contact/prices/index) in one page? Or are you saying: $pt = new MyPage; $pt-render('contact.tpl'); OR $pt = new MyPage; $pt -render('prices.tpl'); OR $pt = new MyPage; $pt-render('index.tpl'); I can see the benefit of this method if that's what you mean. Thanks for helping clarify it, /dev/idal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be aspecificvariable type
Why not add a function: display_my_cms(); This function will check the current cirumstances and displays an CMS system which fits 100% in every enviroment and layout. Even if new technics are available those will suddenly appear ( maybe CSS3 ). [...] That's not bloat. And using a lot of lines of code to do a simple validation like this is not fun. -William El mi? 07-04-2004 a las 09:54, John W. Holmes escribió: Don't add more bloat to the code. Don't be afraid of actually using a couple of lines to accomplish something instead of demanding a built-in function. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validating form field text input to be a specificvariable type
No, as this would be yet another line of source. Maybe get those guys to add another function ctype_digit_and_not_empty(); -- red [...] * Thus wrote William Lovaton ([EMAIL PROTECTED]): or modify is_numeric() to explictly perform an integer validation: is_numeric(mixed value [, bool is_integer = false]) um.. ctype_digit(). Very nice! it works fine. The only issue is that it will return true if the parameter is an empty string (). Nothing that an empty() can't fix. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] confused big time
Hello Mark, Wednesday, April 7, 2004, 6:35:31 PM, you wrote: MA But what about MsSQL, Oracle and postgres to name a few. I have worked MA on a few projects where you read from one db and load into another db. MA Dates then become the spawn of satan. But the MySQL syntax for insert is not the same for other DBs, so you'll ideally need one insert function per DB type anyway :) at which point my original comment applies again. There are other scenarios too.. i.e. INSERT INTO table (val, val2) VALUES (1, val+1) MA True that it wastes CPU time, but in todays climate, having developers MA churning out manageable , readable code is better then something that MA looks like the perl DeCSS program. If you need the nano seconds that MA much buy a better box !. The way people on the list suggested formatting the query IS readable and quickly debug'able to anyone who understands SQL. Obfuscating that into a function could be considered un-readable to some? But, whatever floats your boat mate ;) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] confused big time
You could even do: $sql .= ( '.implode( ',' , $a ).' ); This way everything is quoted though ( but this doesn't matter using MySQL anyway ). If you want to escape the values of $a you could use array_map to do this also without having to loop :-) -- red [...] To get your list of columns, you could do this: $column_list = implode(',',array_keys($a)); $sql = INSERT INTO $tablename ($column_list) VALUES ; That way you only have to loop through $a once. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php + lynx + grep
Hi, I had same problem myself once. Try adding the apache user to sudoers in /etc/sudoers if not already there Cheers, Catalin Brian L. Ollom [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. It's output should be something like this(it changes hourly): TDFONT FACE=Arial,Helvetica KTOL 031452Z 28013KT 10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015 Help! | Brian Ollom | | | NiteHawke.Com| http://www.nitehawke.com/| | An Authorized Firefly Dealer | email [EMAIL PROTECTED] | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php + lynx + grep
Try adding the apache user to sudoers in /etc/sudoers if not already there DANGER WILL ROBINSON. Don't add the Apache user to /etc/sudoers -- Apache's security model relies on that user being unprivileged. lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. Have you verified that lynx, grep, and head are in PHP's path? Check the output of `which lynx` or phpinfo() to figure out what your path is, and whether it includes lynx. Alternatively, use a full path to lynx to avoid confusion. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I get varaibles from an include file without exectuting it?
I agree, the only way I see it can be done is to read the include file in as Text, and parse it. I have a script that is run with a cronjob and would like to fetch some variables from it, using another file, without the script executing. I could resort to putting the variables in a third file, or reading the script as a text file and reconstructing the variables. But, I was hoping there is a better way. Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expression
* Thus wrote Robert Kornfeld ([EMAIL PROTECTED]): hey, professionals out there: i need to write a parser for an email-header to retrieve the email of the 'To:'-field. there are 2 possibilities: 'To: [EMAIL PROTECTED]' or 'To: first foo [EMAIL PROTECTED]' Actually the second one needs to be first foo [EMAIL PROTECTED] - or - foo [EMAIL PROTECTED] so you need something like: /([^]*([^]+)|(.*))/ That will parse one address. if you have more than one address you'll have to break the address list apart sperated by ';' ie. To: [EMAIL PROTECTED]; foo bar [EMAIL PROTECTED] $emails = explode(';', $email_list); and to get that email address list you'll have to take into account folding ie. To: address; address2@ domain.com So to allow for this while reading the header lines: $last_field = ''; foreach($headerline) { // detect a folded header line if ($headerline{1} == ' ' || $headerline{1} == \t ) { $headers[$last_field] .= trim($headerline); continue; } // check for end of headers if ($headerline{1} == \n) { break;// we're done with headers. } //now split the field list($field, $data) = explode(':', $headerline, 2); // ensure name is consistent ok $field = strtolower($field); // save the data $headers[$field] = $data; // incase its folded $last_field = $field; } Now apply the other two methods to $headers['to']; that was a little more than a regex, but I hope it helps. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] confused big time
Andy B mailto:[EMAIL PROTECTED] on Tuesday, April 06, 2004 7:56 PM said: $query=insert into table values( '{$array['index1']['index2']}', '{$array[index2']['index3']}', //so on down the list ); if i understand the readable way right... no, not quite. here is how you should do it (imo): 1. always write SQL commands in upper case. i.e. SELECT name FROM table 2. indent the different sections of the query. i'm not sure that i'm indenting correctly, but i'm basically just copying SQL statements i've seen in the past, as far as indentation goes. $query = INSERT INTO table VALUES ( '{$array['index1']['index2']}' , '{$array['index2']['index3']}' ); oh btw if you do something like that is it possible to insert comments in the middle of a query like that without breaking it up (i.e. for huge queries comment on what the variables are for)?? yes. i don't know if mysql supports them but i think it works like this: $query = INSERT INTO table /* comment */ VALUES ( '{$array['index1']['index2']}' , '{$array['index2']['index3']}' ); hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] update mysql from php web page
Daniel Clark [EMAIL PROTECTED] wrote on 04/07/2004 10:17:36 AM: For the submit button to work it has to be in a form. FORM ACTION=blah_blah.php METHOD=post INPUT TYPE=submit /FORM Hope this helps. Daniel Clark Of course, I didn't notice I left that line out of my code, although I did remember to put in the closing form tag. But, unfortumately, the update is not executed. The form button works, and it appears to do what it should, but the data is not changed. I changed the form method to get so I could see what is being passed and everything there is fine, but at the end of the url I see this- url...stuff...submit=Update+Data Is this correct? What else can I do to see what was passed to the database (if anything)? -- Chip pcenterinput type=submit name=submit value=Update Data/center/p ... more code ... /table ? endif; ? /body /html - I don't see any reason for the submit button to not work at all. What should I look for now? Thanks for the help, Chip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] smarty
Chris W. Parker wrote: Chris de Vidal mailto:[EMAIL PROTECTED] on Tuesday, April 06, 2004 11:43 AM said: I could have put a tag in the template like {bio} but that'd mean maintaining HTML in the PHP code which I wanted to avoid (left the prettyness to the Front Page developer). Instead, I put something like this in the template: {if $level 2} {bio} {/if} i've never used smarty* but i think i understand how it works. so my question is this... would it not be better to place that logic in your php code instead of your template? what you suggest is handy for situations where you want to limit access to anything remotely programmy from users/designers who have no understanding/experience etc (or who use tools like FrontPage...yuck!) (Maybe DreamWeaver is a better option, has better HTML output/processing and can be made to work nicely with Smarty templates.) BUT... It's probably important to understand that templating is really about the seperation of presentation application/business logic in order to allow, for example, better task seperation (interface/graphic designers edit templates and programmers edit PHP files) and not about the seperation of code content (or HTML PHP or somesuch): it is true that most ('so called' -- not all are really template engines) allow you to also seperate the HTML PHP. bare this in mind: PHP is also a templating engine! image 1 file which does calculation, DB transactions and setting output variables and another file which outputs HTML according to logic that reacts to the values of the output variables. to me performance is second to everything else (I prefer slow code thats well documented, loosely coupled* and easily extentable to super fast unreadable tightly coupled code) - first make it do what you need it to do! you can always optimize later and if the code is still not fast enough then code accelerators (like the ZendAccelerator or PHPa) and faster hardware probably offer the cheapest (and mostly quickly implemented) performance boost. I think Smarty is a really good tool and very well supported documented. I have run into limitations regarding PHP5 dereferenced object syntax and static object call syntax which led me to investigate the template parsing mechanism of Smarty - I found regular expressions which exceeded 1000 chars in length!! this I found to be a little worrying, none the less Smarty is still faster I see very little slowdown even when forcing a recompile on every page hit as opposed to not using Smarty at all. I hope that adds to you understanding a bit. If anything is unclear or I have stated something that is incorrect I'd love to hear about it -- always looking to learn more about stuff, especially PHP! Jochem -- *coupling refers to the level of interdependency of various elements with you application. using Smarty _allows_ you to loosen the coupling between business presentation logic (you can technically write all your business logic in Smarty templates but that is ill-advised) by creating a std API for transfering data from one layer to the next. my thinking is this: if {bio} contains anything, it will print to the page. if it doesn't contain anything, nothing will be printed. so there's no need to check the value of $level within the template since {bio} will simply contain something, or it will not. i'm purely looking to understand this smarty thing a little better. :) chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] smarty
From: Chris de Vidal [EMAIL PROTECTED] Or are you saying: $pt = new MyPage; $pt-render('contact.tpl'); OR $pt = new MyPage; $pt -render('prices.tpl'); OR $pt = new MyPage; $pt-render('index.tpl'); I can see the benefit of this method if that's what you mean. That's what I meant. :) I guess I was too consise. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] update mysql from php web page
Something I like to do during troubleshooting is to have the page display the SQL statement I'm processing. Something like: print sql_query ; That was I can verify all the parameters are correct. Do you have autocommit ON? Or need to pass a commit statement? Daniel Clark Of course, I didn't notice I left that line out of my code, although I did remember to put in the closing form tag. But, unfortumately, the update is not executed. The form button works, and it appears to do what it should, but the data is not changed. I changed the form method to get so I could see what is being passed and everything there is fine, but at the end of the url I see this- url...stuff...submit=Update+Data Is this correct? What else can I do to see what was passed to the database (if anything)? -- Chip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php