Re: [PHP] headers showing up in browser
#!/usr/local/bin/php -q on 1/10/02 12:16 PM, Mark at [EMAIL PROTECTED] wrote: > I've got this problem that won't go away. > > The headers are showing up at the top of the page when I run php in > cgi mode. any ideas? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Form Question
keep the data in a variable and do something like on 1/10/02 1:30 PM, Lerp at [EMAIL PROTECTED] wrote: > Hi there, how do I keep values in a form if the user has to go back and fill > in some missing fields? > > Thx Joe :) > > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php executing system commands..
on 1/11/02 1:35 AM, louie miranda at [EMAIL PROTECTED] wrote: > Hi, can php execute system commands > like df, and then print it to html ? http://www.php.net/manual/en/ref.exec.php -- mike cullerton -- 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] RTFM code snippet
hey folks, hope the new year is treating everyone well. i was RTFMing yesterday and ran across this piece of code while (false !== ($file = readdir($handle))) { which is similar to stuff i've done while ($file = readdir($dir)) { so, what am i not catching with my code, and what is really going on in the RTFM code with the "false !==" part? thanks y'all, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] preg_replace help
on 1/11/02 8:20 PM, Gaylen Fraley at [EMAIL PROTECTED] wrote: > Can someone recommend a good tutorial > or book on this subject? Mastering Regular Expressions Jeffrey Friedl O'Reilly & Associates ISBN 1-56592-257-3 -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql_fetch_row win32 to Linux
on 1/12/02 11:45 AM, sundogcurt at [EMAIL PROTECTED] wrote: > myquery = SELECT * FROM xpackage > Warning: Supplied argument is not a valid MySQL result resource in /path > to page with error/default.php on line 5 > > Line 5 is this part > while($myrowz = mysql_fetch_row($myresult)){ this tells me that $myresult is not a valid mysql result resource identifier. how do you obtain $myresult? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 404 Redirection
on 1/13/02 6:07 AM, FiShcAkE at [EMAIL PROTECTED] wrote: > Try that again, without pressing ctrl-enter this time!! > > As I said, I have got the usual script: > > if(isset($action)) > { > $include = $action; > } else { > $include = "home"; > } > include($include. ".inc"); > ?> > > but, how do I put in a custom error page instead of seeing: if i understand what you are asking, you might try something like if (is_file($include. ".inc")) { include($include. ".inc"); } else { include(custom_error.inc); } you may need to execute is_file($include. ".inc") inside a loop so that it checks in all your inlude_directories. foreach($dirs as $dir) { if (is_file($dir.'/'.$include. ".inc")) { blahblahblah } otherwise, if you know 'all' the valid files, you could create an array of filenames and compare $include to elements of the array. > > Warning: Unable to access anyotherpage.inc in > /var/virt/home/stuffwefound-co-uk/public_html/index.php on line 70 > > Warning: Failed opening 'anyotherpage.inc' for inclusion (include_path='') in > /var/virt/home/stuffwefound-co-uk/public_html/index.php on line 70 > > I have got an error page for any other url i.e. apagenotfound.php but I > dont know how to overcome the above. > > Thanks in advance > > Lee > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Newbie database question
on 1/13/02 10:51 AM, Dean Ouellette at [EMAIL PROTECTED] wrote: > I am entering info from form into database, is there a way to check say > firstname, lastname and address to see if it is a duplicate to what is > already in database and if it is then just enter any new information they > may enter and not create a new entry i'm definitely not an expert on this stuff, but here are some things to think about... on way to keep duplicates from being entered, is to make every (firstname, lastname, address) triplet unique in your database. in mysql, this would be something like ALTER TABLE table_name ADD UNIQUE some_unique_name(firstname, lastname, address); this may not be a good thing though. there may be instances where two folks exist with the same firstname,lastname, address. father/son and mother/daughter perhaps. if you just want to check, you can do something like SELECT id FROM table WHERE firstname = '$firstname' and lastname = '$lastname' and address = '$address'; if you get an id, then a record already exists. the problem with this, is data entry. depending on who is typing the stuff in a form, they may not type/spell it exactly the same each time. you may need to figure out some other unique identifier to determine if it's the 'same' person. hope this helps, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?
on 1/13/02 12:56 PM, Sander Peters at [EMAIL PROTECTED] wrote: > My first idea whas to split the date up in vars in php and then print > the vars in the way I like it > Is this a bad idea? Or are there better sollutions? that's the way i do it. i have 2 functions i use all the time for getting dates in and out of mysql using $month,$day,$year. for any project, i also create functions for formatting $month,$day,$year however the customer requires the output. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] beginer
on 1/13/02 10:32 AM, Vania Lavielle Castro at [EMAIL PROTECTED] wrote: > how work with sql server and code php? > i try with the functions and the results are bad > i need examples, please :( http://www.php.net/links.php -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] External Function
on 1/13/02 10:06 AM, Cory at [EMAIL PROTECTED] wrote: > Is it possible to put all of my functions in a text file and just call it > and use the functions in it? http://www.php.net/manual/en/function.require-once.php http://www.php.net/manual/en/function.include-once.php -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Php.ini file missing
hi michael, to create the directory and file, you'll need to run the terminal application. from there, type sudo mkdir /usr/local/lib to create the necessary directory. you should get prompted for a password. type your own password. you need to do this from an administrator account. the first account created during the install process is an administrator account. are you sure you don't have a copy of php.ini on your system? try locate php.ini from the terminal window. if there is one, you can copy it to the /usr/local/lib directory. sudo cp php.ini /usr/local/lib/ if you don't have one, you can download the distribution from php.net and copy php.ini-dist from there to /usr/local/lib and rename it sudo mv php.ini-dist /usr/local/lib/php.ini anyone know a better way to just get php.ini? a couple great sites for macosx http://www.stepwise.com http://macosxhints.com hope this helps, mike on 1/13/02 6:03 PM, Michael Sciascia at [EMAIL PROTECTED] wrote: > Hi, > I am new to this list and also to php and I am sorry to already bother you > with a question you might find really stupid, but I looked around for this > information several days now and I couldn't find some good resources. > > I installed php 4.1.0 on Mac OS X 10.1.2 and everything seems to work well, > also with mySQL and Apache. > > I am learning php from a book for beginners full of explanations and > scripts, so in the last days I wrote some scripts which make possible to > send e-mails filling a form on the browser. The scripts worked out well, but > I haven't been able to read the e-mails and understand where I should be > able to. > > I believed I had to change the SMTP settings of php or some sort of mail > server in the system and reading some articles found in several web sites I > think the solution would be to change some settings in the "php.ini" file. > > The build I downloaded doesn't have any "php.ini" file and in the faq > section of the website from where I downloaded it > (http://www.entropy.ch/software/macosx/php/) there is simply written to > create the "php.ini" file in the "/usr/local/lib/php.ini", including the > intermediate /lib/ directory that doesn't exist already on my system. > > I would like to know how I can create the "php.ini" file or if there is a > easier way to get and read the e-mails sent by the php scripts without > working on the php configuration. > > I am sorry to disturb you all, but I don't have any experience and I haven't > been able to find anything clear about this question. > > I would really appreciate if you could give me some tips or some web site's > addresses where I can find easy information, or where I can download a copy > of the "php.ini" file. > > I thank you in advance for the kindness and the attention. > > > Greetings, > Michael > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Php.ini file missing
on 1/13/02 6:35 PM, Rafael Perazzo at [EMAIL PROTECTED] wrote: > I think that you have this problem because your > sendmail is not running. > Try to run your sendmail (probably this command > /etc/rc.d/init.d/./sendmail > start- Note that before the name sendmail you have > two chars ./) > and I think your problem will be fixed. Then test your > script again to see > if it's working. ahhh, if this is indeed the problem, then you (michael from the original message) need to enable sendmail in /etc/hostconfig by changing the line MAILSERVER=-NO- to MAILSERVER=-YES- (isn't everything different in macosx) again, you need to do this from an administrator account. this will start sendmail each time you reboot. i'm not exactly sure how to start sendmail correctly from the command line, but one of the sites i mentioned earlier might have something. mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Another question - not exactly what i was looking for
how 'bout something like $query = 'select * from table_name where '; $and = ''; if ($lastname != '') { $query .= "lastname = $lastname"; $and = ' and '; } if ($firstname != '') { $query .= $comma."firstname = $firstname; $and = ' and '; } and so on on 1/15/02 1:53 PM, Phil Schwarzmann at [EMAIL PROTECTED] wrote: > Yo, thanks for all your help. But it isn't exactly what im looking for. > > Let's say you had a database with the following four columns... > > -LastName > -FirstName > -Age > -Weight > > ...and you wanted a page that would allow a user to search for one or > more of these fields within the database. > > It would be easy if the user could only pick just one of the fields. > But let's say that want to search only lastname and firstname, or maybe > all four, or maybe just one. How could this be done? > > If I have code that looks like this... > > $query = "select * from table where lastname='$lastname' and > firstname='$firstname' and age='$age' and weight='$weight'"; > > $result = mysql_query ($query); > $num_results = mysql_num_rows($result); > > ...the $num_results is ALWAYS zero unless I typed in all four fields. > > Any help? > > Thanks! > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Lazy evaluation?
on 1/16/02 5:57 AM, Miles Thompson at [EMAIL PROTECTED] wrote: > For "or" statements it does, but not && or xor. I don't know about you, but > I wouldn't want lazy evaluation on a conditional statement involving "and". i'm new to all this stuff, so i'll bite. hopefully someone can explain what i'm missing. if i have a statement like if (($a == 'a') && ($b == 'b')) blahblahblah(); and, $a != 'a'. why should php even look at the value for $b while evaluating this line? shouldn't the if fail after evaluating $a? thanks, mike -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] mysql_insert_id?
on 1/16/02 7:42 AM, Martin Wickman at [EMAIL PROTECTED] wrote: > Dl Neil wrote: > >> 2 because the (function argument) controlling feature is the connection, it >> is not possible for another >> concurrent user to 'steal' your ID or influence the ID returned to you - it's >> all yours! > > Ok, assume you are correct, but what if you are using persistent > connections (ie pconnet)? > it's still 'your' persistent connection that's being queried though. from the manual on mysql_pconnect Returns a positive MySQL persistent link identifier on success this is why you use the link identifier in things like mysql_query, and lets mysql 'know' what 'your' last insert was. hope this helps, mike -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Lazy evaluation?
aha! see, i didn't understand the whole picture. so, let me see if i can create another question. suppose if (($a_good = ($a == 'a')) && ($b_good = ($b == 'b'))) blahblahblah(); are you saying, that $b_good should always have the result of ($b == 'b') even if $a != 'a'? that's not what my test shows (hi bogdan :) so, is there something other than && that forces the other half to be evaluated? interesting... mike on 8/23/01 5:19 PM, TD - Sales International Holland B.V. at [EMAIL PROTECTED] wrote: > On Wednesday 16 January 2002 16:18, you wrote: > > I think the cause is, which is lacking in the reply below, that if you have > like > if ((function1(val, val)) && (function2(val, val)) blabla(); > > you still want function2 to be executed because it does things necessary for > your script, however, if one of them returns false you don't want blabla() to > be executed. If that isn't the case you should use or or one of the other > operators > > not too sure about that tho' but i'm sure I'll be corrected if that isn't the > case :-) > >> on 1/16/02 5:57 AM, Miles Thompson at [EMAIL PROTECTED] wrote: >>> For "or" statements it does, but not && or xor. I don't know about you, >>> but I wouldn't want lazy evaluation on a conditional statement involving >>> "and". >> >> i'm new to all this stuff, so i'll bite. hopefully someone can explain what >> i'm missing. >> >> if i have a statement like >> >> if (($a == 'a') && ($b == 'b')) blahblahblah(); >> >> and, $a != 'a'. >> >> why should php even look at the value for $b while evaluating this line? >> shouldn't the if fail after evaluating $a? >> >> thanks, >> mike >> >> -- mike cullerton michaelc at cullerton dot com > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] PHP as a cron job
>> Unable to open /home/admin/webmin-0.85/ in Unknown on line 0 this is possibly a path or env issue. have you tried using absolute filenames? mike on 1/16/02 10:07 AM, Tiago Luchini at [EMAIL PROTECTED] wrote: > I am trying to run directly via PHP. > > I have tried setting 755 to the script and adding #!/usr/bin/php -q to it > and also tried to change my cron line to run /usr/bin/php sending the script > as a parameter. Both options run normally when logged on a TTY. > > Tiago > > > - Original Message - > From: "Dennis Moore" <[EMAIL PROTECTED]> > To: "Tiago Luchini" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, January 16, 2002 12:18 PM > Subject: Re: [PHP] PHP as a cron job > > >> Please provide more information on how you have set up PHP to run your > cron >> jobs. Are you trying to execute via LYNX or directly via a PHP script? >> >> /dkm >> >> >> - Original Message - >> From: "Tiago Luchini" <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]> >> Sent: Wednesday, January 16, 2002 8:20 AM >> Subject: [PHP] PHP as a cron job >> >> >> I have been trying to use some PHP scripts as a Linux cron job. >> >> It tries to run but replies that: >> Unable to open /home/admin/webmin-0.85/ in Unknown on line 0 >> >> I have no idea why PHP parser is making this confusion. >> Could anyone bring some light to this mistery please? >> >> Atenciosamente, >> >> Tiago Luchini >> Diretor Técnico-Comercial >> Galluch Soluções Internet >> Tel.: 0xx11 6912-3255 >> Cel.: 0xx11 7839-7740 >> > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Maintenance of POP3 accounts
on 1/16/02 10:16 AM, HENDERSON, Roy at [EMAIL PROTECTED] wrote: > I would like to be able to maintain ( ie create or delete ) POP3 accounts > via PHP but my ISP says this cannot be done. > > I find this confusing since they provide me a PHP-based control panel which > I use to do this manually ... first, this is _totally_ doable--heck, they're already doing it with the control panel--but that isn't to say they should necessarily let you have direct access. it's really a function of how the ISP has their end setup. some POP accounts are real accounts on a box and you'd have to mess with /etc/passwd. not something ISP's like their customers doing :) essentially, they'd have to write an API for you to base your code on and leave a port open on a box somewhere listening for requests from you. this could take lots of time to create (which isp's don't have) and be a possible security nightmare. on the other hand, a progressive ISP who had their act together and a competent php programmer could probably get this to work. note that most solutions i've seen to this problem don't actually let you mess with anything directly. you basically end up creating a file (or making an entry in a database) that gets picked up by a cron job the ISP runs and they actually 'do the work'. this adds a little delay between you sending the request and when the cron job runs. but is a pretty cool solution. probably not the answer you wanted to hear, but i've lived on both sides of this fence :) mike -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] PHP as a cron job
on 1/16/02 11:26 AM, Tiago Luchini at [EMAIL PROTECTED] wrote: >>>>>> Unable to open /home/admin/webmin-0.85/ in Unknown on line 0 >>>> >>>> this is possibly a path or env issue. have you tried using absolute >>>> filenames? >>>> >>> >>> Yes. Same thing happens with absolute or relative paths. >> >> what's the line in your code where this error occurs? > > it doesn't run any line at all. don't matter what I put on my code, it just > says "unable to open" > > what's the first line of the file being called by cron? is it #!/usr/local/bin/php -q -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] mySQL select statement with mulitple where definitions
on 1/16/02 11:57 AM, Mike Krisher at [EMAIL PROTECTED] wrote: > someone here has to know the syntax for using multiple items in a where > definition, something like: > > $values = 120106,120095; > $sql = "SELECT * FROM products WHERE catalognumber = $values ORDER BY > price"; > select * from products where catalognumber in (120106,120095) order by you may need quotes around the stuff in the parens, ('120106','120095') -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] mysql_insert_id?
on 1/16/02 10:47 AM, Jimmy at [EMAIL PROTECTED] wrote: > Hi DL, > >>> the only problem i can think of might occur with pconnect is, >>> last_insert_id() will return you the last inserted ID from >>> previous 'session', not current 'session'. >>> to prevent this, you should call last_insert_id() only when >>> your INSERT query executed succesfully. > >> =Of course a "right-living" boy like me, cannot conceive of why one would >> look up LAST_INSERT other than immediately after the INSERT/UPDATE command... > > calling last_insert_id() after INSERT is the number one rule > of course :) > What i mean was, what if the INSERT query fail, but the script still > execute the last_insert_id() function? > Most probably the returned value would be wrong, because it will > return the last_insert_id of previous INSERT query (from previous > 'session') but of course, you'd have checked that the result id returned a valid result and not an error in this case and never looked for the last_insert_id, right? ;) mike -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] PHP & HTML: newbie question
hmmm... not sure about the cgi part. you'll probably need to start the file with something like #!/usr/loca/bin/php -q either way, within the file, you also need to tell the php parser what is php and what is html. surround the php code with tags like on 1/16/02 2:25 PM, Richard at [EMAIL PROTECTED] wrote: > > Hi there > > I just signed up for an account at Spaceports so I can play with PHP I > placed some PHP code in an HTML page and uploaded it to the server. > > But when I checked it in my browser I got the error message: can¹t parse > line 1 > > Line 1 is simply the tag!! > > On one of their user forums someone suggested getting rid of the HTML tags > so I did and just left the PHP code on its own and this works fine so how > can I use PHP with HTML? > > I think it has something to do with the fact that have to use their CGI > server to run PHP??? > > Cheers > > Richard S > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] PHP Security - "view source code"
on 1/16/02 6:04 PM, Rasmus Lerdorf at [EMAIL PROTECTED] wrote: >> On Thu, 17 Jan 2002, [EMAIL PROTECTED] wrote: >> >> (1) avoid using .inc files; use .php files like for normal script > > No, it is safer to block access to .inc files with an httpd.conf rule. > Allowing people to execute files that were meant to be included out of > context could end up being much more dangerous than simply having people > see the source. here is that httpd.conf rule stolen from an earlier post by Rasmus Order allow,deny Deny from all with this rule, if someone requests a file ending in .inc, apache won't deliver it. however, php will still be allowed to include those files itself. -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Linux Book
also, find out if there is a linux users group in your area. in addition to holding group hacks and install fests, our group maintains a mailing list that's a great source of help. on 1/16/02 12:25 PM, Miles Thompson at [EMAIL PROTECTED] wrote: > Book, I don't know. I'd suggest starting with the Guides at the Linux > Documentation Project, > http://www.linuxdoc.org/guides.html > and work from there, and don't forget the HOWTO's. >> S. slightly OT, but what is the best linux book out there, aimed at >> admin/DNS/Networking? -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Php.ini file missing
on 1/17/02 8:54 AM, Michael Sciascia at [EMAIL PROTECTED] wrote: > Looking in the sendmail configuration with Webmin I see that the message > sent by the php script is queued and that it isn't possible to send it > because the host "www@localhost" isn't correct. > In some web sites I found that I should change, in the hostconfig file, the > value "Hostname = AUTOMATIC" to "Hostname = my domain" (which should be my > IP or DNS) isn't getting your bearings always the hardest part of getting started. it's how all the pieces fit together that causes the magic. if you read between the lines, i believe the website you mention has already answered some of your remaining questions here. yet more of getting your bearings straight. anyway, not sure how much of the following you already now, but here's a bunch of stuff. the hostconfig file doesn't have anything to do with php or sendmail. it is only info about your host (or computer) so macosx can boot up properly. processes on the box may use or need info generated from /etc/hostconfig. my guess is that it's gonna be tough (but not impossible) to use sendmail on your machine since you have a dynamic ip address. the reason for this is that sendmail needs to know who 'it' is. ie, what machine to send the message from. you may want to check out the apache documentation http://httpd.apache.org/docs/ > What isn't really clear to me is which domain I have to write here. i believe i am quoting from the website you mentioned this hostname is supposed to be the valid DNS entry of your Mac. > I have an ISDN connection, so I don't have a static IP address and I don't > know about the DNS. first, to find the dns, nslookup your_ip_address should return the name associated with the ip address. you really want the name in the hostconfig file. if it's changing all the time, you will need to change the entry in hostconfig or automate it. > How do you usually check if a php script has really sent the e-mail to the > address in the script? you can't really. the mail function returns true if the mail was sent (as far as php is concerned) but you don't necessarily now if the mail was delivered. i'm not even sure if mail returns true in your case (the mail was queued) you can check the mail queue from the terminal with mailq and (if sendmail is working) force messages to be sent with sendmail -q > In the book I am using to approach to php this isn't explained, so I believe > it should be something really easy to do. The book is for really and > *absolute* beginners and everything is explained in a clear and exhaustive > way. It also has a CD-ROM with mysql, php & apache and it clearly explains > how to install them, but there isn't written anything about setting > something special to let the e-mail scripts work (well actually something > just for Windows and not for Linux or other *nix based systems like Mac OS > X) can't remember if i sent these to you already, but some good sites for macosx are http://macosxhints.com/ http://www.stepwise.com/ http://www.kung-foo.tv/xtips.shtml http://www.entropy.ch/software/macosx/php/ > Which values do you think I should write in the hostconfig file? My usual > provider domain (i.e. www.tiscali.it)? ideally, you would type the fully qualified domain name of your computer. so, to test all this - login to your isp - find out your hostname (nslookup ip_address) - edit /etc/hostconfig to add hostname - see if it works - woohooo! now, the hard part is automating that :) good luck, mike -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] PHP Security - "view source code"
on 1/17/02 9:21 AM, Erik Price at [EMAIL PROTECTED] wrote: > On my Linux box, which is shared with several users (I am admin), I > would like to do something like this -- if I created the group "php", > and added myself to that group, I could use files associated with the > group "php". My web server runs as "nobody". Do I just add "nobody" to > the /etc/groups entry for the group "php" ? Or are you talking about a > more involved administrative setup... another possibility is to add yourself to whatever group the webserver runs as. my webserver runs as www.www so i added myself to the www group. -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] command line are -c doesn't work on win2k?
on 1/18/02 12:00 AM, Jeff D. Hamann at [EMAIL PROTECTED] wrote: > I've been trying to figure out what was wrong with my script... > > mail("[EMAIL PROTECTED]", "Subject", "command line mail() test"); > ?> > > from the command line, > > php mail_test.php > > and getting, > > X-Powered-By: PHP/4.0.6 > Content-type: text/html > > attempting to deliver the mail > Warning: Unknown error in mail_test.php on line 3 didn't notice any other responses, and this is just a guess here, but how about taking the '()' out of the body of the message. ie, "command line mail test" -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] help installing php
hi juni, although i totally agree with the folks who recommended you compile php from source, maybe it's time you sat down :) compiling apache, mysql and php from source can tax even the greatest patience the first time it is tried. hopefully, here's a couple things to think about. create a directory where you store _all_ your source for everything you compile. lots of folks use /usr/src and i'll assume that here. now, download all the source tarballs you need into that directory and expand them all in there. this should create subdirectories for everything. ie, /usr/src/apache_1.3.22 /usr/src/php-4.1.0 /usr/src/mysql-3.23.40 it's possible that you may need other packages. only you will now what is used on your machine. do you use snmp with php? gd? do y'all also use perl with apache? you'll want to read the documentation that comes with _each_ package you are compiling. especially apache. they know about php. there is lots of good info in there. there are also many sites out there with tutorials on getting these all to compile together. you'll need to decide if you want to compile php as a static or dynamic module. static seems to compile easier for some folks, but dynamic means in the future you only need to recompile php to upgrade it (as opposed to recompiling everything like you are about to do :) the first time you do this, it could take hours just getting it all squared away, and that doesn't necessarily include compile time. after that, it should only take you a few minutes each time. to answer the specific question about apache source, if we assume the directories above, then you would use "../apache_1.3.22". i recommend writing down everything it took to get it all working so you have it for next time. the configure string might look something like ./configure \ --enable-track-vars \ --with-mysql=/usr/local \ --with-apache=/usr/src/apache_1.3.22 \ --enable-trans-sid \ --with-snmp \ --with-ftp \ --with-gd depending on what all you need from php. hope this all helps, mike on 1/18/02 12:09 PM, Juni Adi at [EMAIL PROTECTED] wrote: > Ok, I'm now in the middle of installing it from > source code. But I'm not sure where the path to > apache and mysql source code to fill in : > ./configure --with > apache=/path/to/apache_source_code --with > mysql=/path/to/mysql_source_code > > I 'm even not I have the source code for the > two of them as I was instaling both apache and > mysql from rpms. > > So, can you tell me to define the path for those > apache and mysql so I can make the PHP work along > with apache and mysql as well? Or at least tell me > what indicate a source code directory (what files > are in). Maybe I can search it manually. -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] $this objects and vars
on 1/18/02 8:58 AM, TD - Sales International Holland B.V. at [EMAIL PROTECTED] wrote: > now further in the script you'll get an sql query > $this = mysql_fetch_array(indentifier); > > now as far as I knew you shouldn't be possible to use $this for this purpose, > it has nothing to do with objects... why can it be used? it's only confusing > things. The script works tho... this is only a guess, but maybe separate namespaces. one is an array and one is an object. the object $this should only exist inside a method definition, right? $this outside of that context isn't referring to itself at that point but some memory space allocated to the variable named 'this' instead, i guess. ? mike -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] command line are -c doesn't work on win2k?
what about the "[EMAIL PROTECTED]"? is it failing on a 'bad' email address? or maybe putting everything in variables and trying mail($to,$subject,$message); on 1/18/02 9:14 AM, Jeff D. Hamann at [EMAIL PROTECTED] wrote: > nope. no difference. > > jeff. > > "Mike Cullerton" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> on 1/18/02 12:00 AM, Jeff D. Hamann at [EMAIL PROTECTED] wrote: >> >>> I've been trying to figure out what was wrong with my script... >>> >>> >> mail("[EMAIL PROTECTED]", "Subject", "command line mail() test"); >>> ?> >>> >>> from the command line, >>> >>> php mail_test.php >>> >>> and getting, >>> >>> X-Powered-By: PHP/4.0.6 >>> Content-type: text/html >>> >>> attempting to deliver the mail >>> Warning: Unknown error in mail_test.php on line > 3 >> >> didn't notice any other responses, and this is just a guess here, but how >> about taking the '()' out of the body of the message. ie, "command line > mail >> test" >> >> -- mike cullerton michaelc at cullerton dot com >> >> > > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] function arguments
expanding on this... function func($arga, $argb, $argc='') { do_something_with_arga($arga); do_another_thing_with_argb($argb); if ($argc != '') do_somthing_with_argc($argc); } on 1/18/02 1:19 PM, Ben Sinclair at [EMAIL PROTECTED] wrote: > You can do something like this: > > function myFunction($a = "hello", $b = "world") { } > > Both arguments are optional and have default values. This is in the > documentation. > > -- > Ben Sinclair > [EMAIL PROTECTED] > - Original Message - > From: "Malte Fucks" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, January 18, 2001 2:17 PM > Subject: [PHP] function arguments > > > Hi, how do i tell a function which arguments can be passed and which must be > passed... > > example: > function func($arga, $argb, $argc) > { > do_something_with_arga; > do_another_thing_with_argb; > and_if_argc_was_passed_do_something_with_it_too; > } > > because i dont want to pass argc if i dont need it, and to pass void arguments > like '' is annoying... > > -- mike cullerton michaelc at cullerton dot 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]
Re: [PHP] Attaching a file via MAIL()
on 2/1/02 11:36 AM, Dave at [EMAIL PROTECTED] wrote: > How can I add an attachment to an email using MAIL(). So far I have been > able to successfully send email by using: > > mail($to, $subject, $message, $headers); > > Is there something I can add in the $headers to add an attachment?? you really want to read the rfc for this. i think it is 821. google for 'smtp rfc' and you should be able to find it. here is a function i wrote when i was first learning php, and i'm sure it can be cleaned up, but it usually works for me. hope it helps, mike function mail_attachment($to,$subject,$attachment,$attachmentType="",$filename="",$me ssage="") { if ($attachmentType=="") $attachmentType = "text/plain; charset=US-ASCII"; $timestring = md5(time()); $seperator = "NextPart_$timestring"; $header = "MIME-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"$seperator\"\n this is some extra text that should be ignored. if you can read this, perhaps you should upgrade your email program.\n"; if ($filename !="") { $attachpreface = " \n--$seperator Content-Type: $attachmentType; name=\"$filename\" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=\"$filename\""; } else { $attachpreface = " \n--$seperator Content-Type: $attachmentType Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment"; } $messagepreface = " \n--$seperator Content-Type: text/plain; charset=US-ASCII"; $attachment = "$attachpreface\n\n"."$attachment"."\n--$seperator"; if ($message != "") { $message = "$messagepreface\n\n"."$message"."$attachment"; } else { $message = "$attachment"; } //echo "$header\n$message\n"; mail ($to,$subject,$message,$header); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Why does heredoc fail in this instance?
on 2/4/02 11:32 AM, Peter J. Schoenster at [EMAIL PROTECTED] wrote: > Hi > > If I use $snippet = ""; and escape the quotes in the block then it > works. But if I use it as is below, it fails with no useful error > message. Why? not sure if this is it or not, but from the manual http://www.php.net/manual/en/language.types.string.php Variables are expanded, but the same care must be taken when expressing complex variables inside a here doc as with strings. i wonder if $this->this_cgi is causing the problem > > Thanks, > > Peter > > function GetAddCommentSnippet($args) { > $topic_id= $args[id]; > $return_page= $args[return_page]; > > $snippet = << > Your First Name: > Your Last Name: > Your Email Address: > Your Comments: > > > > > > > > > EOS; > > return $snippet; > > > } // END GetAddCommentSnippet > > > --- > "Reality is that which, when you stop believing in it, doesn't go > away". > -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy + chmod problems ...
i just tried a test and it works on MacOS X. even with the space between 'chmod' and '('. what platform are you on? is this a standalone script/app or from a web page? can you perform the chmod from the command-line? what is the entire error message? also, the error doesn't really suggest this, but have you tried using the full path? on 2/7/02 8:07 AM, jeremy rotsztain at [EMAIL PROTECTED] wrote: > hello, > > i'm attempting to copy a file from its original location to a new folder ... > > $oldfile = "files/adamsCampbells.swf"; > $newfile = "photos/adamsCampbells.swf"; > > $test = copy($oldfile, $newfile); > > however, in doing so, i'm encountering some problems: > > Warning: Unable to create 'adamsCampbells.swf': Permission denied > > i've been trying to change permissions so that i can copy the file, but i'm > encountering some errors > > chmod ("files", 0777); > Badly placed ()'s. > > does anybody recognize any problems with my approach or have any advice? > > dnke, > > jeremy > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php Projects
on 2/8/02 12:49 PM, Nick Wilson at [EMAIL PROTECTED] wrote: >> Do I detect a bit of Friday-afternoon sarcasm??? >> >> Actually, a beer sounds good about now > > Friday evening in .dk and php is always best served with a cold one! reminds me of my days as a netadmin. playing with routers late on a friday night after a few cold ones was always fun :) -- mike cullerton michaelc at bakednotfried dot com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie has include path error & new problem
i'm guessing your problems are unrelated. for your network problem, it seems that you didn't really achieve 'networking linux box to windows host' correctly. can you currently ping localhost? what does your route table look like? as for the php problem. it's definitely a problem with your path. in your error message >> Warning: Failed opening '/etc/httpd/php/prepend.php' for >> inclusion (include_path=") in unknown in line 0. php thinks your include_path is ''. that means you have no include path, not even '.' mine is something like .:/var/www/php:/var/www/docs/include:/usr/local/lib/php this is defined in php.ini what's really interesting, is that you call prepend.php with an absolute path. you shouldn't even need the include path. i'd look in php.ini. where do you actually store prepend.php? mike on 7/1/01 11:00 PM, Daniel Goldin (E-mail) at [EMAIL PROTECTED] wrote: > Thanks for your help. The server document root is: /etc/httpd/htdocs. > Perhaps I need to point to this document in root in php.ini file? > > Anyway, I cannot try that now as I have finally achieved networking linux > box to windows host that acts as our internet server. Now when I try to > connect to: http://localhost I get this error > > "425 HTTP ERROR > > Unable to connect to remote host" > > I tried stopping the network, but that only caused Netscape to choke. Hmm. > (help?) > > Best, > > Daniel > > -Original Message- > From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Saturday, June 30, 2001 12:36 AM > To: [EMAIL PROTECTED] > Cc: php > Subject: Re: [PHP] newbie has include path error > > > Hi, > > If you can "surf" local host for standard HTML pages and other php pages > (without includes in them) eg: > > http://localhost/file.html > > Then the problem isn't the server really, it seems to me that the server > document root for your files should be something like: > > /usr/local/apache/ not /etc/httpd/php/prepend.php > > Can you ftp into your server? What's the path to your document root for > all your html / php files? I doubt it's /etc/httpd/php/file.html, if it > isn't this, then the problem is somewhere in your php cnfig to indicate > where the document root is. > > Eh, it's kidna hard to explain... maybe someone else can explain it > better :) > > > Justin French > Creative Director > Indent.com.au > > > > Daniel Goldin wrote: > >> I had php/apache/mysql working perfectly for awhile on my redaht 7.1 box. >> Compiled them all from source and was very proud, as I am at best an > amateur >> programmer. In other words, I love this stuff, but it doen't come > naturally. >> >> Recently I've been fiddling with networking (to little avail), installed a >> new ethernet card and did some other stuff... Anyway, now when I go into >> http://localhost (apache is running), I get this error: >> >> Warning: Failed opening '/etc/httpd/php/prepend.php' for >> inclusion (include_path=") in unknown in line 0. >> >> I've tried putting in this include path in my php.ini file to no effect. >> Please help. I have several projects I'm working on that require php and I >> have no way of working on them on my development box. >> >> Any help gratefully appreciated. Also, I apologize for being too chatty. > > -- > 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] > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail function fails
hmmm... i just copied your code and changed the email address to mine and it worked. $message was set to 'blah'. this tells me you either have a problem with your email address or $message. why don't you echo $message along with "Email NOT sent!". mail messages are particular about their syntax. mike on 7/2/01 7:00 AM, Shrout, Ryan at [EMAIL PROTECTED] wrote: > I am having a problem with the PHP mail() function. Here is the code: > > if (mail ("[EMAIL PROTECTED]", "Quote Request", $message)) { > echo "Email sent!"; > } else { > echo "Email NOT sent!"; > } > > Everytime, I receive the Email NOT sent message and the email isn't sent. > However, from the console on the same machine, I can run the mail command: > mail [EMAIL PROTECTED] and send an email just fine. > > Any ideas as to what could be wrong? > > I am using the latest PHP version and am running Red Hat Linux 7.1 > > Ryan Shrout -- mike cullerton [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]
Re: [PHP] Showing an Image
how about something like, $result = @mysql_query($sql); $data = @mysql_result($result, 0, "PICTURE"); $type = @mysql_result($result, 0, "FILETYPE"); $comment = @mysql_result($result, 0, "COMMENT"); Header("Content-type: $type"); echo $data . "" . $comment; or, instead of using Header, create a page and inside it put printf("%s%s",$image,$comment) mike on 7/2/01 1:39 AM, kachaloo at [EMAIL PROTECTED] wrote: > HI, > I want to show an image from a database but to do that I am using : > $result = @mysql_query($sql); > $data = @mysql_result($result, 0, "PICTURE"); > $type = @mysql_result($result, 0, "FILETYPE"); > Header("Content-type: $type"); > echo $data; > > > but after this I also want to show some text info. How can I do this ? I > will have to use something else besides header. Please Help. > Thanks, > Vishal > > -- mike cullerton [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]
Re: [PHP] setuid
i'm pretty sure apache tries its best to keep things like this (doing anything as root) from happening. you might look at apaches documentation for suexec. on 7/2/01 3:31 AM, Yamin Prabudy at [EMAIL PROTECTED] wrote: > sorry i might miss the discussion bout setuid > can anyone give me an help on how to run suid root > while i have script that run by apache > i had alread set the file like this > -rwsr-xr-x 1 root www 384 Jul 2 16:36 test > but no luck > > Thanks in Advance -- mike cullerton [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]
Re: [PHP] newbie has include path error & new problem
so, let me see if i understand the situation. you could load a webpage from localhost. then you set up networking to access the internet thru a windows machine acting as a gateway. now you can't load a page from localhost? correct? is localhost still your machine? can you load a page from http://127.0.0.1 again, what does your routing table look like? on 7/2/01 3:29 PM, Daniel Goldin (E-mail) at [EMAIL PROTECTED] wrote: > Appreciate your help. Yes I can ping localhost. I do believe I can solve the > php problem once I solve the networking problem as I've discovered that the > prepend path was set incorrectly. > >> >> for your network problem, it seems that you didn't really achieve >> 'networking linux box to windows host' correctly. can you currently ping >> localhost? what does your route table look like? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] newbie has include path error & new problem
on 7/2/01 3:59 PM, Daniel Goldin (E-mail) at [EMAIL PROTECTED] wrote: > Yes, I could load a page from localhost until I set up networking. > > No, I cannot load a page from 127.0.0.1. Tried that. > > Embarrassed to ask. What is a routing table and how do I find it? no need to be embarrased for not knowing what a routing table is, most people wouldn't. a routing table is used by a networked computer to determine how to reach remote hosts. it tells the machine what interface to use for a particular host and physical layer address to send to. what kind of a machine are you on? what steps (specifically) did you take to 'set up networking'? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] newbie has include path error & new problem
cool, you should be able to get the route table with either 'route' or 'netstat -r' on a redhat box. they both return the same thing on my slackware box. [use@box user]$ route Kernel IP routing table Destination Gateway Genmask Flags Metric RefUse Iface localnet* 255.255.255.0 U 0 00 eth0 loopback* 255.0.0.0 U 0 00 lo default gw.mydomain 0.0.0.0 UG1 00 eth0 see how loopback points to the 'lo' interface? does yours? like scott mentioned, you should read the man pages on route and ifconfig. you can find good help at http://www.linuxdoc.org/ mike on 7/2/01 9:53 PM, Daniel Goldin (E-mail) at [EMAIL PROTECTED] wrote: > I'm on a redhat 7.1 box on a pentium 3 pc. I set up networking via netcfg. > Here are the settings (names have been modified): > > Names > > Hostname localhost.localdomain > > > Hosts > > IP Name Nickname > - > 127.0.0.1 localhost.localdomain localhost > 199.33.57.1 windowshost > 198.77.110.8internet.com ghc000 > > > Interface > > interface IP Proto > -- > lo 127.0.0.1None > eth0 199.33.57.3 None > > > Routing > > Default Gateway 199.33.57.7 > default gateway device eth0 > > > Again, I appreciate your help. > > best, > > daniel > > -Original Message- > From: mike cullerton [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 02, 2001 3:06 PM > To: 'PHP List' > Subject: Re: [PHP] newbie has include path error & new problem > > > on 7/2/01 3:59 PM, Daniel Goldin (E-mail) at [EMAIL PROTECTED] wrote: > >> Yes, I could load a page from localhost until I set up networking. >> >> No, I cannot load a page from 127.0.0.1. Tried that. >> >> Embarrassed to ask. What is a routing table and how do I find it? > > no need to be embarrased for not knowing what a routing table is, most > people wouldn't. a routing table is used by a networked computer to > determine how to reach remote hosts. it tells the machine what interface to > use for a particular host and physical layer address to send to. > > what kind of a machine are you on? > > what steps (specifically) did you take to 'set up networking'? > > -- mike cullerton > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] New on PHP, need help with sessions
on 7/3/01 12:19 AM, Victor Spång Arthursson at [EMAIL PROTECTED] wrote: > Hi! > > I'm converting from ASP/VBScript, and need to know how to declare a > session variable. i feel your pain. i just finished moving a site from ASP/VBScript to PHP/Javascript, learning ASP/VBScript and Javascript along the way :) > > In VBScript I just type in: > > <% > session("any") = "victor" > %> > > Then I can print that variable on any page on the same webpage using: > > <% > response.write session("any") > %> > > as long as I don't close the browser or the variable times out. > > Question: How do I achieve the same thing in PHP..? you'll want to take a look at http://www.php.net/manual/en/ref.session.php you can start a session by starting it or by registering a variable. session_start() session_register("variablename") once set, the variables are available as $HTTP_SESSION_VARS["variablename"] or (depending on how php is configured) $variablename. on my macos x box, $variablename does work. > > Thanks in advance, > > Sincerely Victor > > PS Using PHP 4 on Mac OS X DS -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] any reasons to compile apache instead of usingdistribution binaries ?
on 7/3/01 2:18 AM, Marius Andreiana at [EMAIL PROTECTED] wrote: [this is wordy :)] > Hi > > I'm curios how others are handling packages on production servers. > Curently our sysadmins compile openssl,apache,php and other libraries > from sources. > > Do you think it would be better (easier to maintain) to install > apache and other libraries from rpm, and from sources only > php? this really is one of those holy war things. i prefer to compile everything by hand, for two reasons really. one is that when i started doing this, there weren't any package managers, and when they did arrive, the package managers weren't really up to it. installing one package often broke something else. i _had_ to roll my own (including the kernel). my servers don't have users, and i don't have anything on my box i don't need, so keeping it all straight in my head is relatively easy. which brings me to the second reason. for me, compiling myself is just easier. i create a file for every package (as in tarball) i compile. it contains the configure command with all the pertinent switches. i leave the file in the source directory. the next time i need to compile, i execute the file and compile. piece of cake. i know what's up with my box, because i did it. however, i have some friends who know way more about system administration than i do, and they swear by rpm. they like it so much they created their own package based on redhat and rpm, http://www.tummy.com/krud/ i actually used their distro for about a year, but returned to slackware so i could be in control :) i think you'll find that this is really a personal choice thing for most admins, and isn't the kind of thing i'd want management dictating to me. folks should use whichever method they feel most comfortable with and that causes _them_ the least headaches. > > Remember in some companies even the kernel is upgraded from rpm > b/c of easier maintenance and less chances to screw something up. it seems as if you've already decided which side you fall on :) i'll just say that from where i sit, some of your logic seems flawed. sure, the first time you compile a package from source, it takes a little while. but once you get it right, then the next time is a piece of cake. it's learning which switches to turn on or off that takes the time. but, that's why you have good sysadmins, right? :) i think the easier maintenance arguement is still open for discussion. as i said, i don't buy it. as for less chances for screwing things up, i really disagree. as i said, once you figure out how to compile a package, each of the next times are a piece of cake. when you use rpm's, you are stuck with the way they compiled it and you have to wait for a package to come out when a bug fix is released. curious, why do you think it's ok for your sysadmins to compile php but not the other stuff? -- mike cullerton [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]
Re: [PHP] New on PHP, need help with sessions
i believe this is track_vars, but as of php 4.0.3, this is always on. on 7/3/01 9:21 AM, Kurt Lieber at [EMAIL PROTECTED] wrote: > Hi Mike -- > > a related question to your post below. Specifically > >> $HTTP_SESSION_VARS["variablename"] >> or (depending on how php is configured) $variablename. > > I've run into this problem myself and it's very annoying -- any idea the > setting in php.ini that controls this? > > Thanks. > > --kurt -- mike cullerton [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]
Re: [PHP] Troubleshooting syntax ?
http://www.nestegg.net/validate.html on 7/3/01 2:17 PM, Jack Sasportas at [EMAIL PROTECTED] wrote: > Can anyone suggest a tool / web site etc, that helps you check the html > code for the missing / wrong syntax so that it is spotted quickly like > making it red or something, instead of reading through hundreds of lines > of code, hopefully catching the problem? -- mike cullerton [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]
Re: [PHP] loading data into mysql from txt file from php
write a script that reads in each line of the file, uses split() to break the line up at the tabs, and then inserts into the database. $data_array = split([tab],$file); $query = "insert into table values ($data_array[0], $data_array[1],...) you'll have to look up the regular expression for tab and use it where i wrote [tab] in the split() command on 7/3/01 3:02 PM, Clif Wieden at [EMAIL PROTECTED] wrote: > I have a project where the admin uploads a new data file and it needs to > be loaded into a mysql database. What's the best way to do this? The > data file is tab-delimted but could be reformatted. > > Right now the file is uploaded and after copy($new_file, $file_loc) > would like to refresh the db. > > unix box running php4 and mysql 3.22 and of course apache > > Thanks in advance, > clif > -- mike cullerton [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]
Re: [PHP] Help Please
on 7/3/01 9:48 AM, Martín Marqués at [EMAIL PROTECTED] wrote: > On Mié 04 Jul 2001 00:43, you wrote: >> Sorryyou'll need a '$' before the HTTP_REFERER part > > > Even better! Execute phpinfo() and see all the http variables available! > Or var_dump($GLOBALS); yes, but since you won't be 'referred' from anywhere, you won't see $HTTP_REFERRER :) > > Saludos... ;-) > -- mike cullerton [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]
Re: [PHP] Help Please
on 7/3/01 9:56 AM, Martín Marqués at [EMAIL PROTECTED] wrote: >>> Even better! Execute phpinfo() and see all the http variables available! >>> Or var_dump($GLOBALS); >> >> yes, but since you won't be 'referred' from anywhere, you won't see >> $HTTP_REFERRER :) > > ouch! You're totally right! :-) > > P.D.: But the variable will be there, only that it will be empty, right? i don't think so. atleast not in my browser :( > > Saludos... :-) -- mike cullerton [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]
Re: [PHP] image button troubles
because of problems just like this, i've moved to using printf() instead of echo(). printf("x = %s and y = %s",$mapclick,$mapclick_y); on 7/3/79 5:44 PM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: > on 7/3/01 7:52 PM, Kurt Lieber at [EMAIL PROTECTED] wrote: > >> I had a similar problem a while back that I solved by isolating my >> variables. Such as: >> >> >> >> As for why it's happening, I'm not sure. > > > Wow, that fixed it! Though it turns out I was mistaken in thinking I'd > fixed the bug... it still says it's "unable to open" the image I give it... > > hmmm.. > > Susan > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to prevent people from downloading images
on 7/3/01 6:36 PM, rodrigo at [EMAIL PROTECTED] wrote: > This is probably more of a client side programming issue rather than > something that has to do with PHP. But I figure that some of you might > have something meaningful to comment. > > I need a way to prevent the download of some images in a web page. I > also require that these images be presented within the web page. That > is, I don' want them to be displayed in another window. They should > remain embedded in the web page along with the rest of the page > elements. as in you don't want people to steal them? the image has to be passed to the browser, so it's gonna be tough. you may be able to pull it off in specific browsers, but you can't stop someone from writing their own 'browser' that copies the file to disk as it receives the image. i've got a friend that does system work for a place that has artist portfolio's online so folks can browse images and then purchase the rights to use them. they've had some problems with folks not paying (imagine that). they've written a perl program to snoop thru logs and try to track down folks stealing^w using images without paying for them. it's a fairly involved process and definitely isn't exact. anyone else? mike > > Thanks in advance. -- mike cullerton -- 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] max_execution_time
hey folks, i've got a script running into my max_execution_time. is there a way to override the value in php.ini from within a script, rather than increasing the time in php.ini? thanks, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] max_execution_time
rock on, it worked! thanks y'all, you've opened a whole new window. there turned out to be two ways to pull it off ini_set("max_execution_time", $seconds); set_time_limit($seconds) again, thanks, mike on 7/3/01 11:15 PM, Maxim Maletsky at [EMAIL PROTECTED] wrote: > this is the correct link: > http://php.net/manual/en/function.set-time-limit.php > > -maxim maletsky > > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 04, 2001 2:07 PM > To: mike cullerton > Cc: php php > Subject: Re: [PHP] max_execution_time > > >> i've got a script running into my max_execution_time. is there a way to >> override the value in php.ini from within a script, rather than increasing >> the time in php.ini? > > http://php.net/settimelimit > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] writing a query that returns similar numbers
select rowid from numbers where number between mynumber-10 and mynumber+10; on 7/4/79 10:48 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: > I have a database with numbers in one of the tables I'd like to ask mysql to > renturn all numbers with say 10 of mynumber > > Sort of like this: > > $sql = "SELECT rowid FROM numbers WHERE (mynumer is within 10 of number)"; > > > but I've gotten stuck do I have to do this: > > > $sql = "SELECT rowid FROM numbers WHERE (((mynumer+10) < number) AND > (mynumer-10) > number) )"; > > it seems kinda wordy ... > > Susan > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Run Command Line
on 7/5/01 11:00 AM, Arcady Genkin at [EMAIL PROTECTED] wrote: > "Matt Simpson" <[EMAIL PROTECTED]> writes: > >> I need to let PHP run a command as SU... is there any way it can be done? I >> need it to let Courier compile it's makeuserdb and makemaildir. Any help >> would be great. > > If you *really* want to do that, you can install `sudo' package, and > configure it to allow running a particular command as root to whatever > user Apache runs as. sudo is always one of the first things i install on my box. i never login as root if i can help it. being forced to type 'sudo command' always makes me think about what i'm doing. and this is on a box with no users. is this script being run from within apache or on the command line? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php binary ??
on 7/5/01 5:15 AM, Marc van Duivenvoorde at [EMAIL PROTECTED] wrote: > > I've got a small question, can I make php system scripts just like perl > when I have compiled php as a dso module for apache or do I have to > compile it to an binary executable ?? you must have a separate executable > > something like #! /usr/bin/perl -w with a script except then for php. preface your script with #!/your/path/to/php -q > > Marc van Duivenvoorde -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Printing a root link into HTML
what do you mean by 'previous directory'? there's no real chronological order to directories. on 7/6/01 6:27 PM, Chris Anderson at [EMAIL PROTECTED] wrote: > To specify, I want to link to a file in a previous directory, none of those > methods seem to work for that. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] chdir() help
i believe the script considers it's own directory as it's current working directory. try calling the files by image/$file_name on 7/7/01 9:38 AM, McShen at [EMAIL PROTECTED] wrote: > hi > > Currently, i am working in e:\work, and there is a folder named "image" under > e:\work, so, the path to image is e:\work\image. > > I have a script under e:\work, and i wanna display all images under the folder > e:\work\image, I use chdir() to change the directory. but it wouldn't work. it > still displays the images under e:\work. Why is that? Does chdir() work under > win2k pro? here is my script > > --- > > > $dir_name = "e:\work"; > $dir = opendir($dir_name); > while ($file_name=readdir($dir)) { > > if (($file_name!="." && $file_name!="..")) { > echo $file_name."\n "; > > if (chdir('e:\work\image')) { > echo "current dir is e:\work\image"; > } > echo ""; > } > } > closedir($dir); > ?> > - > > Please help me to fix the problem. Thanks. > -- mike cullerton -- 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] registering objects as session variables
hey folks, i'm trying to register an object as a session variable and feel like i'm chasing my tail. i either get the define class before starting session problem or the can't send header error. as soon as i fix one, i cause the other. what are folks doing about this? roll you own using serialize? maybe i'm missing something easy... mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question: Processing files in directory and parsing...
on 7/7/01 7:02 PM, Jeff Lewis at [EMAIL PROTECTED] wrote: > So I need to know how to process the files in the directory and then how to > process a few lines. The structure will always be the same and having the > columns starting at the same position each time. first, do the files have all the heading info in them as well, or just the data? ie, are all the lines the same, or are there some that include stuff other than data? if the files cantaon only data, once you get a file in hand, this can parse the lines. $fd = fopen ($file,'r'); $buffer = fgets($fd, 4096); $field1 = substr($buffer,0,x); $field2 = substr($buffer,x,y); $field3 = substr($buffer,x+y,z); ... where x is the length of the first field, y length of the second ... also, you may want to trim() the fields. i'm sure others around here can come up with something better. :) -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question: Processing files in directory and parsing...
on 7/7/01 7:38 PM, mike cullerton at [EMAIL PROTECTED] wrote: > on 7/7/01 7:02 PM, Jeff Lewis at [EMAIL PROTECTED] wrote: > >> So I need to know how to process the files in the directory and then how to >> process a few lines. The structure will always be the same and having the >> columns starting at the same position each time. > > first, do the files have all the heading info in them as well, or just the > data? ie, are all the lines the same, or are there some that include stuff > other than data? > > if the files cantaon only data, once you get a file in hand, this can parse > the lines. > > $fd = fopen ($file,'r'); oops, missed something... while (!feof ($fd)) { > $buffer = fgets($fd, 4096); > $field1 = substr($buffer,0,x); > $field2 = substr($buffer,x,y); > $field3 = substr($buffer,x+y,z); > ... > > where x is the length of the first field, y length of the second ... > > also, you may want to trim() the fields. > > i'm sure others around here can come up with something better. > > :) > > -- mike cullerton > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting any possible value inside an array
i think this should work $color_list = array(); // not sure if you need this foreach ($myarray as $color) { if (!in_array($color,$color_list)) $color_list[] = $color; } http://php.net/in_array on 7/7/01 11:51 PM, Aaron Bennett at [EMAIL PROTECTED] wrote: > Hi everyone... > > Does someone have a quick and dirty way of returning _any_ possible value > contained within an array? > > For instance: > > $myarray[0] = "red"; > $myarray[1] = "red"; > $myarray[2] = "red"; > $myarray[3] = "blue"; > $myarray[4] = "green"; > $myarray[5] = "blue"; > $myarray[6] = "red"; > > and i'd output "red", "blue" and "green", but not have multiple instances of > each. > > Thanks in advance! > -- > Aaron Bennett > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] registering objects as session variables
on 7/8/01 5:53 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: > Hi mike! > On Sat, 07 Jul 2001, mike cullerton wrote: > >> hey folks, >> >> i'm trying to register an object as a session variable and feel like i'm >> chasing my tail. i either get the define class before starting session >> problem or the can't send header error. as soon as i fix one, i cause the >> other. > > you are doing something wrong somewhere in the process :) > > All you need is the class definition before the session starts. That's all. > > Post some code to see what are you doing. thanks, this is really involved code. (YA weblog program) the index has one include file, but that include file has _many_ includes and lots of interdependence. the object i want to register maintains the page layout, and has a db object and member object as variables. i've got some test code working that doesn't exhibit the problem. now i'm just trying to track it down. :( again, thanks, mike > > -- teodor -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] can't generate gif!!!
on 7/8/01 10:51 AM, Tom Carter at [EMAIL PROTECTED] wrote: > I thought convert was an imagemagick command, rather than unix by default? > could be wrong tho... yes, but you can install it on a box without xwindows and still use it. a pretty cool tool. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] add user from the web interface
on 7/8/01 4:30 AM, INFO (www.trade-revenues.com) at [EMAIL PROTECTED] wrote: > Hi, > > If I want to add a system user from the web interface using Apache + > Redhat 6.2. What language should I use. Should I use PHP or Bash or Perl. > Which one is the best ?? I know PHP can always exec shell command using > exec() function. But, the apache server is set to nobody.. So I can not > exec the root command from the web interface. Advice is need in this > situation. if you want to use a web interface, you're stuck with the user that apache runs as. (nobody in your case) one option is to have the web application create a file, and then have a cron job as root come by and read the file and add the user(s). -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: when to delete a temporary file ?
on 7/8/01 11:45 AM, Lasse at [EMAIL PROTECTED] wrote: >> this was the first approach I thought about, but I don't know how to check >> session IDs other that current one I use session_is_registered() to check >> for the current session but how can I check for other sessions ? tell me >> please :) > > Um... I'm not sure... I've never actually used sessions myself.. :-) I just > figured that it would be possible... php session info can be stored a couple differet ways on your server. the default is a file (one for each session) in /tmp. the name of the file includes the session id. http://www.php.net/session -- mike cullerton -- 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] magic functions
hey folks, hope the day is treating you well. i believe i have solved my chasing the tail problem with registering an object as a session variable. now, i'm having trouble with my database connection. in the object i am registering, one of its variables is a pear db object. the first connection to the page works, any subsequent connection gets the following error > Warning: Supplied argument is not a valid MySQL-Link resource in > DB/mysql.php so, i am wondering how to use __sleep and __wake. there aren't any examples on php.net about this. it mentions something about returning an array of variables to serialize. should i include the db object in this array? anyone have a simple example to start from? any help appreciated, thanks, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Global Variables -- why not have them?
on 7/8/01 7:57 PM, Brian White at [EMAIL PROTECTED] wrote: >>> I dislike the GLOBAL statement in that many of the bugs that get me >>> scratching my >>> head are to do with when I have forgotten to use it. >> >> Then you're probably using it way too often. > > It is usually for "SCRIPT_NAME", or one of the CGI parameters. > > The CGI parameters are arguable, but I pretty much consider SCRIPT_NAME to be > a global constant. php does have constants which are _always_ global. define ("SCRIPT_NAME", $passed_in_script); then you refer to it like my_function() { printf("script is %s",SCRIPT_NAME); } notice there are no quotes or '$' or anything. i've recently changed $DEBUG to DEBUG for things like define("DEBUG", 1); my_db_function() { $rid = $db->query($query); if (!DB::isError) { do_something_cool(); } else { if (DEBUG) printf("\n",$rid->getMessage()) } -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about how to do this...
on 7/8/01 10:58 PM, Steve Werby at [EMAIL PROTECTED] wrote: > "Ben Bleything" <[EMAIL PROTECTED]> wrote: >> I believe (and I'm sure someone will correct me if I'm wrong) that >> whenever you 'include' or 'require' a file, it drops to regular HTML >> mode... so, yes, you will need to use >> tags at the ends => > > Think of the behavior of include() as copying the exact text from your code > in the include'd file and pasting it as is into the calling code...a la > paper and scissors. There is no special transformation. So if the code in > the include'd file would have needed PHP codes if it was directly within the > calling code then it needs it in the include'd file too and if it wouldn't > have in the calling code then it won't in the include'd file. from http://php.net/include An important note about how this works is that when a file is include()ed or require()ed, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Post a form within a running php-script
on 7/8/01 11:17 PM, Bob Horton at [EMAIL PROTECTED] wrote: > What if someone wanted to reply to a form but the form was expecting the > information to arrive using the POST method (and wasn't explicitly PHP)? > > Is there any way to do it if you want to submit to a POST method form? Or > some way to simulate the entering of the information and clicking of the > submit button? > i'm not sure if this is what you are asking, but i can have an url like http://mysite.com/?submit=click_me&opt=my_option and refer to those inside my program as $submit and $opt -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] max_execution_time & header
on 7/9/01 8:17 AM, Peter Schumacher at [EMAIL PROTECTED] wrote: > I still run into the max_execution_time!!! I thought it would be reset as I > redirect to another page. within your script ini_set("max_execution_time", $some_bunch_of_seconds); -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] newbie seeks template info
devshed has an article using fast template http://devshed.com/Server_Side/PHP/PHPFastTemplate/ on 7/25/01 2:06 AM, Daniel Goldin (E-mail) at [EMAIL PROTECTED] wrote: > Could somebody point me to a good primer--and I mean PRIMER--that explains > how templates work in php. I'm thinking--not too clearly, I admit--about > apps like Smarty and PhpLib and Pear, which I've heard so much about. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IE -> View Source
on 7/26/01 12:32 AM, Steve Haemelinck at [EMAIL PROTECTED] wrote: > Some sites are able to disable the source view in ie. How do you do that? don't forget the ol' telnet to port 80 and type GET trick telnet domain.com 80 Connected to domain.com. Escape character is '^]'. GET http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd";> Untitled Connection closed by foreign host. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session - to restrict same user from two logins
on 7/26/01 11:06 AM, deco at [EMAIL PROTECTED] wrote: >> an easier way of doing this is to have a database of users with their >> password in the table and when they log on simply mark them logged using >> sum boolean variable. this will, cut down time. >> good luck!. >> and remeber Have a nice day :) > > And when would you uncheck the boolean value? In theory, when the > session expires, but there's no event being triggered. Only solution would > be to check for active sessions periodically, or something like this... > Ideal solution would be for php to do it by itself when the session > expires.. > instead of a boolean you could use a timestamp and update it each time a page is loaded. then a cron job could come by periodically and delete sessions older than some specified time. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session variable listing
on 7/26/01 2:33 PM, Cole Tuininga at [EMAIL PROTECTED] wrote: > Is there a way to easily list the variables that are registered within > a session? while (list($key, $val) = each($HTTP_SESSION_VARS)) { do_something(); } -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Using Variable Variables...
on 7/26/01 6:46 PM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: > $_VARIABLE_ = "chkContact".$i; > $_VAR_ = $$_VARIABLE_; > > How do I make this work when $chkContact is a global variable? This > returns an empty value because it does not see that $chkContact is a > global variable... > maybe try global $_VARIABLE_, $$_VARIABLE_; -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] asp to php
on 7/26/01 9:52 AM, kaab kaoutar at [EMAIL PROTECTED] wrote: > > Does anyone of u has alreday tried successfully converting asp file to php > file ? > Is it worth doing so or restarting from scratch? > Thanks i've only tried this once, but i'd do it again. you will definitely have to edit the code it produces, but you'll find patterns and you can search and replace some. it's a great way to get some of your typing done if nothing else. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to get the current date and time in to the inputfield of a form with running time.
> on 7/26/01 9:55 PM, Balaji Ankem at [EMAIL PROTECTED] wrote: > > Hi, dear friends, > How can i get the current date and time in the following input field. > > > > DATE: > > STATUS: > > > > > Thanks in advance. > > Regards > -Balaji -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] array through url?
on 7/27/01 12:21 PM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: > Is it possible to send an array of numbers into a php file through a url? > Like if I have a file that adds numbers together, could I send it > > www.domain.com/add.php?num=2,3,4,5 > > $num would be an array. www.domain.com/add.php?num[]=2&num[]=3&num[]=4&num[]=5 -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] idiotic question
on 7/27/01 3:46 PM, Jerry Lake at [EMAIL PROTECTED] wrote: > for the life of me I can't remember > how to convert a string to just the first > letter of itself i.e. $string = test > ...a function > $string_first = t > $word = substr($word,0,1); -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mkdir
On Sat, 28 Jul 2001, Jerry Lake wrote: > when using mkdir > I cant seem to make subdirectories > $oldumask = umask(0); > mkdir('test/test', 0777); > umask($oldumask); > ?> > > is there any way to do this ? does the first test directory already exist? you may need to make them in two steps. i believe mkidir has a switch to force it to create any needed directories along the way. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Can't write to file via php, just via ftp...Can anyonehelp?
on 7/30/01 2:58 PM, Stephan Hübner at [EMAIL PROTECTED] wrote: > Hello all, hi stephan, > another newbie-question, probably... :-) they all are, at first! > And sorry for my (possibly) bad english, I'm from Germany. sorry for mine, i'm from virginia :) > the problem I noticed is that I have to write to a file on the server. I > created a directory where I store the files, upload a data-file into it and > tried to write to it via a php-file. But it seems I don't have the right to > write to it and somehow I can't change that with the ftp-programm I have > ("Interarchy" on the Mac). So, does anybody know if there is a solution for > this? I mean, others have to write to the server too, so there must be a way > to do it... (btw, it's a linux or unix server where the pages are on). > Thanks for your thoughts. there are a couple of things going on here. first, when you ftp to the server, you are probably logging on as yourself. php is probably running as whatever user the webserver is running as. those are most likely two different users. one option you have is to ftp the file as the same user the webserver runs as. this may not really be a viable option. another option is to create a group on the server, and put your user and the webserver user both in that group. when you ftp the file, you will need to make sure it is group writeable. you can do this from the command line on the server, or from interarchy as well. in interarchy, after you have uploaded the file, select the file and choose "Set Permissions..." from the Listing diresctory. then make sure the box for group write is checked. > Have a nice day, > > Stephan Huebner hope this helps, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Attitude of B van Ouwerkerk
on 7/31/01 12:37 PM, scott [gts] at [EMAIL PROTECTED] wrote: > there's a fine line between being terse and being nasty. > > please don't misinterpret this, but i think that we > could all benefit from being less sensitive of the > style each of us express ourselves in... once again, scott, you seem to have a nice concise way of putting things :) newbies are part of internet communities, as are old curmudgeons. thankfully, so too are the wise, willing to share their knowledge. recently, Brian White mentioned a propsed faq for the "headers already sent" question. also, Philip Olson mentioned a link at php.faqts. what is up with a faq for this list? is there one? i have been saving good responses to faq type questions with the intent of putting a faq together. now is as good a time as any. i'll post something in a couple days. that way, we can politley say to newcomers. "hey, nice to have you around. hope we can help you out some. two places you should go to get started are php.net and link.to.list.faq" let me know if there already is one. have a day, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] issues with __sleep() and __wakeup()
on 7/31/01 1:48 PM, scott [gts] at [EMAIL PROTECTED] wrote: > I am having a problem with __sleep(); > there mere existance of it is causing my object > to not get serialized at all. __wakeup() works fine. > > i am using PHP v4.0.6 / apache / win2k. > > If i keep __sleep() in the object, it will not serialize, > but if i remove it, it serialized fine. Does anyone > know why this happens? i asked this about a month ago and didn't hear anything. i too have never been able to get __sleep to work. i think it's because i couldn't figure out what needed to be returned (or how to return it :) at http://www.php.net/manual/en/language.oop.magic-functions.php it says that __sleep is "supposed to return an array with the names of all variables of that object that should be serialized", but there are no examples of this. in a current project, i have an object that is registed as a session variable. it contains three objects and an array. one of the objects is a PEAR db object, and i don't need to serialize it. i do want to maintain the other two objects and the array. i tried a number of ideas inside __sleep, to no avail. without __sleep, it works. with __sleep, i break it. i do use __wakeup to reinitialize my db object, but i just use $db->disconnect(); at the end of my index file to disconnect . does anyone know the proper way to "clean up the object" in __sleep and how to return the variables that should be serialized? can this even be used when one (or more) of the variables is an object itself? thanks, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Execute mixed php code from mysql?
the way i have solved this is to have another column of data_type. switch ($data_type) { case "php": exec($data); break; case "html": include($data); break; } mike on 7/31/01 3:24 PM, Kyle at [EMAIL PROTECTED] wrote: > For example I have in a database: > - In database: > welcome > > if ($something == 'hello') { > echo 'do somethoing'; > }?> > -- Also in Database: > > --- > Now how could i make it so that I have another page that has the following: > index.php - > $db = mysql_connect ($dbhost,$dbuser,$dbpass); > $query = "SELECT code FROM templates WHERE name = 'header'"; > $result = mysql_db_query($dbtabe,$query); > $row = mysql_fetch_array ($result); > echo $row[code]; > ?> > Jump out and have some html content > $db = mysql_connect ($dbhost,$dbuser,$dbpass); > $query = "SELECT code FROM templates WHERE name = 'footer'"; > $result = mysql_db_query($dbtabe,$query); > $row = mysql_fetch_array ($result); > echo $row[code]; > ?> > -- end page -- > For some reason it converts the tags on the php code as it pulls it out, i > figure echo isn't the right function to do this and echo is converting the > ' > I tried eval(), I need a function similar to include(), but can take strings > instead of files. If the content that was in the database and I include()'d > it, it would have the desired effect. > > Thanks in advanced > > - Kyle > > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] dumb mysql_connect issue
or, echo $sql and copy/paste it into an sql client and see what it tells you. on 7/31/01 4:21 PM, Philip Olson at [EMAIL PROTECTED] wrote: > Try putting mysql_error() in your die statements so : > > or die(mysql_error()); > > and see what it tells you. > > Regards, > Philip > > > On Tue, 31 Jul 2001, CGI GUY wrote: > >> Is there anything (add. parameters, etc.) that I'm >> missing that would possibly explain why the following >> code won't execute? >> -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] dumb mysql_connect issue
on 7/31/01 4:10 PM, CGI GUY at [EMAIL PROTECTED] wrote: > Is there anything (add. parameters, etc.) that I'm > missing that would possibly explain why the following > code won't execute? >in FROM table_name.column_name1,table_name.column_name2 table_name.column_name1 is a column, but "FROM" expects a table. try "select table_name.column_name1,table_name.column_name2 from table_name" -- mike cullerton -- 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] include_once vs require_once
hey folks, i'm wondering about the difference between include_once and require_once. the manual says The require_once() statement replaces itself with the specified file The include_once() statement includes and evaluates the specified file so, what is the difference? it's almost like one is a copy/paste and the other is some kind of read. is there any different behavior we should expect in scripts using one method vs another. my first guess was that require_once wouldn't evaluate the file, but i can execute code from within a file using either method. thanks, mike -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: include_once vs require_once
cool, so the difference is _when_ they happen. ok, another question then. if my script includes the line require_once($file); and $file contains the line include_once($other_file); what happens then? :) thanks, mike on 7/31/01 6:57 PM, Andrew Sterling Hanenkamp at [EMAIL PROTECTED] wrote: > Did you look at the difference between include() and require()? > Basically, as I understand it, require() and require_once() are replaced > during parsing--before code execution. And include() and include_once() > are replaced during code execution. Thus, a required file is always > imported into the file whereas an included file is only imported if the > include() statement is executed. The same is true for the _once() > versions except that the statement evaluates to nothing if the file has > already been imported by another statement. > > Cheers, > Sterling > > Mike Cullerton wrote: > >> hey folks, >> >> i'm wondering about the difference between include_once and require_once. >> the manual says >> >> The require_once() statement replaces itself with the specified file >> >> The include_once() statement includes and evaluates the specified file >> >> so, what is the difference? it's almost like one is a copy/paste and the >> other is some kind of read. is there any different behavior we should expect >> in scripts using one method vs another. >> >> my first guess was that require_once wouldn't evaluate the file, but i can >> execute code from within a file using either method. >> >> thanks, >> mike >> >> >> -- mike cullerton >> >> >> > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_SESSION_VARS
if there aren't any session vars, $HTTP_SESSION_VARS won't be an array. i use something like if(isset($HTTP_SESSION_VARS)) { reset($HTTP_SESSION_VARS); while(list($k, $v) = each($HTTP_SESSION_VARS)) { do_something($k,$v); } } on 8/1/01 11:46 AM, Jon Yaggie at [EMAIL PROTECTED] wrote: > SORRY i just coppied it wrong > the actual code is capitalized > > while(list($k, $v) = each($HTTP_SESSION_VARS)) > -- mike cullerton [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]
Re: [PHP] What would you want in a PHP web host?
people want > in a host (although I did find plenty of things they don't want :). think about what you want in support from your vendors. support is support. even monkeys can be trained. it takes someone who cares to provide good support. > I just figured that I would ask the PHP community exactly what they wanted. > Thank you for any insight that you can give me. well, not much of my knowledge is php related, but what the heck :) > > --derek -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fopen(fd, "w") doesn't work?
on 8/1/01 8:39 AM, Ibrahim Noor at [EMAIL PROTECTED] wrote: > I tried to create file by fopen(fd, "w") function, but it didn't work. > Permission Denied, server said. maybe you (the user your script is running as) don't have permission to write the file? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Fun Question - What if...
sometimes i walk aroung outside with my titanium g4 laptop with php installed and watch the dogs poop in the yard while creating a website (php based, of course) of all the pretty flowers http://bakednotfried.com on 8/1/01 1:09 PM, Philip Olson at [EMAIL PROTECTED] wrote: > > Sometimes I walk outside and wonder why the sky is blue. > > On Wed, 1 Aug 2001, Michael J. Seely wrote: > >> HI FOLKS, >> >> Imagine you had a PC Laptop, PHP installed, and a Ricochet/Sierra >> Wireless AirCard 400 - 128 kbps NIC card. >> >> What boom pow applications can you imagine setting up and running >> in this environment? What else would you need, if anything? -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] not null
on 8/1/01 12:50 PM, Jeremy Morano at [EMAIL PROTECTED] wrote: > Hi, > > When a field is declared as an integer, not null and is the primary, > how would I address it's empty set? nut sure i understand the question. if the field is NOT NULL, how could $value be empty? > > ex: if($value == ???) > { > bla > bla > bla > } > > > My condition wants there to be nothing in $value. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: issues with __sleep() and __wakeup()
cool. you and i were talking about two different things. you are using __sleep and __wakeup by issuing the serialize and unserialize commands yourself. i am using __sleep and __wakeup when php automatically issues them itself when using sessions. it is my experience that if you have an object and you register that object as a session variable, and you do _not_ have a __sleep function, then everything works fine. this is different from having a __sleep function and not returning anything (or the wrong thing) mike on 8/1/01 9:32 AM, scott [gts] at [EMAIL PROTECTED] wrote: > i added a (hopefully helpfull) addition to the > online notes regarding magic-functions: > http://www.php.net/manual/en/language.oop.magic-functions.php > > Here's what i posted, if anyone's interested: > > Here is a sample class and some test statements to > demonstrate how __sleep() is used. > > If you do not return anything from __sleep(), your > object will *not* be serialized. You must return > something from __sleep() to tell serialize what > to serialize. > > // to test the class > $x = new Scott(); > print_r($x); > $y = serialize($x); > $z = unserialize($y); > print_r($z); > > // Simple class to test __sleep() > class Scott { > // class variables > var $error; > var $svar = array(); > > // constructor > function Scott() { > $this->svar['Hello'] = "World"; > } > > function __sleep() { > $this->svar['Hello'] = "Yawn"; > // return list of instance-variables to be serialized > return array('error', 'svar'); > } > > function __wakeup() { > $this->svar['test'] = "I'm here!"; > } > > }// end class > ?> -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] SQL syntax error in PHP script. dunno what's wrong
hmmm, i am seeing the same thing as tim here. are we doing something wrong? i created a test table, entered some dummy data and then using scott's example of "'; DELETE FROM seminar; " i tried executing insert into test values (0,''; DELETE FROM test; ',1); and got this error ERROR 1064: You have an error in your SQL syntax near '' at line 1 trying other variations either caused similar errors or added rows to my table. is it possible to sneak in a command in this manner? mike on 8/2/01 2:39 AM, Tim Ward at [EMAIL PROTECTED] wrote: > I'd always understood that mysql doesn't allow multiple statements to be > submitted so this post obviously worried me. I did some tests and confirmed > that this is not a problem in MySQL queries from PHP. If I'm wrong about > this please let me know. > > Tim > > -- > From: scott [gts] [SMTP:[EMAIL PROTECTED]] > Sent: 01 August 2001 18:03 > To: php > Subject: RE: [PHP] SQL syntax error in PHP script. dunno what's > wrong > > no offense to you sam, but please dont ever simply place > single quotes around values. you have to escape the values > *themselves*. > > what if someone submitted the form field title as: > $title = "'; DELETE FROM seminar; " > > if you didn't escape the single quotes in there, it > would get interpreted as a valid DELETE statement > and your seminar table would get wiped. > > however, if you escaped $title, you'd end up setting > title to "\'; DELETE FROM SEMINAR; " > (rather than have the contents of $title interpreted > as SQL commands) > >> -Original Message- >> From: Sam Masiello [mailto:[EMAIL PROTECTED]] >> Subject: RE: [PHP] SQL syntax error in PHP script. dunno what's > wrong >> >> >> You will need to put single quotes around your variables in your > SQL >> statement. Like this: >> >> $sql = "UPDATE TABLE seminar SET >> > title='$title',speaker='$speaker',event_date='$tdate',time='$time',bldg='$bu >> ilding' >> ,rm='$room' WHERE id='$id'"; >> >> Without the quotes, SQL doesn't know that Something Amazing is > supposed to >> go together in the same string. >> >> HTH > -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What would you want in a PHP web host?
on 8/1/01 11:22 PM, Richard Lynch at [EMAIL PROTECTED] wrote: >> caveat--if there are some options that most folks would reasonably call >> 'optional' or 'dangerous', these shouldn't be expected. i am pretty new at >> programming and php, so i have no idea if things like this exist. i >> personally only compile in the options i use. > > There are like 107 PHP third-party extensions. i was really only talking about the features and packages that come with the php distribution (mysql, snmp, gd, imap, etc) i may have misunderstood the question. > > A couple are pretty new/raw, a couple are pretty defunct, and some are just > so damn esoteric or have such a small user-base as to be pointless to > install unless you really know a customer wants it... > > Anticipating what customers want can be tricky, though... :) > > You can now compile PHP and later on add in PHP Extension Modules which is > cool... I've done it with GD once, but it doesn't seem stable, or maybe I'm > doing something funky in the PHP code, as it displays one image only 20% > (ish) of the time. I'll add GD for real later, but 20% is fine for the > proof-of-concept I'm working on right now. > > Anyway, you may be able to add in new PHP extensions without re-compiling > everything, but you'll need to check up on the stability issue. this is cool to know, thanks. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Adopt A Newbie (ME)
dude, aren't you being a little harsh? > I hereby nominate Kyle as the official George W. Bush of the PHP General > mailing list. Anyone second it? to dubya, that is :) -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Phone Number #s Only?
on 8/2/01 5:32 PM, Jeff Oien at [EMAIL PROTECTED] wrote: > Is there a routine out there to strip all characters from a phone > number except the numbers? I was going to write my own but > figured there must already be one out there I can use. Thanks. > Jeff Oien ereg_replace ("[^0-9]","",$string); -- mike cullerton -- 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]