RE: Re[2]: [PHP] Re: PHP CSS
For compatibility among browsers, you might want to call a header('Content-type: text/css'); On top of the css-file-to-be. Wouter -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 2:03 AM To: [EMAIL PROTECTED] Subject: Re: Re[2]: [PHP] Re: PHP CSS On Wed, 8 Oct 2003 09:44:53 -0700, Raquel Rice raquel- [EMAIL PROTECTED] wrote: On Thu, 9 Oct 2003 02:00:20 +1000 Tom Rogers [EMAIL PROTECTED] wrote: You don't need to call your style sheets .css they can be just as easily called.php and even have a querystring attached like subsite.php?user=fred That way just use php as normal and return a style sheet just as you would a html page. Thank you! I think that is exactly what I needed! Hello Raquel.. Browse your site with the included php file that generates the css, and watch your web logs. If the browser is requesting that file with a response status of 200 everytime, I would strongly suggest you fix that. Curt. -- sig-less -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Returning a reference [pretty much SOLVED]
Thanks Curt. This solution works indeed. BUT, there's one but. Isn't there a way to not have to tell PHP that I want the return of $this-AddFoo() as a reference? In the actual code I want to worry as little as possible about specific things like this. Isn't it a little strange that you have to both let php know it's returning a reference as well as let it know that it's expecting a reference as return value? Wouter -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 5:13 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Returning a reference * Thus wrote Wouter van Vliet ([EMAIL PROTECTED]): Hi Folks, I've been using the passing arguments by reference thingie for a while now. But what I want to do know is something I'm used to using in perl, returning a reference. Situation is as follows. 19 20 function AddFoo() { Need to let php know this is returning a reference: function AddFoo() { 21 $Ref = $this-Foos[]; 22 $Ref = new Foo(); 23 return $Ref; I'm surprized this even works, its kind of confusing, i'd rather do something like: $foo = new Foo(); $this-Foos[] = $foo; return $foo; 26 27 $Bar = new Bar(); 28 $Foo = $Bar-AddFoo(); And then let php know you want this as a reference: $Foo = $Bar-AddFoo(); -- don't forghet the $ sign Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Changing users in php script
I don't have much experience in it myself but I've seen it working .. Where you should be looking is not really PHP but more the Apache suexec wrapper/module. You can then specify a user and group in your VirtualHost section. Wouter -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 3:09 AM To: [EMAIL PROTECTED] Subject: [PHP] Changing users in php script I know php runs under the same user/group as the webserver for web based applications, but is there a way to change to another user? All the recent talk about exec got me thinking that I could set something up to automatically create user mailboxes under qmail + vmailmgr. I normall do this via the command line by running 'vadduser' while I'm su'ed to the owner of the virtual host. So basically, to do this via php, I would need to su to the owner of the vhost inside of the script, run the command, and exit out of the su. Can this be done? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] date brain teaser
You'd probably be able to get the first Friday in a year with smth like: $Friday = strtotime(First Friday in 2003); And if you go for the count 7 days up method .. Pitfall could be forgetting to check if you're still in the year you started in. Hope I added something valueable ;) -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 3:18 AM To: 'J Morton'; Shew; [EMAIL PROTECTED] Subject: RE: [PHP] date brain teaser How about something similar, but look for the first Friday and then add seven days (or 604800 seconds) to get the date of the next Friday? -Original Message- From: J Morton [mailto:[EMAIL PROTECTED] Sent: Friday, 3 October 2003 11:20 AM To: Shew; [EMAIL PROTECTED] Subject: Re: [PHP] date brain teaser Sure -- ? $this_date = 1/1/2003; for($i=1; $i=365; $i++) { if (date(l, strtotime($this_date) == Friday)) { echo $this_date . br; } $this_date = date(n/j/Y,mktime(0,0,0,date(m, strtotime($this_date)),date(d, strtotime($this_date))+1,date(Y, strtotime($this_date; } ? Shew wrote: Hi, I'm trying to find a formula for displaying the date for every Friday of a given year, i.e. 2003 Jan 3, 2003 Jan 10, 2003 Jan 17, 2003 etc. Any ideas? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Information from NOD32 1.518 (20030925) __ This message was checked by NOD32 for Exchange e-mail monitor. http://www.nod32.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Output data repeatedly more than once
What I would advise is to capture the output of your reciept into a variable. Assuming that you've got some function calls, maybe even Database request mixed up with some print commands .. Or even some times where you escape out of php (?). Something like this ?php $RecieptID = GetRecieptID(); Print Your reciept number: .$RecieptID; $SomeVar = Functioncall(); Print --\n; // some garbage // Print You owe me: .getTotalValue(); ? And you don't want to run the script multiple times. Do like this: ?php ob_start(); $RecieptID = GetRecieptID(); print Your reciept number: .$RecieptID; $SomeVar = Functioncall(); print --\n; // some garbage // print You owe me: .getTotalValue(); $Data = ob_get_clean(); // or php versions earlier than 4.3: $Data = ob_get_contents(); ob_end_clean(); for ($i=0;$i3;$i++) print $Data; ? Hope it helps ! Wouter -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 1:24 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Output data repeatedly more than once On Tuesday 30 September 2003 18:59, Marek Kilimajer wrote: Yes, you can. But would not it be smarter to increase the number of copies in the print dialog? But that would be environmentally unfriendly because it uses more paper ;-) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Do you believe in intuition? No, but I have a strange feeling that someday I will. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION stuffs that come with php.ini
Hmm .. I haven't been on the list for a while so it took me some time to answer ;).. Anyways, what I believe is a possible cause for your problem is that there simply ain't no session started. Maybe the always start session before the php page request setting was On if not configured, but is now Off in your ini file. 783 ; Initialize session on request startup. 784 session.auto_start = 0 Might wants to be changed to 783 ; Initialize session on request startup. 784 session.auto_start = 1 Also check this one 773 ; Whether to use cookies. 774 session.use_cookies = 1 In combination with 850 ; trans sid support is disabled by default. 851 ; Use of trans sid may risk your users security. 852 ; Use this option with caution. 853 ; - User may send URL contains active session ID 854 ; to other person via. email/irc/etc. 855 ; - URL that contains active session ID may be stored 856 ; in publically accessible computer. 857 ; - User may access your site with the same session ID 858 ; always using URL stored in browser's history or bookmarks. 859 session.use_trans_sid = 0 If both are set to 0, sessions simply won't work since PHP cannot know about the session id. If session.use_cookies is enabled, and session.use_trans_sid is not than you should have Cookies enabled in your browser for sessions to work. Or if you're on Windows, pay special attention to 771 session.save_path = /tmp Which should then be changed to smth like c:\temp That's pretty much what I can say about it .. If neither of those work, just read the entire [Session] section in the php.ini file. Wouter -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 9:26 PM To: [EMAIL PROTECTED] Subject: [PHP] $_SESSION stuffs that come with php.ini I have been building the website for 6 months with everything and I didn't have hte php.ini on it. Just didn't realize it, so I create the php.ini that come from php.ini_dist that came with php source code. Now the $_SESSION doesn't work. I'm not able to make the php.ini to be like the one that php work without it. So, anyone know what is the default session configuration? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Checking mail with `mail`
By advising you something like this 2 ?php 3 exec('echo p 1 | mail', $Lines); 4 5 foreach($Lines as $Line) { 6 print ' '.$Line.\n; 7 }; 8 ? Would I apply for the bonus points? It would generate output similar to Mail version 8.1 6/6/93. Type ? for help. /var/spool/mail/wouter: 6 messages 6 unread U 1 [EMAIL PROTECTED] Tue Sep 30 11:17 24/786 test U 2 [EMAIL PROTECTED] Tue Sep 30 11:17 24/786 test U 3 [EMAIL PROTECTED] Tue Sep 30 11:17 24/786 test U 4 [EMAIL PROTECTED] Tue Sep 30 11:17 24/786 test U 5 [EMAIL PROTECTED] Tue Sep 30 11:17 24/786 test U 6 [EMAIL PROTECTED] Tue Sep 30 11:17 24/786 test Message 1: From [EMAIL PROTECTED] Tue Sep 30 11:17:32 2003 Date: Tue, 30 Sep 2003 11:17:31 +0200 From: Wouter van Vliet [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: test #!/usr/bin/php -q ?php exec('echo p 1 | mail', $Lines); foreach($Lines as $Line) { print ' '.$Line.\n; }; ? Saved 1 message in mbox Held 5 messages in /var/spool/mail/wouter (in this test, I mailed the contents of my script to myself) Hope it helps ya, Wouter -Original Message- From: Dan Phiffer [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 1:05 AM To: [EMAIL PROTECTED] Subject: [PHP] Checking mail with `mail` Is it practical to check for new mail from PHP using the UNIX mail utility? This would mainly be used to check for bounces from large mailings. Bonus points for anyone who can find me an article explaining the technique. Thanks! -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with a regex
Pretty easy, just make the regex stuff a little less greedy .. ;) class='newsitemcontent-td' colspan=2(.*?)\/td\/tr/ That would catch it .. And yes, the question mark is both correct and confusing. But it doesn't mean maybe in here. Now let's hope that your post doesn't include td/tr .. Wouter Ps. I'm assuming you use perl compatible regexes (preg_*) and not POSIX (ereg_*), don't know if this works for POSIX as well -Original Message- From: Adam Zey [mailto:[EMAIL PROTECTED] Sent: Sunday, September 21, 2003 7:07 PM To: [EMAIL PROTECTED] Subject: [PHP] Need help with a regex I'm using the following regex: /trtd class='newsitemtitle-td'([^]*)\/tdtd class='newsitemposter-td'span class=([^]*)([^]*)\/span([^]*)\/td\/tr trtd class='newsitemcontent-td' colspan=2([^]*)\/td\/tr/ Everything works well, except I've ran into one problem. In the last text field, the bulk of the newsitem, sometimes the poster includes some HTML tags (Like br \, but others could be inserted). What I need to do is modify that last submatch ([^]*) so that instead of matching until it reaches a (It catches on the br tag and ruins the match), it will match until it reaches the entire \/td tag. Can somebody help me out with this? I'm completely stumped about how to go about doing a match until string as opposed to a match until character. Regards, Adam. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Newbie Guide] RTFM, STFW, and STFA
Quite Right ! So, since I'm not quite a newbie I did not read all the guides .. RTFM (Read The F*ck!ng Manual) and STFW (Search The [EMAIL PROTECTED] Web) I already knew, but what does STFA stand for ;).. Wouter -Original Message- From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:29 PM To: Jay Blanchard; [EMAIL PROTECTED] Subject: Re: [PHP] [Newbie Guide] RTFM, STFW, and STFA Jay, Thank you very much for bringing this up. I think if people cannot be curteous and cannot obey maliling list rules and etiquette they don't deserve replies. Jay Blanchard wrote: I just had to get it out of my system this morning. No offense intended to anyone, and not directly aimed at anyone. Just had to get it off of my chest because there have been so many times that it could have been used since we had that conversation a few weeks ago. *grumble* more coffee needed, may need to start smoking again... *weak smile* j/k of course...lighten up and as always BTW, thanks to the guy who is periodically posting the newbie guide. It may be paying dividends, but then again I did see a post with a title IN ALL CAPS WITH NO DETAILS! and another that just said Help Have a pleasant, productive, and educational day. *snicker* feeling better already -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using system
Don't think there's one function for it .. Though, you may want to try the output buffers. ob_start(); ( .. Exec here ..) $Var = ob_end_clean(); , Wouter -Original Message- From: Uros [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 3:18 PM To: PHP General list Subject: [PHP] Using system Hello! I'm pulling my hair. What is the right syntax to set output of some system call to variable. I tried everything (system, shell_exec,exec) and always get output to screen. Please help. PHP version 4.3.3 CLI -- Best regards, Uros -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] value contained within a variable contained within another variable
You should be able to do something like this: $kk1_current = something; $data = array (kk1_current,kk2_current,mk_current); $data_post = $$data[0]; . \n; // I want, $data_post = whatever is inside $kk1_current in this example -- strval obviously doesn't work in the case echo $data_post; -Original Message- From: DougD [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 7:18 PM To: [EMAIL PROTECTED] Subject: [PHP] value contained within a variable contained within another variable I may be way off track with what I am trying to do, but here is my scenario and I sure appreciate any insights. There is a string stored in $kk1_current and I want to pull from the array the variable name, add the $ and then retreive the string with the varialbe $kk1_current. This will allow to echo the contents of each varialbe contained with the array. Make sense? $kk1_current = something; $data = array (kk1_current,kk2_current,mk_current); $temp = $ . $data[0]; $data_post = strval($temp) . \n; // I want, $data_post = whatever is inside $kk1_current in this example -- strval obviously doesn't work in the case echo $data_post; THANKS! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] innodb + php caching issues
Might want to try to send aa 'commit' command to the database. Just the first thing that enters my mind - -Original Message- - From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] - Sent: zondag 14 september 2003 7:55 - To: [EMAIL PROTECTED] - Subject: [PHP] innodb + php caching issues - - Hi there i have experienced a wierd bug , where after i - commit a query in innodb that change wont be viewable until - i refresh the page , this doesnt happen in a similar system - framwork using myisam tables the change is viewable, what - could be the problem ? should i just give nocache headers - for a quick fix? - - -- - PHP General Mailing List (http://www.php.net/) To - unsubscribe, visit: http://www.php.net/unsub.php - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Program works only when there are records :-(
Start by giving us the value of $tt, ... That'll probably tell more about the problem. Or you can do something like this: if ($res = mysql_query($tt)) { $num_rows = mysql_num_rows($res); //This is line 25 $x=1; for($i=0; $i5; $i++) { $a = mysql_result($res, $i); //This is line 30 $bb[$x]=$a; $x++; } } else { print sorry, no results found; }; Also, for: = for($i=0; $i5; $i++) { $a = mysql_result($res, $i); //This is line 30 = I'd suggest: while($a = mysql_fetch_array($res)) { Wouter -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Sunday, September 14, 2003 11:45 PM To: [EMAIL PROTECTED] Subject: [PHP] Program works only when there are records :-( Hi, I have a select statment with a UNION so that i am getting 5 COUNT(*)'s from a table. After that I have this code: * $res = mysql_query($tt); $num_rows = mysql_num_rows($res); //This is line 25 $x=1; for($i=0; $i5; $i++) { $a = mysql_result($res, $i); //This is line 30 $bb[$x]=$a; $x++; } $one = $bb[1]; $two = $bb[2]; $thr = $bb[3]; $fou = $bb[4]; $fiv = $bb[5]; $tot=$one + $two + $thr + $fou + $fiv; * When i have some records in the database this works fine and i get all the values in $one,$two etc but when a new account is created and i the COUNT(*) gets back just 0 I get these ugly errors/warnings on my page: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 25 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 What should i do and wheres the problem? I searched on google but just found some sites outputting this, no real help. Totally confused, please help. Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Program works only when there are records :-(
This looks like a pretty decent query to me... To figure out more about the errors mysql is producing, you can try to put a print mysql_error(); After ever call to a mysql function .. From there you should be able to learn more about the errors, and if not: don't bother posting what mysql_error() produces. Ow, and one question: does it give the errors if there's no rows in any table, or also if there's no rows in one of the tables? And in the second option, does it give you the errors less often? Wouter -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 12:49 AM To: esctoday.com | Wouter van Vliet Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Program works only when there are records :-( Hey, Thanks for replying. sorry, i thought i explained what $tt was, but here it is in program code if you want to be clear on it. $tt = SELECT COUNT(*), 'Count1' FROM shared WHERE user ='.$mmmy_user.' and ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count2' FROM dedicated WHERE user='.$mmmy_user.' and ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count3' FROM reseller WHERE user ='.$mmmy_user.' and ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count4' FROM colocated WHERE user ='.$mmmy_user.' and ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count5' FROM freehosting WHERE user ='.$mmmy_user.' and ccno=.$mmmy_ccno; I'll try those things you outlined till then. Cheers, -Ryan Start by giving us the value of $tt, ... That'll probably tell more about the problem. Or you can do something like this: if ($res = mysql_query($tt)) { $num_rows = mysql_num_rows($res); //This is line 25 $x=1; for($i=0; $i5; $i++) { $a = mysql_result($res, $i); //This is line 30 $bb[$x]=$a; $x++; } } else { print sorry, no results found; }; Also, for: = for($i=0; $i5; $i++) { $a = mysql_result($res, $i); //This is line 30 = I'd suggest: while($a = mysql_fetch_array($res)) { Wouter -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Sunday, September 14, 2003 11:45 PM To: [EMAIL PROTECTED] Subject: [PHP] Program works only when there are records :-( Hi, I have a select statment with a UNION so that i am getting 5 COUNT(*)'s from a table. After that I have this code: * $res = mysql_query($tt); $num_rows = mysql_num_rows($res); //This is line 25 $x=1; for($i=0; $i5; $i++) { $a = mysql_result($res, $i); //This is line 30 $bb[$x]=$a; $x++; } $one = $bb[1]; $two = $bb[2]; $thr = $bb[3]; $fou = $bb[4]; $fiv = $bb[5]; $tot=$one + $two + $thr + $fou + $fiv; * When i have some records in the database this works fine and i get all the values in $one,$two etc but when a new account is created and i the COUNT(*) gets back just 0 I get these ugly errors/warnings on my page: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 25 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30 What should i do and wheres the problem? I searched on google but just found some sites outputting this, no real help. Totally confused, please help. Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session stealing, ..
Thanks all for your replies .. It's pretty much what I already thought, a really secure way of handling sessions there is not. Though most of the most interesting information came from Jason (Yes! I'd love to see your custom session handler .. if be it only for inspiration to the one I'm planning to write soon) and Mike .. this issue is one that bothers me also. I'm not on AOL but my IP also can change at any time. It's not common, usually I hold the same one untill I dial my cable provider again .. but how often does this IP change happen and does other ISP's also do things like that? Wouter - -Oorspronkelijk bericht- - Van: Jennifer Goodie [mailto:[EMAIL PROTECTED] - Verzonden: zaterdag 13 september 2003 0:37 - Aan: Wouter van Vliet; PHP General - Onderwerp: RE: [PHP] Session stealing, .. - - - 93 # When deserialized we are called and need to - check if the - stored IP address equals the client's - 94 function __wakeup() { - 95 global $Log; - 96 if ($_SERVER['REMOTE_ADDR'] != - $this-Night['IP']) { - 97 $Log-Warning('IP Address - changed during - sleep and wakeup, will clear userdata'); - 98 $this-Data = Array(); - 99 }; - 100 } - - Upon sleep it stores the IP and time in the session data, and - when it smells - coffee my object wakes up, checks if he's still being used on the - same host - and if not the userdata is plainly cleared. - - - I hope none of your site visitors are on AOL as the IP can - change between - page requests for AOL users. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whats wrong?
or even: title?=(Thank you, $_POST[from])?/title :P - -Oorspronkelijk bericht- - Van: Sid [mailto:[EMAIL PROTECTED] - Verzonden: zondag 14 september 2003 3:43 - Aan: Stevie D Peele; [EMAIL PROTECTED] - Onderwerp: Re: [PHP] Whats wrong? - - - Try this - - title?echo Thank You, .$_POST['from']; ?/title - - - Sid - - On Sat, 13 Sep 2003 08:45:16 -0400, Stevie D Peele wrote: - Whats wrong with this - - - title?php echo Thank You, $senderemail; ?/title - - - where - - - $senderemail = $_POST['from']; - - - It doesnt It only echos thank you. - - - Why? - - -- - PHP General Mailing List (http://www.php.net/) - To unsubscribe, visit: http://www.php.net/unsub.php - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST problem SUPERGLOBALS
Let's explain this thing with the superglobals now once again .. so that everybody knows it ... In newer versions of PHP some superglobal arrays are available... $_GET[] - For any variable passed through the query string (in the URL, or address bar in a http://www.domain.com/page.php?foo=barfoo2=bar2 syntax) but also fields submitted through a form with a tag like FORM method=GET $_POST[]- For any field submitted from a form with tag like FORM method=POST $_COOKIE[] - For any cookie set and available for the script you're running. --- $_REQUEST[] - Merges the above three together. I think I mentioned them in the default order of importance. Post overriding cookie, get overriding post. $_FILES[] - Also for information send by a form, but now only the INPUT type=FILE name=fieldname entries are listed. Remember to use this kind of form tag: form enctype=multipart/form-data action=_URL_ method=post .. espeically method=post and enctype=multipart/form-data are essential. Prior to PHP4.3 the $_FILES superglobal was also included in $_REQUEST, but don't rely on that to happen since it will make your scripts fail in a newer version and have you look for a bug which is almost impossible to find. $_SESSION[] - Session vars set. When using $_SESSION, you should not use session_start() of functions like that. A session usually exists untill a user closes his/her browser window. Or 30 minutes has expired, whatever comes first. (The 30 minutes is a setting in php.ini and can be overriden, if i'm right about that) $_ENV[] - info about the user's default shell, homedir and stuff like that. The user as which your PHP script is running on the server, that is. NOT the user visiting your page. $_SERVER[] - info about the server and the script which is running.. For example $_SERVER['php_self'] gives you the filename of the script, $_SERVER['PHP_AUTH_USER'] for the apache basic authentication username.. - So, now I hope this has been cleared out for everybody.. And that I'll still be in time to see my fav bands play at ParkPop, one of the biggest free open air pop festivals I think in Europe.. just around the corner of my house here in The Hague. Salutes, Wouter -Oorspronkelijk bericht- Van: Jason Wong [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 27 juni 2003 22:46 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] $_POST problem On Saturday 28 June 2003 04:32, Sparky Kopetzky wrote: I've got my script kinda running but am unable to retrieve any values with $_POST. I turned on register_globals in the php.ini and am using this url: If you're going to be using $_POST (which you should) then you should *disable* register_globals. http://www.fttta.com/auction.php?action=reg. (Sorry, it's local for now...) I'm using this kind of line to check for values: elseif ('reg' == $_POST['action']) { do something; } Does print_r($_POST) show your variables? If not are you using the POST method in your form? If so what version of PHP are you using? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Even the best of friends cannot attend each other's funeral. -- Kehlog Albran, The Profit */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] unique random id
check the manual on the rand(); function .. If you want to make sure this number is unique .. create an array storing all the numbers you've used once and do some nice tricks with a loop and stuff untill you get a nice unique random number ... like this: ?php $UsedValues = Array(); function GetRandomNumber() { while( $Rand = round( rand(0, 1000) ) ) { # Using round() to round the float returned by rand() if (!in_array($Rand, $UsedValues)) return $Rand; array_push($UsedValues, $Rand); } }; ? -Oorspronkelijk bericht- Van: Awlad Hussain [mailto:[EMAIL PROTECTED] Verzonden: donderdag 19 juni 2003 10:47 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] unique random id How do i generate a unique random number? thanks awlad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Installation
If you're using a RedHat linux distribution .. have you also installed the php-mysql package .. I'm not totally sure about it's name, just give a search for either mysql or php on the redhat network (rhn.redhat.com) and you'll see that there's a package for php to connect with mysql ... Not sure if it will help you, but you can at least try ... or smth, Wouter -Oorspronkelijk bericht- Van: Anand Tomar [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 17 juni 2003 18:01 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Installation Hi, i tried installing mysql-4.1.0-alpha, apache, php4.3.2. now the issue is that i have all the 3 application running and interacting with each other in sync but every time i try to connect to mysql through php it gives me this error: Warning: mysql_connect(): Client does not support authentication protocol requested by server. Consider upgrading MySQL client this is the 1st time i am trying to set up a server i will really appreciate your helpthanks --anand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Capturing the input of dynamic form fields (part II)
First thing I notice as being at least a bit odd is this part: $nArraySize = count($_POST['test1']); $test1=$_POST['test1[]']; $test2=$_POST['test2[]']; what are you trying to do with that? .. What I'd expect it to look like is smth like: $nArraySize = count($_POST['test1']); $test1 = $_POST['test1']; $test2 = $_POST['test1']; but probably this: foreach($_POST['test1'] as $i = $Value) { $query = INSERT INTO test (test1, test2) VALUES ('.$_POST['test1'][$i].', '.$_POST['test2'][$i].'); $result = mysql_query($query); # and what else you'd want to do ... }; would just make even a little more sense .. some discussion could be about using $_POST['test1'][$i] to get the value again, or just using the $Value variable created by the foreach calls... -Oorspronkelijk bericht- Van: Frank Keessen [mailto:[EMAIL PROTECTED] Verzonden: zondag 15 juni 2003 21:44 Aan: Frank Keessen; James Hicks CC: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Capturing the input of dynamic form fields (part II) Hi, Looks like the value's are not coming to the database.. Can you please all have a close look at my code because it's driving me NUTS! THANKS FOR YOUR HELP! ? // open database connection $connection = mysql_connect($host, $user, $pass) or die (Unable to connect!); // select database mysql_select_db($db) or die (Unable to select database!); $_REQUEST[submit]=isset($_REQUEST[submit])?$_REQUEST[submit]:; if($_REQUEST['submit']!=) { $nArraySize = count($_POST['test1']); $test1=$_POST['test1[]']; $test2=$_POST['test2[]']; echo $nArraySize; for($i=0;$i$nArraySize;$i++) { $query=INSERT INTO test (test1, test2) VALUES ('$test1[$i]', '$test2[$i]'); $result = mysql_query($query); echo(mysql_error().BR$queryBR.mysql_affected_rows($result)); } } ? form name=form1 method=post id=form1 enctype=multipart/form-data action=?=$_SERVER['PHP_SELF']? ? for ($i=1; $i=2; $i++) { echo # $iinput type=\text\ name=\test1[$i]\br; echo # $iinput type=\text\ name=\test2[$i]\br; } ? input type=submit name=submit value=submit /form Regards, Frank - Original Message - From: Frank Keessen [EMAIL PROTECTED] To: James Hicks [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, June 15, 2003 8:59 PM Subject: Re: [PHP] Capturing the input of dynamic form fields (part II) Hi James, Sorry to say; I've put your code in it but there are no error message's displaying and there is no value inserted in the database... Any clue??? Regards, Frank - Original Message - From: James Hicks [EMAIL PROTECTED] To: Frank Keessen [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, June 15, 2003 4:14 PM Subject: Re: [PHP] Capturing the input of dynamic form fields (part II) Whenever I am having problems with SQL queries I always display the query on the page with all the replaced variables so I can make sure that the query makes sense. If it passes the MySQL parser in my brain and still doesn't work, I will copy the displayed query into the command line mysql monitor (or phpmyadmin) and try the command manually to see what happens. I also found it easier to solve my SQL problems by not using or die and just displaying some information about the problem query. This way I know something is wrong if the third line of the echo is not at least 1. $query=INSERT INTO test (test1, test2) VALUES ('$_POST['test1']','$_POST['test2']'); $result = mysql_query($query); echo(mysql_error().BR$queryBR.mysql_affected_rows($result)); James On Sunday 15 June 2003 09:39 am, Frank Keessen wrote: Dear all, Refering to my first e-mail with the same subject; I've reworked the code to this: But the only problem is; Nothing is written into the mysql database! And there are no error displayed.. Can someone have a look at my code? ? $_REQUEST[submit]=isset($_REQUEST[submit])?$_REQUEST[submit]:; if($_REQUEST['submit']!=) { for($i=0;$icount($_POST['test1[]']);$i++) { $query=INSERT INTO test (test1, test2) VALUES ('$_POST['test1']','$_POST['test2']'); $result = mysql_query($query) or die (Error in query: $query. . mysql_error()); } } ? form name=form1 method=post id=form1 enctype=multipart/form-data action=? $_SERVER['PHP_SELF']? ? for ($i=1; $i=2; $i++) { echo # $iinput type=\text\ name=\test1[]\br; echo # $iinput type=\text\ name=\test2[]\br; } ? input type=submit name=submit value=submit /form Thanks very much, Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
RE: [PHP] post data?
What does your form tag look like? -Oorspronkelijk bericht- Van: HPS [mailto:[EMAIL PROTECTED] Verzonden: maandag 9 juni 2003 9:32 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] post data? Dear all, i am using PHP 4.2.2 with Red Hat 8.0 i had a form in form.php, which has a form like this input class=text type=text name=course_id size=10 maxlength=10 value= say, i enter 6 in the text box. After i click the submit button and i echo the value of course_id, it returned 6course_id=6, NOT 6 do you have any idea? thx a lot! HPS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execute command which has root privileges
Probably you should look over here for info about suexec http://httpd.apache.org/docs/suexec.html, or check the 'sudo' man pages... With that you could gain root privilages.. -Oorspronkelijk bericht- Van: vijaypatel [mailto:[EMAIL PROTECTED] Verzonden: maandag 9 juni 2003 6:06 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Execute command which has root privileges Hello, I am using FreeBSD 4.7 ,PHP 4.2.3 Apache 1.3 I want to execute shell script which contains few IPFW commands. I have tried with system(),exec(),passthru() command to execute script but i can't do that. Apache has created www user on FreeBSD. I found that www user has not privilege for IPFW. How can i execute script which contains IPFW commands with PHP? I have given 777 permission to script file. Thanking You. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] post data?
in that case,.. I guess something is going wrong in your checkform javascript function .. probably you attach the name and value (by mistake) to eachother in there -Oorspronkelijk bericht- Van: HPS [mailto:[EMAIL PROTECTED] Verzonden: maandag 9 juni 2003 12:16 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] post data? the form tag is form action=syn2.php method=post onSubmit=return checkform(this); Thx! HPS Esctoday.Com | Wouter Van Vliet [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What does your form tag look like? -Oorspronkelijk bericht- Van: HPS [mailto:[EMAIL PROTECTED] Verzonden: maandag 9 juni 2003 9:32 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] post data? Dear all, i am using PHP 4.2.2 with Red Hat 8.0 i had a form in form.php, which has a form like this input class=text type=text name=course_id size=10 maxlength=10 value= say, i enter 6 in the text box. After i click the submit button and i echo the value of course_id, it returned 6course_id=6, NOT 6 do you have any idea? thx a lot! HPS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multi Selection
First of all, may I advise you to use some sort of indenting .. that pretty much improves the readability.. (also for the ones helping you ;).. ? $connection = mysql_connect($host, $user, $pass) or die (Unable to connect!); mysql_select_db($db) or die (Unable to select database!); $_POST[submit]= isset($_POST[submit]) ? $_POST[submit] : ; if($_POST['submit']!=) { $reisnaam = addslashes($_POST['reisnaam']); $query3 = INSERT INTO reis(reisnaam) VALUES ('$reisnaam'); $result = mysql_query($query3) or die (Error in query: $query. . mysql_error()); print_r($_POST); if(is_array($_POST['somename'])) { foreach($_POST['somename'] as $Key = $Value) { /* $query = 'INSERT INTO ra(reisid, accid) VALUES (LAST_INSERT_ID(), '.$Value.')'; */ $query = 'INSERT INTO ra (accid) VALUES ('.$Value.')'; $result = mysql_query($query) or die (Error in query: $query. . mysql_error()); $LastInsertID = mysql_insert_id(); }; } else { /* $query = 'INSERT INTO ra(reisid, accid) VALUES (LAST_INSERT_ID(),'.$_POST['somename'].')'; */ $query = 'INSERT INTO ra (accid) VALUES ('.$_POST['somename'].')'; $result = mysql_query($query) or die (Error in query: $query. . mysql_error());} $LastInsertID = mysql_insert_id(); } ? Ok .. that reads better.. Only that the text will get wrapped .. can't do anything about that :(.. Now I already see what you're doing wrong... You call LAST_INSERT_ID() in the MySQL query to insert the actual ID.. This should generate an 'double index' error, if you've set a primary key on reisid.. In fact, I expect reisid (for the non-dutchables: TravelID) to be an auto_increment, in that case you *should* not use it in an insert query.. You can and so should just leave it out. (I've added some comment tags around the 'wrong' ones, and changed them ..). Hope this has been of any help to you... Wouter -Oorspronkelijk bericht- Van: Frank Keessen [mailto:[EMAIL PROTECTED] Verzonden: woensdag 4 juni 2003 7:18 Aan: Jim Lucas; [EMAIL PROTECTED] Onderwerp: Re: [PHP] Multi Selection Guys Just another challenge; i've taken the code of Wouter and as you can see i'm first passing data to the reis table.. Then i retrieve the ID... But when you have multiple selection's the trouble starts... The first record is o.k. but then the second record Get's the ID of the first.. How to avoid this? Frank ? $connection = mysql_connect($host, $user, $pass) or die (Unable to connect!); mysql_select_db($db) or die (Unable to select database!); $_POST[submit]=isset($_POST[submit])?$_POST[submit]:; if($_POST['submit']!=) { $reisnaam=addslashes($_POST['reisnaam']); $query3 = INSERT INTO reis(reisnaam) VALUES ('$reisnaam'); $result = mysql_query($query3) or die (Error in query: $query. . mysql_error()); print_r($_POST); if(is_array($_POST['somename'])) { foreach($_POST['somename'] as $Key = $Value) { $query = 'INSERT INTO ra(reisid, accid) VALUES (LAST_INSERT_ID(), '.$Value.')'; $result = mysql_query($query) or die (Error in query: $query. . mysql_error()); }; } else { $query = 'INSERT INTO ra(reisid, accid) VALUES (LAST_INSERT_ID(), '.$_POST['somename'].')'; $result = mysql_query($query) or die (Error in query: $query. . mysql_error());} } ? FORM method=post action=? $_SERVER['PHP_SELF'] ? input size=70 maxlength=250 type=text name=reisnaambr SELECT name='somename[]' size=10 multiple id='somename[]' OPTION value='1'First Thingie/OPTION OPTION value='2'Second Thingie/OPTION OPTION value='3'Third Thingie/OPTION OPTION value='4'Fourth Thingie/OPTION OPTION value='5'Fifth Thingie/OPTION /SELECT input type=submit name=submit value=Toevoegen /FORM - Original Message - From: Jim Lucas [EMAIL PROTECTED] To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 11:05 PM Subject: Re: [PHP] Multi Selection if you are using a mysql data base setup and you have any indecies on the table that you are inserting the data into, then MySQL will automatically re-index the table each and every time the data in the table is modified. Jim Lucas - Original Message - From: Frank Keessen [EMAIL PROTECTED] To: Jim Lucas [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:37 PM Subject: Re: [PHP] Multi Selection Jim, Why does the data have to be reindexed??? I don't understand, can you give me an explenation? Thanks, Frank - Original Message - From: Jim Lucas [EMAIL PROTECTED] To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 10:30 PM Subject: Re: [PHP] Multi Selection I would look into doing something like this. The HTML code that Wouter will work just fine. My ideas are for the process page. When you insert data into a table, it has to re-index the table if you make your statement insert all the data at
[PHP] function re-defined | WorkAround? [and some more Q's]
Folks, I'm working on quite a large website with a lot of php pages.. And a lot of includable functions (modules).. Sometimes one of those modules gets included twice accidently and then it generates an error .. of course.. This made me wonder of there's any way to prevent the function from being defined again.. I've looked on the 'get_included_files' and used it to check if the file was already included.. For one, this had to search through the entire array and second it does not seem to return full file paths to the file, but only the filename itself.. Not really what I want either, since there may be various files with the same filename in various dirs.. Or what I sometimes want to do is overrule a function .. the manual just told me PHP does not support this, is that really true? And then for my last question at this moment... things like print and require are considered langauge construct and therefore don't need the parentheses .. Can I make stuff like that myself too, so I can make something like a function which does not use parentheses ?? Thanks, Wouter _ esctoday.com | your daily eurovision centre Wouter van Vliet, Staff assistant, member technical staff E-mail: [EMAIL PROTECTED] Websites: www.esctoday.com, webzee.mine.nu MSN Messenger passport: [EMAIL PROTECTED] Phone +31-(0)6-1539 7471 Based in The Hague, The Netherlands
RE: [PHP] Best open source banner advertising application
Does any of both (or any other) banner advertising applications support langauge specific banners.. So that Greek visitors would get only the banners you have said to be Greek? And for example maybe even if you don't have any advertisements for Cyprus it would get the Greek ones automatically? (or am I asking too much now?) -Oorspronkelijk bericht- Van: Awlad Hussain [mailto:[EMAIL PROTECTED] Verzonden: woensdag 4 juni 2003 16:24 Aan: John Wards CC: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Best open source banner advertising application Thanks John :) - Original Message - From: John Wards [EMAIL PROTECTED] To: Awlad Hussain [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 3:25 PM Subject: Re: [PHP] Best open source banner advertising application On Wednesday 04 Jun 2003 3:07 pm, Awlad Hussain wrote: Since you have used both systems, would you kindly share with us whats pro cons of them both systems?? I have used phpadsnew and like their user interface.. very neat.. not much sure about oasis. oooh errr put on the sport... Pros for PhpAdsNew: Simple to install Simpleish admin area. Runs on anything that runs apache/php Pros For Oasis Very powerfull and intergrates great into our major website (which phpadsnew didn't) Fast as bits. More features than phpadsnew (traffic shaping for one which is rather handy) Pdf reports (Not sure if phpadsnew does that but I can't think of it.) Can be set up to cluster so has the ablility to handle unlimited page views. 120+ page manual Cons for Phpadsnew. To simple... Slows our system down due to the number of requests we were pushing to it. We do 150-200 thousand page views a day but when running phpadsnew we had about 4 or 5 different advert loactions so it was producing about 1 million requests a day for adverts. Cons for Oasis. Install not for the wary Need root access Has trouble with FreeBSD shared memory (Took our server down a few times so we had to stop using it, we are now on linux and are busy installing it again) 120+ page manual HTH Cheers John Wards SportNetwork.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Automatically include global file ...
Thanks !!! -Oorspronkelijk bericht- Van: Wendell Brown [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 18:52 Aan: PHP General; Wouter van Vliet Onderwerp: Re: [PHP] Automatically include global file ... On Tue, 3 Jun 2003 18:41:59 +0200, Wouter van Vliet wrote: I've heard something about the possibility to set an option somewhere that will include a file to each php file requested... but I can't find it.. It's an ini setting (auto_prepend_file). Check here: http://us4.php.net/ini_set It can be set in the php.ini (or on Apache at least) in the .htaccess as follows: php_value auto_prepend_file /www/extract_post.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problems?
What comes in my mind is that usually in offices (or schools) all workstations have IP's within some IP range.. Unless each workstation dials up to or makes it's own connection with 'the internet'... You should be able to do something with that.. -Oorspronkelijk bericht- Van: Dale [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 20:43 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] problems? The web server sits outside of the office and can be accessed from anywhere pc. I was thinking that if I could some how query the MAC address of the store workstation, I could write some code that would allow only pc with certain MAC addresses to access this timeclock program. The server is a win 2k server and is running php on iis 5.0 Thanks, Dale Ed Gorski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Couple of clarifications Dale: Is this an internal intranet server? Can it be? Do you have admin rights to the server? What's OS and Server are you running? ~Ed -Original Message- From: Dale [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: [PHP] problems? I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multi Selection
What you need to generate as HTML looks smth like this --- FORM method=post action=page.php SELECT name='somename[]' size=10 multiple id='somename[]' OPTION value='one'First Thingie/OPTION OPTION value='two'Second Thingie/OPTION OPTION value='three'Third Thingie/OPTION OPTION value='four'Fourth Thingie/OPTION OPTION value='five'Fifth Thingie/OPTION /SELECT INPUT TYPE='post' /FORM --- page.php should look a bit like this: --- ?php foreach($_POST['somename'] as $Key = $Value) { $Query = 'INSERT INTO table (value) VALUES ('.$Value.')'; mysql_query($Query); }; ? --- What I'm not really sure about are the '[]' in the SELECT name='somename[]' .. might wanna try to leave them out. Also, i'm not sure if the value of $_POST['somename'] is always an array, also if one option is selected.. If it gives an errer, just use something like: ?php if(is_array($_POST['somename'])) { foreach($_POST['somename'] as $Key = $Value) { $Query = 'INSERT INTO table (value) VALUES ('.$Value.')'; mysql_query($Query); }; } else { $Query = 'INSERT INTO table (value) VALUES ('.$_POST['somename'].')'; mysql_query($Query); } ? Just to be sure of the correct POST data, I usually do a ?php print_r($_POST); ? .. just to test it.. Hope it has been of any help, Wouter -Oorspronkelijk bericht- Van: Frank Keessen [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 20:55 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Multi Selection Hi Guys, I'm trying to do the following: I've got a multiple selection box build out of a query of table tdselect name=VALUE[] size=10 multiple id=VALUE[] ? $query2 = SELECT SomethingID, Somewhere FROM Someplace WHERE publiceer = 'yes' ORDER BY somewhere; $result2 = mysql_query($query2) or die (Error in query: $query2. . mysql_error()); if (mysql_num_rows($result2) 0) { while($row2 = mysql_fetch_object($result2)) { ? OPTION VALUE=? echo $row2-SomethingID ?? echo $row2-Somewhere ; ? ? } } ? /option /select The outcome is stored in the VALUE[].. Now i want to have an INSERT query that insert each value seperatly.. So if there are 3 selections it must be repeat the INSERT query three times... Thanks for the help! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php