php-general Digest 2 Dec 2002 13:33:15 -0000 Issue 1739 Topics (messages 126660 through 126712):
Re: Disable refresh? 126660 by: Larry Brown 126661 by: Martin Towell 126663 by: Larry Brown 126683 by: Ernest E Vogelsinger 126686 by: phpnew_bocket 126698 by: Marek Kilimajer Re: [PHP-INST] OS X and Curl Issues 126662 by: Randall Perry Re: XTemplate 126664 by: Oleg Krogius Passing arguments to the same script 126665 by: Troy May 126666 by: John W. Holmes 126667 by: Troy May 126668 by: Kyle Gibson 126669 by: Chris Wesley 126670 by: John W. Holmes 126671 by: Jonathan Sharp 126672 by: Jonathan Sharp 126673 by: Troy May 126674 by: Troy May 126704 by: Marek Kilimajer header() and target page 126675 by: Jami 126676 by: John W. Holmes 126688 by: phpnew_bocket Re: includes & globals 126677 by: Cesar Aracena 126678 by: Tom Rogers 126689 by: Marek Kilimajer Why all the returned emails from this list? 126679 by: Troy May Dynamically Adding methods to an object 126680 by: Brian Takita some data output formatting and grouping question... 126681 by: Victor 126682 by: Bastian Vogt 126693 by: Marek Kilimajer page auto reload after new window closed 126684 by: Michael P. Carel 126685 by: Ernest E Vogelsinger 126691 by: Marek Kilimajer Re: last updated ? 126687 by: Chris Hewitt How do I run a command as root? 126690 by: Luke van Blerk 126692 by: Luke van Blerk 126694 by: John Wards 126695 by: Jon Haworth 126696 by: Marek Kilimajer 126697 by: Matthieu Le Corre Failed php module load 126699 by: bob pilly 126712 by: Ford, Mike [LSS] Newbie Question 126700 by: hacook 126701 by: Jon Haworth How to get/wait for user-input? 126702 by: Martin Thoma 126703 by: Marek Kilimajer PHP and WebDAV 126705 by: Adam.Whitehead.csm.com.au Cache caches anyway, regardless 126706 by: Elmota Abdul Ayyash 126708 by: Justin French Who can tell me the best php-base webmail? 126707 by: joskey.lianluo.com 126710 by: Jon Haworth Re: Date problem 126709 by: Rosen Re: Sessions not written to db on windows... 126711 by: Ford, Mike [LSS] Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---If not, is there a variable that provides information that a refresh occurred to load the page? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -----Original Message----- From: Larry Brown [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:23 PM To: PHP List Subject: [PHP] Disable refresh? Anyone know of a method of preventing a user from refreshing a page. I get multiple updates with the same information in my database... Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---no, no way to disable and no variable to say a refresh happened one way to get around it is to submit to the page that does the update, then get that page to do a header("location...") to another page. When the user refreshes, they'll only refresh the last page, and not the updating page. HTH Martin -----Original Message----- From: Larry Brown [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 12:33 PM To: PHP List Subject: RE: [PHP] Disable refresh? If not, is there a variable that provides information that a refresh occurred to load the page? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -----Original Message----- From: Larry Brown [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:23 PM To: PHP List Subject: [PHP] Disable refresh? Anyone know of a method of preventing a user from refreshing a page. I get multiple updates with the same information in my database... Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- 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--- End Message ---
--- Begin Message ---Thanks guys this forum is going to get me in trouble. It is so convenient I keep asking questions too soon. After submitting the amendment to the original question I thought of the solution of setting a session variable and then clearing it before and after the submittal page. I'll work the gray matter a little harder next time before asking. Thanks again. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:58 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Disable refresh? > Anyone know of a method of preventing a user from refreshing a page. I > get multiple updates with the same information in my database... Hello! You can prevent it multiple ways. Two common solution: - When creating form, add a unique id to it in a hidden field. After succesful insert put that id into a container table, what stores used ids. Before inserting, check the presence of that id in that container. You can make unique ids with php's uniquid() function, or if mod_unique_id compiled into Apache, you can use $_SERVER['UNIQUE_ID'] too. Store expire dates too with that ids to be able delete old ids with a cronjob. - Another way: this is easier, but not too elegant. After inserting data, send a location header to browser to redirect it from that form-processor page to an another. After that, refreshing affects that page. Heilig (Cece) Szabolcs [EMAIL PROTECTED] - http://phphost.hu--- End Message ---
--- Begin Message ---At 02:41 02.12.2002, Martin Towell said: --------------------[snip]-------------------- >no, no way to disable and no variable to say a refresh happened > >one way to get around it is to submit to the page that does the update, then >get that page to do a header("location...") to another page. When the user >refreshes, they'll only refresh the last page, and not the updating page. --------------------[snip]-------------------- This will not stop the user from hitting the "Back" button and refreshing the form... What I do (and it works flawlessly) is to have a serial number stored in the session data. This serial number, mirrored in form data as a hidden field, is incremented with each klick the script receives. Thus the code handling script input is able to determine if the form it just received is the last form it generated (serial number matches), or is outdated (serial number mismatches), for what reason ever, be it a refresh or the user stepping back and resubmitting. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/--- End Message ---
--- Begin Message ---you can use a session : - start the session when the form is first sent - destroy the session upon the first valid insert - subsequent upadates will be prevented since the session is destroyed.. usually multiple updates happens when the user hits the submit button several times or upon refreshing the page ... hence the session method should work fine good luck ! --- Larry Brown <[EMAIL PROTECTED]> wrote: > Anyone know of a method of preventing a user from > refreshing a page. I get > multiple updates with the same information in my > database... > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== +------------------------------------------+ |Wana Know what ISLAM is all about ? | +------------------------------------------+ visit : http://www.sultan.org/#int __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com--- End Message ---
--- Begin Message ---Ernest E Vogelsinger wrote:This will not stop the user from hitting the "Back" button and refreshingIf the user wants it he can do it even with your method. My point is he don't do it unintentionally, so I
the form...
use just the Location method
--- End Message ---
--- Begin Message ---Got it working. First I removed every curl binary and library I could find (had 3 sets, 1 from apple's installation, 1 from my compile, and 1 from a Fink compile I did). Then I configured curl to use Apple's paths, made, and installed: - cd curl-7.10 - ./configure --prefix=/usr - make - sudo make install Then, configure, make php_4.2.3: - ./configure --with-apxs=/usr/sbin/apxs --with-pgsql --with-xml --with-openssl=/usr/local/ssl --with-pear --with-curl=/usr/lib > I've got curl 7.10 and am getting the same error on Mac OS 10.2.2 server. > Here's my config: > > ./configure --with-apxs=/usr/sbin/apxs --with-pgsql --with-xml > --with-openssl=/usr/local/ssl --with-pear --with-curl=/usr/lib/curl > > > Here's curl: > > [systame:local/src/php-4.2.3] randy% /usr/bin/curl -V > curl 7.10 (powerpc-apple-darwin6.2) libcurl/7.10 ipv6 zlib/1.1.3 > > > Here's the error: > > checking for CURL support... yes > checking for CURL in default path... found in /usr/local > found in /usr > checking for cURL 7.9 or greater... configure: error: cURL version 7.9 or > later is required to compile php with cURL support > -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Development/Promotion Mac Consulting/Sales http://www.systame.com/--- End Message ---
--- Begin Message ---PHP is a templating system already, don't reinvent the wheel and create a whole new scripting language (which basically smart is - it just requires php to work). Regards, Oleg -----Original Message----- From: Henry [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 9:02 AM To: [EMAIL PROTECTED] Subject: XTemplate Hi All, I'm looking for a way to seperate my HTML from my PHP and database access code, I pointed in the direction of XTemplate. After having had a look at XTemplate I'm not sure if it is current and stable under PHP 4!!!! Is it and if it isn't is there something better to use? Henry--- End Message ---
smime.p7s
Description: application/pkcs7-signature
--- Begin Message ---Hello, I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: <a href="index.php?samples"> How do I determine what is passed? I need to do an "if" statement with different outputs depending on the argument. if ($samples) { do something } ?? But I can't get anything to work. How do I do it in PHP? (I have no forms, just links)--- End Message ---
--- Begin Message ---> I'm sure this is easy, but I'm drawing a blank. I need to have links at > the > bottom of the page that passes arguments to the same script (itself) when > it > gets reloaded. How do we do this? > > I have the links like this now: > > <a href="index.php?samples"> > > How do I determine what is passed? I need to do an "if" statement with > different outputs depending on the argument. > > if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes...--- End Message ---
--- Begin Message ---Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo "Questions link content will go here"; } elseif(isset($_GET['samples'])) { echo "Samples link content will go here"; } elseif(isset($_GET['rates'])) { echo "Rates link content will be here"; } elseif(isset($_GET['contact'])) { echo "Contact information will go here."; } else { echo "Main content goes here."; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: <a href="index.php?samples"> Any ideas? -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 7:39 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script > I'm sure this is easy, but I'm drawing a blank. I need to have links at > the > bottom of the page that passes arguments to the same script (itself) when > it > gets reloaded. How do we do this? > > I have the links like this now: > > <a href="index.php?samples"> > > How do I determine what is passed? I need to do an "if" statement with > different outputs depending on the argument. > > if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes...--- End Message ---
--- Begin Message ---Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo "Questions link content will go here"; } elseif(isset($_GET['samples'])) { echo "Samples link content will go here"; } elseif(isset($_GET['rates'])) { echo "Rates link content will be here"; } elseif(isset($_GET['contact'])) { echo "Contact information will go here."; } else { echo "Main content goes here."; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: <a href="index.php?samples">
This string merely filles the $HTTP_SERVER_VARS["QUERY_STRING"] variable.
So you should rather check to see if $HTTP_SERVER_VARS["QUERY_STRING"] equals 'questions', 'samples', etc...
$_GET['var'] requires that the link look like this:
<a href="index.php?page=samples">
You could then call $_GET['page'], which would contain the value samples.
--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/
--- End Message ---
--- Begin Message ---On Sun, 1 Dec 2002, Troy May wrote: > The only thing that EVER gets displayed is the final else. (Main content > goes here.) What am I doing wrong? Once again, the links are in this > format: <a href="index.php?samples"> <a href="index.php?samples=1"> To get the desired results with the code you posted, you have to give your query string parameter(s) a value (as above). If you don't want to give samples a value, then examine the query string as a whole: $_SERVER[QUERY_STRING] if( $_SERVER[QUERY_STRING] == "samples" ) ... g.luck, ~Chris--- End Message ---
--- Begin Message ---What PHP version are you using? Try $HTTP_GET_VARS['sample'] if it's an older version. Also try index.php?sample=1, so that "sample" actually has a value (although the method I gave you worked on IIS). ---John Holmes... > -----Original Message----- > From: Troy May [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 01, 2002 11:02 PM > To: [EMAIL PROTECTED]; 'PHP List' > Subject: RE: [PHP] Passing arguments to the same script > > Thanks for responding. I think I'm still doing something wrong. Take a > peek: > > if(isset($_GET['questions'])) { > echo "Questions link content will go here"; > } > elseif(isset($_GET['samples'])) { > echo "Samples link content will go here"; > } > elseif(isset($_GET['rates'])) { > echo "Rates link content will be here"; > } > elseif(isset($_GET['contact'])) { > echo "Contact information will go here."; > } else { > echo "Main content goes here."; > } > > The only thing that EVER gets displayed is the final else. (Main content > goes here.) What am I doing wrong? Once again, the links are in this > format: <a href="index.php?samples"> > > Any ideas? > > > -----Original Message----- > From: John W. Holmes [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 01, 2002 7:39 PM > To: 'Troy May'; 'PHP List' > Subject: RE: [PHP] Passing arguments to the same script > > > > I'm sure this is easy, but I'm drawing a blank. I need to have links > at > > the > > bottom of the page that passes arguments to the same script (itself) > when > > it > > gets reloaded. How do we do this? > > > > I have the links like this now: > > > > <a href="index.php?samples"> > > > > How do I determine what is passed? I need to do an "if" statement > with > > different outputs depending on the argument. > > > > if ($samples) { do something } > > if(isset($_GET['samples'])) > { do something } > > ---John Holmes... > >--- End Message ---
--- Begin Message ---I think you\'d want to use: if ( $_SERVER[\'QUERY_STRING\'] == \'samples\') { // code } otherwise if you use , set your links as: <a href=\"index.php?samples=1\"> -js On Sun, 1 Dec 2002 22:38:54 -0500 Holmes wrote: > > > > I\'m sure this is easy, but I\'m drawing a blank. I need to have links > at > > the > > bottom of the page that passes arguments to the same script (itself) > when > > it > > gets reloaded. How do we do this? > > > > I have the links like this now: > > > > <a href=\"index.php?samples\"> > > > > How do I determine what is passed? I need to do an \"if\" statement > with > > different outputs depending on the argument. > > > > if ($samples) { do something } > > if(isset($_GET[\'samples\'])) > { do something } > > ---John Holmes... > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >--- End Message ---
--- Begin Message ---I think you\'d want to use: if ( $_SERVER[\'QUERY_STRING\'] == \'samples\') { // code } otherwise if you use , set your links as: <a href=\"index.php?samples=1\"> -js On Sun, 1 Dec 2002 22:38:54 -0500 Holmes wrote: > > > > I\'m sure this is easy, but I\'m drawing a blank. I need to have links > at > > the > > bottom of the page that passes arguments to the same script (itself) > when > > it > > gets reloaded. How do we do this? > > > > I have the links like this now: > > > > <a href=\"index.php?samples\"> > > > > How do I determine what is passed? I need to do an \"if\" statement > with > > different outputs depending on the argument. > > > > if ($samples) { do something } > > if(isset($_GET[\'samples\'])) > { do something } > > ---John Holmes... > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >--- End Message ---
--- Begin Message ---Not sure which version, it's my ISP. Adding "=1" to the URL worked though. Thanks! -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:08 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script What PHP version are you using? Try $HTTP_GET_VARS['sample'] if it's an older version. Also try index.php?sample=1, so that "sample" actually has a value (although the method I gave you worked on IIS). ---John Holmes... > -----Original Message----- > From: Troy May [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 01, 2002 11:02 PM > To: [EMAIL PROTECTED]; 'PHP List' > Subject: RE: [PHP] Passing arguments to the same script > > Thanks for responding. I think I'm still doing something wrong. Take a > peek: > > if(isset($_GET['questions'])) { > echo "Questions link content will go here"; > } > elseif(isset($_GET['samples'])) { > echo "Samples link content will go here"; > } > elseif(isset($_GET['rates'])) { > echo "Rates link content will be here"; > } > elseif(isset($_GET['contact'])) { > echo "Contact information will go here."; > } else { > echo "Main content goes here."; > } > > The only thing that EVER gets displayed is the final else. (Main content > goes here.) What am I doing wrong? Once again, the links are in this > format: <a href="index.php?samples"> > > Any ideas? > > > -----Original Message----- > From: John W. Holmes [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 01, 2002 7:39 PM > To: 'Troy May'; 'PHP List' > Subject: RE: [PHP] Passing arguments to the same script > > > > I'm sure this is easy, but I'm drawing a blank. I need to have links > at > > the > > bottom of the page that passes arguments to the same script (itself) > when > > it > > gets reloaded. How do we do this? > > > > I have the links like this now: > > > > <a href="index.php?samples"> > > > > How do I determine what is passed? I need to do an "if" statement > with > > different outputs depending on the argument. > > > > if ($samples) { do something } > > if(isset($_GET['samples'])) > { do something } > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---Thanks, I got it working by adding "=1" -----Original Message----- From: Chris Wesley [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:08 PM To: 'PHP List' Cc: Troy May Subject: RE: [PHP] Passing arguments to the same script On Sun, 1 Dec 2002, Troy May wrote: > The only thing that EVER gets displayed is the final else. (Main content > goes here.) What am I doing wrong? Once again, the links are in this > format: <a href="index.php?samples"> <a href="index.php?samples=1"> To get the desired results with the code you posted, you have to give your query string parameter(s) a value (as above). If you don't want to give samples a value, then examine the query string as a whole: $_SERVER[QUERY_STRING] if( $_SERVER[QUERY_STRING] == "samples" ) ... g.luck, ~Chris--- End Message ---
--- Begin Message --- what abou using action=questions instead of questions=1, then you can use array:
$links=array('questions'=>"Questions link content will go here",
'samples'=>"Samples link content will go here", ................
echo $links[$_GET['action']]
this would be neater.
Troy May wrote:
Thanks for responding. I think I'm still doing something wrong. Take a
peek:
if(isset($_GET['questions'])) {
echo "Questions link content will go here";
}
elseif(isset($_GET['samples'])) {
echo "Samples link content will go here";
}
elseif(isset($_GET['rates'])) {
echo "Rates link content will be here";
}
elseif(isset($_GET['contact'])) {
echo "Contact information will go here.";
} else {
echo "Main content goes here.";
}
The only thing that EVER gets displayed is the final else. (Main content
goes here.) What am I doing wrong? Once again, the links are in this
format: <a href="index.php?samples">
Any ideas?
-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 01, 2002 7:39 PM
To: 'Troy May'; 'PHP List'
Subject: RE: [PHP] Passing arguments to the same script
I'm sure this is easy, but I'm drawing a blank. I need to have linksat
thewhen
bottom of the page that passes arguments to the same script (itself)
itwith
gets reloaded. How do we do this?
I have the links like this now:
<a href="index.php?samples">
How do I determine what is passed? I need to do an "if" statement
different outputs depending on the argument.if(isset($_GET['samples']))
if ($samples) { do something }
{ do something }
---John Holmes...
--- End Message ---
--- Begin Message ---I am just full of them this weekend. Is it possible to direct a header like a html link (i.e. target="_top") ? I have a page that is in a frame, and I want the new page that is called to break the frame and load in the entire frame. Thanks. Jami--- End Message ---
--- Begin Message ---> I am just full of them this weekend. Is it possible to direct a header > like a html link (i.e. target="_top") ? I have a page that is in a frame, > and I want the new page that is called to break the frame and load in the > entire frame. Nope. Use JavaScript. ---John Holmes...--- End Message ---
--- Begin Message ------ "John W. Holmes" <[EMAIL PROTECTED]> wrote: > > I am just full of them this weekend. Is it > possible to direct a header > > like a html link (i.e. target="_top") ? I have a > page that is in a > frame, > > and I want the new page that is called to break > the frame and load in > the > > entire frame. I do not see why not have the request initially opened in the parent frame since both <a> and <form> tags support the "target" propery... which will be set in this case to "parent" I hope this makes your life easier ! good luck ! ===== +------------------------------------------+ |Wana Know what ISLAM is all about ? | +------------------------------------------+ visit : http://www.sultan.org/#int __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com--- End Message ---
--- Begin Message ---Hi all, I'm making a site with a dynamic menu based on IF statements and DB queries, but have this little problem which I can't understand the reason. My programming method is based upon an application.php file which controls the hole site and paths, template files for the header & footer and main PHP files which includes all the needed files that I mentioned before. As an example of this, the header TITLE tag has a <?=$TITLE?> variable to take a different title for each page and after that, I put a $LOCATION variable to tell the menu() function which page is being displayed (different menus for products, about us, etc.) but the menu() function (fetched from a library) is not recognizing this $LOCATION variable. I'm declaring it as a GLOBAL inside the function, but nothing happens. Here's part of my code: This is part of my product's index.php file: <SNIP> <? require ("../application.php"); $TITLE = "Joyería Mara"; $LOCATION = ""; include ("$CFG->templatedir/header.inc"); ?> <TR> <TD VALIGN=top> <P><!--COMIENZO DE CUERPO--><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" HEIGHT="100%"> <TR> <TD VALIGN=top WIDTH=200> <P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=15 WIDTH="100%"> <TR> <TD> <? menu(); ?> </SNIP> =========================== And this is the menu() function: <SNIP> function menu(){ GLOBAL $LOCATION; if ($LOCATION = "productos"){ GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK, $CFG; $MENU_NAME = "Nosotros"; $MENU_LINK = "".$CFG->wwwroot."/nosotros"; $MENU_BACK = "000066"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK; $MENU_NAME = "Productos"; $MENU_LINK = "".$CFG->wwwroot."/productos"; $MENU_BACK = "999999"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK; $MENU_NAME = "Regístrese"; $MENU_LINK = "".$CFG->wwwroot."/registrese"; $MENU_BACK = "000066"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK; $MENU_NAME = "Contacto"; $MENU_LINK = "".$CFG->wwwroot."/contacto"; $MENU_BACK = "000066"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); } else if ($LOCATION = "nosotros"){ echo "hi"; } else{ echo "none"; } } </SNIP> ============================== Any thoughts? Thanks Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina--- End Message ---
--- Begin Message ---Hi, Monday, December 2, 2002, 4:06:54 PM, you wrote: CA> Hi all, CA> I'm making a site with a dynamic menu based on IF statements and DB CA> queries, but have this little problem which I can't understand the CA> reason. My programming method is based upon an application.php file CA> which controls the hole site and paths, template files for the header & CA> footer and main PHP files which includes all the needed files that I CA> mentioned before. CA> As an example of this, the header TITLE tag has a <?=$TITLE?> variable CA> to take a different title for each page and after that, I put a CA> $LOCATION variable to tell the menu() function which page is being CA> displayed (different menus for products, about us, etc.) but the menu() CA> function (fetched from a library) is not recognizing this $LOCATION CA> variable. I'm declaring it as a GLOBAL inside the function, but nothing CA> happens. Here's part of my code: CA> This is part of my product's index.php file: CA> <SNIP> Your if statements should be like this: if ($LOCATION == "productos") //needs the double '=' sign otherwise $LOCATION is always set to productos -- regards, Tom--- End Message ---
--- Begin Message --- Is it not set or is it empty? Try adding this code to menu function after global $LOCATION;
if(!isset($LOCATION) die('$LOCATION is not set!');
Cesar Aracena wrote:
Hi all,
I'm making a site with a dynamic menu based on IF statements and DB
queries, but have this little problem which I can't understand the
reason. My programming method is based upon an application.php file
which controls the hole site and paths, template files for the header &
footer and main PHP files which includes all the needed files that I
mentioned before.
As an example of this, the header TITLE tag has a <?=$TITLE?> variable
to take a different title for each page and after that, I put a
$LOCATION variable to tell the menu() function which page is being
displayed (different menus for products, about us, etc.) but the menu()
function (fetched from a library) is not recognizing this $LOCATION
variable. I'm declaring it as a GLOBAL inside the function, but nothing
happens. Here's part of my code:
This is part of my product's index.php file:
<SNIP>
<?
require ("../application.php");
$TITLE = "Joyería Mara";
$LOCATION = "";
include ("$CFG->templatedir/header.inc");
?>
<TR>
<TD VALIGN=top>
<P><!--COMIENZO DE CUERPO--><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0
WIDTH="100%" HEIGHT="100%"> <TR> <TD VALIGN=top WIDTH=200> <P><TABLE
BORDER=0 CELLSPACING=0 CELLPADDING=15 WIDTH="100%"> <TR> <TD> <?
menu();
?>
</SNIP>
===========================
And this is the menu() function:
<SNIP>
function menu(){
GLOBAL $LOCATION;
if ($LOCATION = "productos"){
GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK, $CFG;
$MENU_NAME = "Nosotros";
$MENU_LINK = "".$CFG->wwwroot."/nosotros";
$MENU_BACK = "000066";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']);
GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK;
$MENU_NAME = "Productos";
$MENU_LINK = "".$CFG->wwwroot."/productos";
$MENU_BACK = "999999";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']);
GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK;
$MENU_NAME = "Regístrese";
$MENU_LINK = "".$CFG->wwwroot."/registrese";
$MENU_BACK = "000066";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']);
GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK;
$MENU_NAME = "Contacto";
$MENU_LINK = "".$CFG->wwwroot."/contacto";
$MENU_BACK = "000066";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']); } else if ($LOCATION = "nosotros"){ echo "hi"; }
else{ echo "none"; } }
</SNIP>
==============================
Any thoughts? Thanks
Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina
--- End Message ---
--- Begin Message ---I'm getting nailed with a bunch of returned emails like this: [EMAIL PROTECTED] - no such user here. There is no user by that name at this server. : Message contains [1] file attachments What's going on? Each one has a different address, but the terminalgmb.ru part is the same for each one.--- End Message ---
--- Begin Message ---Hello, I want to add a method to an existing object. Any ideas how to? I tried using foreach($this->modules->$module_name->methods as $mod_method => $method_name) { $function = '$args = implode(",", func_get_args());'; $function .= 'return mod_'.$module_name.'::'.$mod_method.'($args);'; $lambda = create_function('', $function); $lambda(1); $this->$method_name = $lambda; } The error I got was "Fatal error: func_get_args(): Can't be used as a function parameter in ...: runtime-created function on line 1" when I called $lambda() Is there a way I can know the arguments of a defined method without calling the method? Thank you, Brian Takita--- End Message ---
--- Begin Message ---I just have a fucking mental block; I cannot at all conceive the necessary syntax to or even the theoretical algorithm that I need, to do the following: Consider the following table: U | X | Y --|---|-- me|001|0a me|002|0a me|003|0a me|002|0b me|003|0b me|004|0b ..|...|.. then the code says: SELECT * FROM Y WHERE U = me So now what? - remember I do not know the value of Y, so it has to be an automatic thing; I can't just say ... WHERE U = me AND Y = a. I want this output: 0a 001 002 003 _______________________ (<hr>) 0b 002 003 004 How the hell do I do that? I can't think of the goddamn' syntax! ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca--- End Message ---
--- Begin Message ---Hi, if I got you right, you want to output each value for "Y" and then print out how often this value appears? If yes, you could try this: SELECT Y, COUNT(Y) AS NUMBER FROM TABLE GROUP BY Y HAVING U = 'me' Well, it's Monday morning and I don't know, if this will work, but I guess it does! ;-) Just try it out in phpmyadmin or so... Regards, Bastian Victor schrieb: > I just have a fucking mental block; I cannot at all conceive the > necessary syntax to or even the theoretical algorithm that I need, to do > the following: > > Consider the following table: > > U | X | Y > --|---|-- > me|001|0a > me|002|0a > me|003|0a > me|002|0b > me|003|0b > me|004|0b > ..|...|.. > > then the code says: > > SELECT * FROM Y WHERE U = me > > So now what? > - remember I do not know the value of Y, so it has to be an automatic > thing; I can't just say ... WHERE U = me AND Y = a. > > I want this output: > > 0a > 001 > 002 > 003 > _______________________ (<hr>) > > 0b > 002 > 003 > 004 > > How the hell do I do that? I can't think of the goddamn' syntax! > > ______________________________________________________________________ > Post your free ad now! http://personals.yahoo.ca--- End Message ---
--- Begin Message --- you got the results, now loop it, and if you find Y is different from the previous one, print it:
$previous='';
while($row=mysql_fetch_array($res) {
if($row['Y']!=$previous) echo "$row[Y]<br>";
echo "$row[X]<br>";
}
Victor wrote:
I just have a fucking mental block; I cannot at all conceive the
necessary syntax to or even the theoretical algorithm that I need, to do
the following:
Consider the following table:
U | X | Y --|---|--
me|001|0a
me|002|0a
me|003|0a
me|002|0b
me|003|0b
me|004|0b
..|...|..
then the code says:
SELECT * FROM Y WHERE U = me
So now what?
- remember I do not know the value of Y, so it has to be an automatic
thing; I can't just say ... WHERE U = me AND Y = a.
I want this output:
0a
001
002
003
_______________________ (<hr>)
0b
002
003
004
How the hell do I do that? I can't think of the goddamn' syntax!
______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---Hi to all, Sorry for this kind of post but i cant find a better mailing list for javascript. I have a problem in refreshing my php page script. Im using javascript to open new window for editing purposes. But i want my opener opener page to auto reload upon submit in my new window. Any idea? thanks in advance Regards, mike--- End Message ---
--- Begin Message ---At 09:21 02.12.2002, Michael P. Carel said: --------------------[snip]-------------------- >Sorry for this kind of post but i cant find a better mailing list for >javascript. >I have a problem in refreshing my php page script. Im using javascript to >open new window for editing purposes. But i want my opener opener page to >auto reload upon submit in my new window. --------------------[snip]-------------------- Use JavaScript, for example. There is a window property called "opener" which is a handle to the window which opened the popup. Upon form submit, you could: <script language="JavaScript"> function submitForm(form) { document.forms[form].submit(); window.opener.location.reload(); window.close(); return true; } </script> ...within your form code... <form name="myform" method="post" action="something"> ...your form contents... <button value="Submit this" onClick="submitForm(myform)"> </form> -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/--- End Message ---
--- Begin Message --- This would prevent nonjavascript browsers from submiting the form. Better would be to use the
page that comes after submiting:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Form submited successfully</title>
<meta http-equiv="Content-Type" content="text/html">
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="window.opener.location.reload(); window.close()">
<h3>Form submited successfully</h3><br>
<input type="button" value="Close" onClick="window.close()">
</body>
</html>
Ernest E Vogelsinger wrote:
At 09:21 02.12.2002, Michael P. Carel said:
--------------------[snip]--------------------
Sorry for this kind of post but i cant find a better mailing list for--------------------[snip]--------------------
javascript.
I have a problem in refreshing my php page script. Im using javascript to
open new window for editing purposes. But i want my opener opener page to
auto reload upon submit in my new window.
Use JavaScript, for example. There is a window property called "opener"
which is a handle to the window which opened the popup. Upon form submit,
you could:
<script language="JavaScript">
function submitForm(form) {
document.forms[form].submit();
window.opener.location.reload();
window.close();
return true;
}
</script>
...within your form code...
<form name="myform" method="post" action="something">
...your form contents...
<button value="Submit this" onClick="submitForm(myform)">
</form>
--- End Message ---
--- Begin Message ---Morgan Hughes wrote:Or use stat() to get the page's mtime, something likeGood idea. Chris--- End Message ---
--- Begin Message ---Hi I'm trying to find out how to run a command on the server as root. Does anybody know how to do this? Thanks Luke--- End Message ---
--- Begin Message ---Hi I'm trying to find out how to run a command on the server as root. Does anybody know how to do this? Thanks Luke--- End Message ---
--- Begin Message ---On Monday 02 Dec 2002 10:47 am, Luke van Blerk wrote: > Hi > > I'm trying to find out how to run a command on the server as root. Does > anybody know how to do this? > su root password: your_root_password then run your command This is a php list not a *nix list John--- End Message ---
--- Begin Message ---Hi Luke, > I'm trying to find out how to run a command on the > server as root. Does anybody know how to do this? How about using a combination of exec() and sudo (assuming you're in the sudoers file, that is)? Cheers Jon--- End Message ---
--- Begin Message --- As your server process run as nobody or apache, you need a wrapper setuid root program that will
execute the command you want, but you must be very carefull so it is not exploitable.
Luke van Blerk wrote:
Hi
I'm trying to find out how to run a command on the server as root. Does
anybody know how to do this?
Thanks
Luke
--- End Message ---
--- Begin Message --------BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 the commande run y PHP on the server are run as the user which apache is running as ...aka www or nobody in lot's of case ... so forget running a root commande ( infac for security reason ... it's not very good :/ ) Le Lundi 2 Décembre 2002 10:44, Luke van Blerk a écrit : > Hi > > I'm trying to find out how to run a command on the server as root. Does > anybody know how to do this? > > Thanks > Luke - -- __________ / Matthieu Le Corre | Service Informatique | ____________________ | Inspection Academique de la Sarthe | 72000 LE MANS | ____________________________ | Tel : 02 43 61 58 91 | Mail : [EMAIL PROTECTED] \____________________________________ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE960k/iQG6YxCcev4RAp5PAKCCFTNSZt53WTikYRIJSpR/2Ra84ACfR/0K nrqZuoXNcuu1GWy99XVu7fs= =Y7GA -----END PGP SIGNATURE-------- End Message ---
--- Begin Message ---Hello all Im trying to load php 4.2.3 as a dynamic module into apache server 2.0.43 but am running into problems. Everytime i run the configtest or try and start the apache server i get the following error. Cannot load /usr/lib/apache/libphp4.so into server: /usr/lib/apache/libphp4.so: undefined symbol: ap_block_alarms I have spent some time trying to find a solution to this problem and have seen on the help pages of php.net that it is to do with the apache DSO sharing. I followed the suggestion and recompiled apache with the --enable-shared=max --enable-rule=SHARED_CORE but this still doesnt make any difference. Has anyone else out there seen this problem and maybe know how to fix it? Thanks for any help in advance!! __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com--- End Message ---
--- Begin Message ---> -----Original Message----- > From: bob pilly [mailto:[EMAIL PROTECTED]] > Sent: 02 December 2002 11:24 > > Im trying to load php 4.2.3 as a dynamic module into > apache server 2.0.43 but am running into problems. > Everytime i run the configtest or try and start the > apache server i get the following error. I think you have a fundamental version mismatch there -- AFAIR with Apache 2.0.43, you have to use a pre-production version of PHP 4.3, which at present probably means 4.3.0RC2 (unless they've slipped another one out whilst I wasn't looking!). Anyway, go have a look at http://snaps.php.net/ and see what's available. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211--- End Message ---
--- Begin Message ---Hi all, I have a mySQL database called "srchresult" in a "srchresult" base. In it, i have 9 fields. Everything works perfectly. I would like to know how can i list in a HTML table 30 results for example but only with 7 columns (7 fields only) ? I 've tried some scripts but i can't work this out (i'm a newbie) Thanks a lot, Hacook--- End Message ---
--- Begin Message ---Hi Hacook, > I have a mySQL database called "srchresult" in a "srchresult" base. > In it, i have 9 fields. Everything works perfectly. > I would like to know how can i list in a HTML table 30 results for example > but only with 7 columns (7 fields only) ? Try this: <?php // open the db connection - replace these with your own settings $db = mysql_connect([server], [username], [password]); // select the database - replace with your own mysql_select_db([database], $db); // get the query - add your own field names here $q = mysql_query("SELECT Field1, Field2, Field3 FROM srchresult LIMIT 30"); // start the table echo "<table">; // loop through the results while ($r = mysql_fetch_array($q)) { // echo a table row ?> <tr> <td><?=$r["Field1"]?></td> <td><?=$r["Field2"]?></td> <td><?=$r["Field3"]?></td> </tr> <?php // end of while() loop } // finish the table echo "</table>"; ?> It's untested - shout if it doesn't work. Cheers Jon--- End Message ---
--- Begin Message ---Hello! I'm using a PHP-script as a small console-app. Is the only way to give parameters to it the $QUERY_STRING, or can I wait for the user to input something (like scanf in C)? I couldn't find anything in the docs, so perhaps this is not possible?! Martin--- End Message ---
--- Begin Message ---For console app you can use readline functions Martin Thoma wrote:Hello!
I'm using a PHP-script as a small console-app. Is the only way to give
parameters to it the $QUERY_STRING, or can I wait for the user to input
something (like scanf in C)? I couldn't find anything in the docs, so
perhaps this is not possible?!
Martin
--- End Message ---
--- Begin Message ---Hi All I am currently working on a simple document management system in PHP. Metadata and revision histories and other relevant data is stored in a PostgreSQL database. I would like to set up this system so that there is NO access to any documents through the filesystem (web folders etc.) Hence, the ideal situation is the following: (much simplified) The user is sent to an URL such as: http://www.blah.com/document.php?docid=9994112 This script document.php pushes the Word Document (or whatever type of document it may be) to the user's browser which in turn loads the relevant application. Now, normally when a user clicks "Save" it will attempt to save the file back to the Temporary Internet Files directory or something similar. I would like to make it possible for the user to simply be able to hit Save. The request is then sent back (a webdav request) to http://www.blah.com/document.php?docid=9994112 where this script can then retrieve the body of the file saved back to the web and then store it on the server file system as it pleases. That PHP script then updates the metadata in the PostgreSQL database. So basically what I want to use of WebDAV is its facility for saving "back to the web". I'm not really interested in locking or versioning etc. Will PHP and WebDAV support what I am looking for here? If not, is there anything else that will? The key point is that I must give the users a transparent way of saving back to the web without them having any access to the documents through shares etc. Thanks in advance. --- Adam Whitehead Software Developer - CSM Technology Microsoft Certified Professional (MCP) Ph: (08) 89361 455 ** Mobile (0411) 241 120 E-mail: [EMAIL PROTECTED] www.csm.com.au This e-mail, including any attachments, is intended only for the use of the individual or entity named above and may contain information that is confidential and privileged. Any information contained in this e-mail is not to be used or disclosed for any purpose other than the purpose for which you received it. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this e-mail by mistake, please delete this e-mail permanently from your system. WARNING: Although the company has taken reasonable precautions to ensure no viruses are present in this e-mail, the company can not accept responsibility for any loss or damage arising from the use of this e-mail or attachments.--- End Message ---
--- Begin Message ---i had this problem when my pages were cached when I wanted them to be refreshed, so I went deep in it and included all the recomended headers by the manual, and it worked fine.. I also tried on a clean version, by emptying up the browser cache and temp files on my client machine... until one page came from nowhere, an old old version! now my question is, where did that page come from? are these pages cached anywhere on the SERVER? I have an account on an APACHE server, and I dont know where to look for temporary files, if any get cached... Thank you for any help you can provide. [EMAIL PROTECTED] ===== Yours Elmota ______________________________________________________ http://www.geocities.com/FashionAvenue/5774/index.html __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com--- End Message ---
--- Begin Message ---on 02/12/02 10:49 PM, Elmota Abdul Ayyash ([EMAIL PROTECTED]) wrote: > i had this problem when my pages were cached when I wanted them to be > refreshed, so I went deep in it and included all the recomended headers > by the manual, and it worked fine.. I also tried on a clean version, by > emptying up the browser cache and temp files on my client machine... > > until one page came from nowhere, an old old version! now my question > is, where did that page come from? are these pages cached anywhere on > the SERVER? I have an account on an APACHE server, and I dont know > where to look for temporary files, if any get cached... It could be any proxy server between the client and the server, plus any proxies ON the server... this would include the user's local machine, their local network, their ISP, and any ISP/server in between the client and the server (do a traceroute), althoguh in this case it sounds like you're talking about a LAN. I don't *think* Apache caches anything by itself. Of course changing the filename will ensure you aren't using a cached copy :) Justin French -------------------- http://Indent.com.au Web Development & Graphic Design ----------------------- End Message ---
--- Begin Message ---Thank you for reading my mail! ---------------------------------------------------------- Who can tell me the best php-base webmail? I want a webmail for my mail server, give me a suggest, please! ---------------------------------------------------------- Joskey Liaus [EMAIL PROTECTED]--- End Message ---
--- Begin Message ---Hi Joskey, > Who can tell me the best php-base webmail? IMP (http://www.horde.org/imp/) is pretty good, I use it for my webmail and don't have any complaints. Cheers Jon--- End Message ---
--- Begin Message ---Thanks for this, I understand how to update in date in database, but I need when I get date from database to increase or decrease before to save in database. Can you help me for this ? "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 001501c2999b$d24a71f0$7c02a8c0@coconut">news:001501c2999b$d24a71f0$7c02a8c0@coconut... > > I want to get date from database, to increment ot decrement it with > some > > days, to show the date and after thath > > if user confirm it to save it to database. > > There are a ton of ways you can do it. You can select the date and it's > inc/dec value in the same statement: > > SELECT datecol, datecol + INTERVAL 1 DAY FROM yourtable WHERE ... > > Display whatever you need, if the user agrees to the new day, then issue > an update query: > > UPDATE yourtable SET datecol = datecol + INTERVAL 1 DAY WHERE ... > > To make those queries dynamic, you can replace the '1' with a variable > and assign it's value in PHP to either -1, 1, 2, 3, etc... > > $inc = -1; > > UPDATE yourtable SET datecol = datecol + INTERVAL $inc DAY WHERE ... > > Or... > > You can select out the date you have now, use strtotime() to make it > into a unix timestamp (which PHP works with), and date() to format it > however you want. If the user approves the new date, you can reformat > the unix timestamp back to a YYYY-MM-DD format with date() or use > FROM_UNIXTIME() in your query to insert/update the new date into the > database... > > ---John Holmes... > >--- End Message ---
--- Begin Message ---> -----Original Message----- > From: Gerard Samuel [mailto:[EMAIL PROTECTED]] > Sent: 29 November 2002 20:45 > To: php-gen > Subject: [PHP] Sessions not written to db on windows... > > > I have a bit of code that uses sessions and stores session > data in the > database. > Works flawlessly on FreeBSD 4.7/mySQL/PostgreSQL running php 4.2.3. > When trying to run my code on Windows 2k with MSSQL and > mySQL, its not > working. > The windows box is running php 4.1.2 (its a dev box). If my memory serves me correctly, sessions is broke in PHP 4.1.2 on Windows -- try upgrading. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211--- End Message ---