Re: [PHP] Stop neurotic posting
hardly. I've answered questions on this list that I thought the answer could be easily found on google or php.net. Even more so, there are questions on this list that are CLEARLY this is what I need, can you give me code. That is silly. What people should be asking is, I can't find the answer to this question, can you point me in the right direction. That doesn't happen, however. Are you a developer, or not? Learn, figure it out, ask for guidance, but don't ask for someone to answer question like give me code or i have this idea, will it work, even though i didn't bother to even test or research it. I'm sorry, but I have no pity for the lazy. There is a difference between someone who is new looking for direction to the answer and someone who relies on this list to simply provide it without them doing any work themselves. So, go ahead and call me an elitist. That's fine. I'll just continue to Read The Fucking Manual. [EMAIL PROTECTED] wrote: what a silly elitist view you have perhaps there should be two lists (novice and advanced), and the advanced listed shouldn't answer questions if it's considered trivial enough for the novice list to answer. Curt Zirzow wrote: * Thus wrote andu ([EMAIL PROTECTED]): This is a very busy list, over 100 message in a quiet day and most people are helpful and decent, don't mind reading and learning. Unfortunately there are some who mostly post stuff like 'read the manual' and other shit like that. Stuffing e-mailboxes with such garbage day after day doesn't do anybody any good even if the manual is not being read as much as it should Yes it is a busy list, I have 1000+ messages for 7 days worth. I'm not sure the noisyness of the list is entirely on the ones that are helping. There does seem to be a problem of people posting questions that are plain as day in the manual, or have been repeatedly answered here on the list (thus the joke, has it been 4 days already, being so funny :) if more people would read the manual or know how to find commonly asked and solved quetions this list would probaly drop in 20% (very rough estimate) of posts. Getting that information to the people who arn't reading the manual is a difficult task, cause if they arn't reading the manual, why would they even bother with reading the information on how to find the answer. Now noisyness from the 'helpers'... I have noticed at times that a question is answered the same way like 10 times by 10 different people; this I consider more noisy than a RTFM post. be. Is it too difficult to not answer the post at all if you disagree with the content? Now, I kinda wondered at first if I should not respond to this cause it's rather in a disagreement tone :) I think this shouldn't be considered a bad thing to do. If you find something you disagree with and have (legit) arguments, I would insist that the person reply to it. Of course this only helps if it was in a constructive manor, which I hope this reply was done. Cheers, Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] hanmir!!
oh, haha! John Manko wrote: huh? Chris W. Parker wrote: hanmir!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs ASP.NET formal opinions request
Many people over look this, but maybe you should contact publishers who have PHP based books. Would such books be needed if there wasn't a php market? Cantact them regarding sales. Perhaps they will provide some numbers regarding literature for PHP and all open source publications. Not to mention the number of web hosting firms that support PHP as a client development platform. Also, IBM : http://www-106.ibm.com/developerworks/web/library/wa-phprock3/ http://publib-b.boulder.ibm.com/Redbooks.nsf/9445fa5b416f6e32852569ae006bb65f/7dc5a839a1caf7b585256cad006fce0a?OpenDocument Douglas Douglas wrote: Hello everybody. I've been doing some research about the PHP vs ASP.NET debate, because I need to justify the use of PHP in my graduation work. In my University, people in charge of approving the graduation works advocate Microsoft's technologies. They don't believe in the free software movement or the open source movement. Some guys tried to develop a system using PHP and those people made them change to ASP.NET. They say because It's the future. According to them it's where the money is. Well, I only have one year using PHP, but I'll try to fight. I've read a lot of opinions that have been very useful to me. I collected a lot of those opinions and printed to show them to the authorities, but they said that I needed formal basis (books, scientific journals, etc.) to justify the use of PHP. They said that they'd only allow BIG COMMERCIAL, IMPARTIAL, RECOGNIZED WEBSITES opinions and articles. I pretend to use this comparison found in the Microsoft MSDN website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/phpvsaspnet.asp Can you give me some pointers (websites, names, etc) where I could find this kind of formal comparison about both technologies? I've been looking for some book that covers this issue. I've also been looking for some magazine article that I could use. I'd appreciate any kind of help. Thanks. Regards, Douglas. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding days to a date
http://www.google.com/search?hl=enlr=ie=UTF-8oe=UTF-8q=php+add+days+datebtnG=Google+Search Donpro wrote: I have a piece of code like so: $today =- getdate(); I am looking for a function that will add a variable number of days and return a valid date, i.e., the array elements for mday, mon and year are reset as needed. Is this possible? Thanks, Don --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REMOVE THIS ADDR! Re: [ERR] Re: [PHP] PHP vs ASP.NET formal opinionsrequest
PLEASE REMOVE THIS ADDR FROM THE LIST! IT'S NOT LIKE HE/SHE IS GOING TO BE MISSING ANY MESSAGES! [EMAIL PROTECTED] wrote: Transmit Report: To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED]) Subject: Re: [PHP] PHP vs ASP.NET formal opinions request From: John Manko [EMAIL PROTECTED] Date: Sun, 10 Aug 2003 23:12:43 -0400 To: Dan Anderson [EMAIL PROTECTED] I hate to be the one to break it to you but this isn't the real world. It's a senior project, and he has a chance to justify the reason to do a project in the language he see's fit, not what the political machine wants. I just don't buy the don't go against the tide mentality, and obviously you don't either cause you are on a php mailing list. -john Dan Anderson wrote: I hate to be the one to break it to you but in the real world if a client or the boss says program in ASP .NET you program in ASP.NET because, well, that's where the money is. That doesn't mean there isn't room for using better products, but sometimes you don't get an option. -Dan On Sun, 2003-08-10 at 22:45, Douglas Douglas wrote: Hello everybody. I've been doing some research about the PHP vs ASP.NET debate, because I need to justify the use of PHP in my graduation work. In my University, people in charge of approving the graduation works advocate Microsoft's technologies. They don't believe in the free software movement or the open source movement. Some guys tried to develop a system using PHP and those people made them change to ASP.NET. They say because It's the future. According to them it's where the money is. Well, I only have one year using PHP, but I'll try to fight. I've read a lot of opinions that have been very useful to me. I collected a lot of those opinions and printed to show them to the authorities, but they said that I needed formal basis (books, scientific journals, etc.) to justify the use of PHP. They said that they'd only allow BIG COMMERCIAL, IMPARTIAL, RECOGNIZED WEBSITES opinions and articles. I pretend to use this comparison found in the Microsoft MSDN website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/phpvsaspnet.asp Can you give me some pointers (websites, names, etc) where I could find this kind of formal comparison about both technologies? I've been looking for some book that covers this issue. I've also been looking for some magazine article that I could use. I'd appreciate any kind of help. Thanks. Regards, Douglas. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop neurotic posting
I've only been php coding for less than 2 months. I learn, learn, learn, only ask questions when research turns up nothing, and answer other's questions when I know the answer. andu wrote: --On Wednesday, August 06, 2003 14:40:35 +0800 Jason Wong [EMAIL PROTECTED] wrote: On Wednesday 06 August 2003 14:35, John Manko wrote: perhaps there should be two lists (novice and advanced), and the advanced listed shouldn't answer questions if it's considered trivial enough for the novice list to answer. On many lists you get this kind of suggestion. Almost always the rebuttal is that the people who are in a position to help would then mostly congregate to the 'advanced' list leaving the helpless to fend for themselves on the 'beginners' list. In other words its usually a BAD idea. I guess a better idea is if you are on a list to help others to just do it not moralize them. Forgot how it is as a newbie, start learning a new language. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Do not seek death; death will find you. But seek the road which makes death a fulfillment. -- Dag Hammarskjold */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Andu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session does not end when browser is closed.
make sure the process has terminated. Lee Hanxue wrote: Hi, I am using $_SESSION and each php page has session_start() Session Handling is working fine, except for one problem: when I close my browser and re-open it again, I am still logged in. I tested the log in and log out functions and they work fine. How can I terminate a session when the user closes the browser? All the while I thought a new session will be initiated when a new instance of the browser is used to access a page. Hanxue -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop neurotic posting
I tend to think that PHP will take over the world Just my $0.02. Robert Cummings wrote: Hitler began his conquest by taking a country here, a country there while other countries sat around saying to each other oh he won't keep doing it. Let's DO NOTHING! Obviously that plan was flawed -- and that is what I was referring to -- not that by being quiet suddenly the world will be plunged into war again (not that it isn't already). Cheers, Rob. On Wed, 2003-08-06 at 17:11, Chris Sherwood wrote: Hitler is it? why is it everytime someone mentions a proper ettiquette, or some common sense thing that it is immeadiately taken to an extreme.. is this reasonable behaviour? does it portray us as adults, maybe adults who have a major chip on our shoulders... all I am saying is if you feel nasty ... keep it to yourself now how does that equate to being like or bringing back hitler? - Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Chris Sherwood [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 2:04 PM Subject: Re: [PHP] Stop neurotic posting On Wed, 2003-08-06 at 16:36, Chris Sherwood wrote: or what does it take to actually give a reasonable answer... if I am gonna be rude I wont say anything... doesnt any one remember their mother telling them if you dont have anything nice to say dont say anything at all? That kind of thinking leads to things like Hitler :| If we never say anything then it becomes the norm for people to continue their behaviour. Currently the question being debated is what constitutes poor behaviour/etiquette within this mailing list. While I agree that this forum is primarily for answering questions -- I disagree that it is for answering silly little questions that would be common knowledge if the asker had bothered to read any tutorials or documentation -- most especially when it appears that the poster didn't even bother to do any kind of searching for themselves. I mean really, questions like does X do Y is often as simple as writing 1 to 5 lines of test code which is probably shorter than the email itself and doesn't pollute the mailing list with 5 to 10 replies of yes or no. Cheers, Rob. -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs ASP.NET formal opinions request
I hate to be the one to break it to you but this isn't the real world. It's a senior project, and he has a chance to justify the reason to do a project in the language he see's fit, not what the political machine wants. I just don't buy the don't go against the tide mentality, and obviously you don't either cause you are on a php mailing list. -john Dan Anderson wrote: I hate to be the one to break it to you but in the real world if a client or the boss says program in ASP .NET you program in ASP.NET because, well, that's where the money is. That doesn't mean there isn't room for using better products, but sometimes you don't get an option. -Dan On Sun, 2003-08-10 at 22:45, Douglas Douglas wrote: Hello everybody. I've been doing some research about the PHP vs ASP.NET debate, because I need to justify the use of PHP in my graduation work. In my University, people in charge of approving the graduation works advocate Microsoft's technologies. They don't believe in the free software movement or the open source movement. Some guys tried to develop a system using PHP and those people made them change to ASP.NET. They say because It's the future. According to them it's where the money is. Well, I only have one year using PHP, but I'll try to fight. I've read a lot of opinions that have been very useful to me. I collected a lot of those opinions and printed to show them to the authorities, but they said that I needed formal basis (books, scientific journals, etc.) to justify the use of PHP. They said that they'd only allow BIG COMMERCIAL, IMPARTIAL, RECOGNIZED WEBSITES opinions and articles. I pretend to use this comparison found in the Microsoft MSDN website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/phpvsaspnet.asp Can you give me some pointers (websites, names, etc) where I could find this kind of formal comparison about both technologies? I've been looking for some book that covers this issue. I've also been looking for some magazine article that I could use. I'd appreciate any kind of help. Thanks. Regards, Douglas. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] hanmir!!
huh? Chris W. Parker wrote: hanmir!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [ERR] DEAD MAILBOX
arrg. [EMAIL PROTECTED] wrote: Transmit Report: To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED]) Subject: Re: [PHP] Still can't pass variable through url From: John Manko [EMAIL PROTECTED] Date: Fri, 08 Aug 2003 02:47:01 -0400 To: Martin Towell [EMAIL PROTECTED] actually, you might want to urlencode it. ok, so i doubt that you would need url encoding for $year and $month, but I'm sure you will playing with more of this in the future, so you should properly prepare to do so. Note: browsers will do formatting for you, but don't rely on it. page.php?year= . urlencode($year) . month= . urlencode($month) Martin Towell wrote: See if changing it to page.php?year=$yearmonth=$month works The separator between the page and the query string is ? The separator between each key/value pair is just -Original Message- From: Jack [mailto:[EMAIL PROTECTED] Sent: Friday, 8 August 2003 4:30 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Still can't pass variable through url Dear all I had set the register_global=on and magic_quotes_runtime=off already, but when i click my hyperlink page.php?year=$year?month=$month, it doesn't pass the variable for ?year and ?month to the destination page page.php I'm using php 5.0 above , if the same case apply to php4.04, then there is no problem at all! Can anyone please give me more help on this? Thx alot Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still can't pass variable through url
and. Joe Harman wrote: ?php $year=1999; $month=march; echo a href=\http://www.thingamajigger.com/index.php?year=$yearmonth=$month\; yeah this is the link/a; ? -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 2:47 AM To: Martin Towell Cc: 'Jack'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Still can't pass variable through url actually, you might want to urlencode it. ok, so i doubt that you would need url encoding for $year and $month, but I'm sure you will playing with more of this in the future, so you should properly prepare to do so. Note: browsers will do formatting for you, but don't rely on it. page.php?year= . urlencode($year) . month= . urlencode($month) Martin Towell wrote: See if changing it to page.php?year=$yearmonth=$month works The separator between the page and the query string is ? The separator between each key/value pair is just -Original Message- From: Jack [mailto:[EMAIL PROTECTED] Sent: Friday, 8 August 2003 4:30 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Still can't pass variable through url Dear all I had set the register_global=on and magic_quotes_runtime=off already, but when i click my hyperlink page.php?year=$year?month=$month, it doesn't pass the variable for ?year and ?month to the destination page page.php I'm using php 5.0 above , if the same case apply to php4.04, then there is no problem at all! Can anyone please give me more help on this? Thx alot Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop neurotic posting
perhaps there should be two lists (novice and advanced), and the advanced listed shouldn't answer questions if it's considered trivial enough for the novice list to answer. Curt Zirzow wrote: * Thus wrote andu ([EMAIL PROTECTED]): This is a very busy list, over 100 message in a quiet day and most people are helpful and decent, don't mind reading and learning. Unfortunately there are some who mostly post stuff like 'read the manual' and other shit like that. Stuffing e-mailboxes with such garbage day after day doesn't do anybody any good even if the manual is not being read as much as it should Yes it is a busy list, I have 1000+ messages for 7 days worth. I'm not sure the noisyness of the list is entirely on the ones that are helping. There does seem to be a problem of people posting questions that are plain as day in the manual, or have been repeatedly answered here on the list (thus the joke, has it been 4 days already, being so funny :) if more people would read the manual or know how to find commonly asked and solved quetions this list would probaly drop in 20% (very rough estimate) of posts. Getting that information to the people who arn't reading the manual is a difficult task, cause if they arn't reading the manual, why would they even bother with reading the information on how to find the answer. Now noisyness from the 'helpers'... I have noticed at times that a question is answered the same way like 10 times by 10 different people; this I consider more noisy than a RTFM post. be. Is it too difficult to not answer the post at all if you disagree with the content? Now, I kinda wondered at first if I should not respond to this cause it's rather in a disagreement tone :) I think this shouldn't be considered a bad thing to do. If you find something you disagree with and have (legit) arguments, I would insist that the person reply to it. Of course this only helps if it was in a constructive manor, which I hope this reply was done. Cheers, Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please Help
umm... ok. www.google.com www.php.net that should get you started. Sathiyabama wrote: Dear PHP Team, I request your help to sort some issues in using PHP. 1.Chennai IIT has developed one recorder.We can record our voice and video.Its user defined extenion is MV4. My requirement is 1.I want to send video file using mail() function in PHP.So how to send it.What is the procedure? 2.How to delete one folder using PHP? Please help me ... Regards, Sathiyabama -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP or CGI in C/C++
i did a quick google, and found the following. hope it helps http://phpcomplete.com/articles.php?sec=readArticleid=306 http://www.php-accelerator.co.uk plus, there is something called PHP bcompiler (byte compiler). I dont know the details of any of these, but should help. maybe others can expand on the details. - John Manko Decapode Azur wrote: I would expect compiled C/C++ to be faster as there is no need for the code to be interperated and compiled on each request. Is it possible to compile PHP to improve the speed execution ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I don't understand...
You're trying to assign to a function, seriousley messed up. I reccomend you make sure you know PHP before going any further. Leif, Let's try and be a little more constructive. Jason, mysql_query is a function, so you need to call it, not assign to it. For example. (is this a little of Java crap mixed in here? VB?) mysql_query(Select * from mytable); so, change your code to the following (making a variable $query)... $query = Select ; Now, I'm not sure where you are getting the mysql_fetch_array($sql_uc, MYSQL_ASSOC) from, but there are a few problems here. First, it;s most likely that you dont have a result-set to fetch an array from. Also, you forgot the trailing ) in the while statement. while ($result = mysql_fetch_array($sql_uc, MYSQL_ASSOC) ) { $query .= {$result['field_name']} as {$result['display']} ; } $query .= from $season; mysql_query($query); I suggest you do a google search for php mysql_query Leif K-Brooks wrote: Jason Martyn wrote: Here's kinda what I'm trying to do (not working of course). [snip unimportant code] mysql_query = (select); while ($result = mysql_fetch_array($sql_uc, MYSQL_ASSOC) { mysql_query .= ( . $season ...$result['field_name']. as .$result['display'].,; } mysql_query .= (from .$season.;); You're trying to assign to a function, seriousley messed up. I reccomend you make sure you know PHP before going any further. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Article: PHP vs ASP
I'm wondering if there is an IIS extention for allow PHP in ASP. Wouldn't that be a kick in the ass. (I'm not talking about PHP for IIS, either) Jay Blanchard wrote: [snip] Might want to file this link, next time somebody asks about PHP vs. ASP http://www.wowwebdesigns.com/wowbb/forum12/149.html [/snip] And the thing is that you cannot compare ASP to PHP. ASP is a platform, PHP is a language. This arg has been going on for a couple of years. ASP (Active Server Pages) can entertain a number of languages (VBScript being most popular). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ticketmaster.com and Word Images
Does anyone know how sites like Ticketmaster.com creates the Word Image used for ticket purchase verification? Do they generate the image on-the-fly from a dictionary, or do the images pre-exist and they are pulled from a DB along with the word. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Article: PHP vs ASP
Have you looked at the requirements for Chilisoft? Talk about bloatware. *Required:* * Memory: 256 MB required; 512 MB or more recommended * Disk Space: 150 MB 150MB? hmm. I guess it's not as bad as Microsoft's 1GB install of XP. Joe Harman wrote: Oh, do you mean like Chilisoft for PHP on a IIS server... LOL.. That would be funny -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 10:13 AM To: Jay Blanchard Cc: Ralph Guzman; PHP General Mailing List Subject: Re: [PHP] Article: PHP vs ASP I'm wondering if there is an IIS extention for allow PHP in ASP. Wouldn't that be a kick in the ass. (I'm not talking about PHP for IIS, either) Jay Blanchard wrote: [snip] Might want to file this link, next time somebody asks about PHP vs. ASP http://www.wowwebdesigns.com/wowbb/forum12/149.html [/snip] And the thing is that you cannot compare ASP to PHP. ASP is a platform, PHP is a language. This arg has been going on for a couple of years. ASP (Active Server Pages) can entertain a number of languages (VBScript being most popular). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Article: PHP vs ASP
because it would be funny Jay Blanchard wrote: [snip] I'm wondering if there is an IIS extention for allow PHP in ASP. Wouldn't that be a kick in the ass. (I'm not talking about PHP for IIS, either) [/snip] But why go to the extra-effort? Just to save yourself the installation of PHP on the IIS box? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where am i screwing up?
Can someone correct me on this if i'm wrong... try (meaning, I think that $vars as $keys will put the value into $key, not the key itself): foreach ($vars as $key=$value) // clear all previous sessions { if(isset($_SESSION['$key'])) { unset($_SESSION['$key']); } } Ryan A wrote: Hi, I am just screwing around and getting used to arrays with a foreach thanks to Michael,Jan and Evan from this list and have run into problems. My requirment is pretty simple (code is below too) 1)unset all the sessions that might have been set with reference to the hardcoded array ($vars) 2)if any checkboxes have been set from the previous form then set that session needless to say, its not working, am too new at this to know where my fault is so any help is greatly appreciated. I have even added a few comments as to what i was thinkingtell me if i was wrong. **Start code ?php $vars = Array('noPlatform','noPrice','noSfee','noSpace'); // this corresponds to the name= of each checkbox foreach ($vars as $key) // clear all previous sessions { if(isset($_SESSION['$key'])) { unset($_SESSION['$key']); } } echo done1; //just checking program execution foreach ( $vars as $ ) // if any checkboxes were checked create a session for them { ${$} = ( isset($_POST[$]) ? 1 : 0 ); if($==1) { $_SESSION[$]; echo $; //getting no output from here...I just put it here for testing } } echo done2; //just checking program execution ? End code Thanks in advance, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where am i screwing up?
oh, don't forget, '$key' will not get evaluated. $key will. John Manko wrote: Can someone correct me on this if i'm wrong... try (meaning, I think that $vars as $keys will put the value into $key, not the key itself): foreach ($vars as $key=$value) // clear all previous sessions { if(isset($_SESSION['$key'])) { unset($_SESSION['$key']); } } Ryan A wrote: Hi, I am just screwing around and getting used to arrays with a foreach thanks to Michael,Jan and Evan from this list and have run into problems. My requirment is pretty simple (code is below too) 1)unset all the sessions that might have been set with reference to the hardcoded array ($vars) 2)if any checkboxes have been set from the previous form then set that session needless to say, its not working, am too new at this to know where my fault is so any help is greatly appreciated. I have even added a few comments as to what i was thinkingtell me if i was wrong. **Start code ?php $vars = Array('noPlatform','noPrice','noSfee','noSpace'); // this corresponds to the name= of each checkbox foreach ($vars as $key) // clear all previous sessions { if(isset($_SESSION['$key'])) { unset($_SESSION['$key']); } } echo done1; //just checking program execution foreach ( $vars as $ ) // if any checkboxes were checked create a session for them { ${$} = ( isset($_POST[$]) ? 1 : 0 ); if($==1) { $_SESSION[$]; echo $; //getting no output from here...I just put it here for testing } } echo done2; //just checking program execution ? End code Thanks in advance, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php path statement appears on my webpages
Have you set Apache httpd.conf? Gronquist, Jim M wrote: Ivo, Thanks, but if I leave off this line then I get an error when I try and view my pages. Jim -Original Message- From: Ivo Fokkema [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 9:51 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: php path statement appears on my webpages If you don't run PHP as an CGI but as an module, you don't even need this line. My guess is that you run PHP as a module, so delete the line to fix your problem. HTH, -- Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands Jim M Gronquist [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] u... I include #!/usr/local/bin/php4 at the top of my Php files so that it knows where to find php. Unfortunately the path appears in my web pages. Is there a way for me to turn this off? Is it a setting in Apache or is it something that I change in My php files. #!/usr/local/bin/php4 - Jim Gronquist -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session header issue
I usually included a global variable prefixed to the page, like such.. header(Location: $ssl_server/mypage.php); or header(Location: $server/mypage.php); and a myserversetting.php setting these. Now, I can globally change the servers by editing one file. Chris Shiflett wrote: --- Sam Folk-Williams [EMAIL PROTECTED] wrote: The Location: header requires a correctly formed URL It works fine having Location: main.php That doesn't justify it. This is no different than writing screwed up HTML tables that happen to appear as you want in the browser you're testing with. You never know when your broken code is going to cause problems somewhere, and you've no one to blame but yourself when they do. It's much better for everyone just to do things the right way. The Location header should be an absolute URL. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Possible My Website was hacked... with PHP... please tellme what this is???
trolling! ha binc2 wrote: Hi guys what does trolling mean? Never heard of it before. Angelo -Original Message- From: Joel Rees [EMAIL PROTECTED] To: Joe Harman [EMAIL PROTECTED], [EMAIL PROTECTED] Date: Thu, 31 Jul 2003 16:10:24 +0900 Subject: Re: [PHP] Possible My Website was hacked... with PHP... please tell me what this is??? Assuming you are not just trolling, Fortunatly I don't think they were doing something correctly, cause it didn't deface my site like some of the others Don't count on it. They only deface servers they don't want to use. ... everyone can execute shell commands via system(); on your server. - delete the script ;) Oh, by all means, delete it if you want. But it's not the hole it came in through, and it's not the real backdoor. It's so blatent, I'd guess it's a script kiddy or a decoy. Even if it's a script kiddy, you _want_ to know how it got on the box. I'd take the box offline, back up all the data and configuration files, and re-install the whole system and all programs from scratch. Go over every configuration file with a fine-tooth comb. If the machine is on a subnet and I controlled the subnet, I think I'd take the whole subnet down, including the firewall, and clean every machine up, not putting any machine back on the subnet until it was clean and any holes patched. If I didn't control the subnet, I'd make sure the persons who did know there had been a break-in. And if you have any valuable data, consider it to have been stolen. If you have credit card numbers, report the possibility of theft to the credit card companies. Etc. If you're trolling, go away. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinions on Micro$oft .NET
You have to be deviant if you're going to do anything new. - David Lee Nka wrote: On Thu, 31 Jul 2003 12:35:55 -0500, you wrote: I know this is a little off topic but I really need some help with this. The company I work for just got bought out by a larger company. The larger company uses .NET from Micro$oft. I of course use all open source stuff for our web sites and now the new company wants to come in and pretty much blow away everything I have done and use their .NET setup. I've basically got a month to do research and get my guns loaded for what I'm sure will be a heated debate about the Open Source Solution vs the Micro$oft .NET solution. So what I am looking for is personal and professional opinions about both solutions (specifically PHP etc), any and all links to good articles about both solutions giving the pros and cons of both technologies. Any other mailing lists I can get on to get more opinions about the two technologies. Are their any links to show the cost benifits of using Open Source vs Micro$oft .NET? (I know Open Source is free but I have no clue where to find how much .NET is). In my experience, software and hardware costs are nothing. A VS.NET license costs, what... 2 billed days of programmer time? Maybe 3 or 4 days of web monkey time. Either way, it's trivial compared to a 5% (and that's a very conservative estimate) saving in development time over 3 or 4 years use of the tool. Having said that, you have to factor in retraining costs. If it takes six months to get your old programmers up to speed, it's probably easier to stick with what you know. But in this case... what they know is .NET and you're the interloper. If I was management in that situation, I would be looking to reduce costs by jettisoning the second company's overheads (such as the IT dept), and you're about to make a massive pain-in-the-ass of yourself because of some dumb religious issues. Way to go. If they offer you .NET training grab it with both hands, because it means they want to keep you around and it makes you more marketable. Remember, if they already have/can find a .NET developer who knows enough PHP to maintain legacy code... why even bother to retrain you? (BTW, if you try to argue PHP v. ASP.NET on technical grounds you're gonna get steamrollered, IMO. Seriously, look to what's best for you (learning new skills) and the company you work for (supporting one platform, not two) and spend your time developing a migration path, not a diatribe). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List Administrator
do they just scan the pages, or do they look at the final ouput (ei, after all the document.write's)? I dont know much about this stuff. document.write(user + @ + domain. + com); Johnny Martinez wrote: List Administrator, Google spidered the web view to the list and is indexing our email addresses. Any chance you can edit the code to change [EMAIL PROTECTED] to show as user at domain dot com as many of the public message boards do? This will help reduce the spam we get. Johnny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, JavaScript and populating DropDowns
assuming you have a table with colors, and each color has car associated with it (yes, there might be dup color entries). This should work (check spellings and case, etc..etc...) $query=SELECT * from colors; $results = mysql_query($query) or die (DB ERROR: . mysql_error()); $num = mysql_numrows($results); $i=0; echo script language=javascript\n!--\n; while ($i $num) { echo \n ca[$i] = new Array();; echo \n ca[$i][0] = \ . mysql_result($results,$i,CarID) . \;; echo \n ca[$i][1] = \ . mysql_result($results,$i,ColorID) . \;; echo \n ca[$i][2] = \ . mysql_result($results,$i,ColorName) . \;\n; ++$i; } echo function changeColor(ns) {var SelectColor, NumEntries, i; for (i = document.form1.selectcolor.length; i 0; i--) { document.addform.selectcolor.options[i-1] = null; } document.form1.selectcolor.options[0] = new Option(-- Select Color --,0); len = 0; if (ns != 0) { NumEntries = ca.length for (i = 0; i NumEntries; i++) { if(ca[i][0] == ns){ len++; document.form1.selectcolor.options[len] = new Option(ca[i][2],ca[i][1]); } } } document.form1.selectcolor.selectedIndex = 0; } ; echo \n//--\n/script\n; this in later in the page... $query=SELECT * from car; $results = mysql_query($query) or die(brERROR - Please Contact Site Administratorbr); $num = mysql_numrows($results); $i=0; echo select onchange='changeColor(this.value);' name='selectcar'option value='0'Select Car/option; while ($i $num) { $id=mysql_result($results,$i,CarID); $name=mysql_result($results,$i,CarName); echo option value='$id'$name/option; ++$i; } echo /select; echo select name=selectcoloroption value='0'-- Select Color --/option/select; --- Creative Solutions New Media wrote: Hello, I am using mySQL and PHP to pull some data into my page. I have 2 dropdown boxes. As an example lets say dropbox1 has a list of cars and dropbox2 has a list of colours. Here's the thing. The colours for each car vary so I won't know what colours to populate the 2nd dropbox with until a car is chosen. I really want this all contained on 1 page. Is there a standard way of dealing with this? The only thing I can think of is to reload the page once the make of car is selected which would give me the opportunity to populate the 2nd drop box at that time but that doesn't seem like a good solution. I don't know much in the way of JS but is there a way to do what I need that way? Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL limitations
http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=mysql+max+columnsbtnG=Google+Search Mike Mannakee wrote: Does anyone know what the maximun number of columns I could put in a table is?? I can't find it in manual. Like, could I have a table with 200,000 columns? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP should know my data!
I just wrote a web app, but I'm completely disgusted with PHP. The application works great, but PHP is not smart enough to know what data belongs in my database. Really, I have to enter the stuff in myself. I spent 2 long days writing this (sweating and crying), and you mean to tell me that it doesn't auto-populate my database information? Come on, people! Data entry is the thing of the past! Maybe I'll convert my codebase to COBOL or something. At least, it has proven experience with user data! Sometimes I wonder how long this innovative technology will last when there are incompetent languages like PHP, Perl, and Java. Color me disappointed. John Manko IT Professional -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP should know my data!
LOL :) - Now that's funny! Robert Cummings wrote: Unfortunately I don't think some people got the joke. Next thing you know their going to complain that PHP should have told them the punchline ;) Cheers, Rob. On Thu, 2003-07-24 at 18:17, Chris Hubbard wrote: Now this is funny. John, you've captured the irony of a number of recent posts. Congrats. Been a while since I laughed this hard. Cobol. egad. That's a nice touch. Thanks for the levity. chris -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 2:04 PM To: PHP General Subject: [PHP] PHP should know my data! I just wrote a web app, but I'm completely disgusted with PHP. The application works great, but PHP is not smart enough to know what data belongs in my database. Really, I have to enter the stuff in myself. I spent 2 long days writing this (sweating and crying), and you mean to tell me that it doesn't auto-populate my database information? Come on, people! Data entry is the thing of the past! Maybe I'll convert my codebase to COBOL or something. At least, it has proven experience with user data! Sometimes I wonder how long this innovative technology will last when there are incompetent languages like PHP, Perl, and Java. Color me disappointed. John Manko IT Professional -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] controlling winamp with COM
I would think that a Java applet would be your best bet. You can have real-time updates instead of page reloads. However, you will need to write a server to handle the specific requests for the applet. That can be done in Java, C/C++, or even Perl. I would prefer Perl because of it's string manipulation strengths. However, the most important thing is to how they communicate. For this, I wouldn't got with anything else but XML. John Herren wrote: Is there any way to control an open winamp application in php? I want to use php as a scheduler to play Winamp. The API has system calls to do so, but I don't know how to implement the windows calls. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Jumping between HTTP and HTTPS
This is what I decided to do. So the pages that need to be secured, I send the the SID as a GET QUERY variable. I don't like it, but it's the only thing I seems right. Joel Rees wrote: if you do sniff the hash, the key, and the session. You will have to get your request in before the key becomes stale, race, race! In most cases the authentication is the first thing done so we're dealing with micro seconds. Most cases? Why re-invent the wheel? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_connect, client flags, php 4.3, oh my!
mysql_connect() added support for client flags in 4.3+ I'm wondering if there is another method to supply these flags for any php 4.3? thanks, john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals
whoa, i didn't know that. i love this mailing list! :) Petre Agenbag wrote: a simple extract($_POST) or extract($_GET) would also work -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Date
I'd settle for a function that will generate a date for this upcoming friday. ;) Elliot Tobin wrote: I need a function to create the dates of previous Fridays -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Date
Ha. Not what I have in mind. :) Adam Voigt wrote: Umm. echo(date('U',strtotime('next Friday'))); Notice the strtotime part. On Mon, 2003-07-21 at 09:25, John Manko wrote: I'd settle for a function that will generate a date for this upcoming friday. ;) Elliot Tobin wrote: I need a function to create the dates of previous Fridays -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Date
More like: echo(date('Jennifer Lopez',strtotime('next Friday'))); John Manko wrote: Ha. Not what I have in mind. :) Adam Voigt wrote: Umm. echo(date('U',strtotime('next Friday'))); Notice the strtotime part. On Mon, 2003-07-21 at 09:25, John Manko wrote: I'd settle for a function that will generate a date for this upcoming friday. ;) Elliot Tobin wrote: I need a function to create the dates of previous Fridays -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Serialized Array via Hidden field
Just a small point, you can have both GET and POST. -- search.html - form method=POST action='page.php?action=searchsid=09h34fnn3f0qn34f8n38fn34htq83th83qh' input name=search type=text input type=submit value='Find It!' /form - page.php $sid = $_GET['sid']; session_id($sid); session_start(); $search = $_POST['search']; Also, for those who don't know, you can even reference hash links a href='page.php?action=something#myhashlink Chris Shiflett wrote: --- Andrei Verovski [EMAIL PROTECTED] wrote: I am need to pass serialized assotiative array via form hidden field (not GET or POST). This is impossible. A hidden form field is simply a form field that is not displayed to the user. Form actions must be GET or POST. In order to do it, I did the following: urlencode(serialize($my_array)). Don't URL encode the value of the form field, since the browser will take care of that. You should probably use POST rather than GET, because serializing an array might yield a very long string and make the URL too large for the Web browser and/or Web server to handle. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Jumping between HTTP and HTTPS
I'm having a little trouble understanding how to accomplish this. Should the entire browsing session be HTTPS after login, or just for important functions like login and checkout If noly for those function, who should I design to jump back an forth. I know DB should be used for cart items, but when I jump to HTTPS, should I enclude the session ID (which will be stored in the DB) as a GET query string field? If not, how else will I be able to know which user to continue with. I don't see any functions that will let you specify which session ID to continue with. What is the best practice? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Jumping between HTTP and HTTPS
You dont need to touch any php code, just modify the html so the properlinks point to https where needed. I tried that. However, the session is different when going from 80 to 443. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is the problem?
just a few more tips. the following ensures that an form input field by the name of 'sentence' is actually sent via method=post, otherwhile you can escape it. this is good for low level script integrity if( isset($_POST['sentence']) ) echo $_POST['sentence']; you might want to also look into the following functions. rawurldecode() htmlspecialchars() addslashes() stripslashes() chop() Chris Knipe wrote: form.php is this: form method=post action=takeform.php input type=text value=sentence /form input type=text name=sentence value=sentence Learn to code html ;) takeform.php is this: ? echo $sentence; ? echo $_POST['sentence']; these codes are running at my hosting but it couldn't run on my computer. I tried on pws, apache, php 4.0.4, php 4.2.2 and php5 but it didn't work. why i couldn't run it? It's more than likely register_globals that is off. -- me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with UPDATE command...
what error message are you getting? mysql_error() and mysql_errno() Tony Tzankoff wrote: Here is the code I am trying to implement... update table set col1=value where condition=true and condition=true order by col2 desc, col3 desc limit 1; The UPDATE command does not seem to support the ORDER BY part despite it being listed in the instructions on the mysql.com website. Is there any workaround to this that anybody knows of? Thanks in advance for your help. :o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MYSQL Client Flags
I was interested in how to determine the number of rows matched on an update, even if they weren't updated. The reason for this was mysql_affected_rows() returns the number of rows affected, which my not be the number of rows matched by the query (see the manual). So, I came accross a post in the comment section of the online documentation that says the following: --- from mysql_affected_rows() As of PHP 4.3.0 (I assume, I only tried with 4.3.2), you can make mysql_affected_rows() return the number of rows matched, even if none are updated. You do this by setting the CLIENT_FOUND_ROWS flag in mysql_connect(). For some reason, not all the flags are defined in PHP, but you can use the decimal equivalent, which for CLIENT_FOUND_ROWS is 2. $db= mysql_connect(localhost, user, pass, false, 2); mysql_select_db(mydb, $db); --- from mysql_connect() |I presume that mysql_connect() just passes through to the C MySQL API, which provides these constants: #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ #define CLIENT_LONG_FLAG 4 /* Get all column flags */ #define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ #define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ #define CLIENT_COMPRESS 32 /* Can use compression protocol */ #define CLIENT_ODBC 64 /* Odbc client */ #define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ #define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ #define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */ #define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ #define CLIENT_SSL 2048 /* Switch to SSL after handshake */ #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */| -- So, I started searching, an I found a few other flags(below). My question: Is this list complete, does php have defined flags for these (or do I have to define descriptive variables for the corrasponding numbers), and is this pretty much the extent of the information I will find on the php end of things? CLIENT_MULTI_QUERIES Tell the server that the client may send multi-row-queries (separated with `;'). If this flag is not set, multi-row-queries are disabled. New in 4.1. CLIENT_MULTI_RESULTS Tell the server that the client can handle multiple-result sets from multi-queries or stored procedures. This is automatically set if CLIENT_MULTI_QUERIES is set. New in 4.1. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: TESTERS Needed!
the the following table, when you onmouseover the MSN addy, the enlargement of the font size changes the table width, and it does restore on onmouseout: _*Stats*_ Style: Devil's Bloom Host: www.BritneySpy.com http://www.BritneySpy.com Projects: 3 Hits 321 MSN [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Mark Clarkstone wrote: If any one finds any bugs or anything please let me know! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A new FREE web server can do PHP faster than Apache'smod_php
You should leave an identification tag in your url. This way when people click the link you supplied, you can track where they are coming from LiteSpeed wrote: Hi there! Do you feel the need for speed? Lite Speed Technologies proudly introduces you LiteSpeed Web Server 1.0 LiteSpeed Web Server is a full featured, high performance, secure, and easy-to-use Web server that runs on Unix and Linux. It supports HTTP/1.1, SSL, CGI, FastCGI, PHP, JSP, Servlets, GZIP compression, IP level throttling, connection accounting, DoS attack prevention, and instant recovery mechanisms. Installation is very easy with pre-built binary. Administration and configuration is very easy through a Web interface (written in PHP). Our benchmark shows that LiteSpeed web server can serve static content up-to 5 times faster than Apache And our PHP implementation through Fast CGI interface outperforms Apache's mod_php up-to 50%! We are dedicated to bring the best web server products with combination of speed, security and easiness for you need, any comments, suggestions or criticisms are welcome. The Standard Edition is free for commercial use, and we doubt you can get any web server this good without shelling out thousands of dollars. For more information please visit our web site: http://www.litespeedtech.com Did any one try our product? We'd like to hear from you. :-) BTW: PHP Accelerator should work just fine. Thank you, LiteSpeed Team http://www.litespeedtech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Something to watch look for when getting HEADER Warnings
Recently, I ran into a problem where I continually got a Header already sent message. I took me a while to figure out because the file that was included only contained function definitions, or so I thought. After the closing php tag, I had a new line with a single space on it. This space was, in turn, sent to the browser. file.php begin (blah, not working) - ?php function seomthing() { //do something } ?[enter] [space] file.php end -- It wasn't until I removed the single space and any additional newlines that all worked fine. Any non-null lines outside of the php tags will results in voiding all rights to send any header or cache information, and this includes space or newline characters. Just an FYI. file.php begin (cool, it works now) - ?php function seomthing() { //do something } ?[no newline] file.php end -- Actually, you can have a newline after the clsoing php tab, but if you have a non-null string following that (this includes newline characters), bad bad stuff can happen. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP code beautifier?
I really think that this depends on the topic. I know that if I'm looking for an editor (esp for a language just starting in), I can search google all day, but end up with a list full of fud. In situations like this, I would prefer to go straight to the source and ask the people who have put most editors for that languange to the test, and sometimes that means I need to post to a mailing list. Now, I''m not saying that you don't have a point (All too often people ask without even trying to find the answer themselves. I sometimes find myself doing this, and it's a shame becuase there is so much information a person misses out on that he/she would not normally be exposed to.), but you have to ask yourself A beginner, or a veteran? Othertimes, I just want to be sure I didn't miss something that would be ideal. I don't know...just my .02. Joseph Szobody wrote: Btw, I found all of these on the first two pages of a simple Google search. Might be worth trying in the future. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Best practices
I'm looking for a book on PHP best practices for such things as security, performance, session (esp jumping from http to https), design layout, etcetc... I'm not interested in something that will teach basic PHP. Do you know of any good books, online resources,etc? Thanks. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to store a file into MSSQL?
Look here http://www.mysql.com/doc/en/BLOB.html Actually, if you don't care if the images can be view from outside the DB, you can do what I do. I simplely put the name of the file in a varchar field, then let the browser do the work for you. This is good for files that are referenced from multiple entries (ie, individual products each referencing the same series image) but, blob can work fine. Adam Voigt wrote: I just use a TEXT field, and am doing so with 25k images, without issue. On Tue, 2003-07-15 at 18:45, Javier wrote: Hi everybody, I've trying to store a into a MSSQL Server (7 or 2k) using an example I found on the web (www.php.net). Is it possible that PHP (4.3.2) just store 4k of data? Because after inserting a test image with: $oDatos is an object that handles queries. // storing a file $datastring = join('',file(logo2.jpg)); $data = unpack(H*hex, $datastring); $oDatos-query( insert into temp_test (test) values ( 0x . $data['hex'] .) ); A select will return a 4K file. Is it possible? $row = $oDatos-getData(select test from temp_test); //file://$row = mssql_fetch_assoc($result); $fp = fopen('copy.jpg','w'); So... is there anyway to store a file that it is larger than 4K? Or am I missing something? :) Thanks. -- *** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] KEEP IMAGE RATIO
Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
but that won't address the space limit for display for image larger than 75x75 Brian S. Drexler wrote: Leave out the height or width tag and it will keep the ratio by itself won't it? -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 9:46 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] KEEP IMAGE RATIO Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
ok, i see what you mean.. John Manko wrote: but that won't address the space limit for display for image larger than 75x75 Brian S. Drexler wrote: Leave out the height or width tag and it will keep the ratio by itself won't it? -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 9:46 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] KEEP IMAGE RATIO Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
You will note that I did say that I was looking for a PHP solution to this, anyhow. HTML isn't smart enough to figure that out and this is a PHP list, anyhow. Thank you for the info. I still think that HTML should handle it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SPAM: [PHP] KEEP IMAGE RATIO
yes, that is what CPT John W. Holmes suggested. I will do that. In the meantime, I'm going to join the w3c mailing list. thank you. Justin French wrote: Whilst I have not tested this on multiple platforms/browsers, I believe if you only specify one (the width for example), the browser will proportionately sace the height. The is useful with a fixed width OR height area, but does not solve a scenario where there are height AND width contraints. But you could work it out pretty easily with getimagesize and some ratio calculations... wrap it up in a function pretty easily :) http://au.php.net/manual/en/function.getimagesize.php In fact, there are some functions and notes in the user-contributed section of the above URL that do this for you :) Justin On Wednesday, July 16, 2003, at 11:31 PM, John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verifying a certain amount of numbers
Yes, use preg_match(/^[0-9]{6}$/,$str) since it takes care of both number and length. You dont want to you is_numeric(), because that will match 4e5, etc..etc.. Brent Baisley wrote: I'm pretty sure there will be a problem with using the is_int() function. A similar problem was discussed a few weeks ago on this list and is_int() will return true for a number like 1000e2. The e being treated as an exponential representation of an integer. It might be more reliable to add or subtract 0 from the string and see if it changes. Something like: if( (strlen($str)==6) ( strcmp(($str-0),$str)==0)) It may just be easier to use ereg if you won't be looping through a bunch of numbers. I don't know what the performance difference is between the above function and ereg or preg. On Wednesday, July 16, 2003, at 09:43 AM, Justin French wrote: I tested if( (strlen($str) == 6) (is_int($str)) ) vs if(ereg('^[0-9]{6}$',$str)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing $Vars between 2 php pages
page1.php $_SESSION['myvars_VARNAME'] = $varname; the 'myvars_' is just for identification purposes, so avoid over-writing anthing that you might not want to. page2.php $varname = $_SESSION['myvars_VARNAME']; Valentin wrote: Hi, is any way to pass a $Var from one to other php pages without using FORM and Cookies? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi file multi colomn
is there a max file handle pool in php? look at: http://us3.php.net/fopen http://us3.php.net/fwrite FB wrote: Hi, I have 40 text files.. each files have 1 colomn of a data. I want to write a script to merge them like datafrom1;datafrom2;datafrom3;datafrom40 how can I do that? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP explodes without using isset()
I've tried checking if $_POST and $_GET vars are set with just if($_POST['yuck']) When 'yuck' is not present my code always explodes with *Notice*: Undefined index: yuck on the page output. I never see any mention in the codes examples referencing a php function that instructs the preprocessor not to output such messages, but I've seen this used a lot of places. I'm forced to use isset() with everything. Now, if there is a switch to set in php.ini, this will do my no good since I only have access to it on my dev box. Am I missing out on something here, or do people just accept such messages (doubt it). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
And I still don't see how your proposed method handles the problem you mentioned above with Image2... RDB Now, first, what would you prefer? Second, I hope you understand how the new feature would address the issue (and that you know what the issue is - if i explained it clearly, of course) As sent to [EMAIL PROTECTED] (please read in total, some stuff added) -- consider: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. Rather, with img width=75 height=75 ratio=keep, we will have the following results: Final Display: Image1 : 75x75 : (RATIO 1x1) Image2 : 38x75 (37.5x75) : (RATIO 1:2) This is something simple enough for the browser to handle, and I think it should. - Now, as far as not seeing how this helps, keep in mind that this is NOT a feature, but SHOULD, and a reponse I got from [EMAIL PROTECTED] is the following: = this is what I use to maintain aspect ratio and constrain the image to the limits I have if($image_path == ) { $relative_directory = /images/logo.gif; $size = @GetImageSize(getenv(DOCUMENT_ROOT).$relative_directory); } else { $relative_directory = /images/gallery/$sportid/; $size = @GetImageSize(getenv(DOCUMENT_ROOT).$relative_directory./.$image_path); } $width = $size[0]; $height = $size[1]; if($width 500) { if(($width 500)($height 400)) { $width2 = ($size[0] - ( $size[0] * (1 - (500/$size[0]; $height2 = ($size[1] - ( $size[1] * (1 - (400/$size[1]; } else { $width2 = ($size[0] - ( $size[0] * (1 - (500/$size[0]; $height2 = $size[1]; } } else { $width2 = $size[0]; $height2 = $size[1]; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing $Vars between 2 php pages
why not build a GET QUERY_STRING, save it in a database along with the session_id, the read it on the second page, parsing the string. Jeff Harris wrote: |Valentin wrote: | |Hi, is any way to pass a $Var from one to other php pages without using |DEFANGED_FORM and Cookies? | |Thanks, | On Jul 16, 2003, John Manko claimed that: |page1.php |$_SESSION['myvars_VARNAME'] = $varname; |the 'myvars_' is just for identification purposes, so avoid over-writing |anthing that you might not want to. | |page2.php |$varname = $_SESSION['myvars_VARNAME']; Session still either use cookies or URI: There are two methods to propagate a session id: Cookies, URL parameter Thus sayeth the oracle: http://www.php.net/manual/en/ref.session.php The only way that I can see of passing a variable from page to page without using cookies or URI would be to make sure that only one person can access the entire site at one time and use either a database or a file on the server. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Check if php file is an included file?
If have file1.php that includes file2.php, is there any way to check, from file2.php, if it is indeed included. In other words, I don't want file2.php to display (rather redirect to file1.php) if it's not being requested as a file1.php include file. did I confuse you? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-general as REPLY TO
oops - maybe i should have kept my big mouth shut! ha. anyway, it doesn't look like it's going to change. php_thread --end php-general as REPLY TO Mark wrote: But that would not solve the problem being discussed. None of the webmail services that I've tried have a reply-to-list feature. --- Jim Lucas [EMAIL PROTECTED] wrote: You could signup with a company like yahoo.com or hotmail or bend.com and you could then have a web based email service. You ALWAYS have choices... :) Jim Lucas - Original Message - From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Derick Rethans' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 3:08 AM Subject: RE: [PHP] php-general as REPLY TO -Original Message- From: Derick Rethans [mailto:[EMAIL PROTECTED] Sent: 30 June 2003 22:47 On Mon, 30 Jun 2003, Doug Essinger-Hileman wrote: Having said this, I suspect that you and I will continue to disagree, which is perfectly okay. If this list changes the default I will be happy. If it doesn't, I will learn to adjust. One request I make is that folk, including you, Derick, refrain from sending replies to my email to both the list *and* my personal inbox. There's no need to waste the bandwidth. You'll have to learn to adjust then I guess. And do those 2k really matter? Come on... Just get a good mailer that defaults to Reply-All (like, mutt, pine, pcpine) Some of us don't have the choice -- we work in a corporate or institutional environment where the decision is made centrally. (Hence M$ Outlook 98 here!!!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IsSet() and $_SESSION
None of these worked for me. ok, if you look at the code, the part where echo $_SESSION['uid']; is actually works. I get a print out of the variable. if i call session_start() before anything, set variables in $_SESSION, and check it on another page, the session variables do not exist. in fact, the session isnt even started, cause I get an Undefined variable _SESSION. so, it looks like the session is not spamming page requests. Do I have to call session_start() on every page to read the $_SESSION variables set in another? Shivanischal A wrote: John, I can think of 3 problems... 1. I'm not sure, but try inserting a 'session_start()' in file.php 2. in ur validateadminlogin() method, the mysql_close() never seems to get called. 3. try $_SESSION['uid'] . use ' instead of . seema to cause problems in some cases. best of luck, -shiva - Original Message - From: John Manko [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Monday, June 30, 2003 6:49 AM Subject: IsSet() and $_SESSION I'm having a problem with the value that isset returns on $_SESSION variables. For some reason, even if $_SESSION['uid'] is set, isset returns FALSE. Here is the code: -- file1.php --- include file2.php; if (!isset($_SESSION[uid])) { // This first time $_SESSION[uid] is check, we should // end up in here. However, ValidAdminLogin (next test) // will set $_SESSION[uid] so next time we will not // get here. if ( !ValidAdminLogin($_POST[adminid],$_POST[adminpass])) forceadminlogin(); } elseif ( !ValidAdminSession() ) forceadminlogin(); // this is done to show that $_SESSION[uid] is being set // but isset still returns false echo $_SESSION[uid]; -- file2.php --- function ValidAdminLogin($user, $pass){ global $_SESSION; if (The_MYSQL_Stuff_Is_NOT_OK) return false; else { session_start(); $_SESSION[logged] = true; $_SESSION[username] = $user; $_SESSION[adminlogin] = true; $_SESSION[fname] = $fname; $_SESSION[lname] = $lname; $_SESSION[email] = $email; $_SESSION[uid] = session_id(); return true; } mysql_close(); } DISCLAIMER: This email is bound by the terms and conditions described at http://www.subexgroup.com/mail-disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-general as REPLY TO
Hello, I'm wondering why the listed Reply To address is not [EMAIL PROTECTED] Thing would be so much easier to just reply than cut-n-paste when reply to the entire list on a subject (which is the norm). Can the maintainer set this up? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-general as REPLY TO
Keep in mind that many people post without being subscribed to the list, This is false. In fact, I tried sending a message to the list from another account that wasn't subscribed, and I got a reply stating the following: Because you are not subscribed to [EMAIL PROTECTED] using the email address [EMAIL PROTECTED], your message has been held until you can confirm that you are a real person sending mail. Rasmus Lerdorf wrote: Guys, this will not change. Look back through the archives. It has been discussed a couple of times. If you don't like it, unsubscribe. Sorry to be blunt, but this is a waste of bandwidth. Keep in mind that many people post without being subscribed to the list, so only sending a reply to the list doesn't get them the answer they were looking for. Also, often the list can get slow and getting a private copy of the answer to your question means you don't have to wait an hour or more for it. If you don't know how to configure your mail system to get rid of duplicates, then you will have to suffer through hitting the delete key an extra time. And finally, defaulting to a public post when replying to an individual is simply wrong. -Rasmus On Mon, 30 Jun 2003, Doug Essinger-Hileman wrote: On 30 Jun 2003 at 22:34, Derick Rethans wrote: I disagree with you Derick. In many (most? all?) programs, the reply- all function will send an email back to the list **and** one to the author. This wastes bandwidth needlessly, in my opinion. I receive the messages to the list and do not need to receive a message sent directly to me. You have procmail for that. There is some very good explanation for this, see http://www.math.fu-berlin.de/~guckes/faq/maillist.html#munge_reply-to First, Derick, not everyone has access to procmail. In fact, most folk **do not** have access to procmail. Second, I still think it antithetical to the whole idea of a public mailing list to set the reply-to default to anything other than the mailing list. Since I see no evil coming out of this, nor any misuse, I fail to see the problem. As the owner of a mailing list, I am quite familiar with the webpage you referenced; to my mind, it doesn't make any valid arguments. Having said this, I suspect that you and I will continue to disagree, which is perfectly okay. If this list changes the default I will be happy. If it doesn't, I will learn to adjust. One request I make is that folk, including you, Derick, refrain from sending replies to my email to both the list *and* my personal inbox. There's no need to waste the bandwidth. Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IsSet() and $_SESSION - BUG?
Hello everyone. I was able to determine what was causing my problem with session variables not being persitant across page requests. I want to give you the full scope here, so I'm going to paste the code (and if you have any code tips, please let me know). I think the problem might be this (and I don't know why it should be, but maybe you can help): If you look at file2.php, you will see that ValidAdminLogin() contains the global $_SESSION; declaration., but that's not the problem. ValidAdminLogin() calls a function ResetSessionVariables(), which also contains global $_SESSION;. When global $_SESSION; is present in ResetSessionVariables(), it seems as though the $_SESSION variables are not being preserved across page requests (notice that ResetSessionVariables() is called BEFORE the variables are set with the real data, but it's really $_SESSION['uid'] we are concerned with.) When I remove global $_SESSION; from ResetSessionVariables(), all works fine across page request. Also note that $_SESSION['uid'] is set when we return from the file2.php function calls as noted in the echo command. So, why would a double global definintion negate $_SESSION? file1.php - ?php session_start(); include include/DatabaseConnect.php; include include/commonphp.php; DisableClientCaching(); if (!isset($_SESSION['uid'])) { if ( !ValidAdminLogin($_POST['adminid'],$_POST['adminpass'])){ forceadminlogin(); } } elseif ( !ValidAdminSession() ){ // Not a valid admin session - redirect forceadminlogin(); } ? html body ?php //We always get a value for this, but it get lost when we leave the page. echo $_SESSION['uid']; ? brbrbrbr center a href='additem.php'Add Item/a /center /body /html --- file2.php -- ?php include configvars.php; function ValidAdminSession(){ global $_SESSION; if ( isset($_SESSION['adminlogin']) ){ return 1; } else { return 0;} } function DisableClientCaching(){ header(Expires: . gmdate(D, d M Y H:i:s) . GMT); // Expire now header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header(Cache-Control: no-store, no-cache, must-revalidate); // HTTP/1.1 header(Cache-Control: post-check=0, pre-check=0, false);// HTTP/1.0 header(Pragma: no-cache); // HTTP/1.0 } function ResetSessionVariables(){ // WHEN I REMOVE THIS LINE, EVERYTHING WORKS FINE // global $_SESSION; $_SESSION['uid'] = session_id(); $_SESSION['username'] = ''; $_SESSION['adminlogin'] = False; $_SESSION['fname'] = ''; $_SESSION['lname'] = ''; $_SESSION['email'] = ''; $_SESSION['errormesg'] = ''; } function ValidAdminLogin($user, $pass){ global $_SESSION; include DatabaseConnect.php; mysql_connect($DBAddress,$DBUser,$DBPassword); @mysql_select_db($DBDatabase) or die(ERROR); $query=SELECT * FROM adminuser WHERE user=' . $user .' AND pass=' . md5($pass) . '; $results = mysql_query($query); $num = mysql_numrows($results); if ($num != 1){ $returnvar = false; // Make sure the user exist, and is only one (even though it's a unique SQL field) } else { ResetSessionVariables(); $_SESSION['username'] = strtolower(formatformdata($user)); $_SESSION['adminlogin'] = True; $_SESSION['fname'] = mysql_result($results,0,fname); $_SESSION['lname'] = mysql_result($results,0,lname); $_SESSION['email'] = mysql_result($results,0,email); $_SESSION['uid'] = session_id(); $returnvar = true; } return $returnvar; mysql_close(); } function forceadminlogin(){ ResetSessionVariables(); header(Location: AdminLogin.php); } function formatformdata($mystring){ return addslashes(rawurldecode(chop($mystring))); } ? John Manko wrote: I'm having a problem with the value that isset returns on $_SESSION variables. For some reason, even if $_SESSION['uid'] is set, isset returns FALSE. Here is the code: -- file1.php --- include file2.php; if (!isset($_SESSION[uid])) { // This first time $_SESSION[uid] is check, we should // end up in here. However, ValidAdminLogin (next test) // will set $_SESSION[uid] so next time we will not // get here. if ( !ValidAdminLogin($_POST[adminid],$_POST[adminpass])) forceadminlogin(); } elseif ( !ValidAdminSession() ) forceadminlogin(); // this is done to show that $_SESSION[uid] is being set // but isset still returns false echo $_SESSION[uid]; -- file2.php --- function ValidAdminLogin($user, $pass){ global $_SESSION; if (The_MYSQL_Stuff_Is_NOT_OK) return false; else { session_start(); $_SESSION[logged] = true; $_SESSION[username] = $user; $_SESSION[adminlogin] = true; $_SESSION[fname] = $fname; $_SESSION
[PHP] IsSet() and $_SESSION
I'm having a problem with the value that isset returns on $_SESSION variables. For some reason, even if $_SESSION['uid'] is set, isset returns FALSE. Here is the code: -- file1.php --- include file2.php; if (!isset($_SESSION[uid])) { // This first time $_SESSION[uid] is check, we should // end up in here. However, ValidAdminLogin (next test) // will set $_SESSION[uid] so next time we will not // get here. if ( !ValidAdminLogin($_POST[adminid],$_POST[adminpass])) forceadminlogin(); } elseif ( !ValidAdminSession() ) forceadminlogin(); // this is done to show that $_SESSION[uid] is being set // but isset still returns false echo $_SESSION[uid]; -- file2.php --- function ValidAdminLogin($user, $pass){ global $_SESSION; if (The_MYSQL_Stuff_Is_NOT_OK) return false; else { session_start(); $_SESSION[logged] = true; $_SESSION[username] = $user; $_SESSION[adminlogin] = true; $_SESSION[fname] = $fname; $_SESSION[lname] = $lname; $_SESSION[email] = $email; $_SESSION[uid] = session_id(); return true; } mysql_close(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Securing PHP code
For some people, putting information outside the docroot isn't possible, especially when your site is hosted. On thing you can also try (which is nowhere near the security of outside the docroot) is to put ocnfig data (user, pass, etc...) inside it's own php file that is included in outfiles. For example (assuming that php parser doesn't fail): -- configstuff.php -- ?php $user = myname; $pass = mypass; $db = mydb; ? -- end -- - Edwin - wrote: Hello, Doug Essinger-Hileman [EMAIL PROTECTED] wrote: On 25 Jun 2003 at 16:42, Dan Joseph wrote: Store that file outside the docroot. That way there is no chance they can get it from the web site. I myself use an ini file that is no where near the docroot, and use parse_ini_file() to load the DB information in, and then I connect to it. This method passed our security audit with flying colors. A sample of what my ini file resembles is: [mysql_info] host = 192.168.1.1 uid = username pwd = password dbn = database They end up in a $INI array, and the fields are $INI['host'], $INI['uid'], etc.. You can read more about that function @ www.php.net. I am just beginning to use php and mysql together (I'm new to both). I am having trouble getting this to work in what I think is a very simple test. I have created mysql.ini, and put it outside the docroot: /myhome/mysql.ini. This file, in its entirety, is: [mysql_info} I think you meant [mysql_info]? (Check the closing bracket.) host=spore.org uid=myuserid passwd=mypassword Then I created a webpage with nothing more than the following: ?php parse_ini_file(/home/revref/mysql.ini); echo $INI; ? There's a good example in the manual: http://www.php.net/manual/en/function.parse-ini-file.php Notice that you need to do something like this: (based on your example) ?php $INI = parse_ini_file(/home/revref/mysql.ini); print_r($INI); ? - E - PS Please check the difference between print_r() and echo() as well... ...[snip]... __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php