Re: [PHP] Fwd: PHP Enterprise Bananas
Thanks everybody, looks like I was going down a blind alley, we can just run stuff from cron. Ben On 6 November 2012 17:50, Jim Lucas wrote: > On 11/06/2012 05:03 AM, Ben Edwards wrote: > >> Not sure if this was some type of joke but came across it a while ago. We >> have some PHP we want to move from a site to a cron. Is this the answer >> or >> is there a better way (that does not involve re-writing code in another >> language). >> >> Cant find a home page for the project, maybe it is defunct. >> >> Ben >> > > I have scripts that get ran via crond and others that run 24/7 as daemons. > I have no issues using PHP via the cli. Like Bastien said, you will want > to setup better logging and maybe summary emails from cron would be useful > too. > > -- > Jim Lucas > > http://www.cmsws.com/ > http://www.cmsws.com/examples/ > -- *Ben Edwards - Freelance Filmmaker, Bristol, UK *http://www.funkytwig.com - View my show-reel and production services http://www.icontactvideo.org - iContact Video Network - Community Video Group http://bristol.mirocommunity.org/ - Bristol Community Channel http://bristol.mirocommunity.org/submit_video/ - Submit films to the above (takes < 10 seconds) http://www.icontactvideo.org/news-blog - What it says on the tin @funkytwig <http://twitter.com/funkytwig> - Occasional Twitter postings about community video and the multiverse
[PHP] Fwd: PHP Enterprise Bananas
Not sure if this was some type of joke but came across it a while ago. We have some PHP we want to move from a site to a cron. Is this the answer or is there a better way (that does not involve re-writing code in another language). Cant find a home page for the project, maybe it is defunct. Ben -- *Ben Edwards - Freelance Filmmaker, Bristol, UK *http://www.funkytwig.com - View my show-reel and production services http://www.icontactvideo.org - iContact Video Network - Community Video Group http://bristol.mirocommunity.org/ - Bristol Community Channel http://bristol.mirocommunity.org/submit_video/ - Submit films to the above (takes < 10 seconds) http://www.icontactvideo.org/news-blog - What it says on the tin @funkytwig <http://twitter.com/funkytwig> - Occasional Twitter postings about community video and the multiverse On 6 November 2012 13:01, Ben Edwards wrote: > Not sure if this was some type of joke but came across it a while ago. We > have some PHP we want to move from a site to a cron. Is this the answer or > is there a better way (that does not involve re-writing code in another > language). > > Cant find a home page for the project, maybe it is defunct. > > Ben > -- > *Ben Edwards - Freelance Filmmaker, Bristol, UK > *http://www.funkytwig.com - View my show-reel and production services > http://www.icontactvideo.org - iContact Video Network - Community Video > Group > http://bristol.mirocommunity.org/ - Bristol Community Channel > http://bristol.mirocommunity.org/submit_video/ - Submit films to the > above (takes < 10 seconds) > http://www.icontactvideo.org/news-blog - What it says on the tin > @funkytwig <http://twitter.com/funkytwig> - Occasional Twitter postings > about community video and the multiverse > -- *Ben Edwards - Freelance Filmmaker, Bristol, UK *http://www.funkytwig.com - View my show-reel and production services http://www.icontactvideo.org - iContact Video Network - Community Video Group http://bristol.mirocommunity.org/ - Bristol Community Channel http://bristol.mirocommunity.org/submit_video/ - Submit films to the above (takes < 10 seconds) http://www.icontactvideo.org/news-blog - What it says on the tin @funkytwig <http://twitter.com/funkytwig> - Occasional Twitter postings about community video and the multiverse
Re: [PHP] Fatal error: Call to a member function web_order_change() on a non-object
On 03/03/2008, Chris <[EMAIL PROTECTED]> wrote: > Ben Edwards wrote: > > Our server has just been upgraded to PHP 5.2.5 and suddenly I am > > getting the following error: > > > > Fatal error: Call to a member function web_order_change() on a > > non-object in /var/www/vhosts/cultureshop.org/httpdocs/cart.php on > > line 32 > > > > The code is: > > > > $SESSION["cart"]->web_order_change( true ); > > > > The command 'global $SESSION;' is the first line of the script. > > > > $SESSION is the session variable created with > > > > session_start(); > > session_register("SESSION"); > > > > if ( !isset($SESSION["cart"]) ) { > > $SESSION["cart"] = new Cart; > > } > > > > I am guessing this is a change in OO handling, any idea what is going > > on and how to fix it? > > > I don't think it's a change in OO handling, maybe it's a change in the > error_reporting level for the new version and you hadn't noticed the > problem before. Its a Fatel Error not a warning. Dont see how level off error reporting could be relevant. Regards, Ben > The problem is that $SESSION['cart'] isn't an object - you'll have to > work out why. > > It could be that $SESSION['cart'] is getting overridden at some point > with another type of variable. > > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > -- Ben Edwards - Bristol, UK http://www.flickr.com/photos/funkytwig - have a look at my pics If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fatal error: Call to a member function web_order_change() on a non-object
Our server has just been upgraded to PHP 5.2.5 and suddenly I am getting the following error: Fatal error: Call to a member function web_order_change() on a non-object in /var/www/vhosts/cultureshop.org/httpdocs/cart.php on line 32 The code is: $SESSION["cart"]->web_order_change( true ); The command 'global $SESSION;' is the first line of the script. $SESSION is the session variable created with session_start(); session_register("SESSION"); if ( !isset($SESSION["cart"]) ) { $SESSION["cart"] = new Cart; } I am guessing this is a change in OO handling, any idea what is going on and how to fix it? Regards, Ben -- Ben Edwards - Bristol, UK http://www.flickr.com/photos/funkytwig - have a look at my pics If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating a varable with a name held in a string
On Thu, 10 Feb 2005 23:08:22 -0500, John Holmes <[EMAIL PROTECTED]> wrote: > Randy Johnson wrote: > > I like to do this: > > > > foreach( $row as $key=>$val) { > > > > $$key = $row[$key]; > > > > } > > You're just recreating a slower version of extract()... extract seems like the ticket, but as I will also be wanting to run eatch var through a varable think I will use the foreach approch. Thanks everybody. >From the manual "For each key/value pair it will create a variable in the current symbol table". What exactly is a simble table? Ben > > -- > > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals รข www.phparch.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Bristol, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating a varable with a name held in a string
I have the following code;_ $sql = "select * from text where id= '$id' "; $row = fetch_row_row( $sql, $db ); $img_loc= $row["img_loc"]; $text_type = $row["text_type"]; $seq= $row["seq"]; $rec_type = $row["rec_type"]; $section= $row["section"]; $code = $row["code"]; $repeat = $row["repeat"]; $description= $row["description"] ); $text = $row["text"] ); Was wondering if there was a clever way of doing this with foreach on $row. something like foreach( $row as $index => value ) { create_var( $index, $value ); } So the question is is there a function like create_var which takes a string and a value and creates a variable? Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
[PHP] Magic Quotes Removal code - almost there
The following code is passed $_POST to clean magic quotes code out ;_ function remove_magic_quotes( &$array ) { foreach( $array as $index => $value ) { if ( is_array( $array[$index] ) ) { remove_magic_quotes( $array[$index] ); } else { if ( magic_quotes_runtime() ){ echo "removing slashes $value"; $array[$index] = stripslashes( $value ); } } } } The cleaning works but magic_quotes_runtime is false even if magic codes are on, any ideas? Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
Re: [PHP] Magic Quotes
On Thu, 2005-02-10 at 13:45 +0100, Jochem Maas wrote: > Ben Edwards (lists) wrote: > > PS phpsc.net seems to be down, or is the domain wrong? > > er yes, oops. as Jeffery pointed out it should have been > phpsec.org. had a brainfreeze sorry. OK, trying to do a function to remove magic quotes from the post variable. Something like:- function remove_magic_quotes( &$array ) { foreach( $array as $index => $value ) { if ( is_array( $array[$index] ) ) { remove_magic_quotes( $array[$index] ); } else { if ( magic_quotes_runtime() ){ $array[$index] = stripslashes( $value ); } } } But not quite there. Any ideas? Ben > > Ben > > > > On Thu, 2005-02-10 at 13:28 +0100, Jochem Maas wrote: > > > >>Ben Edwards (lists) wrote: > >> > >>>Am I correct in thinking Magic Quotes automatically adds quotes to all > >>>posted variables, therefore if you are displaying post variables on a > >>>form you have to remove the quotes. They are only needed if you are > >>>actually inserting/updating into the database. Whether magic quotes > >>>are on or not you do not actually have to do anything to data fetched > >>>from the database. If magic quoted are not on you have to add slashes > >>>before you add to the database. > >> > >>you get the gist of it bare in mind _many_ people including actual php > >>developers avoid magic_quotes like the plague cos its a PITA. > >> > >>basically your input to the DB should be properly escaped (there are special > >>functions for this also, depending on your DB, I use alot of firebird and > >>its capable > >>of parameterized queries - making it impossible to do SQL injection if you > >>use > >>the parameterized markup). > >> > >>AND anything you output to the browser should be sanitized properly as > >>well... > >>goto phpsc.net and read everything there - its a good/solid introduction to > >>writing secure php code (e.g. how to combat XSS etc). phpsc.net is headed > >>by Chris > >>Shiflett - a veritable goldmine of php related knowledge do yourself a > >>favor... > >>read his stuff :-) any questions that arise from reading that are welcome > >>here :-) > >> > >> > >>>There is also another function you need pass stuff through if you are > >>>going to use it in an , what is that > >>>function? > >> > >>htmlentities() > >> > >> > >>>Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
Re: [PHP] Magic Quotes
On Thu, 2005-02-10 at 13:28 +0100, Jochem Maas wrote: > Ben Edwards (lists) wrote: > > Am I correct in thinking Magic Quotes automatically adds quotes to all > > posted variables, therefore if you are displaying post variables on a > > form you have to remove the quotes. They are only needed if you are > > actually inserting/updating into the database. Whether magic quotes > > are on or not you do not actually have to do anything to data fetched > > from the database. If magic quoted are not on you have to add slashes > > before you add to the database. > > you get the gist of it bare in mind _many_ people including actual php > developers avoid magic_quotes like the plague cos its a PITA. Yes, it seems like they were invented by the Powers of Darkness ;). I think I am going to put stuff in my common code that is run on at the beginning of every page to remove magic quotes from $_REQUEST, and run all data being put into the database through addslashes first. I can see it is only any to trivial pages where you are taking user input and putting it stright into the database with out validation or re-displaying it. There for it is useless. Regards, Ben > basically your input to the DB should be properly escaped (there are special > functions for this also, depending on your DB, I use alot of firebird and its > capable > of parameterized queries - making it impossible to do SQL injection if you use > the parameterized markup). > > AND anything you output to the browser should be sanitized properly as well... > goto phpsc.net and read everything there - its a good/solid introduction to > writing secure php code (e.g. how to combat XSS etc). phpsc.net is headed by > Chris > Shiflett - a veritable goldmine of php related knowledge do yourself a > favor... > read his stuff :-) any questions that arise from reading that are welcome > here :-) > > > > > There is also another function you need pass stuff through if you are > > going to use it in an , what is that > > function? > > htmlentities() > > > > > Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
[PHP] Magic Quotes
Am I correct in thinking Magic Quotes automatically adds quotes to all posted variables, therefore if you are displaying post variables on a form you have to remove the quotes. They are only needed if you are actually inserting/updating into the database. Whether magic quotes are on or not you do not actually have to do anything to data fetched from the database. If magic quoted are not on you have to add slashes before you add to the database. There is also another function you need pass stuff through if you are going to use it in an , what is that function? Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
Re: [PHP] Problem using return from a class.
On Wed, 9 Feb 2005 16:12:58 +0800, Jason Wong <[EMAIL PROTECTED]> wrote: > On Wednesday 09 February 2005 01:33, Ben Edwards (lists) wrote: > > > > Maybe you should post a bit of code to illustrate your problem ;) > > > > I'me just doing:- > > > > return $radio_html; > > > > as the last line of the method. > > > > If I do > > > > echo $radio_html; > > > > The condense of the variable gets outputted. > > > > I could post the method here but its a bit long. > > You only need to post concise code that illustrates your problem, a one > liner to return a value is all the that your method needs. All I woul post them would be 'retrun $radio_htlm' I will post the end of the method: if ( $columns == 0 ) { $radio_html .= $this->manditoryStar( $manditory ); } else { if ( $manditory ) { $radio_html .= "" . "* You must select at least one option" . ""; } $radio_html .= ""; } $radio_html .= "\n\n\n\n"; // really nagst hack as rtturn not working echo $radio_html; return $radio_html; ++$index; } This works becouse I echo the varable, but not ideal. The method call is echo $object->method(...). If the return was working I would get the code returned twice, but I only get it returned once. without the 'nasty hack' I get nothing;(. Ben > -- > 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 > -- > New Year Resolution: Ignore top posted posts > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > Ben Edwards - Bristol, UK, England > WARNING:This email contained partisan views - dont ever accuse me of > using the veneer of objectivity > If you have a problem emailing me use > http://www.gurtlush.org.uk/profiles.php?uid=4 > (email address this email is sent from may be defunct) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem using return from a class.
On Tue, 2005-02-08 at 16:47 +, Chris Ramsay wrote: > [snip] > I am having a really odd problem. I have a class and if I do a return > nothing is returned. If I do an echo of the variable that is being > returned I can see it so there is something to return. Is there some > strange bug in PHP? > [/snip] > What is it you are doing - are you echoing the call i.e. > echo $myclass->function(); > Or something else? > > Maybe you should post a bit of code to illustrate your problem ;) I'me just doing:- return $radio_html; as the last line of the method. If I do echo $radio_html; The condense of the variable gets outputted. I could post the method here but its a bit long. Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
[PHP] Problem using return from a class.
I am having a really odd problem. I have a class and if I do a return nothing is returned. If I do an echo of the variable that is being returned I can see it so there is something to return. Is there some strange bug in PHP? Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
[PHP] Is there a function to c if a php function exists
I have been implementing a system on a different ISP than I normally use and have got:- Fatal error: Call to undefined function: cal_days_in_month() in /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php on line 134 I found a reference to this an the web and it seems PHP is not compiled with calender support. "recompile php with the "--enable-calendar" option." Cant see being able to get the to re-compile PHP so I guess I am going to have to disable the feature. I seem to remember a while ago seeing a function to test weather a function exists in PHP. That way I can have the relevant validation skipped if the function is missing (I will tell the client if they get decent hosting it will start working). So something like function_exists( cal_days_in_month() ) Anyone know what the function is called. Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
On Tue, 1 Feb 2005 18:57:12 -0600, James Kaufman <[EMAIL PROTECTED]> wrote: > On Tue, Feb 01, 2005 at 08:47:29PM +0000, Ben Edwards wrote: > > I have been implementing a system on a different ISP than I normally use > > and have got:- > > > > Fatal error: Call to undefined function: cal_days_in_month() > > in > > /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php > > on line 134 > > > > I found a reference to this an the web and it seems PHP is not compiled > > with calender support. > > > > "recompile php with the "--enable-calendar" option." > > > > Cant see being able to get the to re-compile PHP so I guess I am going > > to have to disable the feature. I seem to remember a while ago seeing a > > function to test weather a function exists in PHP. That way I can have > > the relevant validation skipped if the function is missing (I will tell > > the client if they get decent hosting it will start working). > > > > So something like > > > > function_exists( cal_days_in_month() ) > > > > Anyone know what the function is called. > > > > Ben > > > > I do this: > > if (!extension_loaded('calendar')) > { > /* > * cal_days_in_month($month, $year) > * Returns the number of days in a given month and year, > * taking into account leap years. > * > * $month: numeric month (integers 1-12) > * $year: numeric year (any integer) > * > * Prec: $month is an integer between 1 and 12, inclusive > * $year is an integer. > * Post: none > */ > function cal_days_in_month($month, $year) > { > return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30); > } > } thanks, I was using $days_in_month = cal_days_in_month( CAL_GREGORIAN, $month, $year ); Is the first parameter optionel. If it is I guess PHP must have overloaded internal functions. Ben > -- > Jim Kaufman > Linux Evangelist > public key 0x6D802619, CISSP# 65668 > http://www.linuxforbusiness.net > --- > The shortest distance between two points is through Hell. > --Brian Clark > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cal_days_in_month() missing, how can I tell if it exists
I have been implementing a system on a different ISP than I normally use and have got:- Fatal error: Call to undefined function: cal_days_in_month() in /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php on line 134 I found a reference to this an the web and it seems PHP is not compiled with calender support. "recompile php with the "--enable-calendar" option." Cant see being able to get the to re-compile PHP so I guess I am going to have to disable the feature. I seem to remember a while ago seeing a function to test weather a function exists in PHP. That way I can have the relevant validation skipped if the function is missing (I will tell the client if they get decent hosting it will start working). So something like function_exists( cal_days_in_month() ) Anyone know what the function is called. Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_pconnect / persistent database conections
On Thu, 27 Jan 2005 22:14:52 -0800, Steve Slater <[EMAIL PROTECTED]> wrote: > At 10:43 AM 1/27/2005, Richard Lynch wrote: > >Ben Edwards wrote: > > > Been meaning to investigate persistent database connections for a > > > while. Coming from a rdbms background (oracle with a bit of whatcom > > > sqlanywhare) I have always felt that the overhead of opening a > > > connection at the beginning of each page was a little resource > > > intensive. > > The mysql_pconnect() function should work well to solve the wasted > resource/overhead you describe. > > But you should be aware that the pconnect function does not exist > in the mysqli set of PHP functions. The mysqli functions allow you to > access newer features of MySQL 4.1 and higher...like prepared statements. > > Here is the blurb from Zend: > > http://www.zend.com/php5/articles/php5-mysqli.php#fn1 So basicaly they are saying that as the connection is hot closed at the end of eatch page you will need mysql to be able to hold a lot more open connections concurently. I guess its something that needs checking with the ISP of the site in question. Ta, ben > Steve > > -- > Steve Slater > [EMAIL PROTECTED] > Information Security Training and Consulting > > PHP / MySQL / Web App Security (LAMP) Training: > http://www.handsonsecurity.com/training.html > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_pconnect / persistent database conections
Been meaning to investigate persistent database connections for a while. Coming from a rdbms background (oracle with a bit of whatcom sqlanywhare) I have always felt that the overhead of opening a connection at the beginning of each page was a little resource intensive. Anyway, I found mysql_pconnect and this sounds like just the ticket. Seems that I can just change my connect method from mysql_connect to mysql_pconnect and it will just work. I do have a couple of questions. Firstly what is the story with mysql_close. There is no mysql_pclose. I guess you don't need to close the connection at the end of each page but what if you do. Is mysql_close ignored if the connection was made with mysql_pconnect or douse it close the connection and next time mysql_pconnect is run it reconnects causing no benefit over mysql_pconnect. also what is the timeout likely to be? My other question is what happens if lots of people connect using the same user/password. I tend to do my own user management so everybody douse. Is doing my own user management really dodge, if we were talking about oracle I would probably say it is. Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic quotes question (still driving me mad)
On Wed, 26 Jan 2005 13:07:34 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> wrote: > Ben Edwards wrote: > > On Tue, 25 Jan 2005 17:02:21 -0800, Chris <[EMAIL PROTECTED]> > > wrote: > >> You should probably use get_magic_quotes_runtime() , as _gpc only > >> applies to GET/POST/COOKIE, > >> > >> htmlspecialchars is needed so the HTML can be parsed properly: > > > > So this is this only done to stuff that is to be displayed on a web > > page? What happens if it is done to stuff that is (possibly) also > > passed through addslashes and written to the database. > > Don't do it. Don't worry, I wont. Databases are for data. I would'nt dream of polluting them with HTML;) > What if tomorrow you decide you need to output a PDF as well as your HTML > from that same data -- You've got all those funky htmlspecialchars() in > your database that have NOTHING to do with your data. They are only > needed for the HTML presentation of your data. Seperation of data and presentation and logic, precisely. Ben > For example, I have a web-site where we have had an on-line calendar for > ages. A few years ago, I found out the client was re-typing all his > calendar items (a hundred a month) into three different software packages, > just so he could get a print-out for flyers/handouts of his calendar of > events. > > Silly client. > > Now his web-site provides him with a PDF of his calendar with a single > click, instead of 4 hours of drudge-work every month copying data from A > to B by hand. There ain't no htmlspecialchars() in the database, thank > [deity], or I'd have to un-do that just to make the PDF. Ugh! > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic quotes question (still driving me mad)
On Tue, 25 Jan 2005 17:02:21 -0800, Chris <[EMAIL PROTECTED]> wrote: > You should probably use get_magic_quotes_runtime() , as _gpc only > applies to GET/POST/COOKIE, > > htmlspecialchars is needed so the HTML can be parsed properly: So this is this only done to stuff that is to be displayed on a web page? What happens if it is done to stuff that is (possibly) also passed through addslashes and written to the database. Also douse it matter what order htmlspecialcharacters/addslashes??? However this is the least of my problems, I still dont have the main magic quotes thing working. So I will detail what I am doing and c if anyone can help. Everything that comes from the database (regardless of what is done to it next) is passed through the following function. function unprep( $text ) { // Take data coming from the database an get it ready to be presented // to the user. if ( get_magic_quotes_gpc() ){ $result = stripslashes($text); } else{ $result = $text; } $result = htmlspecialchars( $result ); return $result; } This is done regardless of what is to be done to the data by using foreach on the row that is returned. foreach( $this->record as $index => $value ) { $this->record[$index] = unprep( $value ); } And before anything is written to the database it goes through the following function. function prep( &$text ) { if ( get_magic_quotes_gpc() ) { return $text; } else { return addslashes($text); } } But I am still getting the \', \\' thing happening. One of my problems is I am not sure at how to reliably look at the data at various stages. If I do echo $value and it has \' in it is '\ displayed or or is ' displayed. I.e. is it only in the if the value in the text box was something like: > > "> Hello World! > > when you go to put in the value attribute it would end up: > > Hello World!" /> > > That would not parse correctly. > > but if you escaped it with htmlspecialchars or htmlentities you'd get: > > > > And the box would contain the proper data > > > Ben Edwards wrote: > > >PS. How does htmlspecialchars fit into this. The unprep function is > >to prepare date coming from the database to be used in >type=text, douse the below function make sence? > > > >Ben > > > >function unprep( $text ) { > > // Take data coming from the database an get it ready to be presented > > // to the user. > > > > if (magic_quotes_gpc()){ > > $result = stripslashes($text); > > } > > else{ > > $result = $text; > > } > > > > return htmlspecialchars( $result ); > >} > >-- > >Ben Edwards - Poole, UK, England > >WARNING:This email contained partisan views - dont ever accuse me of > >using the veneer of objectivity > >If you have a problem emailing me use > >http://www.gurtlush.org.uk/profiles.php?uid=4 > >(email address this email is sent from may be defunct) > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic quotes question
PS. How does htmlspecialchars fit into this. The unprep function is to prepare date coming from the database to be used in http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic quotes question
OK. This is really confusing me. I am using the following function to handle this: function prep( &$text ) { echo get_magic_quotes_gpc()." "; if (get_magic_quotes_gpc()) { echo "mq on for $text"; return $text; } else { echo "mq off"; return addslashes($text); } } And it is not doing the assslashes but stuff like \'s is still being added. wonce savein a few times I get \'. Ben On Tue, 25 Jan 2005 10:39:30 -0800, Chris <[EMAIL PROTECTED]> wrote: > It means that you can't set that setting inside a script with ini_set. > > Since the earliest opportunity to set it in a script would be after it > would have already done it's job, it won't work. > > You must set it before the script runs. > > Chris > > Ben Edwards wrote: > > >In the php manual it states > > > >' Keep in mind that the setting magic_quotes_gpc will not work at runtime.' > > > >What douse this actualy mean? > > > >Ben > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Magic quotes question
In the php manual it states ' Keep in mind that the setting magic_quotes_gpc will not work at runtime.' What douse this actualy mean? Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] String to Date and Date to String Functions?
On Mon, 24 Jan 2005 20:15:15 -, Ford, Mike <[EMAIL PROTECTED]> wrote: > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm > > On 24 January 2005 19:01, Ben Edwards wrote: > > > On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > > How about the strtotime() function? > > > http://us4.php.net/manual/en/function.strtotime.php > > > > No good, it douse not take a format string. What if I wanted to > > convert the timestamp to 'DD-MM-YYY', display it on a form, validate > > it, and then convert it back to a timestamp. > > Well, if you're going to validate it, you'll have to figure out which bits > are the day, month and year -- having done that, you'll have them as three > separate bits of information, so you can use mktime() on them, or glue them > back together to feed to strtotime() in one of the various formats it > recognizes. Seems to me a format string is pretty irrelevant in all of > this. Different users have can have the date displayed in there local form. And no, I dont have to split the date up, the date() function should be able to be used to validate the date. I asume it returns null, or something sensable, if the date is invalid. Anyway as the date format is user defined I need both functions. > Speaking for myself personally, I would never accept a wholly textual date > from a form -- I would have drop-downs for the day and month, and maybe also > for the year depending on the valid range, and then it's a snap just to hand > the resulting values to mktime(). In this case it is a back end administration form as the (power) user does not want to have to fiddle about with drop downs. In fact they can use / or - or . as a seperater. The split function can handle that. L8r, ben > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Headingley Campus, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] String to Date and Date to String Functions?
On Mon, 24 Jan 2005 13:32:36 -0600, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > How about the strtotime() function? > > http://us4.php.net/manual/en/function.strtotime.php > > No good, it douse not take a format string. What if I wanted to > convert the timestamp to 'DD-MM-YYY', display it on a form, validate > it, and then convert it back to a timestamp. > > I cant beleve the PHP date/time functions suck this bad;( > [/snip] > > Well, you could always write some extensions to PHP to cover it, as soon > as you learn to spell does :) > That is awfull grammer. Ime dyslexic, whats your excuse. Was wondering if someone else has writern the function, dont have time at the mo and thought someone else may of. Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String to Date and Date to String Functions?
On Mon, 24 Jan 2005 19:22:40 -, Ford, Mike <[EMAIL PROTECTED]> wrote: > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm > > > On 24 January 2005 17:04, Ben Edwards wrote: > > > On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard > > <[EMAIL PROTECTED]> wrote: > > > [snip] > > > > > > String to Date Function > > > > > > return date stringToDate( str Date, str Format ) > > > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' ); > > > > > > Date to String Function > > > > > > return str dateToString( date Date, str Format ) > > > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' ); > > > > > > Anyone know of any functions that do this or have pointers as to > > > how it can be done. [/snip] > > > > > > You've looked at http://www.php.net/date ? > > > > > Yes. It douse the dateToString bit but how do I do the reverse. I > > can use it to convert a timestamp to a string but how do I convert a > > string to a timestamp. > > Right at the top of the description of date(), the second Note reads: > >Note: To generate a timestamp from a string representation of the >date, you may be able to use strtotime(). As I have said in a previous email to date function takes a format string and the strtodate douse not. Therefore the strtodate() only works on a small subset of what date() can produce. The format I am interested in is DD-MM- which is the way dates are specified in the UK, strtodate() cant handle this. strtodate is not the reverse of date. Your email address seems to indicate you are in the UK - so you may of come across the way UK dates are normaly specified;) Ben > This should give you a clue. > > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Headingley Campus, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] String to Date and Date to String Functions?
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How about the strtotime() function? > http://us4.php.net/manual/en/function.strtotime.php No good, it douse not take a format string. What if I wanted to convert the timestamp to 'DD-MM-YYY', display it on a form, validate it, and then convert it back to a timestamp. I cant beleve the PHP date/time functions suck this bad;( Ben > > From: Ben Edwards <[EMAIL PROTECTED]> > > Date: 2005/01/24 Mon PM 12:03:34 EST > > To: Jay Blanchard <[EMAIL PROTECTED]> > > CC: PHP General List > > Subject: Re: [PHP] String to Date and Date to String Functions? > > > > On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard > > <[EMAIL PROTECTED]> wrote: > > > [snip] > > > > > > String to Date Function > > > > > > return date stringToDate( str Date, str Format ) > > > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' ); > > > > > > Date to String Function > > > > > > return str dateToString( date Date, str Format ) > > > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' ); > > > > > > Anyone know of any functions that do this or have pointers as to how > > > it can be done. > > > [/snip] > > > > > > You've looked at http://www.php.net/date ? > > > > > Yes. It douse the dateToString bit but how do I do the reverse. I > > can use it to convert a timestamp to a string but how do I convert a > > string to a timestamp. > > > > I must say i've used a few languages in my time and the PHP data/time > > functions are a mess. Generaly when you find a function to do > > something to a data item there is an obvious way of reversing this > > (i.e. it has a simeler name). This douse not seem to be the case with > > PHP;( > > > > Ben > > > > -- > > Ben Edwards - Poole, UK, England > > WARNING:This email contained partisan views - dont ever accuse me of > > using the veneer of objectivity > > If you have a problem emailing me use > > http://www.gurtlush.org.uk/profiles.php?uid=4 > > (email address this email is sent from may be defunct) > > > > -- > > 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 > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String to Date and Date to String Functions?
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > > String to Date Function > > return date stringToDate( str Date, str Format ) > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' ); > > Date to String Function > > return str dateToString( date Date, str Format ) > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' ); > > Anyone know of any functions that do this or have pointers as to how > it can be done. > [/snip] > > You've looked at http://www.php.net/date ? > Yes. It douse the dateToString bit but how do I do the reverse. I can use it to convert a timestamp to a string but how do I convert a string to a timestamp. I must say i've used a few languages in my time and the PHP data/time functions are a mess. Generaly when you find a function to do something to a data item there is an obvious way of reversing this (i.e. it has a simeler name). This douse not seem to be the case with PHP;( Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String to Date and Date to String Functions?
Being trying to work out haw to handle dates. Basically I need a function to convert a Date to a String and another function to convert a string to a date. Exactly what format the date is held in is not relevant as long as it is some type of standard (i.e. Unix Timestamps). Both the functions will require a format string (such ad DD/MM/YYY) and again the format/syntax of this is irrelevant, as long as they are the same for both . String to Date Function return date stringToDate( str Date, str Format ) e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' ); Date to String Function return str dateToString( date Date, str Format ) e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' ); Anyone know of any functions that do this or have pointers as to how it can be done. Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array search
probably missing something but php have a function called array_search. Ben On Sun, 23 Jan 2005 11:33:16 -0500 (EST), [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I've been trying for days now to make this work. > > This worked for me (with my IP address for 'John'): > > $viz_ip= $_SERVER['REMOTE_ADDR']; > echo ("Your IP is $viz_ip"); > > $byte_ip= array( > > "204.126.202.56"=>"Mark", > > "63.230.76.166"=>"Bob", > > "84.196.101.86"=>"John", > ); > > function _array_search ($viz_ip, $byte_ip) { > > foreach($byte_ip as $key => $val) { > > if ($viz_ip === $key) { > return($val); > } > > } > > return(False); > } > > > ?> > > Hi > > J > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loading all clases always
I have all my classes in a single directory. I was thinking of automatically loading them all at the beginning of every page. The logic being that the class definitions will get cached (I guess PHP uses filesize/date/time) so the overhead would not be that great. Also at any given time they will all probably be needed by one of the visitors. Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
[PHP] oo arcitecture (Re: [PHP] Extending a Class)
Your email prompted me to think about architecture. What I have is;_ a database class which is the only class with direct access to the database. a table class, which is passed the database class on instantiation. a presenter class which is passed the table class during instantiation. This means that if you want to render html you use and instance of the presenter class but you can also call methods on the database object directly to, for example, update the database. You will probably want a valuator class to validate user input. If you have and extended data dictionary (i.e. validation rules in the database) you would have a extended data dictionary class you pass to the valuator (which itself would have the database passed to in on instantiation). What I cant quite work out is what to do about html related methods that do not relate to a database table (i.e.rendering table top/middle/bottom). Maybe you want a html class which is a composite of the presenter class or can be accessed directly for non-table related presentation? Ben On Thu, 20 Jan 2005 18:17:47 -0800, Phillip S. Baker <[EMAIL PROTECTED]> wrote: > Greetings all, > > I have a class I use for MySQL connection and functions. > > I also have a class that I use to create Paged Results. > > The paged results class connects to a DB and uses allot of sql calls to make > this happen. I am noticing that it does allot that the MySQL class does. > > What I would like to do is to Have the paged results extend the MySQL class > so it can use the functions within that class so I can keep them updated in > just one place. How would I go about doing that?? Is it as simple as > something like this (this is shortened for convience)?? > > class Mysql { > var $results; > var $dbcnx; > > function Mysql($query, $cnx) { // Constructor function > $this->dbcnx = $cnx; > if (!$this->results = @mysql_query($query)) >$this->_error("There was an error with executing your query. Try again > later.", $query); > } > } > > class PageResultSet extends MySQL { > var $results; > > function PageResultSet ($query,$pageSize,$resultpage,$cnx) { > > $this->results = @mysql_query($query,$cnx) or $this->_error('Error Running > your search. Try back later.', $query); > $this->pageSize = $pageSize; > if ((int)$resultpage <= 0) $resultpage = 1; > if ($resultpage > $this->getNumPages()) > $resultpage = $this->getNumPages(); > $this->setPageNum($resultpage); > } > } > > I would like to be able to pass the results from the MySQL class to the > PageResultSet class without have to do the query over and such. > How would I go about coding that? I am not clear on that. > > Also can I extend a function in PageResultSet that is started in MySQL?? > In MySQL I have > function fetchAssoc() { > if (!$this->results) return FALSE; > $this->row++; > return mysql_fetch_assoc($this->results); > } > > In PageResultSet I have > function fetchAssoc() { > if (!$this->results) return FALSE; > if ($this->row >= $this->pageSize) return FALSE; > $this->row++; > return mysql_fetch_assoc($this->results); > } > > Can I just write something like within PageResultSet > function fetchAssocPRS extends fetchAssoc () { > if ($this->row >= $this->pageSize) return FALSE; > } > > Thanks for the help. > > -- > Blessed Be > > Phillip > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if then else short form
I seem to remember seing someone use a abreaviated form of a if/them/else of the type that can be used in java. It was something like if ( a=b ) ? a=1 ; a=2; Anybody know what the correct syntax is? Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: phppatterns.com, Nice idea, shame about the site (was Re: [PHP] Re: class structure.)
On Thu, 20 Jan 2005 11:55:37 -0500, Jason Barnett <[EMAIL PROTECTED]> wrote: > Ben Edwards wrote: > > On Thu, 20 Jan 2005 09:37:37 -0500, Jason Barnett > > <[EMAIL PROTECTED]> wrote: > > > >>Dustin Krysak wrote: > >> > >>>Hi there, I am pretty new to writing classes (and pretty new to PHP > >>>itself), but I was wondering what was the best format for constructing > >> > >>There are a few general patterns that show up time after time. They > >>happen so often that there are formal names for them. This isn't really > >>a PHP question per se, but a good site for exploring object design in > >>PHP is http://phppatterns.com/ > > > > > > Nice idea, shame about the site. I would expect a patterns site to > > have a place with a list of the standard patterns, what they are for > > and implementation in the target language. This site douse not (or it > > http://phppatterns.com/index.php/article/archive/1/ Cool, thats the type of thing. Why don't you have a link at the top with something like 'patterns directory' or alternativly have a 'about us' link with the stuff at phppatterns and use phppatterns for the paterns directory. I would have them listed simplest to more complex. i.e. put Singleton at top. Regards, Ben > Maybe not organized the way you would do it, but there are a lot of > patterns there (and the links will describe implementation in PHP). > > > douse I cant find it). Anyone know of one that douse. > > > > Ben > > > -- > Teach a man to fish... > > NEW? | http://www.catb.org/~esr/faqs/smart-questions.html > STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 > STFM | http://www.php.net/manual/en/index.php > STFW | http://www.google.com/search?q=php > LAZY | > http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phppatterns.com, Nice idea, shame about the site (was Re: [PHP] Re: class structure.)
On Thu, 20 Jan 2005 09:37:37 -0500, Jason Barnett <[EMAIL PROTECTED]> wrote: > Dustin Krysak wrote: > > Hi there, I am pretty new to writing classes (and pretty new to PHP > > itself), but I was wondering what was the best format for constructing > > There are a few general patterns that show up time after time. They > happen so often that there are formal names for them. This isn't really > a PHP question per se, but a good site for exploring object design in > PHP is http://phppatterns.com/ Nice idea, shame about the site. I would expect a patterns site to have a place with a list of the standard patterns, what they are for and implementation in the target language. This site douse not (or it douse I cant find it). Anyone know of one that douse. Ben > > classes. Now for example, i have written 2 versions of a class that > > accomplish the exact same thing. And I was just wondering if there are > > any advantages to either, or even if one was formatted more so to > > standards. Just wanting to learn it the proper way from the get go. My > > classes are formatted for use in flash remoting (hence the methodTable > > stuff - you can ignore it). I guess my question refers more towards the > > declaration of properties, etc. > > Think of declaration of properties and methods as a "contract". When > something is public it is available to all of PHP. When it is private > it is only usable by the class that you define it in. When it is > protected it is a hybrid; it is usable to the class that defined it and > it can be "inherited" by classes that extend that class. > > So, decide what level of access you really *need* for that property / > method. If a property is only supposed to be modified by class methods > (for example, a password string) then make it private or possibly > protected. If everything is public access then there is temptation to > do something like: > > > class myObject { > public $pubprop = 'I am the starting value. Trust me, even though I > am public access'; > } > > function all_hell_breaks_loose($obj) { > $obj->pubprop = 'ANARCHY LIVES! PHEAR DA WRAFF OF DA PUBIC PROPS!'; > } > > $obj = new myObject(); > > /** ... 1000's of lines of code ... */ > > all_hell_breaks_loose($obj); > print_r($obj); > > ?> > > -- > Teach a man to fish... > > NEW? | http://www.catb.org/~esr/faqs/smart-questions.html > STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 > STFM | http://www.php.net/manual/en/index.php > STFW | http://www.google.com/search?q=php > LAZY | > http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] quoting values in HTML - is there a diference between ' and "
I always thought quoting values in HTML had to be dome with double quotes ("). however on reeding some stuff in the PHP manual the examples use single quoted. Single quotes are allot more convenient as I use double quotes generally for quoting strings. So are the two totally synonymous in HTML? Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search engine
Looks like you will have to write your own. Have a look at the scripts you have and see how they do it. One option is to write the 'static' pages into the database as well as the file system. I personaly put all content into a database and do not really have any static pages atall. Ben On Thu, 20 Jan 2005 14:18:49 +0200, Rosen <[EMAIL PROTECTED]> wrote: > I try many scripts for searching, but they don't work how I want. > The problem is, that part of site is static text ( not in database ) , other > part ( products ) are in MySQL database - this part is generating from PHP > scripts. > > "Ben Edwards" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > This kind of depends on what database you are using (I am asuming you > > mean you have a data driven site you want to search so strictly > > speaking it is the database that you want to search). > > > > Mysl has free text search facilities (i.e. you can pass it a number of > > words and it can search for them in a set of database fields and even > > kreates a 'ranking'). however this only works if you have a few > > hundread records - less than this and the results are unpredictable. > > > > Have you tries googeling for php search scripts? > > > > Ben > > > > On Thu, 20 Jan 2005 14:04:44 +0200, Rosen <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > Can someone recommend me a search engine script in PHP for inside one > site? > > > > > > Thanks in advance! > > > Rosen > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > Ben Edwards - Poole, UK, England > > WARNING:This email contained partisan views - dont ever accuse me of > > using the veneer of objectivity > > If you have a problem emailing me use > > http://www.gurtlush.org.uk/profiles.php?uid=4 > > (email address this email is sent from may be defunct) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search engine
This kind of depends on what database you are using (I am asuming you mean you have a data driven site you want to search so strictly speaking it is the database that you want to search). Mysl has free text search facilities (i.e. you can pass it a number of words and it can search for them in a set of database fields and even kreates a 'ranking'). however this only works if you have a few hundread records - less than this and the results are unpredictable. Have you tries googeling for php search scripts? Ben On Thu, 20 Jan 2005 14:04:44 +0200, Rosen <[EMAIL PROTECTED]> wrote: > > Hi, > Can someone recommend me a search engine script in PHP for inside one site? > > Thanks in advance! > Rosen > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with hidden form input values
On Thu, 20 Jan 2005 07:33:01 +0800, Jason Wong <[EMAIL PROTECTED]> wrote: > On Thursday 20 January 2005 07:07, Ben Edwards (lists) wrote: > > I know this is not strictly speaking a PHP question but it is to do with > > a PHP app. > > > > I have a form with a number of hidden values in it. After the post > > print_r( $_POST ) shows all the values except these (this is copied from > > 'Show Source' in the browser. > > > > > > > > > > > > > > Any idea why they wont post? > > It *should* work. Maybe you're using a crappy browser (or a strictly standards > only browser) in which case you ought to (and you should do this anyway) be > using proper HTML ie: > > Ime using Firefox (0.9 I think) but thanks for the tip. Am I correct in thinking quoting is needed to make the HTML XHTML complient? Ben > -- > 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 > -- > New Year Resolution: Ignore top posted posts > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with hidden form input values
On Wed, 19 Jan 2005 15:22:55 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> wrote: > Ben Edwards (lists) wrote: > > I know this is not strictly speaking a PHP question but it is to do with > > a PHP app. > > > > I have a form with a number of hidden values in it. After the post > > print_r( $_POST ) shows all the values except these (this is copied from > > 'Show Source' in the browser. > > > > > > > > > > > > > > Any idea why they wont post? > > The *do* POST, but PHP only handles one level of array references in NAME=xxx > > You can do something like: > while (list($keys, $value) = each($_POST['keyField'])){ >$keys = explode('][', $keys); >list($key1, $key2) = $keys; >$realKeyField[$key1][$key2] = $value; > } > ?> Almost follow this but not quite. Is this the code used to create the hidden HTML input tag or the one to unpack the variable after the post. What is really spooky is the keys are actually held in a variable in an object called keys - your telepathic abilities are very impressive;). My first thought was when you said PHP only handles one level in post was to serialize the array, put the serialized version in as a single hidden HTML tag and unserialize at the other end. do you reckon this is a goer? > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with hidden form input values
I know this is not strictly speaking a PHP question but it is to do with a PHP app. I have a form with a number of hidden values in it. After the post print_r( $_POST ) shows all the values except these (this is copied from 'Show Source' in the browser. Any idea why they wont post? Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
Re: [PHP] Re: PHPED PHP IDE (wasRe: [PHP] php editor)
Leicter, the point I was making was that there was at least one IDE with a debugger - you said there was not, you did not stipulate free. Anyway not having a go, just clearing up miscommunication. Thanks for the work you put into phpeclipse. from what I have seen so far it rocks. BTW is there anyway of getting line numbers down the left hand she of the source file. Having to run the cursor up/down and look at the current line namer is a bit fiddly. Marco, I'me not actually using a debugger yet but was going to give DBG a go. what are the relative merits of DBG/Xdebug (licence/ease of installation/functionality...). Ime using Linux (Ubuntu/Debian). Anyway it douse not matter if the debugger is a separate module to the IDE as long as it is well integrated. Actually I would prefer they were separate - I prefer best of breed than monolithic;). Ben Regards, Ben On Tue, 18 Jan 2005 16:58:03 +0100, Marco Schuler <[EMAIL PROTECTED]> wrote: > Am Dienstag, 18. Januar 2005 16:49 schrieb Lester Caine: > > http://www.zend.com/store/products/zend-studio.php > > > > That's not PhpED either and it's not free. > > > > The debugger is an element a number of people use. We use it in > > PHPEclipse as well. Versions of the DEBUGGER are free, but there > > are also 'improved' versions that are not, integrated into other > > IDE's > > Which free debugger? afaik there is only an integrated debugger in > php3 (http://www.zend.com/manual/debugger.php). > > Are you using one of DBG APD or Xdebug? Are you using Eclipse with the > debugger on linux? > > -- > Cheers! > Marco > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHPED PHP IDE (wasRe: [PHP] php editor)
On Tue, 18 Jan 2005 15:20:56 +, Lester Caine <[EMAIL PROTECTED]> wrote: > Benjamin Edwards wrote: > > > Whats the story with this. It seems too good to be true. A fully featured > > IDE/Debugger released under some sort of free software licence. The site > > you link to seems indicate that is is free software, it has a > > sourceforge.net logo at the botton. However nuspere are selling it for > > ยฃ299. what is the story? > > PhpED is not free > > > http://dd.cron.ru/dbg/downloads.php > > That is the debugger only, and is used by PhpED amongst others - there > is no IDE with the debugger. I thought Zend Studio was a IDE with a debugger? Ben > > -- > Lester Caine > - > L.S.Caine Electronic Services > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with foreatch()
I have the following Code: foreatch( $_POST["mtype"] as $akey => $avalue ) { echo "$akey, $avalue"; } When I run it I get: Parse error: parse error, unexpected T_AS in /var/www/mb/mb_estab_update.php on line 58 58 is the line with the foreatch on it. However if I replace it with: print_r( $_POST["mtype"] ); I get: Array ( [1] => RESTAURANT [2] => BEVERAGEWINE [3] => MAIN ) so the array is populated, what am I doing Wrong? Regards, Ben -- Ben Edwards - Poole, UK, England If you have a problem sending me email use this link http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) signature.asc Description: This is a digitally signed message part
[PHP] Finding position of New line in string
I am trying to find the position of the first occurrence on new line in a string that comes from a database. I tried $pos = strpos( $list_text, "/n" ); But it never returns anything. Any help would be much appreciated. Ben -- Ben EdwardsTel +44 (0)1179 553 551 ICQ 42000477 Homepage - nothing of interest here http://gurtlush.org.uk Webhosting for the masses http://www.serverone.co.uk criticalSite Builder CMS http://www.criticaldistribution.com Get alt news/views films online http://www.cultureshop.org i-Contact Progressive Video http://www.videonetwork.org Fun with corporate graphicshttp://www.subvertise.org -- ******** * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic -> static
On Wed, 2003-10-08 at 08:56, Veniamin Goldin wrote: > Dear All, > > Does anybody have any solutions, which makes possible to produce static pages of all > dynamic cms once a day and can be easily integrated into already made site? > > > Thank you. I have been thinking of doing such thing for a while and have two possible solutions. One is to have a master object and have a variable to set the mode of operation (i.e. Dynamic, Static) You would then abstract all your output (echo etc.) functions. This new echo function would either output in the normal way or to a file handler depending on the $static_dynamic variable. You would then have a master function which crawls your site calling all the pages. The other solution involved using a function which captures all browser i/o into a variable rather than sending it to the screen (cant remember its name). Not as sure how to implement this. Basically if you have not written your CMS using objects it will be a lot harder. One of the reasons I am not generating static snapshots it the CMS I wrote was not originally written without objects. I am slowly rewriting it and when finished I will revisit this issue. Ben -- ************ * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GET globals REQUEST the plot thickens
>From what I have $_REQUEST douse NOT work. As I said vars are being passed on the URL. My code: echo "sec=".$_REQUEST["_section"]."req=$REQUEST_URI"; the output sec= req=/adultdyslexia.org/quiz.php?_menu=TOP&issue=1&_section=QUIZ&gen=Y if I change the request to GET it works fine! Ben -- ************ * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
> Do you have register_globals on or off? If it works in hundreds or other > places, it should work fine. In /etc/php4/apache/php.ini 'register_globals = On'. This is my point, I understand about the global issue but dont have the time to change all my code. > Also, you can use $_REQUEST if you want access to both GET and POST. Thanks for this, are there any issues in using it? what I don't understand is if $_GET is being used people can just change the URL anyway so why is it an issue? Ben -- ************ * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verry strange GET behaviour
> Ben, with register globals off hackers can change variables you don't want > to be changed theirself. Don't really have time to go through all our sites and change every variable option, then retest all the sites. Still dont understand why everything else works. Will probably start using $_GET in future. Ben -- ************ * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Verry strange GET behaviour
Been having a problem accessing a variable that is passed on a URL. I've been developing PHP for years and this makes no seance. The variable I am trying to access in the script is $_section. I put the following code at the beginning (before anything else apart from http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array method attributes (OO)
array $SESSION; near the beginning gives the error Parse error: parse error, unexpected T_ARRAY, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\wwwroot\stwerburghs.org\obj\contacts.obj.php on line 6 Fatal error: Cannot instantiate non-existent class: contacts in d:\wwwroot\stwerburghs.org\cms\list_contacts.php on line 9 At 14:44 08/08/2003 +0100, David Nicholson wrote: Hello, This is a reply to an e-mail that you wrote on Fri, 8 Aug 2003 at 14:18, lines prefixed by '>' were originally written by you. > I wish to pass a session variable into an object and have it available > as > an attribute. I have what I thought I needed below as a code segment > but > it douse no work. Has anybody got any idea how I should achieve this. > Ben > ... > class Contacts{ > var $db; > array $SESSION; > function Contacts( $SESSION, $db ) { > $this->$SESSION = $SESSION; > $this->$db = $db; > } That will work fine for reading from the variable, are you wanting to write to it and have the changes made available outside of your class? if so pass the array in by reference... function Contacts( &$SESSION, $db ) HTH, David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php **** * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array method attributes (OO)
I wish to pass a session variable into an object and have it available as an attribute. I have what I thought I needed below as a code segment but it douse no work. Has anybody got any idea how I should achieve this. Ben .. class Contacts{ var $db; array $SESSION; function Contacts( $SESSION, $db ) { $this->$SESSION = $SESSION; $this->$db = $db; } .. **** * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing database resource to object (OO)
Wan I insatiate an object I want to pass a database resource that can be used throughout the object. The below code should indicate what I want but I get the error "mysql_query(): supplied argument is not a valid MySQL-Link resource". I guess this is because "$this->$db = $db" is wrong. Ben class Contacts{ var $SESSION = array(); var $db; function Contacts( $SESSION, $db ) { $SESSION = array(); $this->$db = $db; echo $this->db; } ************ * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zend Development Environment
Is it me or is it not up to much. I'me getting totally different results from within the IDE and running the code straight on a browser. I am also getting some very strange results (such as changing code and it not having any affect) since I installed it. What experiences have other people had? Ben **** * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_error problem
I am using the below function (error_db) witch is called thus:- function query_db( $sql, $db ) { $result = mysql_query( $sql, $db ) or error_db( $sql, $db ); return $result; } But $sqlerr is always blank (it is set with '$sqlerr = mysql_error( $db );'). Any idea why? Ben function error_db( $sql, $db ) { global $SERVER_NAME; global $SCRIPT_NAME; table_top( "Database Error" ); table_middle(); $sqlerr = mysql_error( $db ); echo "SQL::$sqlError:$sqlerr"; table_bottom(); // Clost of table/html from calling script table_bottom(); html_footer(); // Send error via email $msg = "Database error has accured on $SERVER_NAME\n\n.". "The error message is :-\n\n". "SQL:$sql\n\nError:$sqlerr\n\n". "This message was ". "generated by '$SERVER_NAME$SCRIPT_NAME'"; $subj = "Database error from $SERVER_NAME"; // Hard coded to minimize chance of this module erroring $to = "[EMAIL PROTECTED]"; $from = "From: ".$to; mail( $to, $subj, $msg, $from ); die(); } * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SAFE MODE Restriction in effect
Changed it to dir but not made any difference. I have root access to the server so could change php.ini. However ; Safe Mode ; safe_mode = Off ; By default, Safe Mode does a UID compare check when ; opening files. If you want to relax this to a GID compare, ; then turn on safe_mode_gid. safe_mode_gid = Off So not quite sure why there is a phoblem Ben At 16:23 09/06/2003 +0200, winst0n wrote: Ok, I think the php comand opendir is blocked for security reason. Try with this : $dp = dir($currdir ); dir() and opendir() are the same for client. A lot of hostserver disable opendir(), I dont know why, but they do ;) * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Webhosting for the masses http://serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SAFE MODE Restriction in effect
$dp = opendir( $currdir ); Basically it seems like I need to turn 'SAFE MODE' off but I dont really know what it it or how to turn it off. In fact I am not sure where the config file is on a *nix box or what is it called. Ben At 15:58 09/06/2003 +0200, winst0n wrote: what does the line 219 in misc.inc ?! ******** * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Webhosting for the masses http://serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SAFE MODE Restriction in effect
Getting the below error from a php site I am developing. I am using a new server so I guess it is a php configuration thing, but how do I fix it. Ben Warning: SAFE MODE Restriction in effect. The script whose uid is 510 is not allowed to access /home/virtual/site4/fst/var/www/html/test owned by uid 0 in /home/virtual/site4/fst/var/www/html/test/lib/misc.inc on line 219 * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Webhosting for the masses http://serverone.co.uk * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Viewing PHP pages
Server is probably set up wrong or your extensions are wrong. Check with the ISP wether you have PHP facilities, the extension is .php normally but sometimes .php3. At 03:55 24/03/2003 +, Andy wrote: Can someone help? I have uploaded my PHP pages, created in Dreamweaver MX to my hosting server but when I try to access the page the only option I get is to download it. What am I doing wrong? I have created the forms and guestbooks that mail information to me but these do not work, they are OK when I test them locally but not when they are uploaded. Thank you Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help me pervade Bristol City council to use PHP
Am talking to a part Bristol City Council in the UK. To persuade them to use PHP I need to find some high profile reference sites. Looked on php.net but all the sites were technical support sites, not really corporate or government sites. This is not very good, the MySQL lot have a very good list of sites at http://www.mysql.com/press/user_stories/index.html and the following quote on there site "The MySQL database has an estimated 4,000,000 active installations worldwide, and up to 27,000 copies of MySQL are downloaded per day. Major corporations such as Yahoo!, Cisco, NASA, Lucent Technologies, Motorola, Google, Silicon Graphics, HP, Xerox and Sony Pictures rely on MySQL for heavy-duty, mission-critical applications." This is exactly the type of thing I need for PHP and am supervised it is not on the PHP site. So.. Can anyone give me some sites who use PHP that the people at Bristol city Council would of heard of (i.e. high profile sites). Also I think this type of thing should be on php.net. Ben ******** * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Money format
As I said it is almost what I want but not quite. If it can be done a code snipit would be good. Ben At 19:44 30/01/2003 -0700, V Dub wrote: http://php.net search in functions for number_format Cheers! Quoting Ben Edwards <[EMAIL PROTECTED]>: ### I wish to format money with a ยฃ sign, two decimal places and commas ### separating thousands. I seem to be able to do the ยฃ and decimal places with ### ### sprintf or use money_format to do the commas but cant find how to do ### both/combine them. ### ### any insight, ### ben ### ### ### * Ben Edwards +44 (0)117 968 2602 * ### * Critical Site Builderhttp://www.criticaldistribution.com * ### * online collaborative web authoring content management system * ### * Get alt news/views films online http://www.cultureshop.org * ### * i-Contact Progressive Video http://www.videonetwork.org * ### * Smashing the Corporate image http://www.subvertise.org * ### * Bristol Indymedia http://bristol.indymedia.org * ### * Bristol's radical news http://www.bristle.org.uk * ### * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ### ### -- Richard Whitney Transcend Development Producing the next phase of your internet presence. [EMAIL PROTECTED] http://xend.net 602-971-2791 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 **** * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Money format
I wish to format money with a ยฃ sign, two decimal places and commas separating thousands. I seem to be able to do the ยฃ and decimal places with sprintf or use money_format to do the commas but cant find how to do both/combine them. any insight, ben * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with comma in mail form
Sorted it out with $message = ereg_replace("(\r\n|\n|\r)", "\n", trim( stripslashes( $message) ) ); trim and stripslashes not strictly speaking nessesery. Not 100% sure what happened here but guess \r\n or \r was causing problems. Ben At 11:11 26/12/2002 -0500, 1LT John W. Holmes wrote: > I have actually discovered the problem is in fact that the message gets > truncated after a Carriage Return. > > The even wearder thing is that >$msg = ereg_replace( "\n", "NL", $msg ); > > Douse put NL where the carriage return was but also seems to leave some > kind on new line character. > > So when I run $mgs through the function, do echo $msg, and look in the > source of the HTML $msg is still on a number of different lines, I'm still not sure why the message would be truncated, but try replacing \r\n instead of just \n. Windows uses \r\n, *nix uses \n and I think MAC uses \r. What are you using to view the message? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with comma in mail form
I have actually discovered the problem is in fact that the message gets truncated after a Carriage Return. The even wearder thing is that $msg = ereg_replace( "\n", "NL", $msg ); Douse put NL where the carriage return was but also seems to leave some kind on new line character. So when I run $mgs through the function, do echo $msg, and look in the source of the HTML $msg is still on a number of different lines, Ben ************ * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with comma in mail form
Here is the code with suggestion added, message still gets truncated after comma. Ben include( "common.inc" ); $db = open_db(); html_header( "Contact Us" ); if(isset($doit)) { $errors=array(); check_email( $email, $errors ); if(!isset ($message) || $message == '') { array_push($errors, "Message was empty"); } if(sizeof($errors)) { include($SESSION["libdir"] . "/show_errors.inc"); } else { $admin_email = "\"".lookup_domain( "PARAMETERS", "ADMIN_NAME", $db )."\" <". lookup_domain( "PARAMETERS", "ADMIN_EMAIL", $db ).">"; if(!isset($subject)) { $subject = "Message from email form on $SERVER_NAME"; } table_top("Sending mail..."); table_middle(); $msg = trim( stripslashes( $_POST["message"] ) ); echo $msg; mail( "$admin_email", "$subject", "$msg", "From: $email" ); echo "Your mail has been sent..."; //echo redirect( $SESSION["homedir"]."/index.php", "Home Page", 3 ); echo ""; table_bottom(); html_footer(); exit; } } table_top("Contact Us"); //echo( "Contact Us" ); table_middle(); $admin_email = lookup_domain( "PARAMETERS", "ADMIN_EMAIL", $db ); ?> CultureShop.org, PO Box 29683, London E2 6XH To send us an email fill in this form and press submit Your Email Address: Subject: Message: if(isset($message)) { echo $message; } ?> table_bottom(); html_footer(); close_db( $db ); ?> At 11:47 25/12/2002 -0800, Chris Wesley wrote: On Wed, 25 Dec 2002, Ben Edwards wrote: > I have a fairly simple mail form which gets email, subject and message and > posts to itself. > It then use mail() function to send a email. > mail( $admin_email, $subject, $message, "From: $email" ); > Problem is the message gets truncated if there is a comma in the message > after the comma. I have forms that have identical functionality, but don't exhibit that erroneous behavior. I can't tell what you've done to the arguments to mail() before using them, but the only thing I do is run them through stripslashes() and trim(). i.e. - $message = trim( stripslashes( $_POST['message'] ) ); If that's what you do too ... weird! If not, give it a try and see what happens. g.luck & cheers! ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with comma in mail form
I have a fairly simple mail form which gets email, subject and message and posts to itself. Your Email Address: Subject: Message: if(isset($message)) { echo $message; } ?> It then use mail() function to send a email. mail( $admin_email, $subject, $message, "From: $email" ); Problem is the message gets truncated if there is a comma in the message after the comma. Has anyone had this problem, got a solution to it. Regards, Ben ******** * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with sessions.
I am using sessions for holding who is logged in and it is kind of working. I have got a few emails from customers saying they cant log in (and seeing as we have had less than 30 orders this is a real problem). I can log in OK and cant recreate this problem. Any ideas regarding what this could be would be much appreciated. I guess if you have cookies turned of it wont work but what else may cause a problem. Regards, Ben * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/viws films onlinehttp://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $PHP_SELF empty when using Xitami Web Server
The variable $PHP_SELF seems to be blank, I am using PHP 4.1.2 and Xitami 2.4d9 which are both the latest version. Has anyone else had this problem and do they know how to fix it? Ben * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/viws films onlinehttp://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array()
$db = mysql_open(); $results = mysql_query( "select * from something", $db ); while( $row = mysql_fetch_array( $results ) ) { processing using $row["column"] as reference } Ben At 11:21 05/04/2002, Phil Ewington wrote: >Hi All, > >I am new to PHP and am having a bit of trouble. I have a recordset using... > >$events = mysql_fetch_array($recordset); > >this drags in 3 columns from my table... > >event_id, event_title, event_date > >I want to search the recordset for a given date, if found I want to be able >to reference event_id & event_title from the row. I am using PHP 4.01. > >TIA > >Phil Ewington. > >--- >P.S. If there are any ColdFusion developers on this list, what is the PHP >equivalent of a structure? > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exit();
return maybe. At 16:24 04/04/2002, Mauricio Cuenca wrote: >Hello, > >I'm using recursive functions and call a function from inside another one. >The problem is that when I call the Exit(); function the whole program is >aborted. How can I quit just the current function, not the whole program ? > > >Function One() >{ > If (!$var) { Exit(); } >} > >Function Two(); >{ > One();//This line kills the program > Print("Hello"); //This is not printed =( >} > > >TIA, > >__ >Mauricio Cuenca > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Current URL, Last URL, error handling
Don't seem to exist, neither douse REQUEST_URL? At 16:13 04/04/2002, Julio Nobrega Trabalhando wrote: >$REQUEST_URI? > > If it's not the full you can complement with $HTTP_HOST or similar. > >-- > >Julio Nobrega. > >Um dia eu chego lรก: >http://sourceforge.net/projects/toca > >Ajudei? Salvei? Que tal um presentinho? >http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 > > >"Ben Edwards" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Kind of but not quite. Was wondering if PHP help the actual full url. > > > > Ben > > > > At 15:26 04/04/2002, you wrote: > > > > >On Thursday 04 April 2002 21:56, Ben Edwards wrote: > > > > Is there a way I can get the whole URL of the current page for error > > > > handling/reporting. Also is there a way of getting the >previous/referrer > > > > URL for a similar purpose. > > > > > >Have a look at the values inside $HTTP_SERVER_VARS: > > > > > > > > >print_r($HTTP_SERVER_VARS); > > > > > > > > > > > >-- > > >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > > > >/* > > >"Because he's a character who's looking for his own identity, [He-Man is] > > >an interesting role for an actor." > > >-- Dolph Lundgren, "actor" > > >*/ > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > * Ben Edwards +44 (0)117 9400 636 * > > * Critical Site Builderhttp://www.criticaldistribution.com * > > * online collaborative web authoring content management system * > > * i-Contact Progressive Video http://www.videonetwork.org * > > * Smashing the Corporate image http://www.subvertise.org * > > * Bristol Indymedia http://bristol.indymedia.org * > > * Bristol's radical news http://www.bristle.org.uk * > > * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Current URL, Last URL, error handling
Kind of but not quite. Was wondering if PHP help the actual full url. Ben At 15:26 04/04/2002, you wrote: >On Thursday 04 April 2002 21:56, Ben Edwards wrote: > > Is there a way I can get the whole URL of the current page for error > > handling/reporting. Also is there a way of getting the previous/referrer > > URL for a similar purpose. > >Have a look at the values inside $HTTP_SERVER_VARS: > > >print_r($HTTP_SERVER_VARS); > > > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > >/* >"Because he's a character who's looking for his own identity, [He-Man is] >an interesting role for an actor." >-- Dolph Lundgren, "actor" >*/ > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Current URL, Last URL, error handeling
Is there a way I can get the whole URL of the current page for error handling/reporting. Also is there a way of getting the previous/referrer URL for a similar purpose. Lastly if anyone could point me in the direction on error handling strategy/techniques in general this would be good. Regards, Ben * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FPDF (was Re: [PHP] pdflib)
sorry, should of made it clear I amusing FPDF (http://fpdf.org/) library which looks like it douse the headers for you. Ben At 18:05 18/03/2002, [EMAIL PROTECTED] wrote: >On Mon, 18 Mar 2002, Ben Edwards wrote: > > This looks good, however when I try the examples I get: > > > > %PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream 2.834646 0 0 2.834646 0 > 841.89 > > cm 2 J 0.2 w BT /F1 5.64 Tf ET BT 11 -16.692 Td (Hello World !) Tj ET > > endstream endobj 5 0 obj <> endobj 1 0 obj <> endobj 2 0 obj <<> >> endobj > > 6 0 obj <> endobj 7 0 obj <> endobj xref 0 8 00 65535 f 000337 > > 0 n 000424 0 n 09 0 n 87 0 n > 000236 > > 0 n 000512 0 n 000586 0 n trailer <> startxref 664 > %%EOF > > > > Rather than acrobat being started. Any ideas? > > header('Content-Type: application/pdf'); > >miguel * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error Suggestions?
Not sure exactly what your code is but if you try to pass a literal where a reference type parameter is defined this produces a blank page. function test( &$var ) { echo $var } if you call with test( "hello" ) you get NO output. Ben At 18:01 18/03/2002, Mike At Spy wrote: > > > > On Mon, 18 Mar 2002, Mike At Spy wrote: > > > Anyone have any suggestions for getting better reporting on a generic > > > Parse Error? Code is falling to the end of the script, and I can't find > > > a problem anywhere. > > > > I'd guess you left a curly brace open. Try opening the file in an editor > > that lets you balance your braces. > > >I thought the same thing exactly - but I have gone over them a dozen times >and I am getting nothing! > >In fact, shouldn't any script run before the error? i.e. - shouldn't a >print or echo before any script runs produce something? Mine isn't! > >-Mike > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with date formatting
I use string manipulation on the date, basically split it into $day, $month and $year and use this to product formatted output. Ben At 17:51 18/03/2002, Ryan wrote: >Hi, I'm trying to create an events page, where it shows the posted >events. I enter data using phpmyadmin. Currently, the ouput is like >this: > > >Conference in New York >2002-03-06 > >There is going to be a conference in New York next week. > > >I'm having trouble with the formatting of the date. I'm using the type >date with the function now, so it shows the current date when I post an >event. Here is what I would like: > > >Conference in New York >Wednesday, March 5th, 2002 > >There is going to be a conference in New York next week. > > >Thanks for any help. > >-- >Ryan Spangler >428 N Harmony Ln, Apt. 3 >Whitewater, WI 53190 >(262) 473-8392 >[EMAIL PROTECTED] > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pdflib
This looks good, however when I try the examples I get: %PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream 2.834646 0 0 2.834646 0 841.89 cm 2 J 0.2 w BT /F1 5.64 Tf ET BT 11 -16.692 Td (Hello World !) Tj ET endstream endobj 5 0 obj <> endobj 1 0 obj <> endobj 2 0 obj <<> >> endobj 6 0 obj <> endobj 7 0 obj <> endobj xref 0 8 00 65535 f 000337 0 n 000424 0 n 09 0 n 87 0 n 000236 0 n 000512 0 n 000586 0 n trailer <> startxref 664 %%EOF Rather than acrobat being started. Any ideas? ben At 03:19 18/03/2002, Richard Baskett wrote: >Or look into fpdf.org.. I have it dynamically generate my invoices every >month :) Great class indeed! > >Rick > >When one door closes, another opens; but we often look so long and so >regretfully upon the closed door that we do not see the one which has opened >for us. - Alexander Graham Bell > > > From: Ben Edwards <[EMAIL PROTECTED]> > > Date: Sun, 17 Mar 2002 20:03:55 + > > To: [EMAIL PROTECTED] > > Subject: [PHP] pdflib > > > > I have a html report and am looking into using phplib to generate a pdf > > instead. I have got it installed and started experimenting with it but > > ether it is extremely convoluted or I am missing something. How would I > > create a simple list report (the type you would do in a table). It seems > > all I can to is specify X/Y coordinates and print text. Don't know how > > many pages the report will be for a start. > > > > Ben > > > > > > * Ben Edwards +44 (0)117 9400 636 * > > * Critical Site Builderhttp://www.criticaldistribution.com * > > * online collaborative web authoring content management system * > > * i-Contact Progressive Video http://www.videonetwork.org * > > * Smashing the Corporate image http://www.subvertise.org * > > * Bristol Indymedia http://bristol.indymedia.org * > > * Bristol's radical news http://www.bristle.org.uk * > > * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > ************ > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pdflib
I have a html report and am looking into using phplib to generate a pdf instead. I have got it installed and started experimenting with it but ether it is extremely convoluted or I am missing something. How would I create a simple list report (the type you would do in a table). It seems all I can to is specify X/Y coordinates and print text. Don't know how many pages the report will be for a start. Ben **** * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Math librarys
Getting error 'Call to undefined function: bcmod() ' cos ISP I am using douse not have maths support enabled. Has anyone got a PHP function that will do mod function so I can use this instead. Ben ******** * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.320 / Virus Database: 179 - Release Date: 30/01/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] protecting your php code from other peeping toms?
On this front douse anyone know of any companies who will compile an app as I cant afford the compiler but will need to do this in the future. Is it a stand alone and is it easy to install? Ben At 14:10 15/10/2001, ~~~i LeoNid ~~ wrote: >On Sat, 13 Oct 2001 16:14:39 -0400 impersonator of [EMAIL PROTECTED] >(Matthew Loff) planted &I saw in php.general: > > > >Are there any open source efforts to clone the Zend PHP compiler, so > >that PHP scripts can be distributed in binary form? > > >I don't know of _common_ efforts in this direction. May be it is against >open php policy:) (if i do a pre-processOR [not open], it 'll cost half of >of zend's $$ - 1200/install:)) > > >There is already the Win32 PHP compiler intended for PHP+GTK scripts... > > >No much use if it is only for windows. What/where it is and how $$, btw? >In any case even it is exits for *unix also it should be in every PHP (say >4) installment, which is unlikely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Windows 2000 Browse/upload problem
[Sorry if this is a re-post but I have been having some email problems and cant find original in the archive] I have a PHP application that is working fine on my Windows 98 system but when I try it on my Windows 2000 setup (which has recently had PHP/MySQL installed) there is a problem. When I post from a form with a Browse/File field when I check to see if the temp file exists it douse not. This check is being done in the page being posted to. The strange thing is that the file the varable is set to is something like E:\WINNT\TEMP\phpD4.tmp and I thought PHP used tmp (E:\tmp is where the session data is held). Any idea what is wrong. Regards, Ben ** * Ben Edwards+44 (0)7970 269 522 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Temp File missing Win2k
I am ruining PHP with IIS on Win2k. I am using a PHP app which was working fine but when the app douse a file/upload/submit in the page posted to the temporary file seems not to exist. This was working fine on my Win98 setup. Any idea what is wrong? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Windows/UNIX differences?
Have a regular expression which replaces ' with '' (used to insert ' into db): preg_replace("/\'/", "''", $text ); This works great on the UNIX production machine but not on windows development environment. Actually replaces ' with \'' not ''. Before I write a function that loops thought the whole thing looking at each character and replaces ' with '' has anybody got any ideas? Ben ** * Ben Edwards+352 091 429995 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What is filerpos, filelen and subfile
Forget this one, i'me being stupid. At 04:26 P 21/10/01, Ben Edwards wrote: >This is really strange, found this function someware (cant remember where) >and it works. What I cant find is any reference to filerpos, filelen or >subfile on the php website! They are not functions I define in any inc >files. Anyone know where these are documented? ********** * Ben Edwards+352 091 429995 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] What is filerpos, filelen and subfile
This is really strange, found this function someware (cant remember where) and it works. What I cant find is any reference to filerpos, filelen or subfile on the php website! They are not functions I define in any inc files. Anyone know where these are documented? Ben function get_file_ext($file) { $i = filerpos($file,"."); if (!$i) { return ""; } $l = filelen($file) - $i; $ext = subfile($file,$i+1,$l); return filetolower( $ext ); } ********** * Ben Edwards+352 091 429995 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP is NOTa Bloated Kludge, end of discusion?
"Maxim Maletsky \(PHPBeginner.com\)" <[EMAIL PROTECTED]> on 05/10/2001 01:43:57 To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> cc: Subject: RE: [PHP] PHP is a Bloated Kludge, discuss! Firstly let me say that you lot have been great. Lots of useful stuff and no flame, big Respect! Sorry about reactionary nature of the post. Doing a 9/5 and building PHP sites till 2 in the morning means I drink a lot of coffee during the day. I guess I could blame it PHP's addictive nature ;) (because of its ease of use and power of course). Luckily only on my 2nd cup. Anyway have enough pro-php amo now. Actually had a look at some benchmarks and both mod_php and mod_perl are fast, haven't found any that seem to do proper tests though ( Wish I could get paid for writing apps where all they do is display 'Hello World' 5 thousand times ). Anyone know any good exhaustive ones. >It is just you and some other people similar to you. Thought this >question was up for a while :-) did not know there were many techn-hippy-anarcho-headenist-dyslexic-anti-capitalists left, There's hope for us all ;) >Is it really true? I always though it wasn't. >AFAIN: Long time ago require() was working this way. But now, require() >and include() are the same. Loaded only when needed. No, Been put straight on this one. >Well, it has it's pluses and it's minuses, it is extendable, though OOD >works a little different in it. But hey, it compiles on the fly, >remember? That's a plus for developers, especially newbies. Probably not so bad OOD stuff is handled differently, OO languages do tent to be a bit on the slow side. They also don't really fit with PHP's paradigm. OO stuff is very modular and PHP is not. Weather this is good or bad is one issue but it is certainly true that trying to mix paradigms is always going to be a problem. Also remembering an article by F.Brooks entitles 'There is no Silver Bullet'. Anyone know where there is an on-line version on this. Basically OO is a load of already existing 'good practices' with there own spin and some clever implementation. Kind of a checklist with knobs on it. There is no silver bullet when it comes to Software Engineering, just a load of copper ones. A lot of non-oo language can use a lot of (stolen) OO concepts and as we all know OO douse not garentee good code, just makes it SLIGHTLY more likely (and only if people understand the underlying concepts). >OK, true. But, this is necessary if you want PHP to automatically >connect to different DBs. >A plus to portability and a minus to... (to what?) Not automatically uniformly, but there are libraries out there (I now know) which do this anyway. > We all play it (Devils Advocate) once at least ;-) Well they do say the devil has all the best tunes. >Isn't it the greatest thing of it? >Just think of this - where else you can become a programmer in a short >time? >Compliling/executing/libraring/connecting just to make a simple >guestbook for your site. Steady all, you'll be butting all programmers out of a job, or are you a techn-hippy-anarcho-headenist-dyslexic-anti-capitalists too ;) Neb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP is a Bloated Kludge, discuss!
Exelent, as I said I was playing devels advicate, I like PHP a lot, I am trying to get someone else to use it to and they came up with this stuff. > if(condition) include 'file'; Is exactly what I was looking for. As 'if () {}' loaded, or at least parsed things I did'nt think another form of if would be different ( RFM-;) ). Maybe I should stop developing for a while and have a good wade through the manual. Its so easy to do stuff in PHP it's easy to get lazy! Thanks, Ben Rasmus Lerdorf <[EMAIL PROTECTED]> on 04/10/2001 18:21:28 To: <[EMAIL PROTECTED]> cc: <[EMAIL PROTECTED]> Subject: Re: [PHP] PHP is a Bloated Kludge, discuss! > PHP on the other hand seems to load in ALL the code that MAY be run. i.e. > an include brings things in which are inside an if, even if the if equates > to false. That's not true. if(condition) include 'file'; That will only include the file if the condition is true. Very easy to verify for yourself. So a bunch of your points related to this are void. > Then there is the way database connectivity is handled. > > There are a load of functions (again in the core language) with there NAMES > containing the name of the database you are connecting to. > > For example all MySQL functions are mysql_something and I guess all oracle > ones are oracle_something. This would only be a minor inconvenience > because wrapper functions can be written but from what I can gather > different databases have different functionality available. There is both a C-level abstraction layer called dbx and a user-space one in PEAR. Plus a number of others. So again, this makes your next points void. > Got a nast feeling that ASP (spit) does something like this. As does PHP if you had bothered to look. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP is a Bloated Kludge, discuss!
(From behind filing cabinet where I am ducking preparing for flames). Is it just me or is there anyone else that thinks PHP suffers from not being modular. Let me explain myself. If you write a module for a lot of procedural languages it sits on the filling system and is called up when it is needed , loaded into memory and executed. There maybe some cashing which happens but this is basically how it works. PHP on the other hand seems to load in ALL the code that MAY be run. i.e. an include brings things in which are inside an if, even if the if equates to false. This means that the language is not extendible in the way others are. If you do write a function you wish to include in 'only the pages you wish to use' you have to first include it, then call it. This has also meant that things like spell checking functions are built into the core module rather than called in as or when they are needed. Then there is the way database connectivity is handled. There are a load of functions (again in the core language) with there NAMES containing the name of the database you are connecting to. For example all MySQL functions are mysql_something and I guess all oracle ones are oracle_something. This would only be a minor inconvenience because wrapper functions can be written but from what I can gather different databases have different functionality available. I know this is partly because different databases have different functionality. what I would expect to see is a load of generic function which attempt to provide same functionality where it is available or implement some of the functionality themselves. Obviously for some of the less sophisticated databases these functions would have to do more work and maybe some functionality wouldn't be available in certain databases (but only the things like stored procedures). Got a nast feeling that ASP (spit) does something like this. You may cry, it cant be done. however I remember a connectivity product that came from Borland (this was back in the Paradox Days) which did just this, it even had transaction handling built into this connectivity layer for DBase! Anyway I am playing Devils Advocate. What I do like about PHP is how quickly it can be learnt and how quick you can build apps with it. Maybe this is at the expense of elegance. Maybe PHP5 will address these issues -;) And there are certainly some very busy PHP sites, you should see the traffic levels on indymedia.org during anti-capitalist demonstrations and I am sure during the New York attacks they went belistic. Regards, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting my head around nulls
Steve Cayford <[EMAIL PROTECTED]> on 25/09/2001 17:28:57 To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] Getting my head around nulls On Tuesday, September 25, 2001, at 10:30 AM, [EMAIL PROTECTED] wrote: >> >> Just had a look at manual, ifnull() seems close to useless. However if >> they had NVL(), as Oracle douse >> >> NVL( column|litrel, '*null*' ) >> >> This takes a column or literal as its first arg and if arg is null >> returns >> 2nd arg otherwise returns arg. In other words if the column is null it >> is >> replaces by arg2 otherwise it is simply returned. >> > >Um, that's what ifnull() does. At least it works for me. > >-Steve Verry true, sorry, was looking at nullif. Also noticed the if function, can this have more than three parameters. i.e if ( col, 'A', 'Accept', 'C', 'Complete', 'Unknown' ) like Oracle decode. and if elseif else structure. Neb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting my head around nulls
>Thanks for correcting my misspelling, Andrey, "IS NULL" not "IS_NULL". >Another thing to look at, Ben, is IFNULL(). I would give you an example, but >I never got it to work like I thought it should ;) I think it is supposed to >return an alternate value for NULLs. Just had a look at manual, ifnull() seems close to useless. However if they had NVL(), as Oracle douse NVL( column|litrel, '*null*' ) This takes a column or literal as its first arg and if arg is null returns 2nd arg otherwise returns arg. In other words if the column is null it is replaces by arg2 otherwise it is simply returned. Next week I will sing the prases of the oracle decode statement -;) The week after that I will get all exited about MySQL freetext indexes, yum, yum. Neb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting my head around nulls.
Just realised, you meant 'is null' not is_null. Sorry, couldn't see the wood for the trees. This in ANSI SQL and I use it every day. Had a look at zootweb.com. And I thought ASP meant 'Active Server Pages' not 'Application Service Provider'. And not a zoot suit in sight -;) Regards, Neb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting my head around nulls.
>I wish the rest of the world saw it that way! But not so... That's what capitalism does for you -;) >You may want to look at MySQL's IS_NULL function for retrieving data. Other >than that, I don't have any good advice. It seems that if you retrieve a >NULL from the database and try to assign it to a PHP variable, that variable >gets destroyed. AFAIK, yes, you need a bunch of data checks, both putting >data in and pulling it back out. Strange, I did a search on is_null in the MySQL manual (ver 3.23.40 .pdf) and got no nits on is_null. Could you provide example of its use. Neb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sessions just don't work on my machine. (Trying this again)
Dont use sessions, they are a little flaky anyway. Use a mixture of holding data in database and passing sid/userid/hash around on the URL. You wont regret it. >I have written here several times on this subject and in the end those who >have gratiously helped me have ended up just telling me they have no clue >why it doesn't work. It HAS to be my server setup but I don't know what it >could be. > >Sessions just don't work on my machine... > >The heart of the problem is the session_start() function. > >The first time you start a session with this function it creates a new >session, that's fine. > >The problem happens when it's run and no matter if the SSID is in a cookie >or passed via a form, it will still create a new session, every single time. >It will not pickup the old session. > >Here is the app I setup to demonstrate the problem: > >http://fromtheduke.com/session/ > >The first page initiates the session, the variable is posted to the next >page, the next page should retrieve the session and display the first two >variables which were registered in the session, then display the third var. > >You'll see the third var showsup, the first two don't. The session ID may >or may not remain the same. If you manually remove the index2.php file and >reload the first page, the SSID will have changed. > >Source of the files: >index.php: > >session_start(); > >session_register("var1"); >session_register("var2"); > >$var1 = "My var 1"; >$var2 = "My var 2"; > >?> > >Session Page 1 > > > > >PHPSESSID: >Var1: >Var2: > > >VAR 3: VALUE="go"> > > > > >-- > >Source of index2.php: > >session_start();// start session >session_register("var3"); // register var 3 session variable > >$var3 = $myvar3; >?> > >Session Page 2 > > > > >PHPSESSID: >Var1: >Var2: >VAR3: > > > >-- > >I have tried session_name() to force the session ID. I was told though this >function doesn't set the SSID. It gives the SSID a name or something. > >I have been told this is all setup correctly, yet, you can see it doesn't >work. > >The permissions on my /tmp directory look like this: > >drwxrwxrwt /tmp > >Does this have anything to do with this? I don't know much about the >permissions part of things. > >-- > >Thomas Deliduka >IT Manager > - >New Eve Media >The Solution To Your Internet Angst >http://www.neweve.com/ > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- [EMAIL PROTECTED]+44 (0)7970 269 522 http://www.subvertise.org -- Altering the Corporate Image http://www.criticaldistribution.org -- Buy Alternative Video Online http://www.videonetwork.org -- Community/Radical Video http://www.spamcop.net/ -- Killing SPAM feels good! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Getting my head around nulls.
First recap (been doing RDBMS stuff for over 10 years so reckon this is correct). Nulls and blank are NOT the same in RDBMS (in fact there are actually several types of nulls). MySQL implements this correctly (Unlike Oracle which treats null and blank the same). Up to now I am OK but when it comes to codeing in PHP I am not to sure about best practice. The app I am working on for number datatypes inserts 0 if no data is entered in form. I can see why, I am inserting a blank into the database and MySQL goes (Hang on this is a number fields and as you are not inserting NULL you obviously mean zero). So I guess I need to do some conditional stuff so the blanks are not actually inserted or put null into the PHP variable and insert this (Can PHP vars be null but exist?). Or is their another option? The second half of the issue is getting data from the database. I added a couple of columns to database but then I tried to retrieve them as $row[index]. I got a variable x douse not exist error. This really through me until I realised it was because the value in the database was null and it kind of makes sense not to create the var for nulls (although it makes coding a pig). So again, it seems I need to do a lot of isset() stuff which is going to be a pain. Any other insight. Nulls with varchar/char types are not so much of a problem as long as you don't mind all fields in the database being blank rather than null after you first insert data into them. It would be good to get peoples advice on this. And remember "0 as a number is as important as any other number". Regards, Ben -- "If you criminals strong encryption ONLY the criminals will have it" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP and GD
That directory is VERY close to root. Is that what you intended? "J. Anderson Scarbrough" <[EMAIL PROTECTED]> on 24/09/2001 15:59:04 To: [EMAIL PROTECTED] cc: Subject: [PHP] PHP and GD I am trying to create PNG images on the fly using the following code. if(file_exists($key)) { $diff = time() - filemtime($key); if($diff >= 600) { unlink($key); } } $im = ImageCreateFromPNG($value); $isCreated = imagePNG($im, $key, '80'); //error occurs here I recieve the following error on the line indicated above. imagepng: unable to open '/images/image1.png' for writing When I run phpinfo it shows PHP as begin copiled with GD support with PNG enable on GD (see below) GD Support enabled GD Version 1.6.2 or higher PNG Support enabled WBMP Support enabled The only other issue i could think of was permissions, but i have changed permissions to "rwx" all the way across for the directory and all files inside the directory. Any one have any ideas??? Thanks. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Receiving mySQL result from remote server?
Yes, in fact it is normal. Having dedicated MySQL box is a good idea. A lot of the MySQL security is based around this. To find out how look in the MySQL manual (download .pdf from www.mysql.com) or go on the mysal mailing list (same domain) or if you have a decent isp get primer from there support website (you could have a look at www.pair.com/support). Neb "Jeff Lewis" <[EMAIL PROTECTED]> on 24/09/2001 15:52:24 Please respond to "Jeff Lewis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> cc: Subject: [PHP] Receiving mySQL result from remote server? Is it possible to have a script at xyz.com retrieve data from a mySQL database on abc.com? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] RE: MySQL and PHP problem
4.0.6, yes, douse this mean you have a possible solution -:) At 06:54 A 23/09/01 , you wrote: >SpamCop - Report spam: >http://members.spamcop.net/mcgi?action=logreport&id=10282302 > >I assume you mean PHP 4.06? > >-- >Billy Cravens > >-----Original Message- >From: Ben Edwards [mailto:[EMAIL PROTECTED]] >Sent: Saturday, September 22, 2001 7:48 PM >To: [EMAIL PROTECTED] >Subject: MySQL and PHP problem > >[Reposting cos left error message out, sorry] Had a fully working >installation of MySQL 3.23 with PHP 6.0.6. I then foolishly installed >PGP >which included PGPNet and I cant access my MySQL database from PHP. >When I >try to connect I get error 'Access denied for user: '@GREEN' to database > >'subvert_cd' >', another strange thing is under MyODBC it says 'Not Found'. I have >re-installed both PHP and MySQL (actually installed 3.23.42) after first > >de-installing PHP but still no luck. > >Regards, >Ben >-- >This Email account is protected by http://www.spamcop.net >ALL spam is reported to ISP and there network provider >*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ >* Ben Edwards [EMAIL PROTECTED] +352 091 429995 * >* Homepagehttp://www.gifford.co.uk/~bedwards * >* i-Contact Progressive Videohttp://www.videonetwork.org * >* Smashing the Corporate image http://www.subvertise.org * >* Bristol's radical newshttp://www.bristle.co.uk * >* Open Directory Project http://www.dmoz.org * >*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ > >- >Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail ><[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > -- This Email account is protected by http://www.spamcop.net ALL spam is reported to ISP and there network provider *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ * Ben Edwards [EMAIL PROTECTED] +352 091 429995 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * Open Directory Project http://www.dmoz.org * *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] MySQL and PHP problem
[Reposting cos left error message out, sorry] Had a fully working installation of MySQL 3.23 with PHP 6.0.6. I then foolishly installed PGP which included PGPNet and I cant access my MySQL database from PHP. When I try to connect I get error 'Access denied for user: '@GREEN' to database 'subvert_cd' ', another strange thing is under MyODBC it says 'Not Found'. I have re-installed both PHP and MySQL (actually installed 3.23.42) after first de-installing PHP but still no luck. Regards, Ben -- This Email account is protected by http://www.spamcop.net ALL spam is reported to ISP and there network provider *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ * Ben Edwards [EMAIL PROTECTED] +352 091 429995 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * Open Directory Project http://www.dmoz.org * *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP versus ZOPE
Zope is very good but badly documented. The other things to consider is hosting, which is relatively expensive as there are not that many people who do it. Also the fact that you will have to learn python (which is not a major issue but is probably a much higher learning code than PHP) is something to consider. I started developing an e-commerce site in Zope but switched to PHP because the lack of documentation was driving me nuts. This is a particular problem because zope is far from a traditional language. Its bad enough trying to get your head round a new paradigm when the documentation is good! The only 'book' on it was the one on the web site and the documentation/articles are rather eclectic. Also the book only really scratches the surface. Having said this the email list is very useful and the environment is elegant. Have fun and let me know how you get on. I am not on php-general at the moment so please email me directly (I will try to send this to php-general but an sure it will bounce). Regards, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Login in https, site in http problem
We have a site which logs in using https (secure site) but the rest of the site is in http (non-secure site). We are doing this because we do not have/want to pay for a secure key. The login form posts back to itself so the whole login is in https. The problem is the session variables set in https (username and ip address) are not available in http. Has anybody got any word rounds/solutions for this? Regards, Ben *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ * Ben Edwards [EMAIL PROTECTED] +352 091 429995 * * This Email account is protected by http://www.spamcop.net * * ALL spam is reported to ISP and there network provider * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * Open Directory Project http://www.dmoz.org * *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]