Re: [PHP] How to resolve IP with PHP
hi, i think there is a function that does just that look for gethostbyaddr($ip) in the documentation beware of the implication on the ressources , this function performs a reverse dns lookup which can be time consuming regards 21/01/2002 08:20:48, Police Trainee [EMAIL PROTECTED] wrote: Hello. Can anyone tell me how to resolve an IP into a hostname? I've tried $REMOTE_HOST but all i get back from it is the ip or blank. Is there another environmental variable i need to use or do i have to do something more complicated? thanks so much! -mark __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] File Uploading
Hello, How to upload files in a particular directory using php script in the browser itself Regards, Uma -- 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] Re: php login scripts
Depending on how secure the login information needs to be, you could just store it in a text file, maybe using password() to encrypt passwords. You could then access it using fopen() and save the contents of the file in an array. I'm not too hot on login and authentication though myself! I did get it working, there was a useful example in the PHP manual. LJ XX XX [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi. im new. i installed a login script on my site and after a few days, it stopped working. i reinstalled it and it still refused to work after a dew days. can anyone send me a good login script preferably with no MySql? im very busy atm with all my school stuff. Thanks aron _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- 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] File Uploading
On Monday 21 January 2002 10:34, Uma Shankari T. wrote: Hello, How to upload files in a particular directory using php script in the browser itself The gory details can be found in the chapter Handling File Uploads. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Love is in the offing. -- The Homicidal Maniac */ -- 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] Re: Having a problem with sessions?
Henrik Hudson wrote: SNIP _ session_start(); if (!isset($HTTP_SESSION_VARS[count])) { $HTTP_SESSION_VARS[count] = 0; } else { $HTTP_SESSION_VARS[count]++; } //Print the counter echo Counter is now: $HTTP_SESSION_VARS[count];\nbr\n; echo Let's go to another a href=\sessions.php\page/a...brbr; ___ On my box at home running PHP 4.0.6 it works great. On the work server running PHP 4.0.6 it doesn't work. Just keeps setting count to 0. SNIP I don't see any significant options here. What is your session save handlers? The only major difference that I could find in the php.ini file is that at home I have register globals off and at work they are on? Even with register globals on, you can still use the $HTTP_*_VARS, right? Yes. It's supposed to work, but could you try without register_globals? If it works without register_globals, submit bug report. -- Yasuo Ohgaki -- 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] Re: manual : Call-time pass-by-reference has been deprecated
Bruce Brackbill wrote: Hi, If Call-time pass-by-reference has deprecated so long ago, why are the instructions on how to do it still in the manual? http://www.php.net/manual/en/html/functions.arguments.html#functions.arguments.by-reference At least it should point out that it has been deprecated. Thanks for pointing it out. I've deleted the description in CVS. Next time, please submit bug report with type=Documentation problem :) -- Yasuo Ohgaki -- 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] RE: While on array?
Foreach($anotherarray as $key=$value) Tim www.chessish.com http://www.chessish.com -- From: Daniel Alsén [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 20:30 To: PHP List Subject: While on array? Hi, i am fiddling with a script and need to change a while-loop from running on mysql_fetch_array to a normal array? ie - i have: while($myrow=mysql_fetch_array($result)) { etc... But i want the loop to run with an array i created earlier ($anotherarray = [key1] = value1, [key2] = value2). How would i do that? Does the loop behave the same way - running until the array is out of data? Thanks! # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | +46 8 694 82 22 # # PGP: http://www.mindbash.com/pgp/ # -- 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-JavaScript
Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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] RE: Printing structure and data of array
Foreach($array as $key=$value) ech0($key=$valuebr); Tim www.chessish.com http://www.chessish.com -- From: Daniel Alsén [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 19:33 To: PHP List Subject: Printing structure and data of array Hi, i know i have this answered before. But i can´t find that mail in the archive. How do i print an array to see both the structure and the data within? (test = value, test2 = value2)... # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | +46 8 694 82 22 # # PGP: http://www.mindbash.com/pgp/ # -- 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] best way to approach dates
Gidday Justin, For us guys that don't get dates very often, the subject is one of intense fascination! I answered a bunch of these questions a couple of weeks back, and reproduce that discussion below. Also some comments/responses to you interspersed:- I'm looking to normalise the way in which I work with dates and times, hopefully saving myself some time and effort along the way. Currently, for, say, a news post, i'm using a MySQL DATE column (-MM-DD), but since this isn't all that good (visually) for use on a site, I find myself converting it back out to something like DD-MM-YY or DD-MM for use on the site. Not exactly hard, but it's gotta be done every time. =to ease the effort of repeated activities employ/implement a function (as you say, saves time). Fortunately PHP and SQL/MySQL provide us with plenty, out of the box. Now I find myself wanting to sort things by date (where the ID might be in the wrong order... so 2001-12-25 is listed before 2001-12-26, etc), and more importantly, comparing two dates (3 days away, 3 days ago, 3 hours ago, etc etc). =the reason many people find ISO-format dates confusing is simply that they've grown up with something else (presumably in your case dd/mm/yy). If you sit down and think about the sequence of data, running from the largest unit to the smallest, consistently, you will see that it makes good sense. These have been adopted as local/national standards in various places, eg the EU, but we still don't see them too much - guess we're still smarting from KM vs miles and KG vs pounds-weight (I'm still paying off the bill for that 1KM of sausages I ordered...) =the reason it makes good sense in a computer is because it will fulfil basic functions in both use of a date: (1) to document some date/time, and (2) to be used in basic computations. The best example I can think of is a logging function, eg OpSys tools and Apache. Take a look at the native output any of these and you'll see ISO dates left, right, and center. Other date formats will fulfill one or other of these functions, but will not compromise between both so well. =if you want to sort an ISO date column, go ahead and do it. ISO dates can be compared, just as they are: 2001-12-25 2001-12-26 = true thus Christmas Day came before Boxing Day, last year (and most other years...) =This also applies to ISO dates expressed as an integer 20011225 20011226 = true =If you want to perform calculations on ISO-dates then check out the date functions section in the MySQL manual for DATE_ADD, DATE_DIFF, etc. They will achieve your comparisons, adjustments by period of time (days), etc. =In the same way, PHP has a rich set of date calculation functions, also well covered in their manual. However these are complementary and deal in the PHP prefered date formats. =Sadly, there is no substitute for hitting the books (see advice on this below). Would I be better off using a unix timestamp for everything, then using it to: - convert to different formats - compare - sort in date order - etc etc Also, I've noticed there is a timestamp column type in MySQL... is there a way to cut down on PHP code by using MySQl alone to enter the timestamp (or date) for me? =see comments below about selecting the date format to suit the usage/purpose intended (if you don't want to spend all day converting back and forth - spending time, re-making time?). =There is no ONE right answer - that's why we've been given choices. BEWARE of the word timestamp in that a UNIX timestamp is not the same thing as a MySQL timestamp! Any other suggestions on a sensible method of implementing dates times accross many sites and many bits of code? =here they come... one of your respondents talked about doing subtraction on ISO dates. This will not work - the discussion (below) started off with this question why doesn't it work?:- RE: [PHP] counting with dates (help!) $today = date(Ymd, mktime(0,0,0, date(m),date(d),date(Y))); $last_week = date(Ymd, mktime(0,0,0, date(m),date(d)-7,date(Y))); echo ($today - $last_week); The result is a number like 8876 (20020107-20011231 = 8876) But in date thinking it should be 7! No, that's the difference in time represented by the number of seconds. You still need to work with it a little more. 8876 / 60 = number of hours /* 60 = number of seconds in an hour */ 8876 / 60 / 24 = number of days. /* 24 = number of hours in a day */ =I'm sorry but neither the above, nor the suggestion of Julian dates was correct (in all cases). The two numbers ($today and $last_week) generated in the PHP code above are in CCYYMMDD format (as used by MySQL to store dates, BTW). =So you are correct (Sander): 20020107 less 20011231 equals 8876 =but this number is meaningless. If the formulae proposed above are applied, the answer is not 7 days. =Similarly (Julian dates = CCYYDDD format) 2002007 less 2001365 equals 642 =However let's jump forward in time, to
[PHP] recursive
hi, I hv an XML tree with some elements which keep repeating.. As of now, I am able to print only the last element.. I need to make the loop recursive in order to print all the elements.. wud appreciate any help.. TIA, sands like this: app_info app_id001/app_id app_nameWORD/app_name app_info app_id002/app_id app_nameexcel/app_name /app_info app_info app_id003/app_id app_namePPt/app_name /app_info /app_info app_info app_id004/app_id app_nameZIP/app_name /app_info -- 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] Protect your code
Hi! Using the method to build a html-page from png s you can in a way make it inconviniant for the user to reuse the html-code. The problem is that the textquality is not very good and my host doesn´t have support for gif with fontfiles. I wonder if there is any other way to put text on your page, something like: $string = include (textmaker.php3?text=testword); I am trying to build blanks for use as a memberservice and want it difficult to reuse my code. Any tips? Thanks in advance Regards, Jan - filename=index.php ? $head = img src=\imgtext.php3?text=testtextleft=340c3=0textsize=5imheight=20\ width=750 height=20br; echo $head; ? --- filename=imgtext.php3 ?php $im = @ImageCreate (750, $imheight) or die (Cannot Initialize new GD image stream); $background_color = ImageColorAllocate ($im, 255, 255, 255); $black = ImageColorAllocate ($im, 0, 0, $c3); ImageString ($im, $textsize, $left, 5, $text, $black); ImagePng ($im); ? -- Jan Grafström Lillemans Hus AB Bredsäter 2091 87010 Älandsbro 0611-60920 070-6409073 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
php-general Digest 21 Jan 2002 11:40:12 -0000 Issue 1124
php-general Digest 21 Jan 2002 11:40:12 - Issue 1124 Topics (messages 81296 through 81346): Re: Edit program 81296 by: B. van Ouwerkerk 81298 by: Richard Baskett 81299 by: bvr 81322 by: David Robley best way to approach dates 81297 by: Justin French 81300 by: Martin Towell 81342 by: DL Neil Re: PHP-JavaScript 81301 by: Bruce BrackBill 81312 by: Andrew V. Romero 81325 by: Martin Towell 81340 by: Tim Ward Re: Variable referencing/substitution 81302 by: Martin Towell Re: Confusing Problem 81303 by: Martin Towell PHP/XML gap? 81304 by: Emile Bosch 'include' anchors 81305 by: Phil Schwarzmann 81306 by: Emile Bosch 81309 by: Bogdan Stancescu Re: Opening more than one database at a time? 81307 by: Miles Thompson 81310 by: Jeff Lewis Re: While on array? 81308 by: Bogdan Stancescu 81339 by: Tim Ward Re: mailing list manager 81311 by: Emile Bosch PHP to another language 81313 by: Andrew V. Romero 81316 by: Peter J. Schoenster 81326 by: Martin Towell Re: agh - what am I doing wrong - regular expressions 81314 by: Martin Towell php.ini and mail() 81315 by: Kancha . Cookies w/PHP as CGI Binary, possible? 81317 by: Kurtiigeek Give people a break! 81318 by: Alex Dowgailenko Re: eval() 81319 by: Alex Dowgailenko 81320 by: Rasmus Lerdorf 81321 by: Alex Dowgailenko Code logic problem pulling data from a file / for loop / by array_push 81323 by: Larry Brown Re: textarea 81324 by: David Robley insert select image in mySQL 81327 by: Rio Uniwaly 81329 by: Alex Dowgailenko Having a problem with sessions, Part Deux. 81328 by: Henrik Hudson Just something some people mind find useful 81330 by: Alex Dowgailenko How to resolve IP with PHP 81331 by: Police Trainee 81332 by: Austin Gonyou 81333 by: gaouzief File Uploading 81334 by: Uma Shankari T. 81336 by: Jason Wong 81343 by: J.F.Kishor Re: php login scripts 81335 by: LaserJetter Re: Having a problem with sessions? 81337 by: Yasuo Ohgaki Re: manual : Call-time pass-by-reference has been deprecated 81338 by: Yasuo Ohgaki Re: Printing structure and data of array 81341 by: Tim Ward How to call Calling Non-Existing function 81344 by: S. Murali Krishna recursive 81345 by: Sandeep Murphy Protect your code 81346 by: Jan Grafström Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Plesae forgive me for asking and OT question. Can you please recommend an edit program, (Freely downloadable). Search the archive.. this really is a FAQ. Bye, B. ---End Message--- ---BeginMessage--- Wait.. I thought that was a Frequently Asked Question? *grin* Check out http://marc.theaimsgroup.com/?l=php-general and do a search for editors and you'll find several strings regarding that topic. Cheers! Rick It is very nearly impossible . . . to become an educated person in a country so distrustful of the independent mind. - James Baldwin From: B. van Ouwerkerk [EMAIL PROTECTED] Date: Mon, 21 Jan 2002 00:33:18 +0100 To: [EMAIL PROTECTED] Subject: Re: [PHP] Edit program Plesae forgive me for asking and OT question. Can you please recommend an edit program, (Freely downloadable). Search the archive.. this really is a FAQ. Bye, B. -- 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] ---End Message--- ---BeginMessage--- Or go to download.com, search for 'PHP' Sort list by 'number of downloads'. bvr. Plesae forgive me for asking and OT question. Can you please recommend an edit program, (Freely downloadable). ---End Message--- ---BeginMessage--- [EMAIL PROTECTED] (Mehmet Kamil Erisen) wrote in [EMAIL PROTECTED]:">news:[EMAIL PROTECTED]: Dear List member, Plesae forgive me for asking and OT question. Can you please recommend an edit program, (Freely downloadable). Thanks, Search your local PHP mirror for 'editor'; there is a link to a page listing a lot of editors for both Windows and *nix. ---End Message--- ---BeginMessage--- Hi all, I'm looking to normalise the way in which I work with dates and times, hopefully saving myself some time and effort along the way. Currently, for, say, a news post, i'm using a MySQL DATE column (-MM-DD), but since this isn't all that good (visually) for use on a
Re: [PHP] How to call Calling Non-Existing function
Not sure this is exactly what you need but try this: @Draw_Table() or default_func(); Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[EMAIL PROTECTED] - Original Message - From: S. Murali Krishna [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Sent: Monday, January 21, 2002 1:17 PM Subject: [PHP] How to call Calling Non-Existing function Hi PHP Experts, Is there any way to call a non-existent or undeclared function and redirect the call to someother function by knowing its non-existense. Is there any try() and catch() idea or any configurations, or may be either error handler like thing. for example if I call a function 'Draw_Table()' without declaring like this Draw_Table(); it should know the non-existense of Draw_Table() and redirect to 'default_func' function default_func() { } Note: Perl programmers please recollect 'AUTOLOAD' Method of a package. C++,Java programmers please recollect exception handling. Thanks in Advance. S.Murali Krishna [EMAIL PROTECTED] = We grow slow trying to be great - E. Stanley Jones - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Can't include for higher level directory in php4.1.1
Sorry if this is a newbie question, but I haven't followed the development of 4.1. All my previous code.. I've been able to do this: /index.php /general /content /content/index.php where under content I could include images from a higher level directory like this in content/index.php: include(../general/something.php); or include(/general/something.php); I assume that this in php.ini, but the includes line looks the same. How can continue to have the same behaviour as in 4.0.6 where I could include from other directories above the current one. If it's documented.. a pointer to the doc would be fine. -- 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] File Uploading
Try this: ?php copy($PHP_UPLOADED_FILE_NAME,$DOCUMENT_ROOT.$REQUEST_URI); ? - Original Message - From: Uma Shankari T. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 3:34 AM Subject: [PHP] File Uploading Hello, How to upload files in a particular directory using php script in the browser itself Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Printout paper
Hello, How we find out how many printout pages taken by each user using php script? Regards, Uma -- 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] File Uploading
Hello, When i upload the file it is updating only in the document root directory.It is not updated in some other directory except the root directory.why is it so? Any one tell me the solution for this? Regards, Uma -- 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] File Uploading
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 14:24 * Uma Shankari T. said Hello, When i upload the file it is updating only in the document root directory.It is not updated in some other directory except the root directory.why is it so? Any one tell me the solution for this? Not saying I can help but a little code snippet would give me a fighting chance ;) - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TBfTHpvrrTa6L5oRAtgHAJ97Jl0D4dsfYMzUBewZv7NVYPG30ACgmy5z EQiAEqMJ1BOlHhW1dMzBREw= =8fqH -END PGP SIGNATURE- -- 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] News story with image - help
I guess you must all be getting very bored with this type of question..but away.. I have recently put together a simple news section which allows admin people to add, edit and delete stories from the site...I would like to add the function of adding an image to a story...I have managed to use the upload image script ok but can't work out how to link the image to the story ID. Is there any examples or does anyone have any suggestions? Thanks for reading this. Cheers Will -- 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] Integer in PHP
Hi, I'm new in PHP, coming from JavaScript. In JavaScript you had the function parseInt which was really useful. For example parseInt(2.05) will return 2... How can I do that in PHP ? Thanks. Jerry -- 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] File Uploading
On Monday 21 January 2002 21:17, Uma Shankari T. wrote: Hello, When i upload the file it is updating only in the document root directory.It is not updated in some other directory except the root directory.why is it so? Any one tell me the solution for this? The general procedure for dealing with uploaded files is: 1) Uploaded file is saved in a temp directory (defined in php.ini) under a temp name. 2) Get the temp name and the actual name (see manual). 3) Move the temp file to its final destination. The final destination directory must be writable by the 'user' running the webserver. hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The human race has one really effective weapon, and that is laughter. -- Mark Twain */ -- 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] News story with image - help
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 14:32 * Will Hives said I guess you must all be getting very bored with this type of question..but away.. I have recently put together a simple news section which allows admin people to add, edit and delete stories from the site...I would like to add the function of adding an image to a story...I have managed to use the upload image script ok but can't work out how to link the image to the story ID. When you say link it, what would be the purpose? If you have many stories and many pictures that's one thing but if it's not so many then that is another. Presuming your id's are the keys to the database then perhaps you could re-name the image to include that key? (I have no idea off hand how to do this but I'm sure it's relatively simple) - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TBlGHpvrrTa6L5oRAg/QAJ9Ust0H/IB6jqkipGY89rG+NVxvWQCcC20Q 1aZ/0iT5Knwy6G0e0hhiRmk= =Zmne -END PGP SIGNATURE- -- 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] Integer in PHP
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 14:34 * Jerry said Hi, I'm new in PHP, coming from JavaScript. In JavaScript you had the function parseInt which was really useful. For example parseInt(2.05) will return 2... How can I do that in PHP ? Look up round() in the manuall. www.php.net - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TBmHHpvrrTa6L5oRAk0ZAKCN3zyYJQUosL82hj0I7ZL9dgI8dQCfVo+S alX53aP+WyfMN8In1yxliwo= =JlOa -END PGP SIGNATURE- -- 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] Integer in PHP
intval (2.05); Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[EMAIL PROTECTED] - Original Message - From: Jerry [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 3:35 PM Subject: [PHP] Integer in PHP Hi, I'm new in PHP, coming from JavaScript. In JavaScript you had the function parseInt which was really useful. For example parseInt(2.05) will return 2... How can I do that in PHP ? Thanks. Jerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] News story with image - help
in article [EMAIL PROTECTED], Nick Wilson at [EMAIL PROTECTED] wrote on 1/21/2002 1:36 PM: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 14:32 * Will Hives said I guess you must all be getting very bored with this type of question..but away.. I have recently put together a simple news section which allows admin people to add, edit and delete stories from the site...I would like to add the function of adding an image to a story...I have managed to use the upload image script ok but can't work out how to link the image to the story ID. When you say link it, what would be the purpose? If you have many stories and many pictures that's one thing but if it's not so many then that is another. Presuming your id's are the keys to the database then perhaps you could re-name the image to include that key? (I have no idea off hand how to do this but I'm sure it's relatively simple) Sorry when I say link I mean that the story has an image with it so when the story header is clicked it shows the full story with imagedoes that make any sense? Will - -- Nick Wilson Tel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TBlGHpvrrTa6L5oRAg/QAJ9Ust0H/IB6jqkipGY89rG+NVxvWQCcC20Q 1aZ/0iT5Knwy6G0e0hhiRmk= =Zmne -END PGP SIGNATURE- -- 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] News story with image - help
* On 21-01-02 at 14:46 * Will Hives said I guess you must all be getting very bored with this type of question..but away.. I have recently put together a simple news section which allows admin people to add, edit and delete stories from the site...I would like to add the function of adding an image to a story...I have managed to use the upload image script ok but can't work out how to link the image to the story ID. When you say link it, what would be the purpose? If you have many stories and many pictures that's one thing but if it's not so many then that is another. Presuming your id's are the keys to the database then perhaps you could re-name the image to include that key? (I have no idea off hand how to do this but I'm sure it's relatively simple) Sorry when I say link I mean that the story has an image with it so when the story header is clicked it shows the full story with imagedoes that make any sense? Well, the way I've done it is to make the image URL a field in the story database. Very simple and effective. (have scarf+coat on back in ½hr) -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com msg46819/pgp0.pgp Description: PGP signature
[PHP] Re: Having a problem with sessions, Part Deux.
Hello i had the same problem with horde (apache and php 4.1.1) (tried with apache 1.3.19, 1.3.20 and 1.3.22) i tried with session.use_cookies=0 in the php.ini and now it's correct, perhaps a cookie's management bug ? jean-david Arzur Henrik Hudson wrote: Just FYI. I posted the forwarded question earlier, but did some more testing. I was doing some testing tonight when server traffic was low (ie: stop / restart Apache) and I found out that when register_globals is On, the below code doesn't work. Is this something to do with the EGPCS and how variables are inherited? When register_globals is off, the code works great. Could someone explain why that is? That'd be great :) I would have thought that you can still access the HTTP_SESSION_VARS even if globals is on? Thanks. Henrik On Sunday 20 January 2002 15:12, Henrik Hudson wrote: Hey List- Banging my head again the wall with this one. One of our developers was trying to get some session stuff to work and he couldn't and asked me to look into it. I have a script that contains the following (the sessions.php href reference is the same script accept it calls this one): _ session_start(); if (!isset($HTTP_SESSION_VARS[count])) { $HTTP_SESSION_VARS[count] = 0; } else { $HTTP_SESSION_VARS[count]++; } //Print the counter echo Counter is now: $HTTP_SESSION_VARS[count];\nbr\n; echo Let's go to another a href=\sessions.php\page/a...brbr; ___ On my box at home running PHP 4.0.6 it works great. On the work server running PHP 4.0.6 it doesn't work. Just keeps setting count to 0. The work box is running Apache 1.3.20 with the following compile options: './configure' '--with-apxs' '--with-config-file-path=/etc/php' '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' '--with-pspell' '--enable-ftp' '--enable-gd' '--with-imap' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr/local/mysql' The home box is running Apache 1.3.22 with the following compile options: './configure' '--with-apxs' '--with-config-file-path=/etc/php' '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' '--with-mysql=/usr/local/mysql' '--with-mcrypt' '--with-mhash' '--disable-xml' '--enable-ftp' '--with-gettext' '--with-pspell' '--enable-inline-optimization' The only major difference that I could find in the php.ini file is that at home I have register globals off and at work they are on? Even with register globals on, you can still use the $HTTP_*_VARS, right? The sessionID cookie is getting put into my browser, I checked so the session is starting correctly, just not retaining the variable. Any ideas anyone? Thanks list. Henrik -- 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] Having a problem with sessions, Part Deux.
Henrik, Which session handler are you using? Files, mm, User? Jaime Bozza -Original Message- From: Henrik Hudson [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 20, 2002 11:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Having a problem with sessions, Part Deux. Just FYI. I posted the forwarded question earlier, but did some more testing. I was doing some testing tonight when server traffic was low (ie: stop / restart Apache) and I found out that when register_globals is On, the below code doesn't work. Is this something to do with the EGPCS and how variables are inherited? When register_globals is off, the code works great. Could someone explain why that is? That'd be great :) I would have thought that you can still access the HTTP_SESSION_VARS even if globals is on? Thanks. Henrik On Sunday 20 January 2002 15:12, Henrik Hudson wrote: Hey List- Banging my head again the wall with this one. One of our developers was trying to get some session stuff to work and he couldn't and asked me to look into it. I have a script that contains the following (the sessions.php href reference is the same script accept it calls this one): _ session_start(); if (!isset($HTTP_SESSION_VARS[count])) { $HTTP_SESSION_VARS[count] = 0; } else { $HTTP_SESSION_VARS[count]++; } //Print the counter echo Counter is now: $HTTP_SESSION_VARS[count];\nbr\n; echo Let's go to another a href=\sessions.php\page/a...brbr; ___ On my box at home running PHP 4.0.6 it works great. On the work server running PHP 4.0.6 it doesn't work. Just keeps setting count to 0. The work box is running Apache 1.3.20 with the following compile options: './configure' '--with-apxs' '--with-config-file-path=/etc/php' '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' '--with-pspell' '--enable-ftp' '--enable-gd' '--with-imap' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr/local/mysql' The home box is running Apache 1.3.22 with the following compile options: './configure' '--with-apxs' '--with-config-file-path=/etc/php' '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' '--with-mysql=/usr/local/mysql' '--with-mcrypt' '--with-mhash' '--disable-xml' '--enable-ftp' '--with-gettext' '--with-pspell' '--enable-inline-optimization' The only major difference that I could find in the php.ini file is that at home I have register globals off and at work they are on? Even with register globals on, you can still use the $HTTP_*_VARS, right? The sessionID cookie is getting put into my browser, I checked so the session is starting correctly, just not retaining the variable. Any ideas anyone? Thanks list. Henrik -- Henrik Hudson [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] -- 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] RE: recursive
I'm not quite sure what you're having difficulty with, but this is, in principle, like mapping a file system structure ... which I do like this: function sitemap($path) { if ($dhandle = opendir($path)) { echo(ul); while ($file_name = readdir($dhandle)) { if ($file_name == . or $file_name == ..) continue; echo(li$file_name/li); if (is_dir($path$file_name)) sitemap($path$file_name/); } closedir($dhandle); echo(/ul); } } // end of fn sitemap this shows the general principle, if you're already getting the top level okay you should be able to use this sort of thing to get the rest Tim www.chessish.com http://www.chessish.com -- From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]] Sent: 21 January 2002 11:27 To: [EMAIL PROTECTED] Subject: recursive hi, I hv an XML tree with some elements which keep repeating.. As of now, I am able to print only the last element.. I need to make the loop recursive in order to print all the elements.. wud appreciate any help.. TIA, sands like this: app_info app_id001/app_id app_nameWORD/app_name app_info app_id002/app_id app_nameexcel/app_name /app_info app_info app_id003/app_id app_namePPt/app_name /app_info /app_info app_info app_id004/app_id app_nameZIP/app_name /app_info -- 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] on-line athletic training log
Check hotscripts, google, etc. Check phpauction - there is a remarkable similarity: here is an item (training schedule) and inputs which apply to it (results) (results) (results) Miles Thompson At 09:36 AM 1/21/2002 -0500, Brian V Bonini wrote: I need to build an on-line training log where a coach can enter training routines for specific athletes and atheltes can retrieve their training and log their daily results. Has anyone ever done/started a project along these line? Has anyone seen somethign like this done in PHP? Has anyone seen something similar that could be hacked up and altered to suit my needs? Just figured I'd ask around before I do this from scratch and re-invent the wheel... -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How should I cache database data for php?
Hello, I have a PHP content management application that I've developed. I'm looking to add data caching to it so the database doesn't get pounded all day long, the content on the site changes slowly, once or twice a day. Does anyone know of where I can look to find an application that does this? I've searched and have yet to find anything that does the same kind of thing. I'll take anything, a module or library that does it, or even some other application that does the same thing that I can look at. Ideally I think it would be cool if it would be a PEAR module that the application connects to just like the database, and it manages chaches and querying the database for data in the module. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.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] How should I cache database data for php?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 16:25 * Jeff Bearer said Hello, I have a PHP content management application that I've developed. I'm looking to add data caching to it so the database doesn't get pounded all day long, the content on the site changes slowly, once or twice a day. On that basis caching may not be ideal, certainly not a 'home grown' solution and especially if the db is really going to take a 'pounding' all day. Does anyone know of where I can look to find an application that does this? I've searched and have yet to find anything that does the same kind of thing. I'll take anything, a module or library that does it, or even some other application that does the same thing that I can look at. I think Zend do something that you should look at. www.zend.com (I think it's called 'Zend Cache') - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDQSHpvrrTa6L5oRAsZsAJ0VyUEa9VjUJwS8PMXNnzFPoSwS5ACfambv Cm6HdGnCZeorW+yXIivdgdg= =mJJW -END PGP SIGNATURE- -- 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] Re: password=password('$password') ----- ? help me... :P
Try this: $query = SELECT username,password FROM users WHERE username=\.$username.\ AND password=\.password($password).\; MySQL needs all string data wrapped in quotes. Maybe the backslashes are a bit confusing at first, but its worth taking the time to understand them. Robert V. Zwink http://www.zwink.net/daid.php -Original Message- From: LaserJetter [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 19, 2002 3:43 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: password=password('$password') - ? help me... :P Forget that last post - sorry!!! Instead of using password('$password') in the query string, I would insert a line before connecting to the DB: $newpass = password($password)-- dont need quotes round here then $query = SELECT username,password FROM users WHERE username=$username AND password=$newpass; As $username and $newpass are already inside double quotes you dont need to put them in again!! LJ Hawk [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I've been trying to get this to work for a while, and everyone says that I should use the same thing, but it doesn't work, can anyone tell me what I'm doing wrong? from the form on the previous page I have the $username and $password vars mysql_connect($host, $user, $pswd); mysql_select_db($db); $query = SELECT username,password FROM users WHERE username='$username' AND password=password('$password'); $result = mysql_query($query); $num = mysql_num_rows($result); the $query line is made up from what everyone has told me to write.. I tried to add a list($usarname, $pessword) = mysql_fetch_row($result); and it returned .. but when I removed the AND password=password('$password') part the list showed the username and the password in encrypted form I don't know how this could help me in any way, but atleast it shows I have an encrypted password, but the problem is that the line everyone uses doesn't work.. maybe I need to change some setting in mysql och php.ini or something? anyone have any idea? I know I've asked this several times but it doesn't seem like I'm understood with my problem. Hope I will be now. Hawk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] It Worked! Re: agh - what am I doing wrong - regular expressions
Dear Martin, it worked!! Thank you SO much! - Shawna -Original Message- From: Martin Towell To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Sent: 1/20/02 10:25 PM Subject: RE: [PHP] agh - what am I doing wrong - regular expressions try this... I changed 1. the double quotes in $pattern = ... to single quotes 2. escaped the ? 3. used ereg_replace to do everything, dropping the while loop $content = http://www.globalhealth.org/text.php3?id=151 http://www.globalhealth.org/text.php3?id=151 adjfladjfajdfkladfjl;kadjf jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj; $pattern = ' http://( http://( [\/~_\.0-9A-Za-z#=-\?]+)'; $content = ereg_replace($pattern, A HREF=\javascript:externalURL('\\1');\\\1/A, $content); print $content; -Original Message- From: [EMAIL PROTECTED] [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Monday, January 21, 2002 2:46 AM To: [EMAIL PROTECTED] Subject: [PHP] agh - what am I doing wrong - regular expressions Good morning everyone, I'm trying to adapt existing php code that uses a while loop to scan content for a url pattern, take the matches and add link tags (a) around them so the url with be made into hot links. Simple enough right? Nevertheless, I seem to be having trouble with urls that have question marks in them. Here is the existing code that works - except with question marks: $content = http://www.globalhealth.org/text.php3?id=151 http://www.globalhealth.org/text.php3?id=151 adjfladjfajdfkladfjl;kadjf jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj; $pattern = http://( http://( [\/~_\.0-9A-Za-z#=-]+); while(ereg($pattern, $content, $match)){ $http_old = $match[0]; $http = dubdubdub . $match[1] . $match[2]; $url = A HREF=\javascript:externalURL('$http')\;$http/A; $content = ereg_replace($http_old, $url, $content); }; $content = ereg_replace(dubdubdub, http:// http:// , $content); print $content; ** Here's the same code with the question mark in the pattern variable. When I add the question mark and test the page, my browsers just hang. Escaping the question mark doesn't seem to help (and I also read that escapes aren't necessary between square brackets]: $content = http://www.globalhealth.org/text.php3?id=151 http://www.globalhealth.org/text.php3?id=151 adjfladjfajdfkladfjl;kadjf jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj; $pattern = http://( http://( [\/~_\.0-9A-Za-z#=?-]+); while(ereg($pattern, $content, $match)){ $http_old = $match[0]; $http = dubdubdub . $match[1] . $match[2]; $url = A HREF=\javascript:externalURL('$http')\;$http/A; $content = ereg_replace($http_old, $url, $content); }; $content = ereg_replace(dubdubdub, http:// http:// , $content); print $content; * In an attempt to find the problem, I did a test with the following code and received the result I want - which leads me to believe the problem is possibly with the while loop or the ereg_replace?? $content = http://www.globalhealth.org/text.php3?id=151 http://www.globalhealth.org/text.php3?id=151 adjfladjfajdfkladfjl;kadjf jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj; $pattern = http://( http://( [/~_.0-9A-Za-z#=?-]+); ereg($pattern, $content, $match); print A HREF=\javascript:externalURL('$match[0]')\;$match[0]/A; ** I'm completely confused. I have a feeling there is any easy answer and if I wasn't so frustrated I'd be embarrassed to say that I've spent hours on this... Thanks in advance for your help, Shawna -- PHP General Mailing List ( http://www.php.net/ http://www.php.net/ ) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP vs Java reliability
Hi folks Just putting together a brochure for a product authored in PHP, and making the case for LAMP (Linux/Apache/MySQL/PHP) as a platform, in a market where most competitors are Java based. I recently spoke to a very experienced sysadmin at an ISP who said they always recommend LAMP over Java because even after extensive tuning they had never got their Java servelet/bean platform as reliable as their PHP and Perl setups on both shared and dedicated servers. Has anyone else on the list got experience of this? Is PHP notably more reliable than Java in production situations? Geoff Caplan Advantae Ltd -- 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] Having a poblem with the mail() function
The thing is when i run this script which seems allright to me atleast, it always fails, Can anyone even guess what the problem might be? The webserver is running a php 4.1, SunOS 5.7, Apache, and sendmail which is required for the mail() function if I'm right? Thanks David $address = [EMAIL PROTECTED]; $subject = Test; $body = test; if(mail($address, $subject, $body)) { echo(Success); } else { echo(Didn't work); } Davíð Örn Jóhannssson Vefforritari Atómstöðin hf. Garðastræti 37 101 Reykjavík sími: 595-3643 fax: 595-3649 [EMAIL PROTECTED] http://www.atom.is
[PHP] Php login scripts using PHP4.01, Apache3.01 CGI on W2K
Hi, am looking for good samples scripts for authentication, but I am using the CGI version of Apache. However could be a good way for make authentication using some file or database as the source for the login name and so on. Please let me know if you know where exists a good samples scripts for that. Greetings!! Atte. Ignacio Estrada F. Centro Nacional de Control de Energia Area de Control Occidental 025+6463, 025+6464, 025+6469 -- 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] Having a poblem with the mail() function
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 16:41 * David Orn Johannsson said The thing is when i run this script which seems allright to me atleast, it always fails, Can anyone even guess what the problem might be? The webserver is running a php 4.1, SunOS 5.7, Apache, and sendmail which is required for the mail() function if I'm right? $address = [EMAIL PROTECTED]; $subject = Test; $body = test; if(mail($address, $subject, $body)) { echo(Success); } else { echo(yDidn't work); } So what happens when you run it? Is it printing Didn't work or giving some other error? - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDdgHpvrrTa6L5oRAjkZAJ4qVYZruzwFGJ0rsoqsd4QuICAdRACff9Ii cMDV6kmrE0xDXQdsCC/3nHM= =x2a8 -END PGP SIGNATURE- -- 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 should I cache database data for php?
On Mon, 2002-01-21 at 10:30, Nick Wilson wrote: I have a PHP content management application that I've developed. I'm looking to add data caching to it so the database doesn't get pounded all day long, the content on the site changes slowly, once or twice a day. On that basis caching may not be ideal, certainly not a 'home grown' solution and especially if the db is really going to take a 'pounding' all day. How so? the whole idea of caching the data is so the database stops taking the pounding. Does anyone know of where I can look to find an application that does this? I've searched and have yet to find anything that does the same kind of thing. I'll take anything, a module or library that does it, or even some other application that does the same thing that I can look at. I think Zend do something that you should look at. www.zend.com (I think it's called 'Zend Cache') APC (Alternitive PHP Cache) and afaik Zend Cache don't cache the database data, they cache the execution instructions of PHP code so the PHP intrepreter doesn't have to recompile the code every time, but if there is a query it still queries the DB every time. I've experienced this first hand with APC. At first I thought it would cache the entire PHP output, which would include the data, not just the execution instructions. But I was wrong. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.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] Having a poblem with the mail() function
It simply prints out Didn't work or fails the if statement, no errormsg or nothing, the page executes fine but the mail function is the enly thing that fails to execute. -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED]] Sent: 21. janúar 2002 15:45 To: [EMAIL PROTECTED] Subject: Re: [PHP] Having a poblem with the mail() function -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 16:41 * David Orn Johannsson said The thing is when i run this script which seems allright to me atleast, it always fails, Can anyone even guess what the problem might be? The webserver is running a php 4.1, SunOS 5.7, Apache, and sendmail which is required for the mail() function if I'm right? $address = [EMAIL PROTECTED]; $subject = Test; $body = test; if(mail($address, $subject, $body)) { echo(Success); } else { echo(yDidn't work); } So what happens when you run it? Is it printing Didn't work or giving some other error? - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDdgHpvrrTa6L5oRAjkZAJ4qVYZruzwFGJ0rsoqsd4QuICAdRACff9Ii cMDV6kmrE0xDXQdsCC/3nHM= =x2a8 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP-JavaScript
Unfortunately, that won't work if the value of the JS variable needs to change dynamically based on user interaction; document.write() only works as the page is loaded (well... MSIE might be different, but writing MSIE-only code is a bad practice). The best bet is to use an input field; input fields can change dynamically, and the value can be captured using JS's DOM. But there is absolutely no way around the fact that to send a JS variable to a PHP script, you must send that variable back to the server via POST or GET. Tim Ward wrote: Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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 should I cache database data for php?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 16:47 * Jeff Bearer said On Mon, 2002-01-21 at 10:30, Nick Wilson wrote: I have a PHP content management application that I've developed. I'm looking to add data caching to it so the database doesn't get pounded all day long, the content on the site changes slowly, once or twice a day. On that basis caching may not be ideal, certainly not a 'home grown' solution and especially if the db is really going to take a 'pounding' all day. How so? the whole idea of caching the data is so the database stops taking the pounding. Well, if you're caching but having your content updated twice a day wouldn't you be better off letting the db take the strain? I don't see how else you are going to make sure people are seeing the latest content as opposed to cached pages that are out of date. Let your db do the work, that's what it's for :) One of the 'home grown' solutions I saw was to 404 page to trigger the creation of a static html page made from the results of the first query on the db. The problems I saw though were: What about browser compat issues and what a pain that would be to have to wipe the 'cached' static dir every time you updated your content. It seemed well suited to articles that wouldn't alter much over time though. (I think the piece was on www.devshed.com) - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDtzHpvrrTa6L5oRAu+rAJ0bArR4ohvbvCE4kC6DzqtMe3CvRQCfbBHl Sqy+StTmXNzDgHwZ7PabIH0= =xj8f -END PGP SIGNATURE- -- 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] Having a poblem with the mail() function
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 16:54 * David Orn Johannsson said $address = [EMAIL PROTECTED]; $subject = Test; $body = test; if(mail($address, $subject, $body)) { echo(Success); } else { echo(yDidn't work); } So what happens when you run it? Is it printing Didn't work or giving some other error? It simply prints out Didn't work or fails the if statement, no errormsg or nothing, the page executes fine but the mail function is the enly thing that fails to execute. In that case I reckon you need to start scouring that php.ini and find the bit that gives the Sendmail path. As far as I remember php counts it a success when it delivers the instructions to Sendmail regardless of what SM does with it. So. I don't think you're reaching SM and that's why it's failing. HTH. Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDxvHpvrrTa6L5oRAnRsAJ41oN9tO/N6U2wXA4J8F6CbQcSN0wCeLrbd f1GSi8jpRBsaFJPk2xTJbjU= =GgTv -END PGP SIGNATURE- -- 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 should I cache database data for php?
Well, if you're caching but having your content updated twice a day wouldn't you be better off letting the db take the strain? I don't see how else you are going to make sure people are seeing the latest content as opposed to cached pages that are out of date. Let your db do the work, that's what it's for :) But at 300,000 page views a day, even if the caches only have a ttl of 1 hour I'm still saving over %90 of the traffic from having to query the database. During our busy times I have a bottle neck with the database maxing out the CPU's, so If I can cut the queries the server won't be working as hard, plus file I/O is faster than Database I/O so the site will be faster even when it's not busy. One of the 'home grown' solutions I saw was to 404 page to trigger the creation of a static html page made from the results of the first query on the db. The problems I saw though were: What about browser compat issues and what a pain that would be to have to wipe the 'cached' static dir every time you updated your content. It seemed well suited to articles that wouldn't alter much over time though. (I think the piece was on www.devshed.com) OK I'll look into it,those are the kind of ideas I'm looking for, eventhough I agree, that one doesn't sound like much fun. and I'm not worried about ppl getting errors, I'm worried about them getting the page fast. now it can be slow, but no errors. - -- Nick Wilson Tel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDtzHpvrrTa6L5oRAu+rAJ0bArR4ohvbvCE4kC6DzqtMe3CvRQCfbBHl Sqy+StTmXNzDgHwZ7PabIH0= =xj8f -END PGP SIGNATURE- -- 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] -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.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] How should I cache database data for php?
But at 300,000 page views a day, even if the caches only have a ttl of 1 hour I'm still saving over %90 of the traffic from having to query the database. During our busy times I have a bottle neck with the database maxing out the CPU's, so If I can cut the queries the server won't be working as hard, plus file I/O is faster than Database I/O so the site will be faster even when it's not busy. As form the discussion i understand that you have several pages with huge views during a day. Also it seemes to me thÕ queries they produce are the same. There is a way to avoid big traffic between php - mysql. The way of doing this is to store page generated dynamically with a db query and replace php-script with saved page. You generate content dynamically, but for yourself only. Users get this page, but as a static one. The easiest way is to do it manually - copy current script to another location, execute it and save result html to former location. Nothing changes for user. The greatest way of doing this is 1. develope php-script for generating updated html from moved php-script and updating index.html (e.g. ;) 2. develope another script or program which will call the first one periodically (once an hour, e.g.) Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[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]
[PHP] Error notification and pretty error page
How can i include error notification, like if an MySQL error occurs, to notify me of the offending page and what the error was, while having the page die quietly or nicely, like an message saying that the webmaster will be notified please continue? = dan mccullough Theres no such thing as a problem unless the servers are on fire! __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- 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] Having a poblem with the mail() function
Thanks alot I'll check into the php.ini Regards, David -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED]] Sent: 21. janúar 2002 16:06 To: 'PHP-General' Subject: Re: [PHP] Having a poblem with the mail() function -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 16:54 * David Orn Johannsson said $address = [EMAIL PROTECTED]; $subject = Test; $body = test; if(mail($address, $subject, $body)) { echo(Success); } else { echo(yDidn't work); } So what happens when you run it? Is it printing Didn't work or giving some other error? It simply prints out Didn't work or fails the if statement, no errormsg or nothing, the page executes fine but the mail function is the enly thing that fails to execute. In that case I reckon you need to start scouring that php.ini and find the bit that gives the Sendmail path. As far as I remember php counts it a success when it delivers the instructions to Sendmail regardless of what SM does with it. So. I don't think you're reaching SM and that's why it's failing. HTH. Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TDxvHpvrrTa6L5oRAnRsAJ41oN9tO/N6U2wXA4J8F6CbQcSN0wCeLrbd f1GSi8jpRBsaFJPk2xTJbjU= =GgTv -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How should I cache database data for php?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 17:24 * val petruchek said The greatest way of doing this is 1. develope php-script for generating updated html from moved php-script and updating index.html (e.g. ;) 2. develope another script or program which will call the first one periodically (once an hour, e.g.) I like that. It sounds similar to the method I mentioned. What about browser detection and appropriate css generation etc? Wouldn't the output that's saved be a little *too* static? - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TEH4HpvrrTa6L5oRAmM5AJ9yVyEa5CQRslip3FMg+V8Cl/hawQCbBhAj DajZkvdVS4IFrgKQdzFWBTk= =Nlhi -END PGP SIGNATURE- -- 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] File upload
How can I, using: INPUT TYPE=\FILE\ NAME=\UPLOAD_FOTO\ SIZE=\40\ specify the file extension. I want the user only to upload *.jpg. Thanks, Danielle -- 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] Re: PHP vs Java reliability
http://www.zend.com/zend/art/php-over-java.php the Why PHP on zend.com is a great place to go for this sort of stuff... On Mon, 21 Jan 2002, Geoff Caplan wrote: Hi folks Just putting together a brochure for a product authored in PHP, and making the case for LAMP (Linux/Apache/MySQL/PHP) as a platform, in a market where most competitors are Java based. I recently spoke to a very experienced sysadmin at an ISP who said they always recommend LAMP over Java because even after extensive tuning they had never got their Java servelet/bean platform as reliable as their PHP and Perl setups on both shared and dedicated servers. Has anyone else on the list got experience of this? Is PHP notably more reliable than Java in production situations? Geoff Caplan Advantae Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Error notification and pretty error page
Hi Dan, How can i include error notification, like if an MySQL error occurs, to notify me of the offending page and what the error was, while having the page die quietly or nicely, like an message saying that the webmaster will be notified please continue? you can make a generic function to be called when such error occured. the fucntion will print a nice/default error msg to user and you can log detail information regarding the error into logfile or DB, or even send out a notification email to you. function fatal_error($msg, $file, $line) { //$msg : the to be logged //$file: name of file which trigger the error //$line: line number which trigger the error } the usage: include('lib which contain fatal_error()'); @mysql_query or fatal_error (mysql_error(), __FILE__, __LINE__); __FILE__ and __LINE__ are php predefined constant to indicate current file and line number which is being parsed/executed. you always have to pass this __FILE__ and __LINE__ because PHP dont have the ability to backtrack from which file/line a function is called :( and dont forget to add @ sign in front of the PHP's function, to surpress the error msg generated by PHP. -- Jimmy There is no greater waste as a waste of time -- 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 should I cache database data for php?
The greatest way of doing this is 1. develope php-script for generating updated html from moved php-script and updating index.html (e.g. ;) 2. develope another script or program which will call the first one periodically (once an hour, e.g.) I like that. It sounds similar to the method I mentioned. What about browser detection and appropriate css generation etc? You still can generate css depending on user_agent. Wouldn't the output that's saved be a little *too* static? Depends on certain page properties... if current time (with seconds) is printed there, it will be not 100% real, but in any other case everything depends on how often second script will update it. Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[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]
[PHP] .php unrecognizable extension
I am running Apache 1.3 on WindowsXP just for some developement stuff that I do at home. I just installed PHP to the server but I can't get it to recognize .php as an extension and to have it load those as if they were .html files. IE index.php it just shows a directory listing instead of loading the file. Can someone help me? -- 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] File upload
How can I, using: INPUT TYPE=\FILE\ NAME=\UPLOAD_FOTO\ SIZE=\40\ specify the file extension. I want the user only to upload *.jpg. You can only check $userfile_type to detect the type of uploaded file. You can specify nor extension to browse dialog neither default path for browsing... Security, you know Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[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] .php unrecognizable extension
I am running Apache 1.3 on WindowsXP just for some developement stuff that I do at home. I just installed PHP to the server but I can't get it to recognize .php as an extension and to have it load those as if they were .html files. IE index.php it just shows a directory listing instead of loading the file. Can someone help me? You need to edit httpd.conf in apache/conf Edit DirectoryIndex section Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[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] Regex error
use $rgTemp = split('[|]',$szTag); instead of $rgTemp = split(|,$szTag); on line 2 PHP List wrote: Hi, Can someone please tell me why the this is happening: 1) $szTag = test|3; 2) $rgTemp = split(|,$szTag); 3) $szTag = $rgTemp[0]; 4) $nItemID = $rgTemp[1]; ^line numbers for ref only, not in actual code. Will give me the error: PHP Warning: unexpected regex error(14) in /test.php on line 2 What is an error 14 ? Thanks, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] .php unrecognizable extension
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 17:45 * Dion said I am running Apache 1.3 on WindowsXP just for some developement stuff that I do at home. I just installed PHP to the server but I can't get it to recognize .php as an extension and to have it load those as if they were .html files. IE index.php it just shows a directory listing instead of loading the file. Can someone help me? This is a serious FAQ Try www.php.net (they have the faq there i'm sure) I'd tell you the answer but I can't remember the part of apache.conf you need edit. Good luck. - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TEfpHpvrrTa6L5oRAo6KAJ4486o0poWK+NPJCDuXBDVQCmMlggCgmE59 Fu/BHFovkyckJ0McpQquN2k= =4WY9 -END PGP SIGNATURE- -- 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] File upload
you could write a bit of JavaScript to run on the form's onSubmit event or even the fields onBlur event. Then in your JavaScript, parse out the file name and extension to validate. It's not 100% accurate since users could rename any file to have a JPG extension, but it works for the majority... At 06:41 PM 1/21/2002 +0200, val petruchek wrote: How can I, using: INPUT TYPE=\FILE\ NAME=\UPLOAD_FOTO\ SIZE=\40\ specify the file extension. I want the user only to upload *.jpg. You can only check $userfile_type to detect the type of uploaded file. You can specify nor extension to browse dialog neither default path for browsing... Security, you know Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[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] -- 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] Having a problem with sessions, Part Deux.
I am using files on both systems. The session files are also showing up on both systems. (/tmp) On Monday 21 January 2002 08:15, Jaime Bozza wrote: Henrik, Which session handler are you using? Files, mm, User? Jaime Bozza -Original Message- From: Henrik Hudson [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 20, 2002 11:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Having a problem with sessions, Part Deux. Just FYI. I posted the forwarded question earlier, but did some more testing. I was doing some testing tonight when server traffic was low (ie: stop / restart Apache) and I found out that when register_globals is On, the below code doesn't work. Is this something to do with the EGPCS and how variables are inherited? When register_globals is off, the code works great. Could someone explain why that is? That'd be great :) I would have thought that you can still access the HTTP_SESSION_VARS even if globals is on? Thanks. Henrik On Sunday 20 January 2002 15:12, Henrik Hudson wrote: Hey List- Banging my head again the wall with this one. One of our developers was trying to get some session stuff to work and he couldn't and asked me to look into it. I have a script that contains the following (the sessions.php href reference is the same script accept it calls this one): _ session_start(); if (!isset($HTTP_SESSION_VARS[count])) { $HTTP_SESSION_VARS[count] = 0; } else { $HTTP_SESSION_VARS[count]++; } //Print the counter echo Counter is now: $HTTP_SESSION_VARS[count];\nbr\n; echo Let's go to another a href=\sessions.php\page/a...brbr; ___ On my box at home running PHP 4.0.6 it works great. On the work server running PHP 4.0.6 it doesn't work. Just keeps setting count to 0. The work box is running Apache 1.3.20 with the following compile options: './configure' '--with-apxs' '--with-config-file-path=/etc/php' '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' '--with-pspell' '--enable-ftp' '--enable-gd' '--with-imap' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr/local/mysql' The home box is running Apache 1.3.22 with the following compile options: './configure' '--with-apxs' '--with-config-file-path=/etc/php' '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' '--with-mysql=/usr/local/mysql' '--with-mcrypt' '--with-mhash' '--disable-xml' '--enable-ftp' '--with-gettext' '--with-pspell' '--enable-inline-optimization' The only major difference that I could find in the php.ini file is that at home I have register globals off and at work they are on? Even with register globals on, you can still use the $HTTP_*_VARS, right? The sessionID cookie is getting put into my browser, I checked so the session is starting correctly, just not retaining the variable. Any ideas anyone? Thanks list. Henrik -- Henrik Hudson [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] How should I cache database data for php?
The greatest way of doing this is 1. develope php-script for generating updated html from moved php-script and updating index.html (e.g. ;) 2. develope another script or program which will call the first one periodically (once an hour, e.g.) I like that. It sounds similar to the method I mentioned. What about browser detection and appropriate css generation etc? Wouldn't the output that's saved be a little *too* static? Since reading your first post I've been racking my brains/teasing my memory. I'm sure there's an article on one of the popular PHP sites that talks about exactly this: creating a web page dynamically, but serving it as static HTML (ie with no back-end db access per serving). Suggest you check out DevShed etc. Regards, =dn -- 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-JavaScript
hence my qualification, but you can alter the contents of elements using javascript on the fly, using the innerHTML property, for example. Tim www.chessish.com -Original Message- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 21 January 2002 15:59 To: Tim Ward Cc: Mårten Andersson; [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript Unfortunately, that won't work if the value of the JS variable needs to change dynamically based on user interaction; document.write() only works as the page is loaded (well... MSIE might be different, but writing MSIE-only code is a bad practice). The best bet is to use an input field; input fields can change dynamically, and the value can be captured using JS's DOM. But there is absolutely no way around the fact that to send a JS variable to a PHP script, you must send that variable back to the server via POST or GET. Tim Ward wrote: Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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] PHP cross referencer
Is anyone aware if such a debugging/documentation tool exists? What is/do I mean by a cross referencer? A tool which will list all of the variables (and function names ?and include files) used within a program/script, together with the line number(s) where they are mentioned - hopefully differentiating where the value is referenced from where it is updated, etc. Such is handy for debugging, picking up upper/lower case naming inconsistencies, etc. Please advise, =dn -- 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-JavaScript
Yes, but only in MSIE. As far as I know, no other browser supports the innerHTML property; at least, I have never managed to get it to work in Netscape, Mozilla, Konquerer, or Opera. And I stand firmly behind my earlier statement that developing code that bombs on non-MSIE browsers is a bad practice. This is why I didn't recommend use of the innerHTML property. :) Tim Ward wrote: hence my qualification, but you can alter the contents of elements using javascript on the fly, using the innerHTML property, for example. Tim www.chessish.com -Original Message- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 21 January 2002 15:59 To: Tim Ward Cc: Mårten Andersson; [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript Unfortunately, that won't work if the value of the JS variable needs to change dynamically based on user interaction; document.write() only works as the page is loaded (well... MSIE might be different, but writing MSIE-only code is a bad practice). The best bet is to use an input field; input fields can change dynamically, and the value can be captured using JS's DOM. But there is absolutely no way around the fact that to send a JS variable to a PHP script, you must send that variable back to the server via POST or GET. Tim Ward wrote: Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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 should I cache database data for php?
Since reading your first post I've been racking my brains/teasing my memory. I'm sure there's an article on one of the popular PHP sites that talks about exactly this: creating a web page dynamically, but serving it as static HTML (ie with no back-end db access per serving). This idea came to me after September 11 - many news sites were down because of too many visitors. Some of them refused from dynamic page generation to survive, because huge amounts of visitors looked like hacker attack. In any case this is obvious solution of a problem ;) Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[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] File upload
The official way to do this would be using the accept attribute: accept = content-type-list [CI] This attribute specifies a comma-separated list of content types that a server processing this form will handle correctly. User agents may use this information to filter out non-conforming files when prompting a user to select files to be sent to the server (cf. the INPUT element when type=file). For example, INPUT TYPE=\FILE\ NAME=\UPLOAD_FOTO\ SIZE=\40\ ACCEPT=\image/jpeg\ Unfortunately this is usually unreliably implemented in user agents, so you should find a different solution as suggested by others. Bogdan Danielle van Gladbach wrote: How can I, using: INPUT TYPE=\FILE\ NAME=\UPLOAD_FOTO\ SIZE=\40\ specify the file extension. I want the user only to upload *.jpg. Thanks, Danielle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How should I cache database data for php?
Are you sure that cacheing database data is the right way to approach the problem? How about using a cron job to write static HTML pages from live data? You could set up such a system to run every few hours or so. I haven't done that in PHP, but it's something I'm looking at doing for a Perl project I'm working on. It seems to me that the major problem with news sites such as cnn.com or msnbc.com on dates like 9/11 was the sheer number of visitors coming to the site. No matter how the pages were served up, the load was unbearable for the servers. val petruchek wrote: Since reading your first post I've been racking my brains/teasing my memory. I'm sure there's an article on one of the popular PHP sites that talks about exactly this: creating a web page dynamically, but serving it as static HTML (ie with no back-end db access per serving). This idea came to me after September 11 - many news sites were down because of too many visitors. Some of them refused from dynamic page generation to survive, because huge amounts of visitors looked like hacker attack. In any case this is obvious solution of a problem ;) Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[EMAIL PROTECTED] -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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: Programming a state controller for page transitions
Check out phorum's source, I find it very well-documented and educational. I can't imagine how a collaborative effort can work with obfuscated source... On Saturday, January 19, 2002, at 05:03 AM, Geoff Caplan wrote: Some authors compound the problem by using cryptic variable names, though your variable names are very clear. It seems to me that both the author and the user benefit when code is easy to read: the user is much more likely to read the code to learn new ideas and techniques, and the author is much more likely to get bugfixes and contributions from the users. -- 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] associative arrays..help!
Hi, This is a long one so pl bear with me... I have an XML structure as follows: app_info app_id001/app_id app_nameWORD/app_name app_info //SUB APPLICATION app_id002/app_id app_nameexcel/app_name /app_info app_info app_id003/app_id app_namePPt/app_name /app_info /app_info app_info app_id004/app_id app_nameZIP/app_name /app_info Where there are sub elements of main elements... When I print the array contents, they are printed as Array ( [0] = DEMO_XML [1] = XML Output [2] = DEMODemo [3] = DEMO_AUTH [4] = XML Auth ) and so on whereas I need to make them as Array( [0] [APP] DEMO XML [SUB_APP] XML OUTPUT How can I achieve this?? any suggestions please My for loop reads like this: for($y_aux=0; $y_auxsizeof($nodes_aux); $y_aux++) { $this-appid[] = $nodes_aux[$y_aux]-content; print pre; print_r ($this-appid).br; print /pre; } TIA, sands -- 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 should I cache database data for php?
Even with straight HTML, a server's load capacity is not infinite. If my own server, an old Pentium with 4 GB of hard drive space, and which serves nothing but static HTML pages, got hit with more than a couple hundred hits in a short period of time, it would bomb. I must be misunderstanding your question. I've re-read your original post, and it seems to me that what you're trying to do is save webpage-bound database data in a way which will seriously reduce the load on a webserver; creating static HTML pages from database data instead of building pages dynamically when the user calls them would accomplish that goal, and that is what I was suggesting. val petruchek wrote: It seems to me that the major problem with news sites such as cnn.com or msnbc.com on dates like 9/11 was the sheer number of visitors coming to the site. No matter how the pages were served up, the load was unbearable for the servers. You see, giving user static or dynamic pages differs a lot. Just send html or generate it before with php is not the same. Valentin Petruchek (aki Zliy Pes) http://zliypes.com.ua mailto:[EMAIL PROTECTED] -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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] Error notification and pretty error page
Create a function like error_handling() in it have it do echo We're sorry, we are currently experiencing technical difficulties blah blah blah and have it email you whatever mysql_error() says. then do: mysql_query(SELECT whatever FROM whatever) or die(error_handling()); -Original Message- From: Dan McCullough [mailto:[EMAIL PROTECTED]] Sent: January 21, 2002 11:22 AM To: PHP General List Subject: [PHP] Error notification and pretty error page How can i include error notification, like if an MySQL error occurs, to notify me of the offending page and what the error was, while having the page die quietly or nicely, like an message saying that the webmaster will be notified please continue? = dan mccullough Theres no such thing as a problem unless the servers are on fire! __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How should I cache database data for php?
Even with straight HTML, a server's load capacity is not infinite. If my own server, an old Pentium with 4 GB of hard drive space, and which serves nothing but static HTML pages, got hit with more than a couple hundred hits in a short period of time, it would bomb. I must be misunderstanding your question. I've re-read your original post, and it seems to me that what you're trying to do is save webpage-bound database data in a way which will seriously reduce the load on a webserver; creating static HTML pages from database data instead of building pages dynamically when the user calls them would accomplish that goal, and that is what I was suggesting. You are right ;) Valentin Petruchek (aki Zliy Pes) *** Cut the beginning *** http://zliypes.com.ua mailto:[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]
[PHP] ftp functions
disclamer Before I get flamed for not reading the manual or trying on my own, I would just like to say that I have been working on this for a few days and have read the manual and looked at quite a few examples, all of which seem to elude me. /disclamer I want to upload an image, and I want to use the ftp function to do so. I want to use the ftp functions for two reasons, (1) I have not used them yet, and (2) I will be loading an array with a list of files to be uploaded and I think the ftp functions are better suited for this (as opposed to the copy function). On to the trouble I can connect just fine. ? $ftp_server = xx.xx.xxx.xx; $ftp_user_name = username; $ftp_user_pass = password; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo Ftp connection has failed!br; echo Attempted to connect to $ftp_server for user $ftp_user_namebr; die; } else { echo Connected to $ftp_server, for user $ftp_user_namebr; } //The file, even if I write the path out on my own, does not upload eventually I will have the path put in from a form. // upload the file $destination_file = /public_html/valeriemacwilliam/pics/$SID_.jpg; //(I have tried this without the beginning slash as well) $source_file = C:\\temp\\prestigecars\\bk_jag.jpg; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo Ftp upload has failed!br; } else { echo Uploaded $source_file to $ftp_server as $destination_filebr; } //Even the ftp_close(function fails and causes an error); // close the FTP stream ftp_close($conn_id); ? Are the ftp functions depreciated? I have taken this example directly from the manual and editted the values to reflect my own situation but none of the function calls have been editted. Usually when this is the case I have just over looked something VERY simple and easy, please take a look and see what you can come up with. I would even be happy with an FAQ, I have been through the one on PHP.NET with no joy \C: PHP is the lastest release running on Mandrake 8.1 (w / plenty of horsepower) Thank you for your time. ~Curt~ -- 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] Tracking users...
I am fairly new to PHP and have setup a site that connects to a MySQL db to store different information from our users, however what I would like to setup is something that I could place on a few pages to track users for demographic purposes. What I need to do is as a page is visited I need to generate a random alpha numeric identifier to be used as a session variable for a cookie and also have that cookie's information be placed into a MySQL database for later retrieval. If anyone has a good resource tutorial on this type of function I would greatly appriciate it. Oh and yes I have done quite a bit of research on php.net on both the session() and the setcookie() functions. =) Thanks again. Jas -- 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] ftp functions
one problem, the ftp functions that you are trying to use are on the server. therefor you are trying to connect one server to another server. you are not connecting from your workstation to the remote server. for what you are attempting to do, ftp will not work. Jim Lucas - Original Message - From: sundogcurt [EMAIL PROTECTED] To: GENERAL PHP LIST [EMAIL PROTECTED] Sent: Monday, January 21, 2002 10:47 AM Subject: [PHP] ftp functions disclamer Before I get flamed for not reading the manual or trying on my own, I would just like to say that I have been working on this for a few days and have read the manual and looked at quite a few examples, all of which seem to elude me. /disclamer I want to upload an image, and I want to use the ftp function to do so. I want to use the ftp functions for two reasons, (1) I have not used them yet, and (2) I will be loading an array with a list of files to be uploaded and I think the ftp functions are better suited for this (as opposed to the copy function). On to the trouble I can connect just fine. ? $ftp_server = xx.xx.xxx.xx; $ftp_user_name = username; $ftp_user_pass = password; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo Ftp connection has failed!br; echo Attempted to connect to $ftp_server for user $ftp_user_namebr; die; } else { echo Connected to $ftp_server, for user $ftp_user_namebr; } //The file, even if I write the path out on my own, does not upload eventually I will have the path put in from a form. // upload the file $destination_file = /public_html/valeriemacwilliam/pics/$SID_.jpg; //(I have tried this without the beginning slash as well) $source_file = C:\\temp\\prestigecars\\bk_jag.jpg; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo Ftp upload has failed!br; } else { echo Uploaded $source_file to $ftp_server as $destination_filebr; } //Even the ftp_close(function fails and causes an error); // close the FTP stream ftp_close($conn_id); ? Are the ftp functions depreciated? I have taken this example directly from the manual and editted the values to reflect my own situation but none of the function calls have been editted. Usually when this is the case I have just over looked something VERY simple and easy, please take a look and see what you can come up with. I would even be happy with an FAQ, I have been through the one on PHP.NET with no joy \C: PHP is the lastest release running on Mandrake 8.1 (w / plenty of horsepower) Thank you for your time. ~Curt~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Tracking users...
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 19:58 * jas said I am fairly new to PHP and have setup a site that connects to a MySQL db to store different information from our users, however what I would like to setup is something that I could place on a few pages to track users for demographic purposes. What I need to do is as a page is visited I need to generate a random alpha numeric identifier to be used as a session variable for a cookie and also have that cookie's information be placed into a MySQL database for later retrieval. If anyone has a good resource tutorial on this type of function I would greatly appriciate it. Oh and yes I have done quite a bit of research on php.net on both the session() and the setcookie() functions. =) Thanks again. Jas There is *loads* of stuff on this topic all over the Internet. Have you done a search? Try www.phpbuilder.com www.zend.com www.devshed.com - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TGayHpvrrTa6L5oRAgb5AKCryTN82ryNP7skPLgNJXlR0t3lqQCeMOFc KlqCr9/zCnW6cLVzTM0Zzm4= =1R8f -END PGP SIGNATURE- -- 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] Best way to get the remote IP address?
I'm trying to get the remote IP address of a user in a (PHP) version and server-software independant way, but am having a few problems. Obviously, I've seen $HTTP_SERVER_VARS['REMOTE_ADDR'], but Ive also seen references to $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']. Is there any generic solution to this problem (and if so, what is it?) Cheers -- Alan McFarlane [EMAIL PROTECTED] ICQ: 20787656 -- 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: Programming a state controller for page transitions
Erik I can't imagine how a collaborative effort can work with obfuscated source... Nor can I, but it is surprising how often I download code that is pretty much unreadable. I think a lot of people who try to get projects going just don't think this through, and then wonder why they don't get much response... Personally, I would have thought that it is worth taking to trouble to make any non-trivial code readable before open sourcing - after all, you never know what might grow from it. Even PHP itself started as a modest personal project Geoff Caplan Advantae Ltd -- 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] when 1+1 is not equal to 2... STRANGE float behavior
I understand the issues about binary precision for floating point numbers on standard base 2 systems but I'm unsure of the propper way to fix this problem. Here is the base test case: ? $contract_amount = 9961.00; $bill1 = .95; $bill2 = .05; $billable_this_month += ($contract_amount * $bill1); $paid_to_date += ($contract_amount * $bill2); echoconditional: if(($paid_to_date + $billable_this_month) = $contract_amount)\nbr\n; if(($paid_to_date + $billable_this_month) = $contract_amount) { echotrue; } else { echofalse; } ? This is mostly a cut and paste of a problem that I am trying to fix for a client for a particular record which is coming out of the database and not evaluating like I want it to. you would expect (498.05 + 9462.95) to be equal to 9961.00 . In the case of this problem, all variables in question are of type double at time of comparison. ideas? I tried casting to various different types without success. I'd prefer not to round if at all possible... Thanks! -- - Marc Swanson MSwanson Consulting Phone: (603)868-1721 Fax:(603)868-1730 Mobile: (603)512-1267 [EMAIL PROTECTED] http://www.mswanson.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] While on array?
ie - i have: while($myrow=mysql_fetch_array($result)) { etc... But i want the loop to run with an array i created earlier ($anotherarray = [key1] = value1, [key2] = value2). use foreach($anotherarray as $key = $value) { . A Nawroth -- 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 should I cache database data for php?
Even with straight HTML, a server's load capacity is not infinite. If my own server, an old Pentium with 4 GB of hard drive space, and which serves nothing but static HTML pages, got hit with more than a couple hundred hits in a short period of time, it would bomb. I must be misunderstanding your question. I've re-read your original post, and it seems to me that what you're trying to do is save webpage-bound database data in a way which will seriously reduce the load on a webserver; creating static HTML pages from database data instead of building pages dynamically when the user calls them would accomplish that goal, and that is what I was suggesting. You are right ;) er, yes and no! Jeff's original post mentioned reducing load on the db server - are the db and web servers on the same physical device - and thus his concern? - or perhaps if there are other apps needing to 'compete' with the web server to gain access to the db concurrently? =dn -- 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] when 1+1 is not equal to 2... STRANGE float behavior
Answered my own question... rounding using the round function to two decimal places did the trick: ? $contract_amount = 9961.00; $bill1 = .95; $bill2 = .05; $billable_this_month += ($contract_amount * $bill1); $paid_to_date += ($contract_amount * $bill2); $paid_to_date = round($paid_to_date,2); $billable_this_month = round($billable_this_month,2); $contract_amount = round($contract_amount,2); echoconditional: if(($paid_to_date + $billable_this_month) = $contract_amount)\nbr\n; if(($paid_to_date + $billable_this_month) = $contract_amount) { echotrue; } else { echofalse; } ? now outputs true. :-) -- - Marc Swanson MSwanson Consulting Phone: (603)868-1721 Fax:(603)868-1730 Mobile: (603)512-1267 [EMAIL PROTECTED] http://www.mswanson.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] ftp functions
Would you suggest that I use the copy function instead? I have tried the copy function in a prelim test and I had trouble with the function finding the file on the local machine. From what I have seen in the FAQs on PHPBUILDER and this is not an uncommon problem. One possible solution was that the path to the file to be uploaded must be relative to the location of the script. This doesn't make much sense to me though seeing as the file to be uploaded is on the local machine and the script on the remote machine. I'm drowning here, anybody have a rope? [EMAIL PROTECTED] wrote: one problem, the ftp functions that you are trying to use are on the server. therefor you are trying to connect one server to another server. you are not connecting from your workstation to the remote server. for what you are attempting to do, ftp will not work. Jim Lucas - Original Message - From: sundogcurt [EMAIL PROTECTED] To: GENERAL PHP LIST [EMAIL PROTECTED] Sent: Monday, January 21, 2002 10:47 AM Subject: [PHP] ftp functions disclamer Before I get flamed for not reading the manual or trying on my own, I would just like to say that I have been working on this for a few days and have read the manual and looked at quite a few examples, all of which seem to elude me. /disclamer I want to upload an image, and I want to use the ftp function to do so. I want to use the ftp functions for two reasons, (1) I have not used them yet, and (2) I will be loading an array with a list of files to be uploaded and I think the ftp functions are better suited for this (as opposed to the copy function). On to the trouble I can connect just fine. ? $ftp_server = xx.xx.xxx.xx; $ftp_user_name = username; $ftp_user_pass = password; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo Ftp connection has failed!br; echo Attempted to connect to $ftp_server for user $ftp_user_namebr; die; } else { echo Connected to $ftp_server, for user $ftp_user_namebr; } //The file, even if I write the path out on my own, does not upload eventually I will have the path put in from a form. // upload the file $destination_file = /public_html/valeriemacwilliam/pics/$SID_.jpg; //(I have tried this without the beginning slash as well) $source_file = C:\\temp\\prestigecars\\bk_jag.jpg; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo Ftp upload has failed!br; } else { echo Uploaded $source_file to $ftp_server as $destination_filebr; } //Even the ftp_close(function fails and causes an error); // close the FTP stream ftp_close($conn_id); ? Are the ftp functions depreciated? I have taken this example directly from the manual and editted the values to reflect my own situation but none of the function calls have been editted. Usually when this is the case I have just over looked something VERY simple and easy, please take a look and see what you can come up with. I would even be happy with an FAQ, I have been through the one on PHP.NET with no joy \C: PHP is the lastest release running on Mandrake 8.1 (w / plenty of horsepower) Thank you for your time. ~Curt~ -- 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 should I cache database data for php?
DL Neil wrote: Even with straight HTML, a server's load capacity is not infinite. If my own server, an old Pentium with 4 GB of hard drive space, and which serves nothing but static HTML pages, got hit with more than a couple hundred hits in a short period of time, it would bomb. I must be misunderstanding your question. I've re-read your original post, and it seems to me that what you're trying to do is save webpage-bound database data in a way which will seriously reduce the load on a webserver; creating static HTML pages from database data instead of building pages dynamically when the user calls them would accomplish that goal, and that is what I was suggesting. You are right ;) er, yes and no! Jeff's original post mentioned reducing load on the db server - are the db and web servers on the same physical device - and thus his concern? - or perhaps if there are other apps needing to 'compete' with the web server to gain access to the db concurrently? =dn In which case, it seems to me that my solution would still be a good one. Reducing the number of hits on the database server by building static pages as needed to be served up by a web server would still reduce the load on the database server. -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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] ok, I ask again.. how to encrypt to be able to match database info?
I've asked this several times but it doesn't seem like anyone understands my problem, the passwords are encrypted in the database, but I don't know how to match an unencrypted password from the login form with the database? is it possible to encrypt the password I sent from the form in php or does that have to be done in mysql? in any case, how do I do it? If you don't have anything bright to say, don't, in some of the replys I've had earlier it sounds like you think I'm an idiot... And even if I am, I don't want to be refered as one ;) -- 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] Index.PHP won't load like Index.HTML
I finally got PHP running on Apache in WinXP. I can execute PHP and all that, but I can't get it to open in index.php file like it would open an index.html file.. ie, first file it looks for in a new directory is index.xxx but it won't open the PHP file... Anyone tell me what i need to change?... BTW, i added the extensions in the httpd.conf file. Any ideas?!?! Please help. -- 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] Index.PHP won't load like Index.HTML
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 21-01-02 at 20:44 * Dion said I finally got PHP running on Apache in WinXP. I can execute PHP and all that, but I can't get it to open in index.php file like it would open an index.html file.. ie, first file it looks for in a new directory is index.xxx but it won't open the PHP file... Anyone tell me what i need to change?... BTW, i added the extensions in the httpd.conf file. Any ideas?!?! Please help. This is a serious FAQ Please check the FAQ on www.php.net - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8THAhHpvrrTa6L5oRAn/SAJwMRV1LsRvP1LE2so5QiGtxmQpnrQCgnaTz jTVaXIhISlQnVywELe0im2A= =q1JC -END PGP SIGNATURE- -- 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] ok, I ask again.. how to encrypt to be able to match database info?
what kind of encryption are you talking about? If you mean mysql's password() function, then no you can't do that in php. obviously whatever you use has to match the original encryption. - Mark On Mon, 21 Jan 2002 20:36:59 +0100, Hawk wrote: I've asked this several times but it doesn't seem like anyone understands my problem, the passwords are encrypted in the database, but I don't know how to match an unencrypted password from the login form with the database? is it possible to encrypt the password I sent from the form in php or does that have to be done in mysql? in any case, how do I do it? If you don't have anything bright to say, don't, in some of the replys I've had earlier it sounds like you think I'm an idiot... And even if I am, I don't want to be refered as one ;) -- 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] ok, I ask again.. how to encrypt to be able to matchdatabase info?
On Mon, 21 Jan 2002, Hawk wrote: I've asked this several times but it doesn't seem like anyone understands my problem, the passwords are encrypted in the database, but I don't know how to match an unencrypted password from the login form with the database? is it possible to encrypt the password I sent from the form in php or does that have to be done in mysql? in any case, how do I do it? If you don't have anything bright to say, don't, in some of the replys I've had earlier it sounds like you think I'm an idiot... And even if I am, I don't want to be refered as one ;) How you had encrypted your password? with MySQL 'password' function? if yes, try: select user, ... from table where user = $user and passwd = password($passwd) I think you get the idea :) hope this helps, Antonio. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Antonio S. Martins Jr. - System Analist | Only The Shadow Knows | | WorldNet Internet Maringa - PR - Brasil | what evil lurks in the | | E-Mail: [EMAIL PROTECTED] | Heart of Men! | | [EMAIL PROTECTED] | !!! Linux User: 52392 !!! | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ This e-mail message is 100% Microsoft free! /\ \ / CAMPANHA DA FITA ASCII - CONTRA MAIL HTML X ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL / \ -- 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] Connection to MySQL with SSL.
Hi, if a MySQL server is compiled with SSL support (that's for the 4 series), is it possible to use this secure connection from a PHP script (with mysql_connect)?. Thank you. -- 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] Nobody know nothing about? Php login scripts using PHP4.01, Apache3.01CGI on W2K
Atte. Ignacio Estrada F. Centro Nacional de Control de Energia Area de Control Occidental 025+6463, 025+6464, 025+6469 ignacio.estrada@ cfe.gob.mx Para: [EMAIL PROTECTED] cc: 01/21/2002 09:34Asunto: [PHP] Php login scripts using PHP4.01, Apache3.01 CGI on W2K Hi, am looking for good samples scripts for authentication, but I am using the CGI version of Apache. However could be a good way for make authentication using some file or database as the source for the login name and so on. Please let me know if you know where exists a good samples scripts for that. Greetings!! Atte. Ignacio Estrada F. Centro Nacional de Control de Energia Area de Control Occidental 025+6463, 025+6464, 025+6469 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How should I cache database data for php?
Even with straight HTML, a server's load capacity is not infinite. If my own server, an old Pentium with 4 GB of hard drive space, and which serves nothing but static HTML pages, got hit with more than a couple hundred hits in a short period of time, it would bomb. I must be misunderstanding your question. I've re-read your original post, and it seems to me that what you're trying to do is save webpage-bound database data in a way which will seriously reduce the load on a webserver; creating static HTML pages from database data instead of building pages dynamically when the user calls them would accomplish that goal, and that is what I was suggesting. You are right ;) er, yes and no! Jeff's original post mentioned reducing load on the db server - are the db and web servers on the same physical device - and thus his concern? - or perhaps if there are other apps needing to 'compete' with the web server to gain access to the db concurrently? In which case, it seems to me that my solution would still be a good one. Reducing the number of hits on the database server by building static pages as needed to be served up by a web server would still reduce the load on the database server. I thought we were basically agreeing - should I be arguing with you? Depending upon how far Jeff wants/needs to go, he can either reduce/remove database traffic (only) by 'locking in' the retrieved data (articles) - either as they are written/approved/whatever or on the first occasion a web-request is received; or he can do that and go to the next step - generate static HTML pages and thus remove the necessity to run browser requests through PHP as well, ie reduce his web service load to Apache only. Personally I would presume the second to be 'best', but I don't know all the facts. For example, we can't say that dynamic db load will be driven to 'zero' because there might still be a need for user authentication... Good idea! =dn -- 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] Best way to get the remote IP address?
I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP documentation from January 2001, so you should probably best stick with either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use $REMOTE_ADDR in functions make sure you do a global on it first) - I personally use $REMOTE_ADDR, but you should read the docs for details... Bogdan Alan McFarlane wrote: I'm trying to get the remote IP address of a user in a (PHP) version and server-software independant way, but am having a few problems. Obviously, I've seen $HTTP_SERVER_VARS['REMOTE_ADDR'], but Ive also seen references to $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']. Is there any generic solution to this problem (and if so, what is it?) Cheers -- Alan McFarlane [EMAIL PROTECTED] ICQ: 20787656 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP documentation from January 2001, so you should probably best stick with either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use $REMOTE_ADDR in functions make sure you do a global on it first) - I personally use $REMOTE_ADDR, but you should read the docs for details... That's because it's probably not so much a PHP thing. X-Forwarded-For is normally used when going through a proxy. Say my internal IP is 192.168.1.15, and my proxy's official IP address is 132.248.10.2, then we'd have this: REMOTE_ADDR=132.248.10.2 X_FORWARDED_FOR=192.168.1.15 That way, even when going through a proxy, there's information about who originally submitted the request. -- 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 should I cache database data for php?
DN, Yes the db server and the webserver are on the same box, local connections are much faster than network ones according to mysql. When the site is busy the percent of the system being used by mysql and that being used by PHP/Apache, I estemate would be around 90%-10% so if I get the db load down I'll have smooth sailing. I'm not attempting to elimate the compalition of PHP, I just want to eliminate some database queries. I don't particually care for the idea if writing static html files. I've had really bad experiences with stale files our old system. The way I'm exploring now is to build a caching layer between the php application and mysql. I want the app to query the caching layer just about the same way it queries the database, but add a few other details, time to live, cache name etc. The caching layer will check to see if the query is cached, make sure it's not expired, and return the data just like a result set from the db query. If it is expired, or doesn't exist then it will query and create the cache file for next time. I'm leaning toward storing the data in XML, and kicking around the idea of storing it on a ram disk so it would have killer fast access time. I expected to get tons of links to libraries or other apps that have data caching, I'm quite supprised that I haven't yet. On Mon, 2002-01-21 at 14:20, DL Neil wrote: Jeff's original post mentioned reducing load on the db server - are the db and web servers on the same physical device - and thus his concern? - or perhaps if there are other apps needing to 'compete' with the web server to gain access to the db concurrently? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.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] ftp functions
the copy() function is subject to the same problem that the ftp functions are. you are trying to call a function that is on the remote server and you want it to do things to the local machine. unfortunatly you cannot do this. through a web browser you have no direct access to the local client machine. Jim - Original Message - From: sundogcurt [EMAIL PROTECTED] To: GENERAL PHP LIST [EMAIL PROTECTED] Sent: Monday, January 21, 2002 11:34 AM Subject: Re: [PHP] ftp functions Would you suggest that I use the copy function instead? I have tried the copy function in a prelim test and I had trouble with the function finding the file on the local machine. From what I have seen in the FAQs on PHPBUILDER and this is not an uncommon problem. One possible solution was that the path to the file to be uploaded must be relative to the location of the script. This doesn't make much sense to me though seeing as the file to be uploaded is on the local machine and the script on the remote machine. I'm drowning here, anybody have a rope? [EMAIL PROTECTED] wrote: one problem, the ftp functions that you are trying to use are on the server. therefor you are trying to connect one server to another server. you are not connecting from your workstation to the remote server. for what you are attempting to do, ftp will not work. Jim Lucas - Original Message - From: sundogcurt [EMAIL PROTECTED] To: GENERAL PHP LIST [EMAIL PROTECTED] Sent: Monday, January 21, 2002 10:47 AM Subject: [PHP] ftp functions disclamer Before I get flamed for not reading the manual or trying on my own, I would just like to say that I have been working on this for a few days and have read the manual and looked at quite a few examples, all of which seem to elude me. /disclamer I want to upload an image, and I want to use the ftp function to do so. I want to use the ftp functions for two reasons, (1) I have not used them yet, and (2) I will be loading an array with a list of files to be uploaded and I think the ftp functions are better suited for this (as opposed to the copy function). On to the trouble I can connect just fine. ? $ftp_server = xx.xx.xxx.xx; $ftp_user_name = username; $ftp_user_pass = password; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo Ftp connection has failed!br; echo Attempted to connect to $ftp_server for user $ftp_user_namebr; die; } else { echo Connected to $ftp_server, for user $ftp_user_namebr; } //The file, even if I write the path out on my own, does not upload eventually I will have the path put in from a form. // upload the file $destination_file = /public_html/valeriemacwilliam/pics/$SID_.jpg; //(I have tried this without the beginning slash as well) $source_file = C:\\temp\\prestigecars\\bk_jag.jpg; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo Ftp upload has failed!br; } else { echo Uploaded $source_file to $ftp_server as $destination_filebr; } //Even the ftp_close(function fails and causes an error); // close the FTP stream ftp_close($conn_id); ? Are the ftp functions depreciated? I have taken this example directly from the manual and editted the values to reflect my own situation but none of the function calls have been editted. Usually when this is the case I have just over looked something VERY simple and easy, please take a look and see what you can come up with. I would even be happy with an FAQ, I have been through the one on PHP.NET with no joy \C: PHP is the lastest release running on Mandrake 8.1 (w / plenty of horsepower) Thank you for your time. ~Curt~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] foreach array into mail isn´t working
Hello people, I got this script: ? $maildb = file(mailaddr.txt); foreach ($maildb as $address) { mail($address, THis is the subject\n, This is the message\n, From: [EMAIL PROTECTED]\n); } ? The mailaddr.txt looks like: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] However the script does send mails BUT they look like this: From Nobody [EMAIL PROTECTED] To [EMAIL PROTECTED] Subject [No Subject] **From here down is the message body*** Subject THis is the subject From: [EMAIL PROTECTED] This is the message Anybody have an idea why?? I tried it on 2 servers running PHP4 doesnt work, however i also tried using the mail(...) i used up there but alone and that does work.. so the array is screwing something up.. Josepablo Pérez -- 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 should I cache database data for php?
Jeff, Seeing Richard thinks I have blue (?blood) in (my) veins, I'd better respond nobly and quickly... Yes the db server and the webserver are on the same box, local connections are much faster than network ones according to mysql. When the site is busy the percent of the system being used by mysql and that being used by PHP/Apache, I estemate would be around 90%-10% so if I get the db load down I'll have smooth sailing. =sounds like a plan - unless you simply up the h/w and/or performance... (but you'll have thought of that one first) I'm not attempting to elimate the compalition of PHP, I just want to eliminate some database queries. I don't particually care for the idea if writing static html files. I've had really bad experiences with stale files our old system. =I'm intrigued. Surely rendering the pages as db-less='static' PHP is going to be just as much work as preparing them as HTML (with the attendant performance improvement). =Before we got into three-level systems, static stale pages were a real problem as soon as volumes got 'up there'. However you will be generating the static pages (whether in HTML or PHP) from a database back-end. Thus it would be simple to catalog each 'view' (can I call them that seeing MySQL doesn't offer db views at the moment) in the self-same db, together with an expiry date-time. As new 'views' are being generated the db back-end can also order the termination of expired/stale views - you yourself talk about TTL below, all I'm doing is suggesting moving it 'forward' to view-creation time! The way I'm exploring now is to build a caching layer between the php application and mysql. I want the app to query the caching layer just about the same way it queries the database, but add a few other details, time to live, cache name etc. The caching layer will check to see if the query is cached, make sure it's not expired, and return the data just like a result set from the db query. If it is expired, or doesn't exist then it will query and create the cache file for next time. I'm leaning toward storing the data in XML, and kicking around the idea of storing it on a ram disk so it would have killer fast access time. =isn't one of the criteria of using RAM disks, space requirement minimisation (he says getting the theme firmly between his teeth...) =yes it would require less storage to hold the data, than to hold the entire HTML page - but what do the percentage figures really look like. =It sounds like a good idea to me - although XML is not exactly storage-friendly. I expected to get tons of links to libraries or other apps that have data caching, I'm quite supprised that I haven't yet. =sorry, I wish I could remember where I saw that article. =dn -- 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] foreach array into mail isn´t working
Josepablo, ? $maildb = file(mailaddr.txt); foreach ($maildb as $address) { mail($address, THis is the subject\n, This is the message\n, From: [EMAIL PROTECTED]\n); } ? The mailaddr.txt looks like: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] However the script does send mails BUT they look like this: From Nobody [EMAIL PROTECTED] To [EMAIL PROTECTED] Subject [No Subject] **From here down is the message body*** Subject THis is the subject From: [EMAIL PROTECTED] This is the message Anybody have an idea why?? I tried it on 2 servers running PHP4 doesnt work, however i also tried using the mail(...) i used up there but alone and that does work.. so the array is screwing something up.. =which operating system are you using? =what does your web server have as its admin mail address? =have you tried running without the \n at the end of each field? =dn -- 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] ok, I ask again.. how to encrypt to be able to match database info?
whichever way the original password was encrypted, encrypt the incoming password the same way, ie. if the original was encrypted in php, encrypt the incoming password in php before passing it to the sql statement, similarly if the original password was encrypted using mysql. Martin -Original Message- From: Antonio S. Martins Jr. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 22, 2002 6:47 AM To: Hawk Cc: [EMAIL PROTECTED] Subject: Re: [PHP] ok, I ask again.. how to encrypt to be able to match database info? On Mon, 21 Jan 2002, Hawk wrote: I've asked this several times but it doesn't seem like anyone understands my problem, the passwords are encrypted in the database, but I don't know how to match an unencrypted password from the login form with the database? is it possible to encrypt the password I sent from the form in php or does that have to be done in mysql? in any case, how do I do it? If you don't have anything bright to say, don't, in some of the replys I've had earlier it sounds like you think I'm an idiot... And even if I am, I don't want to be refered as one ;) How you had encrypted your password? with MySQL 'password' function? if yes, try: select user, ... from table where user = $user and passwd = password($passwd) I think you get the idea :) hope this helps, Antonio. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Antonio S. Martins Jr. - System Analist | Only The Shadow Knows | | WorldNet Internet Maringa - PR - Brasil | what evil lurks in the | | E-Mail: [EMAIL PROTECTED] | Heart of Men! | | [EMAIL PROTECTED] | !!! Linux User: 52392 !!! | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ This e-mail message is 100% Microsoft free! /\ \ / CAMPANHA DA FITA ASCII - CONTRA MAIL HTML X ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL / \ -- 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]