Re: [PHP] Sessions
The Session documentation IS difficult to understand. I wrestled with it for some time (and still am). There's just no clear cookie_lifetime variable! All of Lowell Allen's instructions are the same that I've discovered, save that I set the 'session.gc_maxlifetime' to a large number - I was having trouble with the system forgetting me while I was testing. Your typical user might not sit around for an hour between actions, but I did, and while the session might have still been registered it lost the $USERID variable. You can set the session settings in PHP code using 'ini_set' or 'ini_alter' (see the documentation), or (and I like this better) in your .htaccess file - assuming you're using Apache: php_flag session.use_trans_sid off php_flag session.cookie_lifetime 0 php_flag session.gc_maxlifetime 3600 ... as appropriate, of course. Unfortunately this approach isn't very well documented (hmmm, maybe _I_ should...) - I think I stumbled across it a couple years ago. I set the 'use_trans_sid' to off to see why the SESSIONID kept showing up in the URL at odd times. Test using phpinfo() to see if the Local settings change from the global. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date class and Span.php
I am trying to use the Date class and am having trouble with it. Since I'm just starting to use PEAR modules I'm not sure if I'm missing something simple or just what. Date.php calls for an include of a file called Span.php, but the file does not exist in the date subdirectory. I've found some references to that file being missing, so I located a file by that name in the CVS directory and installed it. However, it 'includes' Date.php, the very file that calls it, so I'm unsure that I've got the right thing. However, I commented out those includes and I do not get an error, but I'm unable to get any return from Span.php. I'm trying to use the method addSpan($span), but I have no idea how to 'phrase' the $span variable. If I want to add a span of 6 months, how do I do so? Anyone out there with some experience with this module who can help me? Thank you, Nelson _ Nelson GOFORTH Lighting for Moving Pictures +1.303.322.5042 http://www.earthnet.net/~ngoforth/film -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form Elements - user adding dynamically
I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed. For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner. The design goal is something like Apple's iTools web page construction tool. Beside each slot is a - and a + to delete that slot or to add another one just under the existing slot. I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that. Thanks, Nelson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Elements - user adding dynamically
Thank you for the responses re adding form elements. I will explore Javascript solutions. I've been working on a pure PHP solution - to avoid problems with older browsers - but kept running into roadblocks and wasn't sure I'd get through them. In any case most browsers no support Javascript! - Nelson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returning to a Previous Page
In my application I'd like the user to be able to return to a page that they have had to leave in order to register or log-in to the application. (It's a sort of shopping cart) The URL contains a couple of items of data in the query string. I figure there are two options (and let me know about others) - 1. pass the URL back in hidden fields, and 2. every time the user visits a 'product' page, set that page in a session variable - then when they are done registering I collect the URL and return to that page (so that they don't have to start their search all over again). Is there an advantage to either solution. What problems would I have in resetting the session variable for each page visited? == Additional question on the same topic: No single ENV variable that I can find gives me the full URL. And REQUEST_URI gives me too much for use. i.e.: Let's say the URL is http://www.mydomain.com/about/this/thatfile.php?key=42name=zaphod It seems that to return to this page I need either the full URL or just thatfile.php?key=...etc, but REQUEST_URI gives me /about/this/thatfile?key=etc So, I can concatenate HOST and URI variables to get what I want, but am I missing something here? I am running sessions in this application. Thank you for any assistance, Nelson Nelson Goforth http://www.goforthstudio.com Computer Database Programming: Perl, PHP, SQL, VBA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Paging through MySQL results in PHP
I have an application that returns a set of results from a MySQL query. Let's say I have 100 results from the query, but only want to show 25 per HTML page. The MySQL query is driven by a 'Search' page that creates an array $keywords - which can be of any size. I then loop through the $keywords array to create the SQL code. I understand how to use the LIMIT statement in MySQL - so I can 'page' the output, but how do I pass the $keywords array with each request for the next page? I create a link with a phrase like: printf(...A HREF=results.php?firstitem=1items=25kw=$kw...); but end up just showing that kw=array. Can anyone put me on the right track or point me to some resource? This seems like it should be simple but... Thanks, Nelson -- 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] Allowing user login, but NOT requiring?
In my project I have basic HTML pages with PHP/MySQL driven content. In a subdirectory I have pages that allow users to change the content of the pages and other administrative functions. This subdirectory is protected with Apache mod_auth. What I would like to do is allow authorized users to see an Edit button on each page in the main directory, which would allow them to update a page right from the page itself - rather than going into the admin subdirectory to do it. I can drive the display of an Edit link from the REMOTE_USER environmental variable, but how can I allow the authorized users to log in, while STILL allowing unfettered access by the public? If they log in under the subdirectory that log in name doesn't carry back up to the top directory (I tried), even if I name the realm the same using the AuthName directive in .htaccess . I found some basic information in the book Professional PHP Programming, but could someone point me to another resource that might give a bit more detail? Thanks, Nelson -- 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] Hierarchic menus using Javascript and PHP?
On my site I have a page that takes input into a MySQL database (though this isn't a db question). Each entry has a category and a subcategory entry, which should come from predefined lists and are therefore instituted as pull-down lists. The category list is in a PHP array which feeds a SELECT pull-down list. The subcategory choices should depend upon what category is selected. In order to ease user input, I've used a javascript function to cause the subcategory pulldown to depend upon the category selection. Thus if the category is Animals, the subcategory SELECT would show dog, cat, fish - but if the category were Colors the possible subcategories might be Red, Green, Yellow, Puce. On the initial entry - a blank record - this all works fine. But if I go back in to modify a record I run into trouble, as I can't make the page reflect the stored value of the subcategory within the pull-down list (i.e. as the SELECTED item). I use the following PHP code to display the $categories array - and if there is a stored value ( $formValues[category] ) it displays that selection as SELECTED - which is exactly right. printf(TRTDCategory /TD); printf(TDSELECT NAME=category ONCHANGE=\updateCats()\\n); printf(OPTION VALUE=0 === Select One === /OPTION\n); $i=0; while ($i count($categories)) { printf(OPTION VALUE=%s %s%s/OPTION\n, $categories[$i], $categories[$i] == $formValues[category] ? SELECTED : , $categories[$i]); $i++; } printf(/SELECT/TD/TR); But when it comes to the Sub-Category the list that feeds the SELECT list is not in an array, but is coming from the JavaScript function like: if(subCategoryIndex == 1) // Colors document.search.subcategory.options[1] = new Option('Red'); document.search.subcategory.options[1].value = red; document.search.subcategory.options[2] = new Option('Blue'); document.search.subcategory.options[2].value = blue; ...etc... I can't figure a way to make the 'Update' version of the page display the value of the Sub-Category in a select list (so that the user CAN update it). I can certainly have the value display, but it no long has the other possible members of the list, since it's not coming from a display. I couldn't see a way to do this (updating one form element from another) completely in PHP - else I would have. Does anyone have any ideas? Could I feed a PHP array FROM JavaScript? If I could get the subcategory selection list into an arry I think I could make this work. Or possibly use another JavaScript script inside the PHP portion of the page in order to force it to mark the appropriate item SELECTED? I tried this but couldn't make it work. Any help is appreciated - Thanks, Nelson -- 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] calling javascript functions inside PHP
PHP has some encryption mechanisms in it - but by that time you've sent the data to the server. The other respondents are correct though - you should be using an SSL connection to encrypt the data between the user and your server. On a site that I do I use SSL to keep the data secure between the user and the server - but the server is in another state. So I have the server encrypt the data (using PGP) and send it on to my computer - where I decrypt it. If you cannot manage an SSL connection for whatever reason then having the information encrypted locally might work in theory (though Vigenere isn't as uncrackable as the writer of that article thinks - nor do they know how to spell the name - it wouldn't be worth the effort to steal one cc number). HOWEVER - the 'key phrase' that will encrypt the user data is the SAME one that you would use to decrypt it - and it would have to be right there on the page unless each customer were to pick their own key phrase and phone you with it! This two-way encryption used to be the standard - but it requires that the sender and the recipient have the same key. Public key encryption ('one-way') like PGP allows two separate keys for encryption and decryption, neither of which can be derived from the other. The encryption key is made public, but the decryption key is kept secret. Nelson I use a PHP self-validating form for taking orders off my site. (on submit it calls itself and if there are no errors a send variable is set and it emails me the information, etc - standard stuff). I'd like to start taking CC orders and would like to encode the information using javascript http://javascript.internet.com/passwords/virgenere-encryption.html. I'll use a hidden value as a codephrase to encode the CC number, then when I receive the order I can go to a secure page on the site to decrypt it. The question is - how do I call a javascript function from my PHP code? I want to do the encoding just before I email the form variables. ie - if ($send == yes){ do javascript encoding of cc number $mail (information to me) echo (Your Order has been sent) } Thanks for any help, Dean -- 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] -- === Nelson Goforth Lighting for Moving Pictures phone: 01.303.322.5042 pager: 01.303.634.9733 resume: http://www.earthnet.net/~ngoforth/film -- 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] Content management
I've seen one very heavy-duty example of a completely web-based site development tool. This was done in ASP, VB and SQL Server (I think) but could be done with open source tools. However, they've put many people-years into the project. Every site resides on the ASP's (using the other meaning of ASP now) server. I know this isn't what you're looking for, but I found the structure that they use informative. The trick for this tool is that nearly EVERYTHING seems to be in a database field - I don't think there was any existing page of HTML. Every item on a page (a story, a picture, a form) is stored in SQL. Even each form element appears to be a separate record in a database - there's probably a table called 'forms' in which one defines the NAME, ACTION, etc of a form and another called 'elements' with an ident for the form, then what sort of element it is: INPUT, SELECT, etc - and all of the parameters for that one line. If it IS a SELECT element then there appears to be another table that holds each OPTION as a separate record. It's possible to reorder each option inside a choice list, and each element inside a form, and each portion of a page (the form being one) inside the layout of that page in general - so each element of the larger item must receive an ordinal number as well. The ASP tool they've built is hugely complex - but they've built it to handle _everything_ (you can tinker with HTML if you feel the need) - and for many, many websites at the same time. I'm hoping to take a little of this a build a single site that will handle _something_. Nelson At 5:07 PM -0500 9/10/01, Michael Champagne wrote: I am looking for something like this as well. We are not looking at developing our own interface but maybe going with something like eGrail or Vignette? I'm not too familiar with the pros and cons of these. Which heavy duty content management system is best from a PHP-friendly standpoint? Thanks, Hi All- I am developing a web interface for a school that will allow them to mange the entire site, from users to the actual display elements. The trick has been, they must not have to know HTML to do the administration. The question: does anyone have some links or examples of this kind of system from a layout perspective, even functionality. I want to deliver something they can really use. -- === Nelson Goforth Lighting for Moving Pictures phone: 01.303.322.5042 pager: 01.303.634.9733 resume: http://www.earthnet.net/~ngoforth/film -- 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.net's index.php
Use the DirectoryIndex directive in your '.htaccess' file, as Ryan states. You'll find more information at: http://httpd.apache.org/ Nelson -- 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] Opening another page in code
This seems simple, but for some reason I can't find what I'm looking for in books or the archive. Might just be looking for the wrong words. I just want to open another page, sending some parameters, at a point in a script - without the user clicking on anything (I can do this in a form - I want to do it WITHOUT the form). Like:if($test) { GO_TO_PAGE (http://www.site.dom/page.php?id=838383); } Except with code that actually works, of course. I tried header (Location:...) but got an error message that I can't add to the headers. What have I missed? Thanks, Nelson -- -- 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] Opening another page in code (PROPOSED FAQ)
Brian, Bill and Gunther - Thank you, and others, for answers to this question. I think the FAQ entry is a good idea, perhaps with a special note to Perl programmers. I'm used to something like: print Location:www.site.com; in Perl, which doesn't seem too strict about other data coming first - it just tosses the browser to that URL (or I've been lucky) - and perhaps PHP needs a function like that - just a sort of Stop what you're doing and open this URL! kind of thing. My problem does lie in a 'require' page, so I've got to figure out how to circumvent that. Thanks again, Nelson I have seen this question alot recently. Maybe it is time for an FAQ. Maybe somebody else would like to have an attempt at wording this better: -- === Nelson Goforth Lighting for Moving Pictures phone: 01.303.322.5042 pager: 01.303.634.9733 resume: http://www.earthnet.net/~ngoforth/film -- 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]