php-general Digest 28 Oct 2001 11:52:35 -0000 Issue 961
Topics (messages 72595 through 72619): Re: I'm not <username>, log me out.... 72595 by: Matthew Loff Re: FTP or Telnet files/directories with PHP? 72596 by: CC Zona Re: Replace text 72597 by: DL Neil Re: command line option f -- how do i get the name of the file? 72598 by: DL Neil Q: System user and password 72599 by: taipan.shofiah.kusza.edu.my array_search() 72600 by: Ashley M. Kirchner Re: help needed for multimania.com 72601 by: Andrew Brampton Re: include-ing results in variable? 72602 by: Nathaniel Merriam Multi-dimensional nested arrays in Smarty 72603 by: Chad Guilette Re: how to recognize local or server execution? 72604 by: John A. Grant Problem redirecting 72605 by: Don 72606 by: Justin Garrett 72616 by: Nikola Karoviæ some.php/value -> on win32 72607 by: c Re: problems with sessions (not working) 72608 by: Yasuo Ohgaki phpmyadmin is installed, now how to access it? 72609 by: Chip 72610 by: Jason Brooke Re: Still Learning 72611 by: jtjohnston 72617 by: Christian Reiniger 72618 by: speedboy 72619 by: Nikola Karoviæ Toronto PHP user group active. 72612 by: Dariush Toronto php users group meeting. 72613 by: Dariush Re: Arrays 72614 by: Christian Reiniger Re: Include Precompiled C binaries 72615 by: Christian Reiniger 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] ----------------------------------------------------------------------
I found sessions to be kind of fussy to get working, perhaps that's just because I didn't have any experience with them until the last site I did... A simple call to session_unset() won't erase the session, but should clear whatever username/passkey (I say passkey, assuming/hoping it's encrypted) is stored in the session. -----Original Message----- From: Andy Lewis [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 27, 2001 9:45 AM To: [EMAIL PROTECTED] Subject: [PHP] I'm not <username>, log me out.... Hello All, I'm trying to use php sessions to logout a user that may be sharing a computer with another user. In other words. I don't want user1 to access my site and then user2 be able to access user1's account with an auto login because the session was saved. I've seen a few sites that have a URL or button that a user can click on such as: "I'm not Joe Smith, please log me out." This is what I am trying to accomplish. Can someone point me in the right direction? I have sessions implemented using username and password but, on my login page since those vars are saved in the session the user automatically gets logged in. I also would like to have a checkbox on the login page that, if checked, doesn't cache the username and password. So if they logout they must enter a username and password, instead of getting automatically logged in. Any help will be highly appreciated. Andy -- 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] (Jeff Gannaway) wrote: > Can PHP run some FTP or TELNET commands? <http://php.net/ftp> <http://php.net/fsockopen> -- CC
> Hello guys > > function replace_text_smiley(){ > > global $comment; > // To add a relation between a text smiley a an image smiley do this: > // $faces["text smiley here"] = "img tag to image smile here"; > > $faces[":)"] = "<IMG SRC=\"emoticons/smile.gif\">"; > $faces[":P"] = "<IMG SRC=\"emoticons/tongue.gif\">"; > $faces[":D"] = "<IMG SRC=\"emoticons/happy.gif\">"; > $faces[":("] = "<IMG SRC=\"emoticons/mad.gif\">"; > $faces[";)"] = "<IMG SRC=\"emoticons/wink.gif\">"; > > while(list($text,$image) = each($faces)) > { > $comment = str_replace("$text","$image","$comment"); > } > > return $comment; > } > > this function replaces faces to smilies images > > then in a separete file i use this function and another one to replace urls... the >url replacement is ok but it doesn't change the text to smilies.. > > any guesses?? :) =do you really want those quotation marks in the str_replace function call? =dn
> I am writing a script using php's command line ability and I am lost on > how to work with a file when I don't kow what the file's name is. > > Example: > script.php -f <file> > > In my script, how do I reference the file when I have no idea what it's > name is going to be? > > The scrip will get called by another application: the other application > will pipe a file to my scrip and then the scrip has to work with the > file and output an altered file with a new filename. I have no idea what > the name of the file is going to be beforehand. lucas Take a look at environment variables (etc). =dn
Hi! I plan to build a web page which will use my system user. So what function should I use to check the system password. FYI I'm using Linux RedHat. Thanks in advance. -TaiPan
I'm trying to figure out how am I supposed to write this snippet properly: if (($index = array_search($search, array_keys($pages))) !== false) { echo "index: $index\n"; } else { echo "Not found\n"; } When I search for something that I know exists, it returns the $index just fine. However, when I search for something that does not exist, it never tells me 'Not found', instead it just displays a blank index (it looks like $index = "", not false). Should I be checking it against 'false', or against "" ? Using PHP 4.0.7-dev. -- W | I haven't lost my mind; it's backed up on tape somewhere. +-------------------------------------------------------------------- Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6 http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
http://babelfish.altavista.com That URL may help you translate the page... Andrew ----- Original Message ----- From: "Kamran H. Hassan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, October 27, 2001 7:22 PM Subject: [PHP] help needed for multimania.com Hi, Thanks for the info. about free web hosting www.multimania.com , i will be greateful if any one help in the steps of config. mysql and php on this web hosting, the problem is that site is in non-english language (i think its in french which i dont understand). if any one let me know briefly the steps to upload my website on that web hosting provider i will be very much greateful. i registered a web space at http://khamid.multimania.com hoping for reply and thanks in advance. Kamran H. Hassan _____________________________________________ U wrote | www.multimania.com (php + mysql) | | If you find better ones, please let me know :o) | | See you |
Thanks for your help, I've got it working now (I think!). You're right, I had an echo at the bottom of the included script and I think was loathe to mess with it since I spent about 12 hours getting that one to work! I had read the man page for include -- even the example with the return! -- about a hundred times today, but it just didn't make sense in my head even though I suspected it was related to my problem. This is my first foray into any kind of programming since I played with Turbo Pascal about 10 years ago, so I'm fumbling around a bit :) thanks again, nathaniel > > What's in "banner.inc"? Because, as noted in the manual, an included file > can have a return value *if you give it one*. If you have code there > that's echoing/printing, that will indeed spit out immediately. The trick > is to instead capture that output into a variable and return it. >
I've asked a few questions before on Smarty here and I've worked through them but this one really has me. I checked the Smarty lists for answers and couldn't find a clear answer. Here is my problem. i want to do something to this effect {section name=loop_index loop=$DATA_ARRAY} {$DATA_ARRAY[loop_index].somevalue} {section name=loop_index2 loop=$INNER_ARRAY[loop_index]} {$INNER_ARRAY[loop_index][loop_index2].SOMEVALUE} {/section} {/section} I basically have an associative array $DATA_ARRAY and I want a second two dimensional array where the first array index is the subscript of the first so I basically iterate through the second array within a specific row. but for the life of me I can't get this properly. how would I set this up properly during assignment and output? I believe the above is right for output but what about assignment? $templ_var->append("INNER_ARRAY", ?????); I've tried a lot of things but none seem to work... If anyone of you have any insight it would be greatly appreciated. [EMAIL PROTECTED]
"Dl Neil" <[EMAIL PROTECTED]> wrote in message 0a4e01c15e72$c47db560$a516100a@jrbrown">news:0a4e01c15e72$c47db560$a516100a@jrbrown... > Thanks for the idea. I have just resurrected and had another play with my 'testbench.php', running it from both > IE/Apache and in a DOS box. > > It includes the following code: [...] Thanks (also thanks to the others for the useful comments & ideas). I don't have $HTTP_SERVER_VARS["SERVER_NAME"] or $GLOBALS["SERVER_ADDR"] or $SERVER_SOFTWARE probably because my server is netscape ("nsapi"?). They are all blank. Yes I declared them 'global'. I ended up with these functions which seem to do the trick, at least for my server and NT. function isonserver() { global $PHP_SELF,$argc; return $argc==0 && isset($PHP_SELF) && $PHP_SELF; } function getpagename() { global $PHP_SELF,$argv; return basename(isonserver() ? $PHP_SELF : $argv[0]); } function getlinedelimiter() { return isonserver() ? "\n" : "\r\n"; } The pagename is critical to my site, because the code needs the page name to recognize certain suffixes and 'special page names. Perhaps it is only sufficient to test for $PHP_SELF and not $argc, but I threw in $argc==0 anyway. -- John A. Grant * I speak only for myself * (remove 'z' to reply) Radiation Geophysics, Geological Survey of Canada, Ottawa If you followup, please do NOT e-mail me a copy: I will read it here
Hi, I have a form which when submitted, calls an html page which contains PHP code. Within that code, I wish to redirect my users to another page under certain conditions. So, in my code, I have the following lines: Header( "Location:http://www.mydomain.com/mypage.html"); exit; However, when the above is run, I get the following error generated: Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/vhosts/mydomain.com/htdocs/mypage.html:7) in ../phpscript/general/formmail.php on line 100 Does anyone know what this error means? hanks, Don
>From the manual: Remember that the header() function must be called before any actual output is sent, either by normal HTML tags blank lines in a file, or from PHP. This is the cause of your error. Something is sending output before your call to header(); -- Justin Garrett "Don" <[EMAIL PROTECTED]> wrote in message 000c01c15f67$1a06ad80$[EMAIL PROTECTED]">news:000c01c15f67$1a06ad80$[EMAIL PROTECTED]... Hi, I have a form which when submitted, calls an html page which contains PHP code. Within that code, I wish to redirect my users to another page under certain conditions. So, in my code, I have the following lines: Header( "Location:http://www.mydomain.com/mypage.html"); exit; However, when the above is run, I get the following error generated: Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/vhosts/mydomain.com/htdocs/mypage.html:7) in ../phpscript/general/formmail.php on line 100 Does anyone know what this error means? hanks, Don
You have to put Header( "Location:http://www.mydomain.com/mypage.html"); on top of your php code ----- Original Message ----- From: Justin Garrett <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 28. listopad 2001 07:00 Subject: [PHP] Re: Problem redirecting > From the manual: > > Remember that the header() function must be called before any actual output > is sent, either by normal HTML tags blank lines in a file, or from PHP. > > This is the cause of your error. Something is sending output before your > call to header(); > > -- > Justin Garrett > > "Don" <[EMAIL PROTECTED]> wrote in message > 000c01c15f67$1a06ad80$[EMAIL PROTECTED]">news:000c01c15f67$1a06ad80$[EMAIL PROTECTED]... > Hi, > > I have a form which when submitted, calls an html page which contains PHP > code. Within that code, I wish to redirect my users to another page under > certain conditions. So, in my code, I have the following lines: > > Header( "Location:http://www.mydomain.com/mypage.html"); > exit; > > However, when the above is run, I get the following error generated: > > Warning: Cannot add header information - headers already sent by (output > started at /usr/local/www/vhosts/mydomain.com/htdocs/mypage.html:7) in > ../phpscript/general/formmail.php on line 100 > > Does anyone know what this error means? > > hanks, > Don > > > > > > > -- > 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 can make an URL like www.some.com/index.php/value1/value2/ on Linux+Apache but I can't do it on my win2k+apache 1.3.22 machine. Why? How could I do it? (I want to get "values" with explode ('/',$PATH_INFO) ) Thanx a lot! c
Christian Dechery wrote: > I have a file called miec.php that does quite a lot of processing and > then include()s user_track.inc.php... Where did you register the session variable? If you are registering local variable as session variable, it may not work... I suggest to use $HTTP_SESSION_VARS, if it is possible... -- Yasuo Ohgaki > > miec.php: > -------- > <? > a lot of db processing .... (NO OUTPUT whatsoever) > include("user_track.inc.php"); > UserTrack($products); > the output starts here... > ?> > > user_track.inc.php: > ------------------ > <? > session_start(); > > function UserTrack($products) > { > global $prod_views; > > if( !session_is_registered("prod_views") ) > { > fill the $prod_views array, serialize it... > session_register("prod_views"); > // I've tested the code above... and session_register > returns TRUE and I saw the session file... > } > else > { > do other stuff with the prod_views array > } > } > ?> > > the problem is.... why does it NEVER go into the 'else'... it seems that > the session is registered... but as soon as I refresh the page the > session is lost... > > why? > > > > _____________________________ > . Christian Dechery > . . Gaita-L Owner / Web Developer > . . http://www.webstyle.com.br > . . http://www.tanamesa.com.br >
I just installed the FreeBSD port for PHPMyAdmin and was reading the docs on the php wizard site but cannot figure out how to actually access the interface. Is it through a particular port like webmin? Can some clue me in please? -- Chip W.
In your web browser like you would any other web interface on your machine jason ----- Original Message ----- From: "Chip" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, October 28, 2001 4:39 PM Subject: [PHP] phpmyadmin is installed, now how to access it? > I just installed the FreeBSD port for PHPMyAdmin and was reading the docs on > the php wizard site but cannot figure out how to actually access the > interface. Is it through a particular port like webmin? Can some clue me in > please? > -- > Chip W. > > -- > 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] > >
Still learning! But need syntax help. This works: $myconnection = mysql_pconnect($host,"MyAccount","MyPassword"); ... $news = mysql_query("SHOW TABLE STATUS FROM MyAccount LIKE 'MyTable'"); ... This does not: $MyAccount = "MyAccount"; $MyTable = "MyTable"; $MyPassword = "MyPassword"; $myconnection = mysql_pconnect($host,"$MyTable","$MyPassword"); ... $news = mysql_query("SHOW TABLE STATUS FROM MyAccount LIKE 'MyTable'"); ... So? ... How do I use $MyAccount, $MyTable & $MyPassword correctly? ... I'm creating a function.inc ... An email post & reply would help ... (help me get to bed faster tonight :) ) John
On Sunday 28 October 2001 07:18, jtjohnston wrote: > Still learning! But need syntax help. This works: > mysql_pconnect($host,"MyAccount","MyPassword"); > ... > This does not: > mysql_pconnect($host,"$MyTable","$MyPassword"); Notice something? :) -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) CPU not found. retry, abort, ignore?
> > Still learning! But need syntax help. This works: > > Notice something? :) Yep, you forgot to paste the error message into the email.
"$host" :) ----- Original Message ----- From: Christian Reiniger <[EMAIL PROTECTED]> To: jtjohnston <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: 28. listopad 2001 11:15 Subject: Re: [PHP] HELP: Still Learning On Sunday 28 October 2001 07:18, jtjohnston wrote: > Still learning! But need syntax help. This works: > mysql_pconnect($host,"MyAccount","MyPassword"); > ... > This does not: > mysql_pconnect($host,"$MyTable","$MyPassword"); Notice something? :) -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) CPU not found. retry, abort, ignore? -- 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]
Toronto PHP user group active. Welcoming all php developers with questions and answers. If we get enough people we will be setting up meetings but again based on how many people we can have. www.realsoftstudio.com [EMAIL PROTECTED]
www.realsoftstudio.com ... News Release ... PHP User Group Meeting Monday, Oct.29 at 7pm-10pm PHP SPINAL INJECTION TUTORIAL ----------------------------- When : Monday, Oct.29 at 7pm-10pm Where : Velocet Communications Inc. 210 Dundas street East (At University) suite 8000 (8th floor) Toronto ** If anybody has a 1024x768 capable SVGA projector they could possibly bring to this, please email me: [EMAIL PROTECTED] ** Cost : $1,000,000 per person (If you can't afford to pay that, we will let you in for free) Audience : HTML designers who want to get into writing dynamic web apps, weekend web warriors and experienced web developers who want to understand how PHP fits into the picture. Abstract : PHP is a popular scripting language designed specifically for creating web-based applications. The first half of this fast-paced tutorial, will quickly run through the basic characteristics and then move on to demonstrate how to use PHP to create images, pdf's and flash on the fly. In the second half things will get more complex with topics such as SQL, LDAP, XML, XSL/XSLT plus a peek into the internals of PHP's extension API if there is time. Attendees should have a basic understanding of HTML and the basic HTTP client/server model. For the latter topics a bit of advanced programming experience would be helpful but certainly not required. www.realsoftstudio.com begin 666 newslogo.gif M1TE&.#EA+@`F`-4``)EFF<R9S/_,_]RYW#,S9F9FF9F9S,S,_P`S,V:9F9G, MS,S___7__V:99IG,F<S_S&9F,YF99LS,F?__S-S<N?__]68S,YEF9LR9F?_, MS-RYN?_U]?____7U]<S,S+FYN9F9F69F9C,S,P```/___P`````````````` M```````````````````````````````````````````````````````````` M`````````````````````````````````"'Y! $``"0`+ `````N`"8```;_ M0))P2.(8CTA.Y9A).I'$:)3RJ5H[V.5 `NHZ,%^/V D:2Z-8SECMZ58[XKA< M#,* N'/C>?AA=^> @8!E<7I[?4<>(2 <A!Y/;'1_?VV$''L:CYHB(VTA'B(B M(2$8BV-K@W4-(*92#(]&;:%M'")E( NBH!X$$:RL<B )( !=95(;FFIE(XL9 M"!8A1B&V(Z4<U&URBQ>K=QY2<$<@(AP7(PX>G6,@S:&,H"/PGJP%%ZU1'PN) MC L7!^1&25/':AVC;'06"4R X1(1#IF,.2I4J!$=-0H_)11HRN$0#GTR!*LD M4:*<6*?$*/SUZ&&'#VWV(5$4R)C B1,\<2SCL0@%_SIV-&VD%\L1JT4@#NB\ MV;,(S%AJV' 0J:G+2D)-*DE8VO$AR#G[&CZ@"$N,`2YE%I15-*H73Y<=EGG M@,&#@DB1Q-1%N4!D5+8W6W[L(V?!`A 9E)(5J6 DQ:.BWC[\0/51A@R,<MK% MH( S':$U=S*:#"=0I,HD@Z8L2@VI8"$@\QK!E6%46I$\Q2@P!JBUJ=<<L% " M[2"C,&!"Z]+9JG+4A=T3)D_@+7=4G*.V;Y$$8>#Z0CL]JR@6(R"=AVBNYZK4 MQID0;]&O7\X9V[M,=NT*(@"P71?[)VE$2-!='(FYEU)"O&ECTE+&]'0+" &8 M-Y$@G\VUH'\2?.)@([95:+M4A6)<((A5]QDBA$8><!& !(V5P=QU[H'@P'"W M4',/,$T1TMV#E02@2!=HV6> '1<N)&)3)+019!<76"61`27Y4A):OEV0`))% M2%! "%*R,LPB71[E9$DUVK*(B5Y5@E077=K3`$>^E>1!! 1 L,B56!812P`) MP'F31!%LR64!72HBRB@-Y0F;$3G9! *A?WY#)I2!*7K&3( $&H*@4[+5Q1Z@ :2@$)!],=924AMED:ZJJP>3"!4MBQ.D00`#L` ` end
On Friday 26 October 2001 10:17, Ashley M. Kirchner wrote: > I'd like to create an array of "available resources", and be able > to check it every time. What I'd like to do is something like; > > $site = array( "section1" => #, "section2" => #, etc.. ) > > where "section*" is a STRING variable and # is an INT (if it's > even possible to do that) > > Once I have this setup properly, I'm going to have a routine that > extracts data from PATH_INFO, namely '$section' and '$page' which > should then be checked against the array: > > - if $section exists in the array [...] http://www.php.net/manual/en/ref.array.php -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) Drink wet cement. Get stoned.
On Friday 26 October 2001 22:32, Daelic wrote: > I was debating perl Vs. PHP with a friend, and he came up with this: > > "Perl can include compiled C binaries without backprocessing them, > which is a pretty useful trick." Ask him what he means with "backprocessing" -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) CPU not found. retry, abort, ignore?