php-general Digest 5 Mar 2001 21:48:18 -0000 Issue 549 Topics (messages 42593 through 42676): Re: function questions 42593 by: Tim Ward Is it possible to get call stack information? 42594 by: Neil Kimber Re: Get remote IP ot Host 42595 by: Michael Meinl Re: help gurus: multi-dimensional array problem. 42596 by: Robert Vetter 42608 by: Tim Ward 42615 by: Robert Vetter PHP & Apache 2.0 42597 by: Benoit Re: dealing with no record 42598 by: Robert Vetter Re: Function to compare an array with another array 42599 by: Tim Ward subscribe my mail-id for PHP mailing lists 42600 by: B Satish , Gurgaon Re: how to redirect to other page? 42601 by: Batonik apache does not understand php3 42602 by: Marcos 42607 by: Martín Cabrera Diaubalick Is PHP ready for XML? 42603 by: Erick Papadakis Inserting DATE in mySQL!! 42604 by: Thomas Edison Jr. 42605 by: Miles Thompson 42609 by: CC Zona 42610 by: Hardy Merrill 42612 by: CC Zona help functions 42606 by: Montgomery-Recht, Evan 42611 by: CC Zona Re: HREFs that can't be 42613 by: Boget, Chris Re: Problem getting PostgreSQL to compile 42614 by: The Hermit Hacker Re: undefined symbol: xmlXPtrNewContext 42616 by: Sebastien Roy Re: Help Please: Php configuration 42617 by: archana sharma Re: max array size question.. 42618 by: Paul K Egell-Johnsen delete an element from an array 42619 by: kaab kaoutar 42621 by: Hardy Merrill 42622 by: kaab kaoutar 42623 by: Hardy Merrill 42625 by: kaab kaoutar 42630 by: Hardy Merrill 42641 by: Christian Cresante input textfield value cat! 42620 by: kaab kaoutar 42628 by: kaab kaoutar 42633 by: Christian Reiniger 42635 by: Batonik Match Records 42624 by: Website4S.aol.com MySQL - Problem with multiple INSERTs? 42626 by: Chris Re: stumped on mailing a complete page 42627 by: Chris Adams Re: NETSCAPE Screws QUERY STRING!!!!!! 42629 by: Chris Adams passing variable via url 42631 by: Kansas Territory 42634 by: Christian Reiniger Re: [PHP-WIN] Re: IE 5.5,authentication,PHP sessions: IE never stops 42632 by: John Henckel 42652 by: Chris Poirier imap problems. 42636 by: Chris Lee Re: IE 5.5,authentication,PHP sessions: IE never stops 42637 by: Ken 42673 by: Ken Verify session in function 42638 by: Tobias Talltorp 42643 by: kaab kaoutar Start you php script over?? 42639 by: Brandon Orther 42642 by: Boget, Chris 42644 by: Chris Lee Supress error message to apache log? 42640 by: Michael A. Peters 42645 by: Michael A. Peters HELP!!! FTP!!!! 42646 by: Bruno Freire getting info.. help! 42647 by: Brandon Orther 42648 by: Chris Lee 42649 by: Henrik Hansen 42650 by: Larry Jeannette Pam Auth 0.2 released 42651 by: Chad Cunningham Regular Expression Help 42653 by: Jeff Oien 42654 by: Henrik Hansen RPMs for PHP accessing PostgreSQL via ODBC over RedHat 42655 by: Paulo Parola get current events from mysql query by date? 42656 by: Matthew Delmarter 42658 by: Henrik Hansen 42660 by: Jeff Oien 42676 by: php3.developersdesk.com Document Contains No Data in Netscape? 42657 by: Robert Cooper 42674 by: Chris Lee Re: Hide Include-Files from the Web 42659 by: Richard Kitamura - Media Net Link, Inc. 42669 by: mailing_list.gmx.at Is it odd or even??? 42661 by: Brandon Orther 42662 by: Boget, Chris 42663 by: Jon Rosenberg 42664 by: Larry Jeannette 42665 by: Boget, Chris 42666 by: Brian V Bonini 42667 by: John Guynn 42670 by: Boget, Chris Re: Is it odd or even??? Optimize!!! 42668 by: Nathan Cassano 42675 by: Julian Wood carriage return in multipart/form-data form post 42671 by: Jeff Schwartz 42672 by: Chris Lee 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] ----------------------------------------------------------------------
why are you using this construct instead of echo()? e.g. echo("Hey there " . foo::bar($baz) . " how are you doing?"); Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: kevin1 [mailto:[EMAIL PROTECTED]] > Sent: 02 March 2001 09:57 > To: php-general > Subject: function questions > > > I have a here doc: > > print <<<END > Hey there foo::bar($baz) how are you doing? > END; > > foo::bar is a method that returns the name of $baz. I can't > seem to get > that to interpolate properly. It would make my life cleaner > and easier > if this could work. Is this at all possible? > > >
Is there anyway within PHP to get a complete dump of the call-stack? I can't use the Zend debugger for technical reasons (awaiting bug fix before it will work in our environment). I'd love to have a call that would return an array of call stack info. to the current line. Thanks, Neil
> I have problem with "REMOTE_ADDR" or "REMOTE_DOST". > > "REMOTE_ADDR" always return me 127.0.0.1 (localhost) !!! > The php program is on remote server ( not locally ) - www.f2s.com. > > How can I get IP or HOST of the visitor ? The problem might be, there is a proxy / redirection on the same server. You might try HTTP_X_FORWARDED_FOR. ( or so... try test.php3 for exact info... ) -- Krankenhaus Martha-Maria Nuernberg EDV-Organisation Michael Meinl Tel: 0911/959-1493 -1493 Fax: 0911/959-1412 -1422 --- Linux - The choice of the GNU generation
andrew wrote: > > Because I want to display it like this: > > category1 (href anchor to category1 below) > category2 > category3 > > category1 > link1 > link2 > link3 > > category2 > link1 > etc... > Hello, Ever heard of mysql_data_seek()? Have a look in the PHP Docs. Robert
Get a list of unique categories then get a list of each one would do it. $link_id = mysql_connect($host, $usr, $pass) or die (mysql_error()); mysql_select_db($database, $link_id); $sql="select distinct category from links"; $result = mysql_query($sql, $link_id) or die ("no results"); $cat_list = new Array(); while ($row=mysql_fetch_array($result)) { $cat_list[] = $row["category"]; echo("<a href=\"$PHP_SELF?#$category\">$category</font></a><br>"); }; foreach ($cat_list as $this_Cat) { echo("<a name=\"$category\">$this_Cat</font></a><br>"); $sql="select name, url from links where category = '$this_Cat'"; $result = mysql_query($sql, $link_id); while ($row=mysql_fetch_array($result)) { echo ("<a href='" . $row[url] . "'>" . $row["name"] . "</a><br>"); }; } haven't tested this but the principal should be okay and do what you're after Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: andrew [mailto:[EMAIL PROTECTED]] > Sent: 03 March 2001 19:59 > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] help gurus: multi-dimensional array problem. > > > Because I want to display it like this: > > > category1 (href anchor to category1 below) > category2 > category3 > > > category1 > link1 > link2 > link3 > > category2 > link1 > etc... > > > > On 3/3/01 2:49 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Addressed to: andrew <[EMAIL PROTECTED]> > > [EMAIL PROTECTED] > > > > ** Reply to note from andrew <[EMAIL PROTECTED]> Sat, > 03 Mar 2001 14:26:30 > > -0500 > >> > >> help! :)> > >> > >> I'm trying to return a list of links under associated > categories from a > >> database table that has the fields: "linkID, category, name, url". > >> > >> I'm selecting the fields and then trying to construct a > multi-dimensional > >> array so that the correct items get put into it (and then > printed out): > >> > > > > Why build an array, and store ANOTHER copy of all the data in memory > > while the script runs? That is just a waste of memory... > > > > > > SELECT Category, Name, URL FROM Links ORDER BY Category, Name; > > > > > > > > To display them: > > > > $OldCategory = ''; > > > > while( list( $Category, $Name, $URL ) = mysql_fetch_row( > $Result )) { > > > > if( $OldCategory != $Category ) { > > print "Category Header $Category<BR>\n"; > > > > $OldCategory = $Category; > > } > > > > print "<A href=\"$URL\">$Name</a><BR>\n"; > > } > > > > > > > > > > > > Rick Widmer > > Internet Marketing Specialists > > http://www.developersdesk.com > >
Tim Ward wrote: > > Get a list of unique categories then get a list of each one would do it. > > $link_id = mysql_connect($host, $usr, $pass) or die (mysql_error()); > mysql_select_db($database, $link_id); > $sql="select distinct category from links"; > $result = mysql_query($sql, $link_id) or die ("no results"); > $cat_list = new Array(); > while ($row=mysql_fetch_array($result)) > { $cat_list[] = $row["category"]; > echo("<a > href=\"$PHP_SELF?#$category\">$category</font></a><br>"); > }; > > foreach ($cat_list as $this_Cat) > { echo("<a name=\"$category\">$this_Cat</font></a><br>"); > $sql="select name, url from links where category = > '$this_Cat'"; > $result = mysql_query($sql, $link_id); > while ($row=mysql_fetch_array($result)) > { echo ("<a href='" . $row[url] . "'>" . $row["name"] > . "</a><br>"); > }; > } > > haven't tested this but the principal should be okay and do what you're > after > > Tim Ward > Senior Systems Engineer > Hello, This sulution is not very good: too many SELECTs, too much memory usage... Why not just use 2 Tables: Category and Links, and work with a LEFT JOIN? Then you could get all data needed with a single SQL statment, no additional arrays would be needed, either. Don't forget: MySQL is a RELATIONAL database - Why not make usage of it? Robert
Do someone know when PHP will work as apixs under Apache 2.0 ?
"Jacky@lilst" wrote: > > People > If I run a sniplet like this: > > ********************** > $query="select name from foo"; > $result= mysql_query($query); > while($row = mysql_fetch_row($result)) > stuffssss.......to display record found.... > ... > *********************** > what am I suppose to do if I also want the code to be able to deal with the case >that no record found and redirect user to other page? Hello, In the PHP Manual, section MySQL, there is a description of a function called mysql_num_rows()... Robert
function ArrayCompare($array1, $array2) { $answer = new Array() foreach ($array1 as $element) { if (($key = array_search($element, $array2)) === false) { $answer[$key] = $array2[$key]; } } return $answer; } this will return an array that is a copy of the first array with only those elements that are not in array2. If you only want the first one either just use the first one( foreach(){ ... break;}) or put a break in the if. Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: Jimmy Bäckström [mailto:[EMAIL PROTECTED]] > Sent: 05 March 2001 06:38 > To: PHP General List > Subject: Function to compare an array with another array > > > Shu! > I need some help here. > I have a script where I want to compare two arrays with > eachother, and return one value from that does not exists in > both arrays. I have an array of pictures id number created > from a database query. I use sessions to save id numbers of > pictures into an array. I want the first array to be compared > to the second and return the first key/value-pair that are > not found in the session array... > Is there a way I can do this? > > Thankful for any help! > /Broder B >
dear sir can you please subscribe my mail-id for PHP mailing group lists Thanks in advance satish
On Mon, 5 Mar 2001, JW wrote: > i have used header to redirect to other page. [cut] > if ($result == false) > { > header ("HTTP/1.0 404 Not Found"); > exit; > } > else > { > header ("../Form/first.html"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ According to RFC, you should use: header('302 Moved'); header('Location: http://new.location.com'); Greets, Batonik
hi, i have installed php4. from my browser i can read php .. but not php3. what should i do? regards, marcos [EMAIL PROTECTED]
Hello Marcos, In your httpd.conf file there's a line that looks similar to: AddType application/x-httpd-php4 .php4 .phtml Just add the php3 extension. It should be something like this: AddType application/x-httpd-php4 .php4 .phtml .php3 HTH Regards
I am beginning on how to work with xml, but i need some prelim help. let us say i have an XML file as follows: --------------- <Book> <Author>Jonathan Swift</Author> <Name>Gulliver's Travels</Name> </Book> <Book> <Author>Agatha Christie</Author> <Name>Murder on 57</Name> </Book> --------------- I want to know if PHP supports the following to do with the above file: - How to list the above information on a HTML page (I mean using PHP of course) - in tables.Which functions should I use, EXPAT functions or DOM functions? (Whats the difference?) - What if I need to search through a XML file? How would I go about doing it - recommended way? - What if I needed to add a new tag to all the BOOKS in the XML file. For instance, <Isbn>2390737-380973</Isbn> How would I do this for all the books in my XML file? I'd appreciate any help! Thanks! Erick. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.230 / Virus Database: 111 - Release Date: 25-Jan-01
I'm using the following code to insert date into my mySQL table named "Booking". I've created variables that store the date with dashes "-" seperating them. But it's not working. It's giving me an error on the $SQl line. following is the code : <?php $db = mysql_connect("localhost","root"); mysql_select_db("motorola",$db); $realsdate="$syear"."-"."$smonth"."-"."$stdate"; $realedate="$eyear"."-"."$emonth"."-"."$endate"; $realstime="$shh".":"."$smm"."-"."$sttime"; $realetime="$ehh".":"."$emm"."-"."$entime"; $sql = INSERT INTO booking (room,sdate,edate,stime,etime,purpose,reserved) VALUES ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$res'); $result = mysql_query($sql) or Die ("An unexpected error occured. Please go back and book again."); ?> ?? Cheers, T. Edison jr. ===== Rahul S. Johari (Director) ****************************************** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 ******************************************* __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
What field type are you using to store time? Echo your $sql and compare it to MySQL's documentation on the time column and how you have defined the field. Miles At 03:51 AM 3/5/01 -0800, Thomas Edison Jr. wrote: >I'm using the following code to insert date into my >mySQL table named "Booking". I've created variables >that store the date with dashes "-" seperating them. >But it's not working. It's giving me an error on the >$SQl line. > >following is the code : > ><?php > $db = mysql_connect("localhost","root"); > mysql_select_db("motorola",$db); > $realsdate="$syear"."-"."$smonth"."-"."$stdate"; > $realedate="$eyear"."-"."$emonth"."-"."$endate"; > $realstime="$shh".":"."$smm"."-"."$sttime"; > $realetime="$ehh".":"."$emm"."-"."$entime"; > $sql = INSERT INTO booking >(room,sdate,edate,stime,etime,purpose,reserved) VALUES >('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$res'); > $result = mysql_query($sql) or Die ("An unexpected >error occured. Please go back and book again."); >?> > >?? >Cheers, >T. Edison jr. > > >===== >Rahul S. Johari (Director) >****************************************** >Abraxas Technologies Inc. >Homepage : http://www.abraxastech.com >Email : [EMAIL PROTECTED] >Tel : 91-4546512/4522124 >******************************************* > >__________________________________________________ >Do You Yahoo!? >Get email at your own domain with Yahoo! Mail. >http://personal.mail.yahoo.com/ > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Thomas Edison Jr.") wrote: > I'm using the following code to insert date into my > mySQL table named "Booking". I've created variables > that store the date with dashes "-" seperating them. > But it's not working. It's giving me an error on the > $SQl line. > > following is the code : > > <?php > $db = mysql_connect("localhost","root"); > mysql_select_db("motorola",$db); > $realsdate="$syear"."-"."$smonth"."-"."$stdate"; > $realedate="$eyear"."-"."$emonth"."-"."$endate"; > $realstime="$shh".":"."$smm"."-"."$sttime"; > $realetime="$ehh".":"."$emm"."-"."$entime"; > $sql = INSERT INTO booking > (room,sdate,edate,stime,etime,purpose,reserved) VALUES > ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$res > '); > $result = mysql_query($sql) or Die ("An unexpected > error occured. Please go back and book again."); > ?> Your value for the variable "sql" isn't enclosed in quotes. BTW, tracking down problems with a sql query gets easier when you give yourself a more informative die() message, such as: or die ("MySQL says: " . mysql_errorno() . " " . mysql_error() . "\nPHP says: $errormsg"); -- CC
CC Zona [[EMAIL PROTECTED]] wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] ("Thomas Edison Jr.") wrote: > > > I'm using the following code to insert date into my > > mySQL table named "Booking". I've created variables > > that store the date with dashes "-" seperating them. > > But it's not working. It's giving me an error on the > > $SQl line. > > > > following is the code : > > > > <?php > > $db = mysql_connect("localhost","root"); > > mysql_select_db("motorola",$db); > > $realsdate="$syear"."-"."$smonth"."-"."$stdate"; > > $realedate="$eyear"."-"."$emonth"."-"."$endate"; > > $realstime="$shh".":"."$smm"."-"."$sttime"; > > $realetime="$ehh".":"."$emm"."-"."$entime"; > > $sql = INSERT INTO booking > > (room,sdate,edate,stime,etime,purpose,reserved) VALUES > > ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$res > > '); > > $result = mysql_query($sql) or Die ("An unexpected > > error occured. Please go back and book again."); > > ?> > > Your value for the variable "sql" isn't enclosed in quotes. BTW, tracking > down problems with a sql query gets easier when you give yourself a more > informative die() message, such as: > > or die ("MySQL says: " . mysql_errorno() . " " . mysql_error() . "\nPHP ^^^^^^^^^ Just a technicality, but I think I remember this to be mysql_errno(). But CC is right - in your "die", give yourself as much info about the error as possible. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com > says: $errormsg"); > > -- > CC > > -- > 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]
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Hardy Merrill) wrote: > > or die ("MySQL says: " . mysql_errorno() . " " . mysql_error() . "\nPHP > ^^^^^^^^^ > > Just a technicality, but I think I remember this to be > mysql_errno(). But CC is right - in your "die", give yourself > as much info about the error as possible. Oops, you're right about the typo. Sorry about that. It's *very late at night here. <g> -- CC
Has anyone spent any time and thought into including help within the library, ie. so you could do a. mysql.connect().help() or something like that so as a developer addeds a new function we as end users might be able to understand the function. Most likely by creating a help file to return to the browser because right now I'm finding a lot of undocumentented features. thanks, evan
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Montgomery-Recht, Evan") wrote: > Has anyone spent any time and thought into including help within the > library, ie. so you could do a. > > mysql.connect().help() or something like that so as a developer addeds a new > function we as end users might be able to understand the function. Most > likely by creating a help file to return to the browser because right now > I'm finding a lot of undocumentented features. But at the point where a function would be sufficently documented to have this built-in help file, wouldn't the same information be readily available in the online manual? -- CC
> > How is 3 different from 1? > 1: http://www.somedomain.com/program.php?parm1=value1 > 3: http://www.somedomain.com/program.php/value1 > $PATF_INFO now contains '/value1' Ahh. > This is pretty much acceptable to search engines. Even better add: > <Location /program> > ForceType application/x-httpd-php > </Location> > to httpd.conf. Then the following url will work: > http://www.somedomain.com/program/value1/value2/command.php > program _is_ the program. $PATH_INFO containls: > '/value1/value2/command.php' I've tried setting this up, but for the life of me, I could not get it to work. I've just settled with including the ".php" after the program name and that works just as well... http://www.somedomain.com/program.php/value1/value2/command.php ----------------------------------^^^^^^^^^^ > Which you can: $Params = explode( '/', $PATH_INFO ); and > get an array: > $Params[0] : value1 > $Params[1] : value2 > $Params[2] : command.php Yup. I do this, but using the above. > > > Why do you want to eliminate all get params and cookies? > > > That might > > > have a lot of control as to what the best approach will be. > > GET because they can be modified and > So can these URL based param passing schemes. Even POST > params are not all that secure from a determined hacker. All it > takes is a little work with a program to fake POST values. The > only advantage they have is taking a little more work. Yes, I know. But that little extra work is enough. Plus, we are going to try a few things (including encrypting; not one way) the hidden variables. That and trying to make sure that the form submission request originated from our server. I'm still trying to find the answer as to when HTTP_REFERER is available and when it isn't... still haven't heard anything back on that one... > > Cookies because not all users will have them turned on. > Good reason. > If you don't care about serach engines, you can just use PHP4 sessions, > and append the session ID, or compile with --enable-trans-sid and let > php use cookies when available or place the session ID in the URN if > they are not. As I've mentioned in another post, this is *not* working. We have that directive turned on/compiled in and it still does not append the session ID to URLs if the user's browser does not accept cookies. I submitted a few code samples last week that I set up to demonstrated this. Everything looks ok in the php.ini and everything that needed to be was turned on when PHP4 (we are using 4.0.3pl1) was compiled, but still the session ID is not being appended to the URL. I wish I knew what was wrong. Chris
On Mon, 5 Mar 2001, K Old wrote: > Yes, I've checked phpinfo() and not it is not compiled in. That is the > problem. I have recompiled PHP with pgsql support and there is some > problem. I'm not sure why it isn't compiling it in. I've tried everything > I know....the installation goes fine...no error messages, everything seems > ok. > > Any ideas? when you run configure, the status messages that are output, do they list pgsql as being found? even with --with-pgsql enabled, if it can't find the libraries or header files, it will re-disable it again ... > > > >From: The Hermit Hacker <[EMAIL PROTECTED]> > >To: K Old <[EMAIL PROTECTED]> > >CC: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > >Subject: Re: [PHP] Problem getting PostgreSQL to compile > >Date: Fri, 2 Mar 2001 22:30:11 -0400 (AST) > > > > > >have you checked phpinfo() to make sure that pgsql support is actually > >compiled in? if so, any errors on connection, or just silently fails? > > > >On Fri, 2 Mar 2001, K Old wrote: > > > > > Hello, > > > > > > I'm running RH 7 and Apache. I have the latest version of PostgreSQL > >and it > > > is installed and running correctly. I have installed PHP with the > > > --with-pgsql and it seems to install everything needed, but when I try > >to > > > use pg_connect() it fails to connect. Any ideas what I can do? > > > > > > Thanks, > > > Kevin > > > [EMAIL PROTECTED] > > > _________________________________________________________________ > > > Get your FREE download of MSN Explorer at http://explorer.msn.com > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > >Marc G. Fournier ICQ#7615664 IRC Nick: > >Scrappy > >Systems Administrator @ hub.org > >primary: [EMAIL PROTECTED] secondary: > >scrappy@{freebsd|postgresql}.org > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org
I'm having the exact same problem, did someone find a way to correct that problem???? Evething looks good when compiling, the error occured when I try to start Apache. I am using sablotron 0.51 with libxmlparse and libxmltok that came from the Sablotron RPM version 0.44 (because I could not find them anywhere else). Regards, Sebastien Roy PHP programmer [EMAIL PROTECTED] Jack Lauman wrote: > I get the following error when I attempt to start Apache 1.3.19 > (RedHad 7.0): > > apachectl start > > Syntax error on line 230 of /etc/httpd/conf/httpd.conf: > Cannot load /usr/lib/apache/libphp4.so into server: > /usr/lib/apache/libphp4.so: > undefined symbol: xmlXPtrNewContext > /usr/sbin/apachectl start: httpd could not be started > > I'm using libxml 2.3.3, and I assume the error is from the ./configure > statement --xith-dom > > I'd appreciate any suggestions on how to resolve it. > > TIA > > Jack > > -- > 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]
Thanks a lot!!! Yes it is working now with both cgi as well as php4isapi.dll. I removed php4isapi.dll from filter, which was crashing my web server. From: "Phil Driscoll" <[EMAIL PROTECTED]> To: "archana sharma" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> Subject: Re: [PHP] Help Please: Php configuration Date: Sun, 4 Mar 2001 14:33:36 -0000 MIME-Version: 1.0 Received: from [194.217.242.88] by hotmail.com (3.2) with ESMTP id MHotMailBC6B9E89006440043213C2D9F2580DFB0; Sun Mar 04 06:39:06 2001 Received: from dialsolutions3.demon.co.uk ([194.222.141.102] helo=philsntserver)by anchor-post-30.mail.demon.net with smtp (Exim 2.12 #1)id 14ZZdR-000FX1-0U; Sun, 4 Mar 2001 14:37:21 +0000 >From [EMAIL PROTECTED] Sun Mar 04 06:40:49 2001 Message-ID: <011001c0a4b8$445fca40$0c800001@philsntserver> X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 I'm guessing that you are adding the ISAPI version of php. If so, try installing it as a CGI instead (set the script mappings to php.exe instead of php4isapi.dll and remove php4isapi.dll from the filters list). Cheers -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Jeff wrote: > > I'm trying to read in a text file that has 42620 lines. Each line has > zip code information separated by commas. I have no problem reading the > file into an array. But when I try and read each element in the array > and put it into another array I get a "500 server error". The second to > last line is what's causing the problem. > > After doing some debugging I found out that at around iteration 18000 is > when the server error occurs. Any ideas? I know I should use a > database, but i'm intrigued by this problem. Check out if the memory usage is overrun; check if timeout occurs. (Your probgram isn't much help without the data) -- Paul K Egell-Johnsen Developer/PR Manager eZ systems as http://ez.no/
Hi! how can i decrement the length of an array! In fact i'm trying to delete an element from an array , i'v put the content of i in i-1 (loop) and i tried to decrement the array legnththis way: count($x)=count($x)-1; but it generates an error! Thanks _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
I'm not sure what you mean - are you trying to remove an element from the array while you are *inside* a loop that is iterating through that same array? If the loop is small enough, copy it in so we can all see what you are trying to do. kaab kaoutar [[EMAIL PROTECTED]] wrote: > Hi! > how can i decrement the length of an array! > In fact i'm trying to delete an element from an array , i'v put the content > of i in i-1 (loop) and i tried to decrement the array legnththis way: > count($x)=count($x)-1; > but it generates an error! > > Thanks > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi! FIRST OF ALL THANKS ! well do u mean that the only way to remove an elemnt from an array is to copy it into another array? it does not suit me cause the array is a session variable and i need to update it ! Thanks _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Have a look at http://www.php.net/manual/en/function.unset.php "unset" may do what you want. HTH. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com kaab kaoutar [[EMAIL PROTECTED]] wrote: > > Hi! > FIRST OF ALL THANKS ! > well do u mean that the only way to remove an elemnt from an array is to > copy it into another array? it does not suit me cause the array is a session > variable and i need to update it ! > > Thanks > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Thanks! but i know this function! i can't do that cause my varibale is multidimenssional, and i don't want to update all that ! for one element ! we can't decrement the length of the array ?! no way ? >From: Hardy Merrill <[EMAIL PROTECTED]> >To: kaab kaoutar <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: [PHP] delete an element from an array >Date: Mon, 5 Mar 2001 10:57:49 -0500 > >Have a look at > > http://www.php.net/manual/en/function.unset.php > >"unset" may do what you want. > >HTH. > >-- >Hardy Merrill >Mission Critical Linux, Inc. >http://www.missioncriticallinux.com > >kaab kaoutar [[EMAIL PROTECTED]] wrote: > > > > Hi! > > FIRST OF ALL THANKS ! > > well do u mean that the only way to remove an elemnt from an array is to > > copy it into another array? it does not suit me cause the array is a >session > > variable and i need to update it ! > > > > Thanks > > >_________________________________________________________________________ > > Get Your Private, Free E-mail from MSN Hotmail at >http://www.hotmail.com. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >-- >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] > _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
kaab kaoutar [[EMAIL PROTECTED]] wrote: > Thanks! but i know this function! > i can't do that cause my varibale is multidimenssional, and i don't want to > update all that ! for one element ! > we can't decrement the length of the array ?! no way ? Here's an example of a multidimensional array - I "unset" one of the values in the middle - I don't know why this won't work for you: <? $arr1 = array("a" => array('1' => "a111", '2' => "a222", '3' => "a333"), "b" => array('1' => "b111", '2' => "b222", '3' => "b333"), "c" => array('1' => "c111", '2' => "c222", '3' => "c333")); foreach ($arr1 as $key1 => $value1) { echo "<br>"; echo "key=[$key1], value=[$value1]<br>"; foreach ($value1 as $key2 => $value2) { echo " key2=[$key2], value2=[$value2]<br>"; } } unset($arr1["b"]["2"]); echo "<br><br>Unset b2 now<br><br>"; foreach ($arr1 as $key1 => $value1) { echo "<br>"; echo "key=[$key1], value=[$value1]<br>"; foreach ($value1 as $key2 => $value2) { echo " key2=[$key2], value2=[$value2]<br>"; } } ?> Here's the output displayed on the browser: ------------------------------------------- key=[a], value=[Array] key2=[1], value2=[a111] key2=[2], value2=[a222] key2=[3], value2=[a333] key=[b], value=[Array] key2=[1], value2=[b111] key2=[2], value2=[b222] key2=[3], value2=[b333] key=[c], value=[Array] key2=[1], value2=[c111] key2=[2], value2=[c222] key2=[3], value2=[c333] Unset b2 now key=[a], value=[Array] key2=[1], value2=[a111] key2=[2], value2=[a222] key2=[3], value2=[a333] key=[b], value=[Array] key2=[1], value2=[b111] key2=[3], value2=[b333] key=[c], value=[Array] key2=[1], value2=[c111] key2=[2], value2=[c222] key2=[3], value2=[c333] > > > > >From: Hardy Merrill <[EMAIL PROTECTED]> > >To: kaab kaoutar <[EMAIL PROTECTED]> > >CC: [EMAIL PROTECTED] > >Subject: Re: [PHP] delete an element from an array > >Date: Mon, 5 Mar 2001 10:57:49 -0500 > > > >Have a look at > > > > http://www.php.net/manual/en/function.unset.php > > > >"unset" may do what you want. > > > >HTH. > > > >-- > >Hardy Merrill > >Mission Critical Linux, Inc. > >http://www.missioncriticallinux.com > > > >kaab kaoutar [[EMAIL PROTECTED]] wrote: > > > > > > Hi! > > > FIRST OF ALL THANKS ! > > > well do u mean that the only way to remove an elemnt from an array is to > > > copy it into another array? it does not suit me cause the array is a > >session > > > variable and i need to update it ! > > > > > > Thanks > > > > >_________________________________________________________________________ > > > Get Your Private, Free E-mail from MSN Hotmail at > >http://www.hotmail.com. > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > >-- > >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] > > > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com
Since its the last element, just pop it out: array_pop() --- kaab kaoutar <[EMAIL PROTECTED]> wrote: > Hi! > how can i decrement the length of an array! > In fact i'm trying to delete an element from an > array , i'v put the content > of i in i-1 (loop) and i tried to decrement the > array legnththis way: > count($x)=count($x)-1; > but it generates an error! > > Thanks > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Hi! i'm storing values in session variables, when i get a value wich is a sequence of words seperated by space, it echoes successfully but when i try to initialize the value of an input textfield with it i got only the first word! i tried to encode decode but no way ! Thanks _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
I'm using a variable! <input type="text" name="MyTextInput" value=<?=$val ?>> >From: "Brad S. Jackson" <[EMAIL PROTECTED]> >To: "kaab kaoutar" <[EMAIL PROTECTED]> >Subject: Re: [PHP] input textfield value cat! >Date: Mon, 5 Mar 2001 10:08:21 -0600 > > > >Make sure you have quotes around the value. > ><input type="text" name="MyTextInput" value="MyValue"> > > >Hi! >i'm storing values in session variables, when i get a value wich is a >sequence of words seperated by space, it echoes successfully but when i try >to initialize the value of an input textfield with it i got only the >first >word! i tried to encode decode but no way ! >Thanks > > _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
On Monday 05 March 2001 17:29, you wrote: > I'm using a variable! > <input type="text" name="MyTextInput" value=<?=$val ?>> Well, you *still* need to have quotes around it: <input type="text" name="MyTextInput" value="<?=$val ?>"> > >Make sure you have quotes around the value. > > > ><input type="text" name="MyTextInput" value="MyValue"> -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) ...to paraphrase Churchill, while representative democracy may be terrible, it's still the best system that large corporations can buy. - David Weinberger JOHO January 25, 2000
On Mon, 5 Mar 2001, kaab kaoutar wrote: > I'm using a variable! > <input type="text" name="MyTextInput" value=<?=$val ?>> Quote the value: <input type="text" name="MyTextInput" value=\"<?=$val ?>\"> Greets, Batonik
I`m trying to find the best method to match records between two tables in a MySQL database. But it must match atleast once, so here is a scenario for you to think about. Member - Job, Salary, Location Jobs - Job, Salary, Location All values will be enum sets in both tables as follows Job = enum 'developer','designer','none' Salary = enum '10K','15K','none' Location = enum 'usa','uk','none' Ok so the user has come to the site and I have his Job Salary and Location stored, he clicks a link which then performs the search. His values are as follows.. Job = developer, Salary = 10K, Location = uk I want to search the Jobs table and match it with the above, this part I can do. The next stage is if it doesn`t find any matches it then finds the nearest. So if the only record I have in the Jobs table is as follows Job = developer, Salary = none, Location = uk How do I go about making it pick up the nearest. At the moment I am using SELECT * FROM Jobs where Job='$Job' and Salary='$Salary' and Location='$Location' So obviously it won`t match them, anyone wake me up from my slumber and help me out with this? Cheers Ade
Howdy, I'm getting weird problems trying to INSERT to two different tables, in consecutive mysql_queries. Before, I had 3 queries going, and only 2 would work at any time. It seemed like it was 'rotating' the bad query - first the 1st query would fail (the other two were fine), then I'd empty all my tables and refresh, and this time the 2nd query was the problem, and if I did it again the 3rd was. All queries worked fine in phpMyAdmin, both individually and when executed en masse. I've boiled it down to just two queries that don't work. I've included everything below (including table schemata), to enable reproduction. It seems like a bug to me - the question is, is the bug in PHP, MySQL, or my brain? This is driving me CRAZY!!!!!!!!!!!! - Chris mysql_connect("localhost", "myusername", "mypassword"); mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name, comment) VALUES (1, 'sysmsg9.txt', 'Some file')"); mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment) VALUES (1, 'sysmsg9.txt', 'Some file')"); CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80) NOT NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL, comment text NOT NULL, PRIMARY KEY (id) ); (P.S. I've tried things like using SET syntax, using mysql_query instead of mysql_db_query, etc. Nothing helps.)
On 3 Mar 2001 17:17:15 -0800, Brett <[EMAIL PROTECTED]> wrote: >I want to send a confirmation email upon receiving an order, and would like >to send the page that I display on the browser to the user. ob_start(); // do something mail('confirm@somewhere', 'confirmation', ob_get_contents()); ob_end_flush();
On 4 Mar 2001 04:17:18 -0800, Thomas Edison Jr. <[EMAIL PROTECTED]> wrote: >The Internet Explorer converts the spaces in a query >string into it's hexadecimal value of "%20" >automatically, but netscape is not doing so. It's not >reading the space and thus not displaying the page at >all and giving the HTTP error 400. Use urlencode() or rawurlencode() when generating those URLs. The standards don't allow raw spaces in a URL string, so you'll need to encode your data when generating a link to work with browsers other than IE.
using PHP 3.x on Linux, I've always been able to pass along a variable like http://www.domain.com/index.php3?foo=bar and then I could print out this with something like echo $foo; would print out "bar" I've recently installed the latest PHP4 onto a Windows2000 server, I'm trying the same thing here, a simple test, and echo $foo; gives me nothing however including a PHPINFO() on the page displays this: HTTP_GET_VARS["foo"] bar I'm I missing something here ? Kevin -------------------------------------------------------------------- Kevin Heflin | ShreveNet, Inc. | Ph:318.222.2638 x103 VP/Production | 333 Texas St #175 | FAX:318.221.6612 [EMAIL PROTECTED] | Shreveport, LA 71101 | http://www.shreve.net --------------------------------------------------------------------
On Monday 05 March 2001 17:43, you wrote: > using PHP 3.x on Linux, I've always been able to pass along a variable > like http://www.domain.com/index.php3?foo=bar > > and then I could print out this with something like > echo $foo; > would print out "bar" > > I've recently installed the latest PHP4 onto a Windows2000 server, I'm > trying the same thing here, a simple test, and > echo $foo; > > gives me nothing > > however including a PHPINFO() on the page displays this: > HTTP_GET_VARS["foo"] bar > > I'm I missing something here ? Check whether register_globals is set to "on" -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) ...to paraphrase Churchill, while representative democracy may be terrible, it's still the best system that large corporations can buy. - David Weinberger JOHO January 25, 2000
At 09:51 PM 3/4/01 -0500, Ken wrote: >Anyway, can someone please test to see if this doesn't happen in IE5.0? > >I really hate this situation, yessir. I have installed IE 5.00.2614.3500 (that's what came with Win 98 2nd edition CDROM vers 4.10.2222A) and it does NOT have the problem you have described. However, it has another bug that is almost as good. Make this page called mytest.php (I am using Xitami on localhost for the server) <?php if(!isset($PHP_AUTH_USER)) { Header("WWW-Authenticate: Basic realm=\"My Realm\""); Header("HTTP/1.0 401 Unauthorized"); echo "Sorry you are not authorized\n"; exit; } else { echo "Hello $PHP_AUTH_USER.<P>"; echo "You entered $PHP_AUTH_PW as your password.<P>"; } ?> These are the steps I did. 1. open mytest.php and when the password prompt appears, I enter a userid/password. 2. I see the "Hello" page with my userid and password. 3. close IE and reopen mytest.php, again the prompt appears -- this is good. 4. close IE and Restart Windows. 5. open mytest.php and when the password prompt appears, I hit CANCEL. 6. the message "Sorry you are not authorized" appears 7. in the address box I type www.google.com and wait for it to appear 8. I press the BACK button and guess what I see? I see the "Hello" page with my userid and password from step 2 !!!!!!!!!!!!!! apparently the page is retrieved from the browser cache. John Henckel alt. mailto:[EMAIL PROTECTED] Zumbro Falls, Minnesota, USA (507) 753-2216 http://geocities.com/jdhenckel/
Hi Ken, > At 10:56 AM 3/5/01 -0600, John Henckel wrote: > >1. open mytest.php and when the password prompt appears, I enter a userid/password. > >2. I see the "Hello" page with my userid and password. > >3. close IE and reopen mytest.php, again the prompt appears -- this is good. > >4. close IE and Restart Windows. > >5. open mytest.php and when the password prompt appears, I hit CANCEL. > >6. the message "Sorry you are not authorized" appears > >7. in the address box I type www.google.com and wait for it to appear > >8. I press the BACK button and guess what I see? I see the "Hello" page with my >userid and password from step 2 !!!!!!!!!!!!!! apparently the page is retrieved from >the browser cache. > > This is exactly one of the things I was complaining about: It is NOT a browser cache >issue - it still remembers your username and password, and will continue to send it >with page requests. This happens when you hit "cancel" on the new password prompt. >You'd think it would forget the username and password at this point, but it doesn't. >You have to clear the password field and hit OK. Crazy, huh? > > - Ken There is a suggestion in the PHP online documentation that has worked for me (except in Opera 5, which seems to ignore the Realm). Add a timestamp to the Realm that changes with each new session. IE 5.0 will prompt for a different password, because it sees it as a different login. Later, Chris.
ok, here we go. imap functions seem tobe funny. I could not get php to compile with the latest imap, I was getting errors about xml, go figure. and could not not like lib/yes go figure. I downloaded php 4.0.5dev all compiled well, but I get strange things happening, like imap functions do not return errors they just timeout. some functions just dont work, only timeout and cause segfaults, I cant tell if there are errors or not because of this. foreach($this->mail_headers as $pos => $val) $this->mail_body[$pos] = imap_body($this->mail_stream, $pos); where mail_headers is an array with all the headers pos and their value. this causes segfaults. any idea's? I would pref not to use the dev version of php? I also noticed on ftp://ftp.cac.washington.edu/imap/ that the newest imap is beta, anything stable out there? -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED]
At 10:56 AM 3/5/01 -0600, John Henckel wrote: >1. open mytest.php and when the password prompt appears, I enter a userid/password. >2. I see the "Hello" page with my userid and password. >3. close IE and reopen mytest.php, again the prompt appears -- this is good. >4. close IE and Restart Windows. >5. open mytest.php and when the password prompt appears, I hit CANCEL. >6. the message "Sorry you are not authorized" appears >7. in the address box I type www.google.com and wait for it to appear >8. I press the BACK button and guess what I see? I see the "Hello" page with my >userid and password from step 2 !!!!!!!!!!!!!! apparently the page is retrieved from >the browser cache. This is exactly one of the things I was complaining about: It is NOT a browser cache issue - it still remembers your username and password, and will continue to send it with page requests. This happens when you hit "cancel" on the new password prompt. You'd think it would forget the username and password at this point, but it doesn't. You have to clear the password field and hit OK. Crazy, huh? - Ken
At 02:39 PM 3/5/01 -0500, Chris Poirier wrote: >There is a suggestion in the PHP online documentation that has worked for >me (except in Opera 5, which seems to ignore the Realm). Add a timestamp >to the Realm that changes with each new session. IE 5.0 will prompt for a >different password, because it sees it as a different login. This is, in fact, what my system attempts to do. The catch is that I CAN'T change the realm with a new session...because I don't GET a new session, because IE 5.5 is not starting a new session when it should! Indeed, when I change the realm, I get the prompt. But I can't tell when the user closed his browser and started a new one, because IE 5.5 (on the machines I'm testing on) is still keeping the old session, acting like the browser never closed. Again, my system works perfectly on the other browsers I've tried. It changes the realm when appropriate. It sets a flag in the database when the user hits logout. And it works the way it should. Just in IE 5.5 (on the machines I'm testing on) do I get this horrible behavior. - Ken >Later, Chris.
I am building my first basic function to verify a session. If the verification is not in the function it works... What am I missing? (I couldn´t find anything about this in the mailing list archive) -- This works ------> session_start(); if (isset($PHPSESSID)){ echo "ok"; } else echo "not ok"; } -- This does not work -----> session_start(); verifySess(); function verifySess() { if (isset($PHPSESSID)){ echo "ok"; } else echo "not ok"; } } Thanks, // Tobias
U just have to add global $PHPSESSID to make the session variable global; >From: "Tobias Talltorp" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: [PHP] Verify session in function >Date: Mon, 5 Mar 2001 18:30:00 +0100 > >I am building my first basic function to verify a session. >If the verification is not in the function it works... >What am I missing? >(I couldn´t find anything about this in the mailing list archive) > >-- This works ------> >session_start(); > > if (isset($PHPSESSID)){ > echo "ok"; > } else > > echo "not ok"; > } > > >-- This does not work -----> >session_start(); >verifySess(); > >function verifySess() { > if (isset($PHPSESSID)){ > echo "ok"; > } else > > echo "not ok"; > } > } > >Thanks, >// Tobias > > > > > >-- >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] > _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Hello, Is there a way for me to tell my php script to start over? I want to have an if then statement to check if something is done. Then if it isn't I want the php script to start over. Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
> Is there a way for me to tell my php script to start over? I > want to have an if then statement to check if something is > done. Then if it isn't I want the php script to start over. header( "location: $PHP_SELF" ); OR header( "location: $REQUEST_URI" ); if you are using a query string/GET variables Chris
header() <?php if ($done) ... else { header("Location: http://$SERVER_NAME/$PHP_SELF"); exit(); } ?> i your using sessions without coookies. header("Location: http://$SERVER_NAME/$PHP_SELF?PHPSESSID=$PHPSESSID"); -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] ""Brandon Orther"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Is there a way for me to tell my php script to start over? I want to have an if then statement to check if something is done. Then if it isn't I want the php script to start over. Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
I have the following php function- function doclink ($documentdir, $rpmname, $doc_file) { $string="rpm -qd $rpmname |head -1 |sed s?\"$documentdir\"?\"\"? |cut -d\"/\" -f2"; $rpm_installed=exec($string); $DOC_ABSOLUTE="$documentdir/$rpm_installed"; if (file_exists("$DOC_ABSOLUTE/$doc_file")) { if (is_link("$rpmname")) { unlink("$rpmname"); } symlink("$DOC_ABSOLUTE", "$rpmname"); return "$rpmname/$doc_file"; } else { return "failed"; } } later its used when creating a page of documentation links for the user, like this- $mysqldoc=doclink($docdir, "MySQL", "manual_toc.html"); if (strstr($mysqldoc,"failed")) { echo "<!-- could not locate MySQL documentation -->\n"; } else { echo "<P><font face=$font color=$color size=$size><A href=\"$mysqldoc\">MySQL Documentation</A></font>\n"; } Works beautifully, problem is- if the rpm isn't installed that's querried in the doclink function, the error message rpm puts out is sent to the apache error.log. I don't want that. Is there a way to supress the error message for that exec call? Thanks -=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michael A. Peters Abriasoft Senior Developer http://www.abriasoft.com/ (510) 623-9726x357 Fax: (510) 249-9125
I feel dumb... $string="rpm -qd $rpmname 2>/dev/null |head -1 |sed s?\"$documentdir\"?\"\"? |cut -d\"/\" -f2"; On Monday, March 5, 2001, at 09:33 AM, Michael A. Peters wrote: > I have the following php function- > > function doclink ($documentdir, $rpmname, $doc_file) { > $string="rpm -qd $rpmname |head -1 |sed s?\"$documentdir\"?\"\"? |cut -d\"/\" >-f2"; > $rpm_installed=exec($string); > $DOC_ABSOLUTE="$documentdir/$rpm_installed"; > if (file_exists("$DOC_ABSOLUTE/$doc_file")) { > if (is_link("$rpmname")) { > unlink("$rpmname"); > } > symlink("$DOC_ABSOLUTE", "$rpmname"); > return "$rpmname/$doc_file"; > } else { > return "failed"; > } > } > > later its used when creating a page of documentation links for the user, like this- > > $mysqldoc=doclink($docdir, "MySQL", "manual_toc.html"); > if (strstr($mysqldoc,"failed")) { > echo "<!-- could not locate MySQL documentation -->\n"; > } else { > echo "<P><font face=$font color=$color size=$size><A href=\"$mysqldoc\">MySQL > Documentation</A></font>\n"; > } > > Works beautifully, problem is- if the rpm isn't installed that's querried in the >doclink > function, the error message rpm puts out is sent to the apache error.log. I don't >want that. > > Is there a way to supress the error message for that exec call? > > Thanks > -=-=-=-=-=-=-=-=-=-=-=-=-=-=- > Michael A. Peters > Abriasoft Senior Developer > > http://www.abriasoft.com/ > > (510) 623-9726x357 > Fax: (510) 249-9125 > -- > 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] > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michael A. Peters Abriasoft Senior Developer http://www.abriasoft.com/ (510) 623-9726x357 Fax: (510) 249-9125
Hi my name is bruno from Brazil. I have a linux server with Apache and PHP 4 running. What i wanna do is upload a file. Look the problem: I have a lan.(local Network) Consider this: Network server running apache : 6.6.6.6 Network client station : 6.6.6.5 If The apache server executes the php code when a client station requires a php page to make ftp conection, the remote host is the apache server and local host is th apache server. I think this for this cause: Look my code: <html> <head> <body bgcolor="#FFFFE6"> <?php $conn_id = ftp_connect("6.6.6.6"); $login_result = ftp_login($conn_id, "login", "password"); $destination="/home/httpd/html/intranet/test.txt"; $oriogin="c:\windows\test.txt"; $upload = ftp_put($conn_id,$destination,$origin,FTP_BINARY); if (!$upload) { echo "Ftp upload has failed!"; ftp_quit($conn_id); exit; } ftp_quit($conn_id); ?> </body> </html> WHAT IS WRONG???
Hello, Is there a way to remove all the spaces in the beginning of a string? Example: " 45 fasfda asdfasf" would be "45 fasfda asdfasf" and " 45 fasfda asdfasf" would be "45 fasfda asdfasf" No matter how many spaces in the begging in I just want it to delete the first spaces. I hope you can understand. :Þ Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
trim() -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] ""Brandon Orther"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, Is there a way to remove all the spaces in the beginning of a string? Example: " 45 fasfda asdfasf" would be "45 fasfda asdfasf" and " 45 fasfda asdfasf" would be "45 fasfda asdfasf" No matter how many spaces in the begging in I just want it to delete the first spaces. I hope you can understand. :Þ Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
> Hello, > > Is there a way to remove all the spaces in the beginning of a string? > > Example: > > " 45 fasfda asdfasf" would be "45 fasfda asdfasf" > > and > > " 45 fasfda asdfasf" would be "45 fasfda asdfasf" > look at http://www.php.net/manual/en/function.ltrim.php or maybe http://www.php.net/manual/en/function.trim.php -- Henrik Hansen
ltrim removes spaces on the left rtrim removes spaces on the right trim removes spaces on both the left and right Larry Jeannette MIS Director, e.Republic -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Monday, March 05, 2001 11:08 AM To: PHP User Group Subject: [PHP] getting info.. help! Hello, Is there a way to remove all the spaces in the beginning of a string? Example: " 45 fasfda asdfasf" would be "45 fasfda asdfasf" and " 45 fasfda asdfasf" would be "45 fasfda asdfasf" No matter how many spaces in the begging in I just want it to delete the first spaces. I hope you can understand. :Þ Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi, I've released Pam Auth 0.2 after many months :) Pam Auth is a php4 extension that allows simple pam authentication. Possible uses for this include using php to authenticate against local password files (dangerous!), samba/nt domains, ldap, mysql databases, and anything else which pam supports. Changes in version 0.2 include: - fixed problem with building on some systems - fixed problem with core dumps on solaris - fixed typo which caused errors to not be properly returned - added ability to specify pam servicename in php.ini - it now compiles as a shared module (although it won't load...) I hope to figure out the shared library issue soon which should simplify the installation process greatly. For more information and to download, please visit http://www.math.ohio-state.edu/~ccunning/pam_auth.html Please let me know if you encounter any problems with this version. -- Chad Cunningham [EMAIL PROTECTED] "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is bad! Oh beware the other head of science, Arthur, it bites!"
I want to delete everything after a tab (or space) on each line of a text file and can't figure it out. An example line is ARIA 5.19 -0.0625 -1.19 5.25 4.5 48.5 100300 I want to the output to be ARIA Thanks. Jeff Oien
> I want to delete everything after a tab (or space) on each line of > a text file and can't figure it out. > > An example line is > ARIA 5.19 -0.0625 -1.19 5.25 4.5 48.5 100300 > you can explode on a tab $arrlines = explode("\t", $the_line); then save $arrlines[0] from every line. Don't know if it's the most optimal way but it works :) -- Henrik Hansen
Hi, We are currently running the following configuration on our server: Linux Red Hat 7.0 PostgreSQL 7.1beta4-1 PHP 4.0.1pl2 I need to add some RPM package (or perhaps an apache module) to enable PHP to access PostgreSQL via ODBC. In order to have PostgreSQL native access support we installed package 'php-pgsql-4.0.1pl2-9.i386.rpm'. Is there some similar RPM package to enable ODBC access in PHP4.0.1pl2? If not, how should I procceed? TIA, Paulo
I have a mysql database of events. It contains the following fields: - EventID - EventName - EventDescription - EventStartDate - EventEndDate I would like to query the database for the next 5 events from the current date (today). Any ideas? Regards, Matthew Delmarter Web Developer
> I have a mysql database of events. It contains the following fields: > > - EventID > - EventName > - EventDescription > - EventStartDate > - EventEndDate > > I would like to query the database for the next 5 events from the current > date (today). Any ideas? works if EventStartDate is a timestamp (i think) $strselect = "SELECT EventName FROM table WHERE EventStartDate > UNIX_TIMESTAMP() LIMIT 5"; if EventStartDate is not a timestamp what is it then? hope it helps -- Henrik Hansen
This is just a guess but wanted to take a shot at it. Something like SELECT EventID, EventName, EventDescription, EventStartDate, EventEndDate WHERE EventStartDate > CURRENT_DATE ORDER BY EventStartDate ASC LIMIT 5; How did I do? Jeff Oien > I have a mysql database of events. It contains the following fields: > > - EventID > - EventName > - EventDescription > - EventStartDate > - EventEndDate > > I would like to query the database for the next 5 events from the current > date (today). Any ideas? > > Regards, > > Matthew Delmarter > Web Developer
Addressed to: <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from <[EMAIL PROTECTED]> Mon, 5 Mar 2001 14:10:28 -0600 > > This is just a guess but wanted to take a shot at it. > > Something like > > SELECT EventID, EventName, EventDescription, > EventStartDate, EventEndDate > WHERE EventStartDate > CURRENT_DATE > ORDER BY EventStartDate ASC > LIMIT 5; > > How did I do? Close, very close. I belive CURRENT_DATE is a MySQL function. MySQL functions are identified by not having a space between the function name and the required ( that makes it a function. If CURRENT_DATE is actually a function (I use NOW() because it is shorter) then you need to change the WHERE clause to: WHERE EventStartDate > CURRENT_DATE() If CURRENT_DATE() is not a valid function change it to: WHERE EventStartDate > NOW() Both assume that EventStartDate is a MySQL DATE, DATETIME or TIMESTAMP value. If they are something else, this will not work. It should be one of these types though!!! Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
I have a set of pages I've been working on to do address entry for registered users to a MySQL database. I'm running up against a wall that I've been fighting for two days... process is thus: checks session vars to see if user is logged in. if not, present login screen. if logged in: see if this is a submitted form, or a blank request for one. if blank request, present the HTML form. if submitted: check the incoming data to determine if the address type (home, work or other) is set. if not, give error. if set, checks to see if that type was already in the database for that user, and checks to see if this address was flagged as the mailing address. if either case, give error and exit. past all that? The the script SHOULD run the mysql_query and insert the submitted data to the database. if successful, should return one of two options: either go to the site main index page, or reload a blank address form if the user wants to enter an additional address. My problem is coming in AFTER the type and mailing checks, and before the mysql_query. I can't find any problems with the script; everything looks right to me. However: if I fill out the form and leave out the type field, I get the correct error. if I mark a type that exists in the database already, or that type already has a mailing flag set, I get the correct error. if I fill out the form correctly, and hit either button, I get a Netscape error "Document Contains No Data". What in tarnation is going on? Can someone help me please? Robert Cooper AwakeningRetreat.Net Webmaster ----- Attached script below address.php ----- <? require("backend.php"); session_start(); session_register("refer"); $refer = "/register/address.php"; if (!$seslog) { header("Location: /register/login.php"); exit; } else { $username = $sesusername; $id = $sesid; if (isset($street)) { if (!$type) { include("header.html"); echo "<P><CENTER><FONT SIZE=+2>Must Specify address type.</FONT><BR> <FONT SIZE=+1>Click the back arrow on your browser, select a type, and resubmit.<P> <a href=\"http://www.awakeningretreat.net/\">Continue without entering address information.</FONT></CENTER>"; include("footer.html"); exit; } else { mysql_connect("localhost","www","") or die("Unable to connect to SQL server"); mysql_select_db("awakening") or die("Unable to select database"); $query = mysql_query("select type, mailing from address where id='$id'"); $result = mysql_num_rows($query); if ($result > 0 ) { while ($row = mysql_fetch_array($query)) { if ($row[type] == $type) echo "$type address already exists in database. <a href=\"/register/address.php\"> Back to address entry.</a><P>"; if ($row[mailing] == $mailing) echo "You have already defined $row[type] as mailing address. <a href=\"/register/address.php\"> Back to address entry.</a><P>"; } exit; } else { $result = mysql_query("INSERT INTO address VALUES ('$id', '$street', '$city', '$state', '$ZIP', '$type', '$mailing')"); if (!$result) { echo "Unknown database error in address.<BR> Please contact the <a href=\"mailto:[EMAIL PROTECTED]\">Webmaster</a> with this information."; exit; } else { include("header.html"); echo "<P>Finished updating addresses."; include("footer.html"); switch ($action) { case "Finish" : header("Location: http://www.awakeningretreat.net/"); break; case "Add Another" : header("Location: /register/address.php"); break; } } } } } else { include("header.html"); echo " <CENTER> <FONT SIZE=+2>Address Information</FONT> <P> <FORM ACTION=\"address.php\" METHOD=\"POST\"> <table border=0 cellspacing=0 cellpadding=0> <TR><td align=right>Street : </td><td><input type=text name=street></td></tr> <TR><td align=right>City : </td><td><input type=text name=city></td></tr> <TR><td align=right>State : </td><td><input type=text name=state SIZE=2></td></tr> <TR><td align=right>ZIP : </td><td><input type=text name=ZIP SIZE=10></td></tr> <TR><td align=right>Address Type : </TD><TD><input type=radio name=type value=home>HOME <input type=radio name=type value=work>WORK<input type=radio name=type value=other>OTHER </SELECT></TD></TR> <TR><td> </TD><TD><input type=checkbox name=mailing value=\"Y\"> This is my Mailing Address</TD></TR> <TR><td align=right>Submit and:</td><td><input type=submit value=\"Finish\" name=\"action\"> <input type=submit value=\"Add Another\" name=\"action\"></td></tr> <TR><TD COLSPAN=2 ALIGN=CENTER><a href=\"http://www.awakeningretreat.net/\">OR: continue without entering address information.</TD></TR> </table> </CENTER> NOTES: <a href=\"/privacy.php\">Privacy Policy</a><BR> All fields on this page are optional. However, answering them will help other Awakeners find you!<BR> <P> </form> "; include("footer.html"); } } ?>
this is caused by netscape receiving no data. ie. <?php exit(); ?> will product no data, because nothing is echo'd. netscape hates this, and will display a warning. the other reason could be there is something wrong with a funky function your using. ie. if pdflib isnt compiled properly with TTF then when you try to use a TTF php will cause apache to seg fault, because of this apache doesnt send your client any data. netscape hates this too. tail your error_logs see what is coming up, any seg faults? this could be it. try adding a few echo statments see what comes up. -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] "Robert Cooper" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a set of pages I've been working on to do address entry for registered users to a MySQL database. I'm running up against a wall that I've been fighting for two days... process is thus: checks session vars to see if user is logged in. if not, present login screen. if logged in: see if this is a submitted form, or a blank request for one. if blank request, present the HTML form. if submitted: check the incoming data to determine if the address type (home, work or other) is set. if not, give error. if set, checks to see if that type was already in the database for that user, and checks to see if this address was flagged as the mailing address. if either case, give error and exit. past all that? The the script SHOULD run the mysql_query and insert the submitted data to the database. if successful, should return one of two options: either go to the site main index page, or reload a blank address form if the user wants to enter an additional address. My problem is coming in AFTER the type and mailing checks, and before the mysql_query. I can't find any problems with the script; everything looks right to me. However: if I fill out the form and leave out the type field, I get the correct error. if I mark a type that exists in the database already, or that type already has a mailing flag set, I get the correct error. if I fill out the form correctly, and hit either button, I get a Netscape error "Document Contains No Data". What in tarnation is going on? Can someone help me please? Robert Cooper AwakeningRetreat.Net Webmaster ----- Attached script below address.php ----- <? require("backend.php"); session_start(); session_register("refer"); $refer = "/register/address.php"; if (!$seslog) { header("Location: /register/login.php"); exit; } else { $username = $sesusername; $id = $sesid; if (isset($street)) { if (!$type) { include("header.html"); echo "<P><CENTER><FONT SIZE=+2>Must Specify address type.</FONT><BR> <FONT SIZE=+1>Click the back arrow on your browser, select a type, and resubmit.<P> <a href=\"http://www.awakeningretreat.net/\">Continue without entering address information.</FONT></CENTER>"; include("footer.html"); exit; } else { mysql_connect("localhost","www","") or die("Unable to connect to SQL server"); mysql_select_db("awakening") or die("Unable to select database"); $query = mysql_query("select type, mailing from address where id='$id'"); $result = mysql_num_rows($query); if ($result > 0 ) { while ($row = mysql_fetch_array($query)) { if ($row[type] == $type) echo "$type address already exists in database. <a href=\"/register/address.php\"> Back to address entry.</a><P>"; if ($row[mailing] == $mailing) echo "You have already defined $row[type] as mailing address. <a href=\"/register/address.php\"> Back to address entry.</a><P>"; } exit; } else { $result = mysql_query("INSERT INTO address VALUES ('$id', '$street', '$city', '$state', '$ZIP', '$type', '$mailing')"); if (!$result) { echo "Unknown database error in address.<BR> Please contact the <a href=\"mailto:[EMAIL PROTECTED]\">Webmaster</a> with this information."; exit; } else { include("header.html"); echo "<P>Finished updating addresses."; include("footer.html"); switch ($action) { case "Finish" : header("Location: http://www.awakeningretreat.net/"); break; case "Add Another" : header("Location: /register/address.php"); break; } } } } } else { include("header.html"); echo " <CENTER> <FONT SIZE=+2>Address Information</FONT> <P> <FORM ACTION=\"address.php\" METHOD=\"POST\"> <table border=0 cellspacing=0 cellpadding=0> <TR><td align=right>Street : </td><td><input type=text name=street></td></tr> <TR><td align=right>City : </td><td><input type=text name=city></td></tr> <TR><td align=right>State : </td><td><input type=text name=state SIZE=2></td></tr> <TR><td align=right>ZIP : </td><td><input type=text name=ZIP SIZE=10></td></tr> <TR><td align=right>Address Type : </TD><TD><input type=radio name=type value=home>HOME <input type=radio name=type value=work>WORK<input type=radio name=type value=other>OTHER </SELECT></TD></TR> <TR><td> </TD><TD><input type=checkbox name=mailing value=\"Y\"> This is my Mailing Address</TD></TR> <TR><td align=right>Submit and:</td><td><input type=submit value=\"Finish\" name=\"action\"> <input type=submit value=\"Add Another\" name=\"action\"></td></tr> <TR><TD COLSPAN=2 ALIGN=CENTER><a href=\"http://www.awakeningretreat.net/\">OR: continue without entering address information.</TD></TR> </table> </CENTER> NOTES: <a href=\"/privacy.php\">Privacy Policy</a><BR> All fields on this page are optional. However, answering them will help other Awakeners find you!<BR> <P> </form> "; include("footer.html"); } } ?> -- 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]
How bout an Apache redirect for .inc files to go to denied.htm or something? PHP scripts could get to them, but they wouldn't be accessible via http. At 08:01 PM 3/3/01 +0100, [EMAIL PROTECTED] wrote: >Hi! > >as I wrote in my mail: >1. >I won't name them ".inc" but ".inc.php" (so *I* know, it's an include file) >2. >I don't even want them to be executable!!! > >and therefore my question was, if this (on top of every include-file) would >be safe enough: >>> if (substr($SCRIPT_URL,-8)==".inc.php") exit; >$PHP_SELF better than $SCRIPT_URL in line above??? > >thanks >michi > >> Include files do not have to end with '.inc', which is purely a convention >> of dubious value. If you use '.php' as the extension for included files, >> they will have to be parsed by PHP and can't be read as plain text from >> outside. >> >> > Hi! >> > >> > I want my include-files not be seen from outside AND not be executed!!! >> > I don't have access to a directory outside DOCUMENT_ROOT and I don't >> have >> > .htaccess!!! >> > >> > I think about something like: >> > 1. >> > name: <file>.inc.php >> > 2. >> > add code: >> > if ($PHP_SELF==MY_NAME) exit; >> > as first line in the inluded script. >> > so, if the script is being included from another script, the code will >> be >> > executed - but if the file will be called directly, no code is executed! >> > BUT - how do I get the include-file's name? >> > >> > or is it safe enough, to use something like >> > if (substr($SCRIPT_URL,-8)==".inc.php") exit; > >-- >Sent through GMX FreeMail - http://www.gmx.net > >-- >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] > >
Hi! As I wrote before, I don't have .htaccess nor access to the apache-conf!!! michi > How bout an Apache redirect for .inc files to go to denied.htm or > something? PHP scripts could get to them, but they wouldn't be accessible > via http. > > > > At 08:01 PM 3/3/01 +0100, [EMAIL PROTECTED] wrote: > >Hi! > > > >as I wrote in my mail: > >1. > >I won't name them ".inc" but ".inc.php" (so *I* know, it's an include > file) > >2. > >I don't even want them to be executable!!! > > > >and therefore my question was, if this (on top of every include-file) > would > >be safe enough: > >>> if (substr($SCRIPT_URL,-8)==".inc.php") exit; > >$PHP_SELF better than $SCRIPT_URL in line above??? > > > >thanks > >michi > > > >> Include files do not have to end with '.inc', which is purely a > convention > >> of dubious value. If you use '.php' as the extension for included > files, > >> they will have to be parsed by PHP and can't be read as plain text from > >> outside. > >> > >> > Hi! > >> > > >> > I want my include-files not be seen from outside AND not be > executed!!! > >> > I don't have access to a directory outside DOCUMENT_ROOT and I don't > >> have > >> > .htaccess!!! > >> > > >> > I think about something like: > >> > 1. > >> > name: <file>.inc.php > >> > 2. > >> > add code: > >> > if ($PHP_SELF==MY_NAME) exit; > >> > as first line in the inluded script. > >> > so, if the script is being included from another script, the code > will > >> be > >> > executed - but if the file will be called directly, no code is > executed! > >> > BUT - how do I get the include-file's name? > >> > > >> > or is it safe enough, to use something like > >> > if (substr($SCRIPT_URL,-8)==".inc.php") exit; -- Sent through GMX FreeMail - http://www.gmx.net
Hello, Is there an easy way to check and see if a number is odd or even? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
> Is there an easy way to check and see if a number is odd or even? if( $num % 2 ) { echo "Odd"; } else { echo "Even"; } Chris
You could divide it by 2, odd numbers will always have a remainder even umbers never will. here are math functions, but none for odd/even that i see. Jon ----- Original Message ----- From: "Brandon Orther" <[EMAIL PROTECTED]> To: "PHP User Group" <[EMAIL PROTECTED]> Sent: Monday, March 05, 2001 3:17 PM Subject: [PHP] Is it odd or even??? > Hello, > > Is there an easy way to check and see if a number is odd or even? > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > -------------------------------------------- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
use the modulus operator: ($number % 2) returns 0 if the value is even Larry Jeannette MIS Director, e.Republic -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Monday, March 05, 2001 12:18 PM To: PHP User Group Subject: [PHP] Is it odd or even??? Hello, Is there an easy way to check and see if a number is odd or even? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
> That won't work. % returns the remainder from a division of > the number divided by the mod number. Yours: > if($num %2 == 0){ > echo "even"; > }else{ > echo "odd"; > } Mine: > > if( $num % 2 ) { > > echo "Odd"; > > > > } else { > > echo "Even"; > > > > } Ours are identical, just the other way around. This: if( $num % 2 ) { means if the result of that operation is anything other than 0 (zero), which is a truth in PHP. Chris
Use the modulus operator.... > -----Original Message----- > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: Monday, March 05, 2001 3:18 PM > To: PHP User Group > Subject: [PHP] Is it odd or even??? > > > Hello, > > Is there an easy way to check and see if a number is odd or even? > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > -------------------------------------------- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
Color me confused because I though true was any non zero value and false was zero. I know I am using the following code: if (!($num % 4){ do something} and it does something when $num is evenly divisible by 4 (ie. $num % 4 = 0). If I were testing for odd vs even I'd do the following: if (!($num % 2) { Odd } else { Even } John Guynn This email brought to you by RFCs 821 and 1225. -----Original Message----- From: Boget, Chris [mailto:[EMAIL PROTECTED]] Sent: Monday, March 05, 2001 2:33 PM To: 'Kenneth R Zink II'; Php (E-mail) Subject: RE: [PHP] Is it odd or even??? > That won't work. % returns the remainder from a division of > the number divided by the mod number. Yours: > if($num %2 == 0){ > echo "even"; > }else{ > echo "odd"; > } Mine: > > if( $num % 2 ) { > > echo "Odd"; > > > > } else { > > echo "Even"; > > > > }
> Color me confused because I though true was any non zero > value and false was zero. Right. And if( $num % 2 ) { echo "it's odd"; } means that the operation returned a remainder - a non zero value. > I know I am using the following code: > if (!($num % 4){ do something} > and it does something when $num is evenly divisible by 4 (ie. > $num % 4 = 0). > If I were testing for odd vs even I'd do the following: > if (!($num % 2) { > Odd And this is: If( NOT ZERO ) { Odd } which is the same as: if( $num % 2 ) { If there is a remainder, it's not zero. Chris
You all are a bunch of un-optimizing novices. Just do some bit banging. i.e. if(1 & number){ echo "$number is odd"; }else{ echo "$number is even"; } -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Monday, March 05, 2001 12:18 PM To: PHP User Group Subject: [PHP] Is it odd or even??? Hello, Is there an easy way to check and see if a number is odd or even? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
Clever. For those of us unfamiliar with bitwise ops, here's how this works: The bitwise and op (&) works on bits like this: dig1 dig2 Result 0 0 0 0 1 0 1 0 0 1 1 1 An even number's binary representation always ends with 0 (ie 12 = 1100) while an odd ends with 1 (ie 13 = 1101). So doing a bitwise & with 1 will only produce 1 if the last binary digit is 1 (ie an odd num), otherwise 0 (see table). And, like Nathan implies, this will be very fast (way faster than modulus), since you only ever deal with 2 bits of info. For an explanation of other bitwise operators, look here: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/bitwise.html J on 3/5/01 12:36 PM, Nathan Cassano at [EMAIL PROTECTED] wrote: > > You all are a bunch of un-optimizing novices. Just do some bit banging. > > i.e. > > if(1 & number){ > echo "$number is odd"; > }else{ > echo "$number is even"; > } > > > -----Original Message----- > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: Monday, March 05, 2001 12:18 PM > To: PHP User Group > Subject: [PHP] Is it odd or even??? > > > Hello, > > Is there an easy way to check and see if a number is odd or even? > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > -------------------------------------------- >
We've just moved to a new server and I'm running into an odd problem. The code is below. On my old server it correctly returns: [test] t 116 e 101 s 115 t 116 But on my new server I get: [ test] 13 10 t 116 e 101 s 115 t 116 Has anyone else run into this? <?php echo "[$action] <BR> "; while ($action){ $c = substr($action,0,1); $action = substr($action,1); echo "$c " . ord($c) . "<BR>"; } ?> <FORM ENCTYPE='multipart/form-data' ACTION='z.html' METHOD='POST'> <input type="hidden" name="action" value="test"> <INPUT TYPE='submit' VALUE='Process'></FORM> __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
<form method=post action='$PHP_SELF'> <input type=submit </form> even the simplest forms product a 0x013 0x10 imediatly after the <form> I wish there was a way to control this behaviour. I thought it was normal, and anoying. -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] "Jeff Schwartz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... We've just moved to a new server and I'm running into an odd problem. The code is below. On my old server it correctly returns: [test] t 116 e 101 s 115 t 116 But on my new server I get: [ test] 13 10 t 116 e 101 s 115 t 116 Has anyone else run into this? <?php echo "[$action] <BR> "; while ($action){ $c = substr($action,0,1); $action = substr($action,1); echo "$c " . ord($c) . "<BR>"; } ?> <FORM ENCTYPE='multipart/form-data' ACTION='z.html' METHOD='POST'> <input type="hidden" name="action" value="test"> <INPUT TYPE='submit' VALUE='Process'></FORM> __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]