Re: [PHP] session variables - help
I'm realy sorry for u, but the reason for no answers is ur concept. may be some rules will help u and I recommend u to think to spend the time to rewrite the whole code. Im shure u will solve the problem then: first dont use the global arrays directly. pick the values u need and put them in reasonable types of variables. build the business logic on these variables and if u feel like put the results in well readable new ones then populate the presentation in the required htmls this will give u an more structured code, easier to debug and more fun for the group to help u I still dont understand why u use the $_SESSION variable. user often leave forms open for hours and then submit them. u can not expect a user to end a job in the livecycle of the session. thats what hidden form fields are made for. the $_session is for member like things and applications with security issues where u can expect the user to finish things in a certain time or u restart the whole. "Allen McCabe" wrote in message news:657acef20908132257x630719e1g4ecddcdff9492...@mail.gmail.com... > Ben, > > First of all, I thank you for your time and help. > > My ai with using unset($var) in update_order.php is to set the SESSION > variable for an item to ' ' (empty) so that it would not show up on the > order summary (because my writeResultRow() function will only write a row if > that variable is greater than 0). > > I just can't figure out what I'm missing here. Before I received your > response, I made a few changes to my code, which helped streamline the > calculating parts (grabbing values from SESSION instead of POST, and now > when I update order_summary, the values will remain because it pulls them > from the SESSION). > > I want to edit the values in the SESSION, so that when update_order.php > redirects to order_process.php, the values are changed, and if applicable, > an item is removed from the html table (if the quantity is less than 1). > > Here is some more complete code: > > [code = order_process.php] > > session_start(); > // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION > foreach($_POST as $k=>$v) { > $_SESSION[$k]=$v; > } > > $thisPage="AFY"; //NAVIGATION PURPOSES > include("afyshows.php"); //CONTAINS ARRAYS FOR SHOW ENTITIES; POPULATES > ORDER FORM > ?> > > . . . > > > > > > > > > > > > /> > > . . . > > > function findTotalCost($b, $c) { > $total = $b * $c; > return $total; > } > > function writeResultRow($a, $b, $c, $d, $e, $f) { > if($a != '') { > echo "\n\n\t"; > echo "".$b."".$c."".$d.""; > echo "".$e." name='".$a."' id='".$a."' size='2' />=\$".$f.""; > echo ""; > } > } > > //SETS $Total_show_01 to PRICE * QUANTITY > //FORMATS TOTAL > //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES > $Total_show_01 = findTotalCost($shows['show_01']['price'], > $_SESSION['show_01_qty']); > $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', ''); > writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'], > $shows['show_01']['date'], $shows['show_01']['time'], > $shows['show_01']['price'],$Total_show_01_fmtd); > > //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38) > > ?> > . . . > > > > [/code] > > Now, here is the update_order.php code in entirety: > > [code] > > session_start(); > foreach ($_SESSION as $var => $val) { > if ($val == "0") { > unset($_SESSION[$var]); > } elseif ($val == '') { > unset($_SESSION[$var]); > } else { > $val = $_SESSION[$var]; > > } > } > header("Location: order_process.php"); > > //NOTICE I FIXED THE LOCATION OF THE header() FUNCTION > //BUT IT STILL DOES NOT UPDATE > > ?> > > [/code] > > If you're still with me, I thank you. I removed all the styling elements > from the html to make it easier for you (and me) to see what it says. I have > invested many hours into this, and have generated many many lines of code, > but I hope what I gave you is sufficient, while not being overwhelming at > this hour. > > Thank you very much for your help thus far, anything else would be greatly > appreciated. > > > On Thu, Aug 13, 2009 at 5:56 PM, Ben Dunlap wrote: > > > > > > >> I have the following code for order_update.php: > >> > >> [code] > >> > >> session_start(); > >> extract($_POST); > >> foreach ($_POST as $var => $val) { > >> if ($val > 0) { > >> $_SESSION[$var] = $val; > >> } else { > >> unset($var); > >> > >> } > >> header("Location: order_process.php"); > >> } > >> > >> [/code] > >> > >> This is not working, however, and it just loads order_process.php with no > >> values for the varaibles, as if I just refreshed the page with no > >> sessions. > > > > > > Maybe you left it out but I didn't see any place where you used $_SESSION > > in order_process.php. Also, your redirect in order_update.php appears to be > > inside your foreach loop, which would definitely mess things right up -- but > > maybe that was just a typo in your email? > > > > Otherwise the logic in order_update.php looks OK, but th
Re: [PHP] session variables - help
On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote: > user often leave > forms open for hours and then submit them These users should be taken out and beaten over the head with their keyboards! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables - help
well thanks good they are far away then, but the problem is ur client, i didnt find anybody giving me the permission to beat his customers "Ashley Sheridan" wrote in message news:1250236989.2344.10.ca...@localhost... > On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote: > > user often leave > > forms open for hours and then submit them > > These users should be taken out and beaten over the head with their > keyboards! > > Thanks, > Ash > http://www.ashleysheridan.co.uk > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using fopen on a site with popups
Hey everyone! I have a question. I know that you can use fopen to open not just local files, but also files via HTTP. My question is, assuming you're attempting to open a page that has popups, is there anyway to get at the actual content underneath the popup? Thanks! James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables - help
On Fri, 2009-08-14 at 10:05 +0200, Ralph Deffke wrote: > well thanks good they are far away then, but the problem is ur client, i > didnt find anybody giving me the permission to beat his customers > > "Ashley Sheridan" wrote in message > news:1250236989.2344.10.ca...@localhost... > > On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote: > > > user often leave > > > forms open for hours and then submit them > > > > These users should be taken out and beaten over the head with their > > keyboards! > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > > Beat them hard enough and they tend to forget who did it... My life would be so much easier without end users! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using fopen on a site with popups
On Fri, 2009-08-14 at 01:15 -0700, James Colannino wrote: > Hey everyone! I have a question. I know that you can use fopen to open > not just local files, but also files via HTTP. My question is, assuming > you're attempting to open a page that has popups, is there anyway to get > at the actual content underneath the popup? > > Thanks! > > James > As far as I'm aware, you won't get any popups using fopen. Popups are a thing of Javascript (or links clicked on that have a target other than _self, _parent or _top) so just calling the page won't trigger them to be opened. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using fopen on a site with popups
have u tried? I did not, but as far as I understand u getting the stream including the html causing the browser to open an popup. so what is ur real problem then? "James Colannino" wrote in message news:4a851d14.2010...@colannino.org... > Hey everyone! I have a question. I know that you can use fopen to open > not just local files, but also files via HTTP. My question is, assuming > you're attempting to open a page that has popups, is there anyway to get > at the actual content underneath the popup? > > Thanks! > > James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using fopen on a site with popups
Ralph Deffke wrote: > have u tried? > > I did not, but as far as I understand u getting the stream including the > html causing the browser to open an popup. > > so what is ur real problem then? Yeah, ummm... Sorry for the traffic. That was a really stupid question... It looks like the format of a page I was reading data from changed, which messed something else up. It just recently started implementing popup ads as well, so I blamed that, but as another poster pointed out, popups are caused by javascript execution in the browser, so that shouldn't have any effect on the content I read. Me needs to get some sleep :) James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using fopen on a site with popups
well included in a html
RE: [PHP] session variables - help
> -Original Message- > From: Allen McCabe [mailto:allenmcc...@gmail.com] > Sent: 14 August 2009 06:58 > My ai with using unset($var) in update_order.php is to set the > SESSION > variable for an item to ' ' (empty) so that it would not show up on > the > order summary (because my writeResultRow() function will only write > a row if > that variable is greater than 0). > > I just can't figure out what I'm missing here. Before I received > your > response, I made a few changes to my code, which helped streamline > the > calculating parts (grabbing values from SESSION instead of POST, and > now > when I update order_summary, the values will remain because it pulls > them > from the SESSION). > > I want to edit the values in the SESSION, so that when > update_order.php > redirects to order_process.php, the values are changed, and if > applicable, > an item is removed from the html table (if the quantity is less than > 1). > > Here is some more complete code: > > [code = order_process.php] > > session_start(); > // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION > foreach($_POST as $k=>$v) { > $_SESSION[$k]=$v; > } This has just destroyed anything that was previously in the session, so if you're recycling from the update_order.php script, you've just thrown away whatever that script did! You need to make this conditional on having arrived here from the initial form -- various ways you could do that, but I leave you to figure that one out. (Also, personally, if I were doing this at all, I would just copy the array as a single entity: $_SESSION['_POST'] = $_POST; and then reference individual elements through that as, e.g., $_SESSION['_POST']['School']. That's probably a matter of personal style as much as anything, but gives you another way to think about.) [ . . . . ] > > > function findTotalCost($b, $c) { > $total = $b * $c; > return $total; > } > > function writeResultRow($a, $b, $c, $d, $e, $f) { > if($a != '') { > echo "\n\n\t"; > echo "".$b."".$c."".$d.""; > echo "".$e." value='".$a."' > name='".$a."' id='".$a."' size='2' > />=\$".$f.""; > echo ""; > } > } > > //SETS $Total_show_01 to PRICE * QUANTITY > //FORMATS TOTAL > //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES > $Total_show_01 = findTotalCost($shows['show_01']['price'], > $_SESSION['show_01_qty']); > $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', ''); > writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'], > $shows['show_01']['date'], $shows['show_01']['time'], > $shows['show_01']['price'],$Total_show_01_fmtd); > > //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38) AARRRGHHH!! This cries out for an array-based solution -- repeating near-identical code that many times is totally ludicrous, and should be a major clue that you need to refactor. You'll have to forgo using indexes like ['show_01'] and use straight integers, but the massive reduction in repetitive code (and hence far fewer opportunities for mistakes!) will be well worth it. Something like: for ($i=1; $i<=38; ++$i): $Total[$i] = findTotalCost($shows[$i]['price'], $_SESSION['qty'][$i]); $Total_fmtd[$i] = number_format($Total[$i], 2, '.', ''); writeResultRow($_SESSION['qty'][$i], $shows[$i]['title'], $shows[$i]['date'], $shows[$i]['time'], $shows[$i]['price'],$Total_fmtd[$i]); endfor; [ . . . . ] > Now, here is the update_order.php code in entirety: > > [code] > > session_start(); > foreach ($_SESSION as $var => $val) { > if ($val == "0") { > unset($_SESSION[$var]); > } elseif ($val == '') { > unset($_SESSION[$var]); > } else { > $val = $_SESSION[$var]; That line is back-to-front -- you're assigning the current value in the session to $val, which is then immediately thrown away as the foreach loop starts a new iteration. What you mean is $_SESSION[$var] = $val. Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, C507, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with memcache - help needed
Hello folk! Currently, we use memcached as caching solution. We provide a link to 3 servers, a server-2x the Memcache daemon is started (2 different ports (depending 4GB) 192.168.0.1:11211 (4 GB) 192.168.0.1:11212 (4 GB) 192.168.0.2:11211 (700 MB) 192.168.0.3:11211 (700 MB) -> Php.ini: memcache.hash_strategy consistent = <-- $o_memcache = new Memcache (); $o_memcache->addServer ([SERVER], [PORT]); whenever a request comes the "connect" is no longer needed because Memcache established the connection automatically. We also tried $o_memcache=connect([SERVER], [PORT]); - same problem. About $o_memcache->get([KEY]), we check to see if the KEY is already set (KEY = UNIQUE!). In case of error returns GET "false". When TRUE, the content of the KEY will be shown - otherwise with $o_memcache->set([KEY], [CONTENT], MEMCACHE_COMPRESSED, mktime (date ( "H") +6)); will be saved for 6 hours. You should guess the KEY will be saved for the next 6 hours, but in this case, it will not. After about 2-3 minutes the KEY returns with GET "FALSE" again. ? We also tried this: - Memcache connection with addServer, connect and pconnect - 1 server as connection, multiple server (like listed above - as pool) ? Server stats: evictions = 0 cur_connections: ~50-100 ? Server settings: Apache 2.11 PHP 5.2.8 Memcache-Info by phpinfo(); Active persistent connections 4 Version 2.2.5 Revision $Revision: 1.111 $ memcache.allow_failover 1 1 memcache.chunk_size 8192 8192 memcache.default_port 11211 11211 memcache.default_timeout_ms 1000 1000 memcache.hash_function crc32 crc32 memcache.hash_strategy consistent consistent memcache.max_failover_attempts 20 20 ? Does anybody know this issue or solution(s) to fix this problem? Thanks for help. Jean Michel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session variables - help
> -Original Message- > From: Ford, Mike [mailto:m.f...@leedsmet.ac.uk] > Sent: 14 August 2009 11:45 > > Now, here is the update_order.php code in entirety: > > > > [code] > > > > > session_start(); > > foreach ($_SESSION as $var => $val) { > > if ($val == "0") { > > unset($_SESSION[$var]); > > } elseif ($val == '') { > > unset($_SESSION[$var]); > > } else { > > $val = $_SESSION[$var]; > > That line is back-to-front -- you're assigning the current value in > the session to $val, which is then immediately thrown away as the > foreach loop starts a new iteration. What you mean is > $_SESSION[$var] = $val. No, wait a minute, hold your foot up! I was so focussed on the strange assignment that I didn't read the whole thing properly. What you're *actually* doing here is -- er, well, totally not what you want to, I suspect! Having re-read the message I responded to, I'm going to go back to it and post another response Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, C507, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with memcache - help needed
On Fri, Aug 14, 2009 at 7:14 AM, Jean Michel Malatray wrote: > Hello folk! > > Currently, we use memcached as caching solution. > > We provide a link to 3 servers, a server-2x the Memcache daemon is started > (2 different ports (depending 4GB) > > 192.168.0.1:11211 (4 GB) > > 192.168.0.1:11212 (4 GB) > > 192.168.0.2:11211 (700 MB) > > 192.168.0.3:11211 (700 MB) > > -> Php.ini: memcache.hash_strategy consistent = <-- > > $o_memcache = new Memcache (); > > $o_memcache->addServer ([SERVER], [PORT]); > > whenever a request comes the "connect" is no longer needed because Memcache > established the connection automatically. > > We also tried $o_memcache=connect([SERVER], [PORT]); - same problem. > > About $o_memcache->get([KEY]), we check to see if the KEY is already set > (KEY = UNIQUE!). > > In case of error returns GET "false". > > When TRUE, the content of the KEY will be shown - otherwise with > $o_memcache->set([KEY], [CONTENT], MEMCACHE_COMPRESSED, mktime (date ( "H") > +6)); will be saved for 6 hours. > > You should guess the KEY will be saved for the next 6 hours, but in this > case, it will not. > > After about 2-3 minutes the KEY returns with GET "FALSE" again. > > ? > > We also tried this: > > - Memcache connection with addServer, connect and pconnect > > - 1 server as connection, multiple server (like listed above - as pool) > > ? > > Server stats: > > evictions = 0 > > cur_connections: ~50-100 > > ? > > Server settings: > > Apache 2.11 > > PHP 5.2.8 > > Memcache-Info by phpinfo(); > > Active persistent connections 4 > > Version 2.2.5 > > Revision $Revision: 1.111 $ > > memcache.allow_failover 1 1 > > memcache.chunk_size 8192 8192 > > memcache.default_port 11211 11211 > > memcache.default_timeout_ms 1000 1000 > > memcache.hash_function crc32 crc32 > > memcache.hash_strategy consistent consistent memcache.max_failover_attempts > 20 20 > > ? > > Does anybody know this issue or solution(s) to fix this problem? > > Thanks for help. > > Jean Michel > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > A couple of things, 1) Use PECL/Memcached and not PECL/Memcache. It's faster, better maintained, has more features, blah blah blah. 2) Set expects an integer number of seconds to keep it, mktime(date() + 6) is going to return an enormous number, which it looks like memcache doesn't know how to handle. If you want to save something for six hours, you need to set() with an integer value of 60*60*6 (seconds in a minute * minutes in an hour * 6 hours). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Byte Code Compiler
quite a while I'm thinking for what could that be used. also in the documentation there are no posts, has anybody ever played arround with if? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session variables - help
> -Original Message- > From: Allen McCabe [mailto:allenmcc...@gmail.com] > Sent: 14 August 2009 06:58 > > Here is some more complete code: > > [code = order_process.php] > > session_start(); > // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION > foreach($_POST as $k=>$v) { > $_SESSION[$k]=$v; > } > > $thisPage="AFY"; //NAVIGATION PURPOSES > include("afyshows.php"); //CONTAINS ARRAYS FOR SHOW ENTITIES; > POPULATES > ORDER FORM > ?> > > . . . > > > Er wait, no! Sessions and hidden form fields are generally alternative solutions to the same problem -- you shouldn't be putting the same values both in the session and in hidden form fields. In this case, I'm beginning to suspect that the hidden fields are the better solution, but there is a certain amount of personal preference in this. > > > > > > > > > /> > > . . . > > > function findTotalCost($b, $c) { > $total = $b * $c; > return $total; > } > > function writeResultRow($a, $b, $c, $d, $e, $f) { > if($a != '') { > echo "\n\n\t"; > echo "".$b."".$c."".$d.""; > echo "".$e." value='".$a."' > name='".$a."' id='".$a."' size='2' > />=\$".$f.""; > echo ""; > } > } > > //SETS $Total_show_01 to PRICE * QUANTITY > //FORMATS TOTAL > //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES > $Total_show_01 = findTotalCost($shows['show_01']['price'], > $_SESSION['show_01_qty']); > $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', ''); > writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'], > $shows['show_01']['date'], $shows['show_01']['time'], > $shows['show_01']['price'],$Total_show_01_fmtd); > > //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38) > > ?> > . . . > > > > [/code] If I'm reading what you want to do correctly, it seems to me there are two obvious approaches to this: (i) Have a single form which posts back to itself, showing all the show information and requested quantities and calculated result fields (such as total cost); initially, this will have the calculated fields not displaying anything, and these will be (re)populated at each Update. Using this method, all your values are contained solely within the $_POST array. (ii) Have your initial form post to the process form, which then also posts to itself on Update. This process form will have visible fields only for values which can be changed, but *must* then contain hidden fields for all the other values which were originally passed in the $_POST array. This arrangement means that the process form always receives a full complement of values in the $_POST array -- either from the original form, or from hidden fields posted back to itself. This is all just coming off the top of my head, and I'm sure there are improvements/other solutions to be offered. Hope this will give you some things to think about, and maybe a pointer or two towards a satisfactory solution. Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, C507, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables - help
Thank you all for your responses. Mike. I like the ii option better, mostly because I already have most of that in place (ie. order posts to process, and process has editable fields and hidden fields with the remaining complimentary values). Martin suggested I use the following code for my update script (which is posted to via the process page): [code] foreach($_POST as $key => $value) if( '0' == $value || '' == $value ) { /*if*/ session_is_registered( $key ) && session_unregister( $key ); } [/code] I am not following the logic on the above code very well, but is this indeed a better option? And is not session_*whatever deprecated? The reason I am using $_SESSION is because it seems that php 6 will use solely this method, and it currently works with php 5. The other reason I am using it is so that I can keep the variables stored elsewhere for whenever I need them; I don't want to have to juggle all the information with POST and hidden inputs unless it will work seamlessly, and be ready for update at a later date (if I move to using a database to store show information, or when php 6 is mainstream). Keep in mind that once I get the update feature working, I need the process page to have a final submit button that will insert the order into a database table AND send a notification email to myself (and an email to the user). Am I setting myself up for failure with this udate order option? I ask because the update feature relies on a form, and are not forms limited to one submit button? Thanks all for your patience! I will work on this today and write back with any further questions I can't figure out on my own. And if anyone has any advice I will be checking my email regularly. Allen On Fri, Aug 14, 2009 at 7:52 AM, Ford, Mike wrote: > > -Original Message- > > From: Allen McCabe [mailto:allenmcc...@gmail.com] > > Sent: 14 August 2009 06:58 > > > > Here is some more complete code: > > > > [code = order_process.php] > > > > > session_start(); > > // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION > > foreach($_POST as $k=>$v) { > > $_SESSION[$k]=$v; > > } > > > > $thisPage="AFY"; //NAVIGATION PURPOSES > > include("afyshows.php"); //CONTAINS ARRAYS FOR SHOW ENTITIES; > > POPULATES > > ORDER FORM > > ?> > > > > . . . > > > > > > > > Er wait, no! Sessions and hidden form fields are generally alternative > solutions to the same problem -- you shouldn't be putting the same values > both in the session and in hidden form fields. In this case, I'm beginning > to suspect that the hidden fields are the better solution, but there is a > certain amount of personal preference in this. > > > > > > > > > > > > > > > > > > > > /> > > > > . . . > > > > > > > function findTotalCost($b, $c) { > > $total = $b * $c; > > return $total; > > } > > > > function writeResultRow($a, $b, $c, $d, $e, $f) { > > if($a != '') { > > echo "\n\n\t"; > > echo "".$b."".$c."".$d.""; > > echo "".$e." > value='".$a."' > > name='".$a."' id='".$a."' size='2' > > />=\$".$f.""; > > echo ""; > > } > > } > > > > //SETS $Total_show_01 to PRICE * QUANTITY > > //FORMATS TOTAL > > //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES > > $Total_show_01 = findTotalCost($shows['show_01']['price'], > > $_SESSION['show_01_qty']); > > $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', ''); > > writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'], > > $shows['show_01']['date'], $shows['show_01']['time'], > > $shows['show_01']['price'],$Total_show_01_fmtd); > > > > //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38) > > > > ?> > > . . . > > > > > > > > [/code] > > If I'm reading what you want to do correctly, it seems to me there are two > obvious approaches to this: > > (i) Have a single form which posts back to itself, showing all the show > information and requested quantities and calculated result fields (such as > total cost); initially, this will have the calculated fields not displaying > anything, and these will be (re)populated at each Update. Using this > method, all your values are contained solely within the $_POST array. > > (ii) Have your initial form post to the process form, which then also posts > to itself on Update. This process form will have visible fields only for > values which can be changed, but *must* then contain hidden fields for all > the other values which were originally passed in the $_POST array. This > arrangement means that the process form always receives a full complement of > values in the $_POST array -- either from the original form, or from hidden > fields posted back to itself. > > This is all just coming off the top of my head, and I'm sure there are > improvements/other solutions to be offered. Hope this will give you some > things to think about, and maybe a pointer or two towards a satisfactory > solution. > > > Cheers! > > Mike > -- > Mike Ford, > Electronic Information D
Re: [PHP] design pattern
On Thu, Aug 13, 2009 at 4:45 PM, Ralph Deffke wrote: > Hi Martin, > > thanks for ur efforts, this is a lot of good work. > > for my opinion the start is a bit too much theoretical and valid for all > type of application. In simple words, u are too close to the book. > > I would love to have something closer to the purpose of PHP > and its applications. > > if u have a look at the SMARTY documentation u have good explanation (and a > bad example by the way concerned oop) what are the real world problem. > > When it comes to the final u find the most spagetti code in putting the page > grafic designer toghether with the business logic. > > It would be great if this could be put in good oop patterns. As I can not > see that with the little amount of time I have got, p l e a s e tell me what > will come up on this edge? > > ralph_def...@yahoo.de > > > "Martin Scotta" wrote in message > news:6445d94e0908131322w722a37bbi24983ae143c5d...@mail.gmail.com... >> On Thu, Aug 13, 2009 at 4:04 PM, Ralph Deffke > wrote: >> >> > so guys >> > >> > why u don't discuss Martins outcome? >> > is there no advice, idears? >> > isn't there a need for it? >> > nobody want to use it? >> > >> > I WANT TO LEARN >> > >> > ralph_def...@yahoo.de >> > >> > >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> >> I was following the entirely conversation, I must admit I wasn't expecting >> such thread. >> >> It is not common to see design patterns applied to PHP applications and, > is >> more common to don't see PHP applications. They are just scripts. Many >> scripts in a simple folder puts together to do the dirty work. >> >> Of course there are many kicking-ass PHP Applications, but they are a >> minimum portion compared to old-fashioned scripts. >> >> So, how do we start writing good quality PHP Applications? That's a very >> good question, and I don't know the answer, but I think by talking about >> design patterns we are in a good way. >> >> It's true that using design patterns the code will run slower, but it'll > be >> flexible, maintable, and the most important: simple. >> After all that's what we are looking for, something really simple that > make >> our life as developers happier every day. How do you explain the crescent >> number of php frameworks for rapid development? >> >> PHP core team has taken OOP seriously. >> Do you note the new SPL objects? The core team creates those objects using >> many designs patterns. >> By example the RecursiveDirectoryIterator and it's family use the > decorator >> pattern. >> Also features such as "late static binding" were added because a design >> pattern. >> >> I think there will be some "separation" in the community, those who will >> stay using scripts and those who will use heavily OOP. I do not know who > the >> "dark side" will be, xD >> >> >> -- >> Martin Scotta >> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > L - O - L. Little time you've got? I just glanced at the list and you seem to have a lot of time typing up incoherent messages. I would suggest reading some books on programming architecture instead of typing out all sorts of silly emails that don't make any sense. As it turns out, if you know how to program in theory, the language itself becomes moot. Bai! -- http://www.ericbutera.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables - help
On Fri, Aug 14, 2009 at 12:25 PM, Allen McCabe wrote: > Thank you all for your responses. > > Mike. > > I like the ii option better, mostly because I already have most of that in > place (ie. order posts to process, and process has editable fields and > hidden fields with the remaining complimentary values). > Martin suggested I use the following code for my update script (which is > posted to via the process page): > > [code] > > foreach($_POST as $key => $value) >if( '0' == $value || '' == $value ) >{ >/*if*/ session_is_registered( $key ) && >session_unregister( $key ); >} > > [/code] > > I am not following the logic on the above code very well, but is this > indeed > a better option? And is not session_*whatever deprecated? The reason I am > using $_SESSION is because it seems that php 6 will use solely this method, > and it currently works with php 5. The other reason I am using it is so > that > I can keep the variables stored elsewhere for whenever I need them; I don't > want to have to juggle all the information with POST and hidden inputs > unless it will work seamlessly, and be ready for update at a later date (if > I move to using a database to store show information, or when php 6 is > mainstream). > > Keep in mind that once I get the update feature working, I need the process > page to have a final submit button that will insert the order into a > database table AND send a notification email to myself (and an email to the > user). Am I setting myself up for failure with this udate order option? I > ask because the update feature relies on a form, and are not forms limited > to one submit button? > > Thanks all for your patience! I will work on this today and write back with > any further questions I can't figure out on my own. And if anyone has any > advice I will be checking my email regularly. > > Allen > On Fri, Aug 14, 2009 at 7:52 AM, Ford, Mike wrote: > > > > -Original Message- > > > From: Allen McCabe [mailto:allenmcc...@gmail.com] > > > Sent: 14 August 2009 06:58 > > > > > > Here is some more complete code: > > > > > > [code = order_process.php] > > > > > > > > session_start(); > > > // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION > > > foreach($_POST as $k=>$v) { > > > $_SESSION[$k]=$v; > > > } > > > > > > $thisPage="AFY"; //NAVIGATION PURPOSES > > > include("afyshows.php"); //CONTAINS ARRAYS FOR SHOW ENTITIES; > > > POPULATES > > > ORDER FORM > > > ?> > > > > > > . . . > > > > > > > > > > > > > Er wait, no! Sessions and hidden form fields are generally alternative > > solutions to the same problem -- you shouldn't be putting the same values > > both in the session and in hidden form fields. In this case, I'm > beginning > > to suspect that the hidden fields are the better solution, but there is a > > certain amount of personal preference in this. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > /> > > > > > > . . . > > > > > > > > > > > function findTotalCost($b, $c) { > > > $total = $b * $c; > > > return $total; > > > } > > > > > > function writeResultRow($a, $b, $c, $d, $e, $f) { > > > if($a != '') { > > > echo "\n\n\t"; > > > echo "".$b."".$c."".$d.""; > > > echo "".$e." > > value='".$a."' > > > name='".$a."' id='".$a."' size='2' > > > />=\$".$f.""; > > > echo ""; > > > } > > > } > > > > > > //SETS $Total_show_01 to PRICE * QUANTITY > > > //FORMATS TOTAL > > > //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES > > > $Total_show_01 = findTotalCost($shows['show_01']['price'], > > > $_SESSION['show_01_qty']); > > > $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', ''); > > > writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'], > > > $shows['show_01']['date'], $shows['show_01']['time'], > > > $shows['show_01']['price'],$Total_show_01_fmtd); > > > > > > //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38) > > > > > > ?> > > > . . . > > > > > > > > > > > > [/code] > > > > If I'm reading what you want to do correctly, it seems to me there are > two > > obvious approaches to this: > > > > (i) Have a single form which posts back to itself, showing all the show > > information and requested quantities and calculated result fields (such > as > > total cost); initially, this will have the calculated fields not > displaying > > anything, and these will be (re)populated at each Update. Using this > > method, all your values are contained solely within the $_POST array. > > > > (ii) Have your initial form post to the process form, which then also > posts > > to itself on Update. This process form will have visible fields only for > > values which can be changed, but *must* then contain hidden fields for > all > > the other values which were originally passed in the $_POST array. This > > arrangement means that the process form always receives a full complement > of > > values in the $_POST array -- either from the original form, or from >
Re: AW: [PHP] Re: Re: Re: Design Patterns
At 3:09 PM -0500 8/13/09, Shawn McKenzie wrote: Ralph Deffke wrote: for those of u not being a physician semiconductors are of pretty big atoms, but this is not the main problem, the problem is that u have to cut out structures off these semiconductors > in order to build faster computers this matters. -snip- > My physician had best never mention cutting structures off my semiconductor. -Shawn Me too! I haven't much to spare. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Byte Code Compiler
Ralph Deffke wrote: quite a while I'm thinking for what could that be used. also in the documentation there are no posts, has anybody ever played arround with if? There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably more. I think APC and eAccelerator are the most popular. I use eAccelerator. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Re: Re: Re: Design Patterns
tedd wrote: At 3:09 PM -0500 8/13/09, Shawn McKenzie wrote: Ralph Deffke wrote: for those of u not being a physician semiconductors are of pretty big atoms, but this is not the main problem, the problem is that u have to cut out structures off these semiconductors > in order to build faster computers this matters. -snip- > My physician had best never mention cutting structures off my semiconductor. -Shawn Me too! I haven't much to spare. I've got a baby toe that keeps smashing into various floor level obstacles. I don't think it does much other than cause me pain :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Byte Code Compiler
On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummings wrote: > Ralph Deffke wrote: >> >> quite a while I'm thinking for what could that be used. also in the >> documentation there are no posts, has anybody ever played arround with if? > > There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably > more. I think APC and eAccelerator are the most popular. I use eAccelerator. > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Does eac work with 5.3.0 now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Byte Code Compiler
Eddie Drapkin wrote: On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummings wrote: Ralph Deffke wrote: quite a while I'm thinking for what could that be used. also in the documentation there are no posts, has anybody ever played arround with if? There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably more. I think APC and eAccelerator are the most popular. I use eAccelerator. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Does eac work with 5.3.0 now? Release 0.9.6 rc1 does: http://eaccelerator.net/wiki/Release-0.9.6-rc1 Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Byte Code Compiler
On Fri, Aug 14, 2009 at 12:24 PM, Robert Cummings wrote: > Eddie Drapkin wrote: >> >> On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummings >> wrote: >>> >>> Ralph Deffke wrote: quite a while I'm thinking for what could that be used. also in the documentation there are no posts, has anybody ever played arround with if? >>> >>> There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably >>> more. I think APC and eAccelerator are the most popular. I use >>> eAccelerator. >>> >>> Cheers, >>> Rob. >>> -- >>> http://www.interjinn.com >>> Application and Templating Framework for PHP >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> Does eac work with 5.3.0 now? > > Release 0.9.6 rc1 does: > > http://eaccelerator.net/wiki/Release-0.9.6-rc1 > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > Do you know how stable it is? APC still occasionally gives me a bus error with 5.3.0 so it's disabled for now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Byte Code Compiler
Eddie Drapkin wrote: On Fri, Aug 14, 2009 at 12:24 PM, Robert Cummings wrote: Eddie Drapkin wrote: On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummings wrote: Ralph Deffke wrote: quite a while I'm thinking for what could that be used. also in the documentation there are no posts, has anybody ever played arround with if? There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably more. I think APC and eAccelerator are the most popular. I use eAccelerator. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Does eac work with 5.3.0 now? Release 0.9.6 rc1 does: http://eaccelerator.net/wiki/Release-0.9.6-rc1 Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Do you know how stable it is? APC still occasionally gives me a bus error with 5.3.0 so it's disabled for now. No idea... I've used 5.3.0 for a few tests but I'm still using 5.2.9 for development uses. Probably won't completely switch over my development for a few more months. One of my requirements is a stable eAccelerator for 5.3 :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Byte Code Compiler
Robert Cummings wrote: Eddie Drapkin wrote: On Fri, Aug 14, 2009 at 12:24 PM, Robert Cummings wrote: Eddie Drapkin wrote: On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummings wrote: Ralph Deffke wrote: quite a while I'm thinking for what could that be used. also in the documentation there are no posts, has anybody ever played arround with if? There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably more. I think APC and eAccelerator are the most popular. I use eAccelerator. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Does eac work with 5.3.0 now? Release 0.9.6 rc1 does: http://eaccelerator.net/wiki/Release-0.9.6-rc1 Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Do you know how stable it is? APC still occasionally gives me a bus error with 5.3.0 so it's disabled for now. No idea... I've used 5.3.0 for a few tests but I'm still using 5.2.9 for development uses. Probably won't completely switch over my development for a few more months. One of my requirements is a stable eAccelerator for 5.3 :) Actually, I just checked, I'm using the 5.2.10 release for dev. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini files as config - hidden
I'm building a little framework for my self, The configuration of the framework is done in an ini file, How do you suggest to hide its contents? .htaccess wont be good (or atleast only htaccess) since if its turned off The file contains mysql password and important data. How should I make sure the file stays hidden from someone who might tries to access it? -- Use ROT26 for best security
Re: [PHP] session variables - help
> Thanks all for your patience! I will work on this today and write back with > any further questions I can't figure out on my own. And if anyone has any > advice I will be checking my email regularly. If you've already tried this with no luck, please ignore -- but you might speed up the whole process by stepping aside from the "real" code briefly, starting fresh in an empty directory, and just putting together a handful of extremely simple scripts with the single goal of entering one value, updating it, and then doing some final pseudo-processing on the updated value. Then, you could step it up a bit by by adding a second value that gets entered at the beginning, and cannot be updated in the middle but must be preserved through to the end. Doing all this might help clarify the basic flow of the system and enable you to simplify its structure before going back and tackling the real code. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ini files as config - hidden
I think a good solution is to put the ini file out of your html folder so only your scripts can read it. ""? "" escreveu na mensagem news:907722000908141031v5b020fe0m5a3cc8a9dc196...@mail.gmail.com... > I'm building a little framework for my self, > > The configuration of the framework is done in an ini file, > > How do you suggest to hide its contents? > > .htaccess wont be good (or atleast only htaccess) since if its turned > off > > The file contains mysql password and important data. > > > How should I make sure the file stays hidden from someone who might tries > to > access it? > > -- > Use ROT26 for best security > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ini files as config - hidden
2009/8/14 João Cândido de Souza Neto : > I think a good solution is to put the ini file out of your html folder so > only your scripts can read it. I agree, and I try to do the same, but I've noticed that most open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS Made Simple) have always stored database credentials inside of DocumentRoot, by default. Not sure if this is a compromise to allow ease-of-use by less-technical users, or if my insistence on putting this sort of file outside of DocumentRoot is just paranoia (and not the good kind). I'd definitely be interested to hear how others on the list approach this problem. And that's only one part of the equation, if you're on a shared-hosting platform. Are you, or do you have your own server? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ini files as config - hidden
2009/8/14 Ben Dunlap > 2009/8/14 João Cândido de Souza Neto : > > I think a good solution is to put the ini file out of your html folder so > > only your scripts can read it. > > I agree, and I try to do the same, but I've noticed that most > open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS > Made Simple) have always stored database credentials inside of > DocumentRoot, by default. > > Not sure if this is a compromise to allow ease-of-use by > less-technical users, or if my insistence on putting this sort of file > outside of DocumentRoot is just paranoia (and not the good kind). > > I'd definitely be interested to hear how others on the list approach > this problem. > > And that's only one part of the equation, if you're on a > shared-hosting platform. Are you, or do you have your own server? > > Ben > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > A workaround to this is to simple let the browser get the ini as a php file. What? are you insane? no. it is really easy. 1) Name your ini files .php so, database.ini will be database.php 2) Put in the top of your script this line ; So, when the file is opened as an ini file the semilcolon indicates that it's a comment. But, when the browser call for this file... php just exit's in the first line. Our data will be safe as long as the first line will remains there. -- Martin Scotta
Re: [PHP] Re: ini files as config - hidden
A long time ago I worked in many shared servers, nowadays I´m not working with web sites, only systems, so my customers always has their own server. The question is: 1) The ini file you mentioned has ini extension? if yes, it must be out of the document root because if someone types its url, the browser will certainly show up its content. 2) Has it php extension? if yes, it can be inside the documento root because if someone types its url, PHP will show up only the result of its code.. "Ben Dunlap" escreveu na mensagem news:7997e80e0908141056i483f4e2h7dffe0c83b90d...@mail.gmail.com... 2009/8/14 João Cândido de Souza Neto : > I think a good solution is to put the ini file out of your html folder so > only your scripts can read it. I agree, and I try to do the same, but I've noticed that most open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS Made Simple) have always stored database credentials inside of DocumentRoot, by default. Not sure if this is a compromise to allow ease-of-use by less-technical users, or if my insistence on putting this sort of file outside of DocumentRoot is just paranoia (and not the good kind). I'd definitely be interested to hear how others on the list approach this problem. And that's only one part of the equation, if you're on a shared-hosting platform. Are you, or do you have your own server? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ini files as config - hidden
It´s a cool solution as well. "Martin Scotta" escreveu na mensagem news:6445d94e0908141103l6710c766wcc89f05111a65...@mail.gmail.com... 2009/8/14 Ben Dunlap > 2009/8/14 João Cândido de Souza Neto : > > I think a good solution is to put the ini file out of your html folder > > so > > only your scripts can read it. > > I agree, and I try to do the same, but I've noticed that most > open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS > Made Simple) have always stored database credentials inside of > DocumentRoot, by default. > > Not sure if this is a compromise to allow ease-of-use by > less-technical users, or if my insistence on putting this sort of file > outside of DocumentRoot is just paranoia (and not the good kind). > > I'd definitely be interested to hear how others on the list approach > this problem. > > And that's only one part of the equation, if you're on a > shared-hosting platform. Are you, or do you have your own server? > > Ben > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > A workaround to this is to simple let the browser get the ini as a php file. What? are you insane? no. it is really easy. 1) Name your ini files .php so, database.ini will be database.php 2) Put in the top of your script this line ; So, when the file is opened as an ini file the semilcolon indicates that it's a comment. But, when the browser call for this file... php just exit's in the first line. Our data will be safe as long as the first line will remains there. -- Martin Scotta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ini files as config - hidden
> 1) Name your ini files .php so, database.ini will be database.php Actually I was assuming the configuration file to be a PHP script -- as is typical in big open-source CMSes. I took "ini file" earlier in the thread to be a generic description of any file, whatever the extension, that contains sensitive configuration data. > Our data will be safe as long as the first line will remains there. And as long as the file is actually handed off to PHP for processing. Seems like there are plenty of situations, none of them too far-fetched, that could cause the web server to mistakenly serve a file with ".php" in its name as a generic text file rather than handling it correctly. I'd rather just have the file outside of DocumentRoot and avoid that risk entirely. But again, maybe that's just unproductive paranoia? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP_SAPI
Hi all! I'm making a class for handling different things depending on what web server are you running PHP. Can you tell me the output of this script and your environment? It'll be useful to me to have different values, especially from Windows or IIS ( Please reply this in private, so we keep the list clean, then I'll send the full list ) Is there any documentation about the possible value of PHP_SAPI? I was surfing the web and found this list, but I don't know if it complete: aolserver, apache, apache2filter, apache2handler, caudium, cgi, cgi-fcgi, cli, Continuity, embed, isapi, milter, nsapi, phttpd, pi3web, roxen, thttpd, tux,webjames should I look at php source-code for these values? -- Martin Scotta
[PHP] Making HTML Scripts over PHP Programming
Dear All, I have developed php library for open source community, for making HTML scripts over PHP Programming, HTML Object. It's PHP Object Library for making autogenerated HTML scripts over PHP Programming. Providing the variety of needs to make HTML code automatically, such as HTML Tags, Attributes, Tag's Content, Frequently Used Tags, and Other HTML Object. HTML Object is created in accordance with the needs of web developers, easy to use, Object Oriented Programming, and flexible for any web applications. visit: http://code.google.com/p/html-object/ HTML Object is PHP 5 Class Object Library, the purposes is web developers can use this library for Presentation Layer or Web User Interface (UI) on web applications, creating HTML code with PHP script, all controlled on server. Early features of them: * Autogenerated HTML Tags, Attributes, and Contents * Frequently Used Tags * Generating HTML Document / Web Pages * HTML Tables All class libraries is documented in Application Programming Interface (API) Documentation, you can visit http://api.global.qummatic.com/html-object. For developers can checkout the latest source code, please visit http://code.google.com/p/html-object/source/checkout. The latest release files can be downloaded in http://code.google.com/p/html-object/downloads/list -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables - help RESOLVED
Thanks everyone for your help, I finally got it working. For those that were curious, my writeResultRow() function was not naming the input fields properly, so the SESSION variables could not be updated properly. I had to add an array item for each show, an id, then call the id to name the inputs with. On Fri, Aug 14, 2009 at 11:13 AM, Ben Dunlap wrote: > Great, hope it helps! -Ben > > On Fri, Aug 14, 2009 at 10:52 AM, Allen McCabe > wrote: > > This is an EXCELLENT idea. > > >
Re: [PHP] Re: ini files as config - hidden
On Fri, 2009-08-14 at 15:03 -0300, Martin Scotta wrote: > 2009/8/14 Ben Dunlap > > > 2009/8/14 João Cândido de Souza Neto : > > > I think a good solution is to put the ini file out of your html folder so > > > only your scripts can read it. > > > > I agree, and I try to do the same, but I've noticed that most > > open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS > > Made Simple) have always stored database credentials inside of > > DocumentRoot, by default. > > > > Not sure if this is a compromise to allow ease-of-use by > > less-technical users, or if my insistence on putting this sort of file > > outside of DocumentRoot is just paranoia (and not the good kind). > > > > I'd definitely be interested to hear how others on the list approach > > this problem. > > > > And that's only one part of the equation, if you're on a > > shared-hosting platform. Are you, or do you have your own server? > > > > Ben > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > A workaround to this is to simple let the browser get the ini as a php file. > What? are you insane? no. it is really easy. > > 1) Name your ini files .php so, database.ini will be database.php > 2) Put in the top of your script this line > > ; > > So, when the file is opened as an ini file the semilcolon indicates that > it's a comment. > But, when the browser call for this file... php just exit's in the first > line. > > Our data will be safe as long as the first line will remains there. > Silly idea. If you want to read in the ini file via PHP to get the values out, why don't you just have them as PHP vars? There's extra overhead involved in processing the ini, which is a big bad idea if the ini is used to hold database details, as not only does the database connection take time, but you've increased the time needed to access the connection details! Way to go! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP: File or directory?
I have just got access to a new server, and am playing with upload/download procedures. I looked in the root directory, and see several objects which I assume to be directories. However I was surprised to find there does not appear to be any command to determine if an object is a file or directory, either in PHP FTP or plain FTP. I could try to change to them, or download them, but this seems overkill. Am I overlooking something obvious? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php