[PHP] re-setting all cookies
I want a button that resets all my cookies. Can I reset them all with a foreach command? AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re-setting all cookies
/*From the php manual $arr = array(1, 2, 3, 4); foreach ($arr as $value) { $value = $value * 2; } */ $_COOKIE is a variable... but you need the key for setcookie(). so you can do: foreach($_COOKIE as $key = $value){ setcookie($key,, time()-3600); } i know there is the $value bit that we never use, but this is the simplest form I can think of. can anyone else think of something better? HTH :D On Tue, 22 Mar 2005 08:39:45 -, AndreaD [EMAIL PROTECTED] wrote: I want a button that resets all my cookies. Can I reset them all with a foreach command? AD -- 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.ini file
-Original Message- From: Burhan Khalid [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 2:05 PM Hopefully not! Files in /tmp are deleted in most *NIX variants, this is a _bad_ idea and the name of the folder pretty much tell You so... Default path is /usr/local/lib No, I don't think this is correct. The default path for temporary files is /tmp -- I just tested it on a clean install of PHP. Ehhh... php.ini, a temp file? The whole point of temporary upload files is that they are deleted by the system, so you don't have stale files lying around. Which is why there is the move_uploaded_file function. This, of course, is assuming I didn't mis-interpret the question. Quote: i'm experimenting with php on mandrake 10 and i'm not sure about a few things. first, where should the php.ini file go? I think You did indeed. And I´ll correct my self for the info: If You compile PHP there´s a parameter to use: --with-config-file-path=/usr/local/php.ini Skip the php.ini from the _path_ (doh!) -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] remove space
Hello, How can I remove a space character from variable value. for example: change $name = John Doe; to $name = JohnDoe; The blank space needs to be removed from the string. How? Thanks a lot! _will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] remove space
-Original Message- From: William Stokes [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 22, 2005 10:49 AM How can I remove a space character from variable value. for example: change $name = John Doe; to $name = JohnDoe; The blank space needs to be removed from the string. How? Did You search? http://dk.php.net/manual-lookup.php?pattern=replace Str_replace, ereg_replace, preg_replace is just a few friends, that will help You. Php.net is Your best friend ;-) -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remove space
[snip] How can I remove a space character from variable value. [/snip] Take a look at preg_replace, for example... RTFM @ http://www.php.net/preg_replace ;) chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re-setting all cookies
Ken wrote: /*From the php manual $arr = array(1, 2, 3, 4); foreach ($arr as $value) { $value = $value * 2; } */ $_COOKIE is a variable... but you need the key for setcookie(). so you can do: foreach($_COOKIE as $key = $value){ setcookie($key,, time()-3600); } i know there is the $value bit that we never use, but this is the simplest form I can think of. can anyone else think of something better? foreach(array_keys($_COOKIE) as $key) { setcookie($key,, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_ssl + php4-curl interaction problem ... ?
Marc G. Fournier wrote: As a follow up to this, I just installed curl 7.12.3_2, to see if going back a version would fix the problem, and it does ... apache with curl enabled now works again beside SSL ... Not sure where the bug is, but the newer version of curl appears to have a problem with php4-curl ... You should probably post this at bugs.php.net. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] spot the mistake??
[snip] if (isset($submitted)){ [/snip] s...what sets $submitted then? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why not @ ?
Hi, If you care to take a peak at http://www.dte.ua.pt/cv/ and pass your mouse over the link Mário Gamito, you'll see in the status bar that the link is: http://www.dte.ua.pt/cv/[EMAIL PROTECTED] Allright. However, if you click and go to the respective page, you'll see that the @ is switched by %40. There is no need to even click it. Just Copy the link in the page and paste it in some editor. Even this way, the link is wrong. This completely bogles me. I mean, i pass the mouse over the link and i see @ in the status bar. If i Copy the link and paste it into a text editor, i get %40. Any help would be apreciated. The relevant code follows my signature. Warm Regrds, Mário Gamito -- while (!$recordSet-EOF) { print (a href =\http://www.dte.ua.pt/cv/cv_show.php?email=.UrlEncode($recordSet-fields[1]).\.HtmlEntities($recordSet-fields[0])./abr /); //print (a href =\http://www.dte.ua.pt/cv/email=?\.$recordSet-fields[0]./abr /); $recordSet-MoveNext(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HTTP
It is SOAP. I read tutorial on w3 website. Have one more question: The data that is exchange in SOAP protocol is encrypted or not? Thanks On Mon, 21 Mar 2005 17:32:59 -0800 (PST), Richard Lynch [EMAIL PROTECTED] wrote: On Fri, March 18, 2005 11:14 am, Jerry Swanson said: I create XML file, how to pass the XML file to another server through HTTP? Let's try it this way: What's the other server? Did you read their FAQ and their documentation? Here are functions that, depending on what you read on the other server, may be helpful: http://php.net/file (GET) http://php.net/fsockopen (POST) http://php.net/curl (SSL) The (WORD) indicates which function you would use, at a minimum, if you find that word in the other server's documentation. Note that in each case, you *could* use the next function down in my list, if you wanted to do it the hard way. :-) YMMV. NAIAA. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] spot the mistake??
there is a hidden field called submitte Chris Ramsay [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] if (isset($submitted)){ [/snip] s...what sets $submitted then? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why not @ ?
It was curious to me, but I did a right click view source and here is your %40. a href =http://www.dte.ua.pt/cv/cv_show.php?email=gamito%40gmail.com;Maacute;rio Gamito/a well if your source code when you upload says @, then i can only imagin its being rendered on the server, otherwise every mailto:[EMAIL PROTECTED] would be broken. Marcus Joyce Mário Gamito wrote: Hi, If you care to take a peak at http://www.dte.ua.pt/cv/ and pass your mouse over the link Mário Gamito, you'll see in the status bar that the link is: http://www.dte.ua.pt/cv/[EMAIL PROTECTED] Allright. However, if you click and go to the respective page, you'll see that the @ is switched by %40. There is no need to even click it. Just Copy the link in the page and paste it in some editor. Even this way, the link is wrong. This completely bogles me. I mean, i pass the mouse over the link and i see @ in the status bar. If i Copy the link and paste it into a text editor, i get %40. Any help would be apreciated. The relevant code follows my signature. Warm Regrds, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session destroy/unset question - the same session_id is regenerated.
After unsetting and destroying the session, the same sid is generated. is this a normal behaviour? i did this: session_start() //kill session variables unset($_SESSION); session_destroy(); Thanks in advance ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why not @ ?
Hello Mário, Tuesday, March 22, 2005, 11:42:13 AM, you wrote: MG However, if you click and go to the respective page, you'll see that the MG @ is switched by %40. Yes, because you are URL encoding it, which does exactly that. Put a space into an email address and you'd see a %20 instead, etc. The browser will convert it back for display purposes *within the actual browser* (i.e. title bar, status bar) but the actual text really contains a %40. If you don't want this behaviour, don't URL encode the email address. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
[snip] So my question has to do with planning a project (not necessarily a website in general, but a programming project specifically). I've got Visio 2003 and a pad of paper with a pencil. I'm pretty much willing to try out different methods although I prefer a visual approach. [/snip] +1 for pencil paper or whiteboard. And in the words of Obi Jay, Use the flowchart Chris I know that there is lots of excitement about UML, especially in light of PHP5's better implementation of OOP, but 25+ years of experience tells me that basic flowcharting, before UML (which is not as complex as some would like to make it), will save you several headaches down the road. Keep in mind that flowcharts are living docsif you need to make a change to the code somewhere down the line you can (and should) change the flowchart to reflect it. Another good thing about a flowchart is its ability to describe the big picture as well as the most intricate detail. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [NEWBIE GUIDE] For the benefit of new members
= Please feel free to add more points and send to the list. 20050322jb - Note the new location of PHP Editors list. = 1. If you have any queries/problems about PHP try http://www.php.net/manual/en first. You can download a copy and use it offline also. Please also try http://www.php.net/manual/faq.php for answers to frequently answered questions about PHP (added by Christophe Chisogne). 2. Try http://www.google.com next. Searching for php YOUR QUERY may fetch you relevant information within the first 10 results. 3. There is a searchable archive of the mailing list discussion at http://phparch.com/mailinglists. Many of the common topics are discussed repeatedly, and you may get answer to your query from the earlier discussions. For example: One of the repeatedly discussed question in the list is Best PHP editor. Everyone has his/her favourite editor. You can get all the opinions by going through the list archives. If you want a chosen list try this link : http://www.thelinuxconsultancy.co.uk/phpeditors.php (contributed by Christophe Chisogne). 4. Not sure if PHP is working or you want find out what extensions are available to you? Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); ? If PHP is installed you will see a page with a lot of information on it. If PHP is not installed (or not working correctly) your browser will try to download the file. (contributed by Teren and reworded by Chris W Parker) 5. If you are stuck with a script and do not understand what is wrong, instead of posting the whole script, try doing some research yourself. One useful trick is to print the variable/sql query using print or echo command and check whether you get what you expected. After diagnosing the problem, send the details of your efforts (following steps 1, 2 3) and ask for help. 6. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access users' computer related information (OS, screen size etc) using PHP. Nor can you modify any the user side settings. You need to go for JavaScript and ask the question in a JavaScript list. On the other hand, you can access the information that is SENT by the user's browser when a client requests a page from your server. You can find details about browser, OS etc as reported by this request. (contributed by Wouter van Vliet and reworded by Chris W Parker.) 7. Provide a clear descriptive subject line. Avoid general subjects like Help!!, A Question etc. Especially avoid blank subjects. 8. When you want to start a new topic, open a new mail composer and enter the mailing list address php-general@lists.php.net instead of replying to an existing thread and replacing the subject and body with your message. 9. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. [contribued by Chris W Parker] 10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html [contributed by Jay Blanchard) 11. Do not send your email to the list with attachments. If you don't have a place to upload your code, try the many pastebin websites (such as www.pastebin.com). (contributed by Burhan Khalid) Following these guidelines will ensure that you get effective responses from the list members. Otherwise, your questions might not be answered. === Hope you have a good time programming with 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] [semi OT]: Planning projects
I remember reading that UML was fairly complex. Although brief reading up on it, it didn't seem all that hard. I think the next version is supposed to be simpler. I made a decision about 6 months wether I was going to learn UML or design patterns next. I chose design patterns, and really think I made the right choice. I've picked up some UML in the process, but more importantly, I amy planning for change much better. One of the mantras I've picked up is to figure out what changes in the program and separate it out. How you separate it out is where design patterns come in. I've discovered that design patterns help me plan much better and code much better. After all, it's all about managing change. A few years ago I read an article about where UML was being used. It was mainly in the big companies. Smaller companies found it slowed them down when they needed to get their product to market quickly. This pretty much worked well during the internet boom since it was mainly a bunch of really good programmers trying to create a product that they would see to the end. In a corporate environment, there is always a mix of talent and there is no guarantee the whole group will be there for the product life cycle. Thus UML is practically a must for a corporate environment so that everything can be documented for the next person to pick up quickly. If it's just you and maybe a couple of other people. The old fashioned way works very well. UML is great, but it will probably slow the process down for the sake of good documentation. If you can, go to your nearest paint store and pickup a can or two of chalkboard paint and make an entire wall (or two) of your apartment, house or work, a chalkboard. Wouldn't a 30ft x 8ft chalkboard be nice for diagrams? For a really wicked thinking environment, get a few black lights, turn off the lights, crank the music and work in the dark. The chalk glows in black light, so you'll be able to see what you are doing. On Mar 22, 2005, at 7:46 AM, Jay Blanchard wrote: [snip] So my question has to do with planning a project (not necessarily a website in general, but a programming project specifically). I've got Visio 2003 and a pad of paper with a pencil. I'm pretty much willing to try out different methods although I prefer a visual approach. [/snip] +1 for pencil paper or whiteboard. And in the words of Obi Jay, Use the flowchart Chris I know that there is lots of excitement about UML, especially in light of PHP5's better implementation of OOP, but 25+ years of experience tells me that basic flowcharting, before UML (which is not as complex as some would like to make it), will save you several headaches down the road. Keep in mind that flowcharts are living docsif you need to make a change to the code somewhere down the line you can (and should) change the flowchart to reflect it. Another good thing about a flowchart is its ability to describe the big picture as well as the most intricate detail. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why not @ ?
Hi Richard, Thanks a lot for your tip and explanation. It did worked :) Warm Regards, Mário Gamito Richard Davey wrote: Hello Mário, Tuesday, March 22, 2005, 11:42:13 AM, you wrote: MG However, if you click and go to the respective page, you'll see that the MG @ is switched by %40. Yes, because you are URL encoding it, which does exactly that. Put a space into an email address and you'd see a %20 instead, etc. The browser will convert it back for display purposes *within the actual browser* (i.e. title bar, status bar) but the actual text really contains a %40. If you don't want this behaviour, don't URL encode the email address. Best regards, Richard Davey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] access violation
Hello Rob, Monday, March 21, 2005, 10:32:36 PM, you wrote: R Anyone else had a problem like this? I couldn't find anything in the R php or apache bug databases that sounded like the same problem. R Windows XP pro SP2 R Apache/1.3.33 (Win32) R PHP/4.3.10 I have something similar on one webserver where PHP is throwing the Access Violations and it happens during refresh of POST data. It is intermittent in terms of exactly when the first one occurs, but once it happens then I can usually get it to throw again every 2nd or 3rd refresh of a POST. The only system stuff we have in common is the OS. The webserver is Sambar, and PHP is 5.0.3. It didn't start having this issue till I updated the PHP to 5.0.3, so I'm going to reinstall it at some point to see if that helps any. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Building modular applications (long)
You may want to look into design patterns. This will help you create applications that adapt to change well. When designing your application, figure out what changes when a module is present and separate it out. Find out what every module will use and group that together. You're going to want different actions to be taken depending on which modules are present without needing to change a function call. Object oriented programming and design patterns will allow you to do this well. Implementing certain design patterns can be a bit difficult in PHP4, but design patterns in general is an area that will make you a better programmer. Your concept is almost the same as a complete system with restrictions to certain modules. In your case, you are just saying the modules aren't there rather than being restricted. Your idea for having a script that would build the menu is good for a system with user level restrictions because things change depending on who is logged in. But I wouldn't build the menu from scratch every time if you are just checking for modules. The menu should be built when a module is installed or removed. That's the only time it will change anyway. If you are looking for dynamic discovery of the modules that are present, then you are doing something similar to WDS and UDDI. On Mar 21, 2005, at 6:56 PM, Chris W. Parker wrote: Hello, So I was thinking about building some modularity into future projects and wanted to bounce some ideas off my fellow list members. My definition of modular application is: A modular application is one that can have it's major functions added/removed with the click of a button, or the creating/deleting of a file without breaking the application on any level. The user should be able to add/remove a module* from the filesystem and have the application update itself automatically without any (or very little) interaction with the user of the application. For example, here is what I've come up with at this point for how a modular application could be built. First of all there would need to be some kind of script that controls/integrats/manages the individual modules. I imagine this task to be performed within an include file that is included at the top of every file in the application (let's call it adjuster.php). This include file would determine how to build the main menu based on certain factors within the applications directory tree. Said another way, this file would take an inventory of the available modules and build a menu based on what it found. In this way a module could be added/removed without any interaction** from the user and the menu would update automatically. This in and of itself is not difficult. What I think the difficult part of it will be is finding the appropriate way to construct modules. At this point I'm imaging a directory called modules/ where each directory within the modules/ directory is a module itself. It would contain all the classes and functions associated with that module as well as a definition file for that module (could be a simple .txt file). Adjuster.php would read the modules/ directory and recursively discover each module and then build the main menu accordingly. Having said all that I think what I'm looking for is some feedback from experienced person(s) on the list with building modular applications. I can see this being really helpful for something like a shopping cart, CRM, or CMS app. Thanks, Chris. * In the short time I've been thinking about what a module is I've determined it to be one of a few things (or a combination thereof). A module could be (a) a single file, (b) a set of files, or (c) a directory containing one or more files and/or directories. ** Not having any interaction with the user does not have to be a requirement, but it would sure be helpful when upgrading the application. For example: Customer comes to your website, buys a new module (or downloads for free, however you choose to license the software), and simply adds it to the module repository. Yadda yadda yadda, a new, full functional menu option is available. p.s. Are there any lists out there that deal with programming in general? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] seraching / indexing in php
I'm looking for a script which indexes the pages of a site (dynamic pages) in a dbase and makes it possible to search the site based on keywords/sentences/etc. Does anyone has any experience with such scripts and which do they recommend? Thx in advance Reinhart
Re: [PHP] seraching / indexing in php
Hello! I suggest you take a look at: http://www.phpdig.net/ Regards, Frank 2005-03-22 kl. 15.47 skrev Reinhart Viane: I'm looking for a script which indexes the pages of a site (dynamic pages) in a dbase and makes it possible to search the site based on keywords/sentences/etc. Does anyone has any experience with such scripts and which do they recommend? Thx in advance Reinhart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] seraching / indexing in php
Thanks Frank, One question: on most of these search engines I can't seem to find if the index and search dynamically generated pages. The intention is to make a site where several users have one page each which they can edit on there own. Do you think most of those engines can index pages like that? Or should I create an index every time a page is updated / made? Greetings -Oorspronkelijk bericht- Van: Frank Arensmeier [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 22 maart 2005 15:54 Aan: php list general Onderwerp: Re: [PHP] seraching / indexing in php Hello! I suggest you take a look at: http://www.phpdig.net/ Regards, Frank 2005-03-22 kl. 15.47 skrev Reinhart Viane: I'm looking for a script which indexes the pages of a site (dynamic pages) in a dbase and makes it possible to search the site based on keywords/sentences/etc. Does anyone has any experience with such scripts and which do they recommend? Thx in advance Reinhart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cache class
Hi, I'm having a bit of a problem. I include a class in my script, the first time run fine, and then if I change anything in my class, changes are not reflected on the browser, it's like it's still the old class which is used. I've cleared the browser cache, force a pragma no-cache, but no, nothing do the trick. even if I do return; at the beginning of the method I called, it doesn't work... does someone have a clue about what is going on ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Different approach?
Thanks! Needed to know that! :) John Josh Whiting wrote: $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('$StudentNumber','$Exercise1','$Exercise2'); mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); your example looks pretty solid, but the code above does not escape the $StudentNumber, $Exercise1, and $Exercise2 variables. If any of these variables contain data that when placed into the SQL string interferes with the SQL itself, you'll have unexpected failures and also a security hole if untrusted users can populate those variables. The solution is to wrap any strings or untrusted input like that in a call to mysql_escape_string(), like so: $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('. mysql_escape_string($StudentNumber).','. mysql_escape_string($Exercise1).','. mysql_escape_string($Exercise2).'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cache class
From: Mister Jack [mailto:[EMAIL PROTECTED] Hi, I'm having a bit of a problem. I include a class in my script, the first time run fine, and then if I change anything in my class, changes are not reflected on the browser, it's like it's still the old class which is used. I've cleared the browser cache, force a pragma no-cache, but no, nothing do the trick. even if I do return; at the beginning of the method I called, it doesn't work... does someone have a clue about what is going on ? Not to be a jerk and ask the obvious question, but are you editing the right file and/or saving it to the right place? I only ask because I've done that so many times it's not funny. :) -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session destroy/unset question - the same session_id is regenerated.
You probably need to eat the session cookie in addition to destroying the session. ?php /** Destroy session record in /tmp or your database or wherever */ session_destroy(); /** Destroy the $_SESSION vars so they are removed from PHP script */ unset($_SESSION); /** Destroy the cookie so that a new session will start next visit */ setcookie(session_name(), -3600); ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] [semi OT]: Planning projects
Brent Baisley wrote: I remember reading that UML was fairly complex. Although brief reading up on it, it didn't seem all that hard. I think the next version is supposed to be simpler. I made a decision about 6 months wether I was going to learn UML or design patterns next. I chose design patterns, what are design patterns? -- symbulos partners -.- symbulos - ethical services for your organisation http://www.symbulos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cache class
To add to the discussion: are you using anything like the Zend performance cache? MMTurck? Smarty? I ask because there are various programs out there (some PHP-based, some not) that will cache PHP code. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] [semi OT]: Planning projects
what are design patterns? http://phppatterns.com -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Full-text searches sucks?
Hey, I dont want to do that as its only mysql 4.1+ compatable, IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth. Oops, thats what i meant. The problem is a LOT of hosts are still on 3.23.xx so I dont want to do the BOOLEAN MODE thing. -Ryan On 3/21/2005 8:51:07 PM, Larry E. Ullman ([EMAIL PROTECTED]) wrote: Thanks for replying. You're quite welcome. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. I dont want to do that as its only mysql 4.1+ compatable, IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
Jay Blanchard mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 4:47 AM said: +1 for pencil paper or whiteboard. And in the words of Obi Jay, Use the flowchart Chris I would very much like to use flowcharts but I haven't been able to use them effectively yet. That is, I'm not sure how to split up the macro from the micro. Macro being the flow a user would take through the checkout section of the site and micro being how a function works. Keep in mind that flowcharts are living docsif you need to make a change to the code somewhere down the line you can (and should) change the flowchart to reflect it. Good to know. Another good thing about a flowchart is its ability to describe the big picture as well as the most intricate detail. See above. :| Have suggestions? Or maybe if I'm lucky you've got a few sample charts you can send me (PDF/Visio/jpeg)? This thread has been interesting so far. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Building modular applications (long)
Brent Baisley mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 6:41 AM said: In your case, you are just saying the modules aren't there rather than being restricted. Your idea for having a script that would build the menu is good for a system with user level restrictions because things change depending on who is logged in. But I wouldn't build the menu from scratch every time if you are just checking for modules. The menu should be built when a module is installed or removed. That's the only time it will change anyway. Yeah I thought of this near the end of writing my email. And you're right, the script to build the menu should only be run when modules change. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting form name
I'm trying to get the name of a form. I tried the following code, but I guess the data in $_POST only contains data on the form elements that go inside the form tags, but not info from the form tag itself. Any suggestions on how to get the form name? ? foreach ($_POST as $key=$value) { echo $key . --- . $value . br; } echo hr; echo form name=\myForm\ action=\test.php\ method=\POST\ value=\AAA\$ echo input type=\text\ name=\textbox\; echo input name=\mySubmit\ type=\submit\; echo /form; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting form name
Hello, Tuesday, March 22, 2005, 5:13:50 PM, you wrote: jk I'm trying to get the name of a form. I tried the following code, but jk I guess the data in $_POST only contains data on the form elements jk that go inside the form tags, but not info from the form tag itself. jk Any suggestions on how to get the form name? Stick a hidden input field in your form that contains the name of it. You cannot extract it from any super-global, it's not passed in that way. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting form name
Hello j, Tuesday, March 22, 2005, 10:13:50 AM, you wrote: j I'm trying to get the name of a form. I tried the following code, j but I guess the data in $_POST only contains data on the form j elements that go inside the form tags, but not info from the form j tag itself. Any suggestions on how to get the form name? j echo form name=\myForm\ action=\test.php\ method=\POST\ value=\AAA\$ IIRC, form name is not sent by any browser, so it won't show up in POST / GET / COOKIES or anywhere else. The easiest way is to set a hidden field which contains that information.. i.e. input type=hidden name=formName value=myForm / -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cant get this to work at all
Fairly new to php and just working my way around it. I have the text boxes and want to retrieve the values using a foreach. Many thanks, AD begin 666 problem.php M/#]P:' -@T*:[EMAIL PROTECTED]ESV5T(@DW5B;6ET=5D*2E[#0H-F9O[EMAIL PROTECTED] M)%]03U-46R=C;V]K:64G72!AR D;F%M92 ]/B D86=E*0T*PT*( @V5T M8V]O:VEE*)C;V]K:65;)YA;65=(BP@)%G92D[#0H@(!E8VAO(1?0T]/ M2TE%6R1N86UE73L-GT-@T*( T*#0I]#0H_/@T*/%$3T-465!%($A434P@ M4%53$E#((M+R]7,T,O+T141!(5$U,(#0N,[EMAIL PROTECTED]')A;G-I=EO;F%L+R]% M3B(@(FAT=' Z+R]W=WN=S,N;W)G+U12+VAT;6PT+VQO;W-E+F1T9(^#0H\ M:'1M;#X-CQH96%D/@T*#0H\+VAE860^#0H-CQB;V1Y/@T*/9OFT@;F%M M93TB9F]R;3$B(UE=AO9#TB]S=(@86-T:6]N/2(\/R D4$A07U-%3$8[ M(#\^(CX-B @/'1A8FQE('=I9'1H/2(U,34B()OF1ECTB,2(^#0H@( @ M/'1R/@T*( @( @/'1D('=I9'1H/2(X-R(^/1I=B!A;EG;CTB8V5N=5R M(CX-B @( @( @/EN'5T(YA;64](F-O;VMI95MA;F1R96%=(B!T7!E M/2)T97AT(B!C;%SSTB=5X=%]F:65L9(@:60](F-O;VMI95MA;F1R96%= M(B!V86QU93TB(B!S:7IE/2(Q(B!M87AL96YG=@](C$B(#X-CPO9EV/CPO M=0^#0H@( @( \=[EMAIL PROTECTED]@](C0Q,B(^/' ^06YDF5A/]P/CPO=0^ M#0H@( @/]TCX-B @( \='(^#0H@( @( \=0^/1I=B!A;EG;CTB M8V5N=5R(CX-B @( @( @( \:6YP=70@;F%M93TB8V]O:VEE6VIA;65S M72(@='EP93TB=5X=(@8VQAW,](G1E'1?9FEE;0B(ED/2)C;V]K:65; M:F%M97-=(B!V86QU93TB(B!S:7IE/2(Q(B!M87AL96YG=@](C$B/@T*( @ M( @/]D:78^/]T9#X-B @( @(#QT9#X\#Y*86UESPO#X\+W1D/@T* M( @(#PO='(^#0H@( @/'1R/@T*( @( @/'1D/CQD:[EMAIL PROTECTED](F-E M;G1EB(^#0H@( @( @( @/EN'5T(YA;64](F-O;VMI95MS=5V95TB M('1Y4](G1E'0B(-L87-S/2)T97AT7V9I96QD(B!I9#TB8V]O:VEE6W-T M979E72(@=F%L=64](B(@VEZ93TB,2(@;6%X;5N9W1H/2(Q(CX-B @( @ M(#PO9EV/CPO=0^#0H@( @( \=0^/' ^4W1E=F4\+W ^/]T9#X-B @ M( \+W1R/@T*( \+W1A8FQE/@T*( \:[EMAIL PROTECTED]'EP93TBW5B;6ET(B!N M86UE/2)3=6)M:70B('9A;'5E/2)3=6)M:70B/B @#0H@(#QI;G!U=!N86UE M/2)S=6)M:71T960B('1Y4](FAI91E;B(@:60](G-U8FUI='1E9(@=F%L D=64](C$B/@T*/]F;W)M/@T*/]B;V1Y/@T*/]H=UL/@T* ` end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Postgresql PHP
Any recommendations on books for postgresql PHP usage. Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Postgresql PHP
Hello Danny, Tuesday, March 22, 2005, 6:07:55 PM, you wrote: DB Any recommendations on books for postgresql PHP usage. Just get a good book on Postgres, the PHP side of it can be easily picked-up from the PHP manual itself. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cant get this to work at all
Paste the code to a pastebin site... or use .phps extension for the PHP code and leave it on your server for us to look at it. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] here is the problem again
http://www.aztechost.com/problem.phps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cant get this to work at all
http://www.aztechost.com/problem.phps AndreaD [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Fairly new to php and just working my way around it. I have the text boxes and want to retrieve the values using a foreach. Many thanks, AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [semi OT]: Planning projects
Well this one hasn't been offered yet: I just subscribed to php|architect and there was an article in either the Feb or March issue (I got them 1 day apart so I don't remember off hand) about a system of design. I'll try not to give too much away, but it used index cards. The index cards each represented a class. They were split down the center and on one side the methods of the class was named and on the right the right, all of the class's dependencies were written down. So a DB class might have a dependancy on the DB software and related functions. A session handling class, however, might call a method of setCookie or sessionHandler or some such. Oh, and for those of you who don't currently subscribe to php|arch, I would suggest it. It has some interesting articles about subjects and technologies relating to php that you won't find elsewhere. Not only that, but these guys know what they're talking about. That's just my $.02 -justin -- Justin Lilly University of South Carolina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Résultats sur plusieurs pages
Bonjour, J'utilise PHP et MySQL grâce à EasyPHP sous WindowsXP. J'ai réussi à modifier un programme php pour pouvoir l'utiliser à gérer un dictionnaire d'une langue locale, dont vous avez une phrase ci-dessous. L'interogation de la base de données peut donner suivant les cas, un grand nombre de résultas, aussi j'essaie d'ajouter quelques lignes de programmation pour que le résultat d'une recherche qui donne un trop grand nombre de réponse puisse petre affiché sur plusieurs pages, à la manière des moteurs de recherche, genre Google. Où puis-je trouver un exemple de ces quelques lignes de programmation, je bataille depuis plus de quinze jours en vain...! http://www.ubaye-verdon.net/barcinonien/index.php3 Merci et meilleures salutations. Vôou miéi abeouràr en clapiér qu'en noutàri (Le Langage de la Vallée de Barcelonnette par François Arnaud Gérard Morin)
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Résultats sur plusieurs pages
From: clariond jean claude [mailto:[EMAIL PROTECTED] Bonjour, J'utilise PHP et MySQL grâce à EasyPHP sous WindowsXP. J'ai réussi à modifier un programme php pour pouvoir l'utiliser à gérer un dictionnaire d'une langue locale, dont vous avez une phrase ci-dessous. L'interogation de la base de données peut donner suivant les cas, un grand nombre de résultas, aussi j'essaie d'ajouter quelques lignes de programmation pour que le résultat d'une recherche qui donne un trop grand nombre de réponse puisse petre affiché sur plusieurs pages, à la manière des moteurs de recherche, genre Google. Où puis-je trouver un exemple de ces quelques lignes de programmation, je bataille depuis plus de quinze jours en vain...! http://www.ubaye-verdon.net/barcinonien/index.php3 Merci et meilleures salutations. Bonjour, S'il-vous plait, pardonez ma Francaise. Je suis Americaine, mais je parle Francais un peu. Si je lis votre question correctement, vous desire paginez votre resultats. Vous avez besoin le nombre de records dans l'ensemble de resultat. Si vous desire montrer dix resultat dans chaque page, ajoutez un clause LIMIT a votre interogation: SELECT * FROM nom_de_table LIMIT n,10; `n' est l'excentrage, ou la pointe commencement. Passer `n' de chaque page et ajoutez 10: http://domain.net/resultant.php3?n=0 http://domain.net/resultant.php3?n=10 http://domain.net/resultant.php3?n=20 ... http://domain.net/resultant.php3?n=100 Avec le clause LIMIT, votre interogation est: SELECT * FROM nom_de_table LIMIT 0,10; SELECT * FROM nom_de_table LIMIT 10,10; SELECT * FROM nom_de_table LIMIT 20,10; ... SELECT * FROM nom_de_table LIMIT 100,10; Le premiere retourne resultant zero a dix, le seconde retourne onze a vingt, et le deniere retourne resultant cent a cent-dix. J'espere que ceci aide, et ma Francaise et intelligible! Bonne chance! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cache class
I usually encounter this when there's an error of some sort. Tail your error log and see if the apache child thread is seg faulting (if you're using httpd). The web server may still be up, but your code is causing the particular connection to fail. Because the connection just dies, the browser never receives any content, and so never changes what's on screen. Look for scoping issues: i.e., accessing a singleton from an aggregate object's constructor (before the singleton has been instantiated). Alternatively, comment out everything but the first few lines, and start uncommenting more and more until it stops working all together. As a good test, try this: ?php [...trial code...] echo 'test run finished'; exit; /* [...unknown code...] */ ? Hope this helps, Jeremy Mister Jack wrote: Hi, I'm having a bit of a problem. I include a class in my script, the first time run fine, and then if I change anything in my class, changes are not reflected on the browser, it's like it's still the old class which is used. I've cleared the browser cache, force a pragma no-cache, but no, nothing do the trick. even if I do return; at the beginning of the method I called, it doesn't work... does someone have a clue about what is going on ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Résultats sur plusieurs pages
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mike Johnson wrote: | Si je lis votre question correctement, vous desire paginez votre | resultats. Vous avez besoin le nombre de records dans l'ensemble de | resultat. Si vous desire montrer dix resultat dans chaque page, | ajoutez un clause LIMIT a votre interogation: Utilise Pear::Pager. C'est très pratique. http://pear.php.net/package/Pager Amicalement, Aurélien -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCQH172e0VO2fZtNYRAm7AAJwNz56nogkEdbQ4bh2WPKPD0g6rSQCgsDDy l7pHD3rh5CaWwSfvdwspDuo= =RXZt -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php: else if problem
to: 'php-general@lists.php.net' from: Leonidas Savvides Please see my problem below in PHP code : _ ?php echo $month, $day, $year, $month2, $day2, $year2;// these are ok-normal values from web form if ( ! @checkdate($month,$day,$year) ) { echo this operate till here; // include_once (normaldays.php); @ // wrongpickupdate.htm } else if ( ! @checkdate($month2,$day2,$year2) ) { include_once (wrongdropoffdate.htm); } else if ( $tsp $tsnow ) { // $tsp=time stamp pickup date include_once (wrongpickupdate.htm); // include_once (normaldays.php); // wrongpickupdate.htm } else if ( $tsp = $tsd ) { // $tsd=time stamp drop off date include_once (wrongpickupdate.htm); } else if ( $days = 60 ) { // $days var come from $tsd $tsp include_once (manydays.htm); } else if ( $days = 2 ) { include_once (fewdays.htm); } else { include_once (normaldays.php); } ? _ problem 1. executes first statement what ever vars are 2. if no ! to first statement , executes second statement 3. if no ! to first second statement, executes first include_once() statement meaning : } else if ( $tsp $tsnow ) { include_once (wrongpickupdate.htm); } whatever values of $tsp $tsnow are . well WHERE THE PROBLEM IS ? *mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * http://us.f610.mail.yahoo.com/ym/[EMAIL PROTECTED] [EMAIL PROTECTED] * Leonidas Savvides
[PHP] HTML - to - PDF
Hi All, I have some reports I need converted from HTML to PDF, I'm on a LAMP box, so does anyone have any free suggestions? Thanks, Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED]
Re: [PHP] HTML - to - PDF
Hi All, I have some reports I need converted from HTML to PDF, I'm on a LAMP box, so does anyone have any free suggestions? Google htmldoc thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: here is the problem again
The cookie will not/set or print out. AndreaD [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] http://www.aztechost.com/problem.phps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php: else if problem
In PHP you should write it as } elseif {, so there's no space between else and if. Read http://php.net/elseif for more details On Tue, 22 Mar 2005 22:48:00 +0200, Leonidas Savvides [EMAIL PROTECTED] wrote: to: 'php-general@lists.php.net' from: Leonidas Savvides Please see my problem below in PHP code : _ ?php echo $month, $day, $year, $month2, $day2, $year2;// these are ok-normal values from web form if ( ! @checkdate($month,$day,$year) ) { echo this operate till here; // include_once (normaldays.php); @ // wrongpickupdate.htm } else if ( ! @checkdate($month2,$day2,$year2) ) { include_once (wrongdropoffdate.htm); } else if ( $tsp $tsnow ) { // $tsp=time stamp pickup date include_once (wrongpickupdate.htm); // include_once (normaldays.php); // wrongpickupdate.htm } else if ( $tsp = $tsd ) { // $tsd=time stamp drop off date include_once (wrongpickupdate.htm); } else if ( $days = 60 ) { // $days var come from $tsd $tsp include_once (manydays.htm); } else if ( $days = 2 ) { include_once (fewdays.htm); } else { include_once (normaldays.php); } ? _ problem 1. executes first statement what ever vars are 2. if no ! to first statement , executes second statement 3. if no ! to first second statement, executes first include_once() statement meaning : } else if ( $tsp $tsnow ) { include_once (wrongpickupdate.htm); } whatever values of $tsp $tsnow are . well WHERE THE PROBLEM IS ? *mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * http://us.f610.mail.yahoo.com/ym/[EMAIL PROTECTED] [EMAIL PROTECTED] * Leonidas Savvides -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: here is the problem again
AndreaD mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 12:25 PM said: The cookie will not/set or print out. http://www.aztechost.com/problem.phps setcookie(cookie[$name], $age); echo $_COOKIE[$name]; I think it should be: setcookie(cookie[$name], $age); echo $_COOKIE['cookie[{$name}]']; ?? Please see http://www.php.net/setcookie. Also you're teaching yourself a very bad habit of writing scripts with register_globals turned on. See google for more information. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php: else if problem
read the manual, you can use both (else if and elseif). The script does exactly what you tell it to. The flaw(s) is(/are) in your logic. Second of all, might I please advise you to have a good look at your code, and at least *try* to clean it up a bit? I'm sure you didn't mean it like this, but your code is wordwrapped in such a weird way that it's hard to distinguish what is actual executable code, and what your comments are supposed to be - tul Franklin van de Meent wrote: In PHP you should write it as } elseif {, so there's no space between else and if. Read http://php.net/elseif for more details On Tue, 22 Mar 2005 22:48:00 +0200, Leonidas Savvides [EMAIL PROTECTED] wrote: to: 'php-general@lists.php.net' from: Leonidas Savvides Please see my problem below in PHP code : _ ?php echo $month, $day, $year, $month2, $day2, $year2;// these are ok-normal values from web form if ( ! @checkdate($month,$day,$year) ) { echo this operate till here; // include_once (normaldays.php); @ // wrongpickupdate.htm } else if ( ! @checkdate($month2,$day2,$year2) ) { include_once (wrongdropoffdate.htm); } else if ( $tsp $tsnow ) { // $tsp=time stamp pickup date include_once (wrongpickupdate.htm); // include_once (normaldays.php); // wrongpickupdate.htm } else if ( $tsp = $tsd ) { // $tsd=time stamp drop off date include_once (wrongpickupdate.htm); } else if ( $days = 60 ) { // $days var come from $tsd $tsp include_once (manydays.htm); } else if ( $days = 2 ) { include_once (fewdays.htm); } else { include_once (normaldays.php); } ? _ problem 1. executes first statement what ever vars are 2. if no ! to first statement , executes second statement 3. if no ! to first second statement, executes first include_once() statement meaning : } else if ( $tsp $tsnow ) { include_once (wrongpickupdate.htm); } whatever values of $tsp $tsnow are . well WHERE THE PROBLEM IS ? *mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * http://us.f610.mail.yahoo.com/ym/[EMAIL PROTECTED] [EMAIL PROTECTED] * Leonidas Savvides -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: here is the problem again
Chris W. Parker wrote: AndreaD mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 12:25 PM said: The cookie will not/set or print out. http://www.aztechost.com/problem.phps setcookie(cookie[$name], $age); echo $_COOKIE[$name]; I think it should be: think again setcookie(cookie[$name], $age); echo $_COOKIE['cookie[{$name}]']; ?? Please see http://www.php.net/setcookie. have you tried reading it yourself? the answer /is/ in there you know! Basically, what happens here is the fact that when you set a cookie using setcookie(), that cookie isn't automatically added to the $_COOKIE superglobal. why not? because the $_COOKIE superglobals array contains cookies *recieved* from the user, and this one just left on its way *to* the user. Until the user reloads the page, that cookie will not show up in the $_COOKIE array. But, please tell me, why don't you print it like this: echo $age ? -tul Also you're teaching yourself a very bad habit of writing scripts with register_globals turned on. See google for more information. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Arrays between pages
Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$testArray\; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.
Re: [PHP] Passing Arrays between pages
Please can someone tell me how you pass arrays between PHP pages. $var = serialize($testArray); echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$var\; Then unserialize the variable on the receiving page. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Arrays between pages
1. you can put your array in string using implode() function and on next page create the array back using explode() function. $testArray = implode('|', $testArray); # you will get: Apple|Banana|Peach On next page: $testArray = explode('|', $testArray); 2. use serialize()/unserialize() functions For more info read manual. -afan PartyPosters wrote: Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$testArray\; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [suspicious - maybe spam] [ PHP] [suspicious - maybe spam] RE: [ suspicious - maybe spam] [PHP] [suspici ous - maybe spam] Résultats sur plusieurs pages
Please, This is an English list. I'll thank if you can write plain english on it. Thanks. On Tue, 22 Mar 2005 21:18:06 +0100, Aurélien Cabezon [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mike Johnson wrote: | Si je lis votre question correctement, vous desire paginez votre | resultats. Vous avez besoin le nombre de records dans l'ensemble de | resultat. Si vous desire montrer dix resultat dans chaque page, | ajoutez un clause LIMIT a votre interogation: Utilise Pear::Pager. C'est très pratique. http://pear.php.net/package/Pager Amicalement, Aurélien -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCQH172e0VO2fZtNYRAm7AAJwNz56nogkEdbQ4bh2WPKPD0g6rSQCgsDDy l7pHD3rh5CaWwSfvdwspDuo= =RXZt -END PGP SIGNATURE- -- 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] count with match probelm
Hi, I am running this kind of a statement: $q=mysql_query(select cno,date_and_time,MATCH(ad_sub, ad_text) AGAINST('$words') AS score from .$tcname.ads WHERE MATCH(ad_sub, ad_text) AGAINST('$words') AND is_confirmed=1 LIMIT $limit1, $limit2); which is running fine...my problem is I am using a class for pagination which requires the total number of records that will be returned to break the query into pagesand which will give me the values of $limit1 and , $limit2 which i will use in the above statement...but running a count() is not working, it gives me an error, what other options do i have other than running the same query twice and using mysql_num_rows? (which i think would be quite intensive/wasteful as i am querying @ 100 rows each time) This is my count() query, maybe theres a problem here? $how_many = mysql_result(mysql_query(SELECT COUNT(*), MATCH(ad_sub, ad_text) AGAINST('$words') AS score from .$tcname.ads WHERE MATCH(ad_sub, ad_text) AGAINST('$words') FROM .$tcname.ads where is_confirmed=1),0); Thanks in advance, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [NEWBIE GUIDE] For the benefit of new members
[snip] I feel we should add this to the rules. Dunno about the others, but it really drives mad to delete bunches of emails with equal contents posted within 5 minute interval. --- Please avoid sending duplicate letters to the list. If you feel your email was not delivered properly or no-one noticed it, try sending again in a couple of days. Reposting frequently will not help solving your problems; in addition, members won't be much pleased if you flood 'em, so you decrease your chances to get helpful answers. If your mail server doesn't work properly, please pay attention to thousands of decent free ones. --- wbr Stan F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with epoch date before 1970 on PHP 4.3.1
Hi there we have discovered a bug when trying to format a date which is before 1970 on one of our servers running PHP 4.3.1 , it will convert the 1966 year to 1970, is there any possible workaround for this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help! configure Apache as a proxy
I configured a Apache server as a proxy. But it's very slow. when I use this server connect internet it's NOT so slow. I think it's because,my config has some error! Who can help me? thank you IfModule mod_proxy.c Listen 8086 ProxyRequests On ProxyVia On ProxyRemote * http://192.168.1.9:8080 NoProxy 192.0.0.0/8 AllowCONNECT 8086 #ProxyReceiveBufferSize 2048 #ProxyBlock .imrworldwide.com Proxy * Order deny,allow Deny from all Allow from 192.168.2.100 /Proxy /IfModule Shi MuQi LangFang ABC (China) v Tel:(86)-316-68382!^ /(_)\ E-mail:[EMAIL PROTECTED] ^ ^
RE: [PHP] access violation
hi Leif Glad to know I'm not the only one ;) The only system stuff we have in common is the OS. The webserver is Sambar, and PHP is 5.0.3. It didn't start having this issue till I updated the PHP to 5.0.3, so I'm going to reinstall it at some point to see if that helps any. That's interesting - it also started happening for me after installing PHP 5.0.3. But I have reverted to 4.3.10 for now, and I can't see how installing 5.0.3 into an entirely separate directory can break my old php install. Hmm.. Incidentally, are you using Pear at all? Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destroy/unset question - the same session_id is regenerated.
Ken wrote: After unsetting and destroying the session, the same sid is generated. No session identifier is generated at this point. This generation only happens when there is no identifier presented by the client, or when you explicitly regenerate it using something like session_regenerate_id(). is this a normal behaviour? Yes. Are you sure you need a new session identifier? i did this: session_start() //kill session variables unset($_SESSION); session_destroy(); I'd have to do some tests to find out, but you might want to set $_SESSION to attay() rather than just unset it, but these might have essentially the same behavior (e.g., memory is freed but not overwritten). Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help! configure Apache as a proxy
I configured a Apache server as a proxy. But it's very slow. when I use this server connect internet it is NOT so slow. I think it ss because,my config has some error! Who can help me? thank you IfModule mod_proxy.c Listen 8086 ProxyRequests On ProxyVia On ProxyRemote * http://192.168.1.9:8080 NoProxy 192.0.0.0/8 AllowCONNECT 8086 Proxy * Order deny,allow Deny from all Allow from 192.168.2.100 /Proxy /IfModule Shi MuQi LangFang ABC (China) v Tel:(86)-316-68382!^ /(_)\ E-mail:[EMAIL PROTECTED] ^ ^
Re: [PHP] Re: cache class
Many thanks for all the answers. I've checked that I was saving the right file (I even think about it !), and even if I'm using Templeet (sort of smarty http://templeet.org ) i've disabled all cache, and this code is only PHP not template-language. I've checked the error.log, and it just said that the file does not exists (which is normal, the page is generated when it's missing, by Templeet, thus proving it's not using a cache). Now, i've put the class definition inside by PHP file, (I do not include it anymore with include ''), and it just hang with the error.log saying that it exhausted all memory. On Tue, 22 Mar 2005 15:18:17 -0500, Jeremiah Fisher [EMAIL PROTECTED] wrote: I usually encounter this when there's an error of some sort. Tail your error log and see if the apache child thread is seg faulting (if you're using httpd). The web server may still be up, but your code is causing the particular connection to fail. Because the connection just dies, the browser never receives any content, and so never changes what's on screen. Look for scoping issues: i.e., accessing a singleton from an aggregate object's constructor (before the singleton has been instantiated). Alternatively, comment out everything but the first few lines, and start uncommenting more and more until it stops working all together. As a good test, try this: ?php [...trial code...] echo 'test run finished'; exit; /* [...unknown code...] */ ? Hope this helps, Jeremy Mister Jack wrote: Hi, I'm having a bit of a problem. I include a class in my script, the first time run fine, and then if I change anything in my class, changes are not reflected on the browser, it's like it's still the old class which is used. I've cleared the browser cache, force a pragma no-cache, but no, nothing do the trick. even if I do return; at the beginning of the method I called, it doesn't work... does someone have a clue about what is going on ? -- 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] Passing Arrays between pages
Thanks for all your help!!! managed it with - $testArray = implode('|', $testArray); On next page: $testArray = explode('|', $testArray); - Original Message - From: [EMAIL PROTECTED] To: PartyPosters [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, March 22, 2005 10:06 PM Subject: Re: [PHP] Passing Arrays between pages 1. you can put your array in string using implode() function and on next page create the array back using explode() function. $testArray = implode('|', $testArray); # you will get: Apple|Banana|Peach On next page: $testArray = explode('|', $testArray); 2. use serialize()/unserialize() functions For more info read manual. -afan PartyPosters wrote: Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$testArray\; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Notice: Undefined offset: 3 in ..........
Hello, Please could someone tell me why I am getting (Notice: Undefined offset: 3 in ..) from using this code. for ($i=0; $i=3; $i++){ mysql_query(INSERT INTO shipped(userID, productID, distID, username,ship_company, ship_add1,ship_add2) VALUES(1, '$productID','$v_distIDArray[$i]', userID, '$v_companyArray[$i]','$v_add1Array[$i]','$v_add2Array[$i]')); } Thanks Kaan - Original Message - From: PartyPosters To: php-general@lists.php.net Sent: Tuesday, March 22, 2005 10:01 PM Subject: Passing Arrays between pages Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$testArray\; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.
Re: [PHP] Notice: Undefined offset: 3 in ..........
PartyPosters wrote: Hello, Please could someone tell me why I am getting (Notice: Undefined offset: 3 in ..) from using this code. for ($i=0; $i=3; $i++){ mysql_query(INSERT INTO shipped(userID, productID, distID, username,ship_company, ship_add1,ship_add2) VALUES(1, '$productID','$v_distIDArray[$i]', userID, '$v_companyArray[$i]','$v_add1Array[$i]','$v_add2Array[$i]')); } Because you only have 3 elements in one or more of those arrays. Remember, index 3 is the 4th element. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] send email sample
PHPer, Sorry, I caused a lot of trouble to you. Because my company block 80 port, only use email. Thanks for your help. John Taylor-Johnston wrote: Burhan Khalid wrote: Can you give me a send email sample? RTFM : http://www.php.net/manual/en/function.mail.php Burhan, That's awfully polite. RTFM. How are people supposed to get started? Take that attitude back over to the Perl newsgroup. One of the joys of PHP has been a non-techhead, non-stressful, Open Source spirit of teaching and helping others, which in turn helps PHP grow and flourish. I'm polite, but seems that the original poster took no effort on their part to try and solve the problem first. I'm polite to people that try and solve the problem first, before coming to others for help. The original poster could have done any of the following things: 1. Simply type mail in the search box on the php.net website, which would have taken them to the section titled Mail Functions, where the first line reads The mail() function allows you to send mail. When they would have clicked on mail(), the would have seen examples on how to send an email. 2. Simply typing sending email php in Google would have gotten them a lot better results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Information from NOD32 This message was checked by NOD32 Antivirus System for Linux Mail Server. http://www.nod32.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Borrowed code- how to give credit
Hey, I used a single line of code (ver batim) from a pear class in my own code. I try to always be honest and not steal code but this single line does exactly what I need. The code is for a NPO website and will never be sold or anything like that. How should I give credit for the line of code in my own code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Borrowed code- how to give credit
You can add as many remarks as you want... It won't show up in the code or mess it up. Just say something like /* The next line of code came from my PEAR class. I did not create it, it was something we created in class. Just giving credit where credit is due */ I myself, wouldn't care. I mean, the burden of proving it would be on them. And who's to say that you didn't get it elsewhere. Just my $.02... Bryan On Tue, 22 Mar 2005 19:54:27 -0500, C Drozdowski [EMAIL PROTECTED] wrote: Hey, I used a single line of code (ver batim) from a pear class in my own code. I try to always be honest and not steal code but this single line does exactly what I need. The code is for a NPO website and will never be sold or anything like that. How should I give credit for the line of code in my own code? -- 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] Passing Arrays between pages
Please can someone tell me how you pass arrays between PHP pages. $var = serialize($testArray); echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$var\; Then unserialize the variable on the receiving page. To this you might also add an MD5 hash to check for authenticity, depending on what you're doing with that incoming data that you're unserializing (consider an client who sends you a serialized array that you didn't intend). You'll also want to encode the serialized data with htmlentities: $serialized = serialize($testArray); $hash = md5($serialized . my secret phrase); echo 'input type=hidden name=serialized value='.htmlentities($serialized).''; echo 'input type=hidden name=hash value='.$hash.''; then on the receiving end: if ($_POST['hash'] != md5($_POST['serialized'] . my secret phrase) { // the hash doesn't match up, consider the data unusable } else{ $testArray = unserialize($_POST['serialized']); } HTH /jw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GIF instead of JPG..
Hi, I found this beautiful piece of code on the php site which make a proportional thumbnail, problem is its only working with JPEG files...and not with GIFs, can someone please help me convert it to GIF too? I tried but got a bit confused as there are no functions that are equal to imagecreatetruecolor that is in the below script. The below script works perfectly for jpgs: ?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); if ($width ($width_orig $height_orig)) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ? Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the online manual! Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] seraching / indexing in php
or you can have a try on google:) xx site:www.yours.com On Tue, 22 Mar 2005 15:47:01 +0100, Reinhart Viane [EMAIL PROTECTED] wrote: I'm looking for a script which indexes the pages of a site (dynamic pages) in a dbase and makes it possible to search the site based on keywords/sentences/etc. Does anyone has any experience with such scripts and which do they recommend? Thx in advance Reinhart -- Sincerely, Forest Liu() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GIF instead of JPG..
Hi, I found this beautiful piece of code on the php site which make a proportional thumbnail, problem is its only working with JPEG files...and not with GIFs, can someone please help me convert it to GIF too? If your version of GD supports GIFs (which not all do), then it's almost as simple as changing every place you see the string jpeg to gif. Look in the online manual for the image functions. You'll see reference to the ones here (such as imagecreatfromjpeg()) and also ones for PNGs and GIFs and a few others. Just realize that when you are reading a file of a particular type, you need to use those imagetype() functions... But in most cases they are completely interchangable if you're passing paths to images of the appropriate type. Hope all of that makes sense :) -M I tried but got a bit confused as there are no functions that are equal to imagecreatetruecolor that is in the below script. The below script works perfectly for jpgs: ?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); if ($width ($width_orig $height_orig)) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ? Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the online manual! Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- 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] GIF instead of JPG..
On Wed, March 23, 2005 5:30 am, Ryan A said: Hi, I found this beautiful piece of code on the php site which make a proportional thumbnail, problem is its only working with JPEG files...and not with GIFs, can someone please help me convert it to GIF too? I tried but got a bit confused as there are no functions that are equal to imagecreatetruecolor that is in the below script. I believe all the imagecreatefromXYZ functions create a truecolor image for internal manipulation... Though I could be wrong, as GIF images do have pallet information within them, and I supposed GD could be justified in using that to build a 256-color image... At any rate, imagecreatetruecolor creates a format-less image -- It's not a GIF, JPEG, TIFF, or anything, really. It's in an internal GD format, and you can do whatever you want to it, and then output it as whatever format you want. The below script works perfectly for jpgs: As noted, just change jpg to gif everywhere, and it should work fine, if your GD supports GIF. Or you could even alter the script to determine the image format based on its filename, then call the correct imagecreatefromXYZ and the correct imageXYZ at the end. Or, you could even use http://php.net/imagegetsize and IGNORE the filename, and base your decision on what's actually *IN* the file, so when some idiot renames a jpeg to .gif because they think that will make it a GIF (yes, that really happens) then you won't get messed up. ?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); if ($width ($width_orig $height_orig)) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ? Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the online manual! Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Borrowed code- how to give credit
On Tue, March 22, 2005 4:54 pm, C Drozdowski said: I used a single line of code (ver batim) from a pear class in my own code. I try to always be honest and not steal code but this single line does exactly what I need. The code is for a NPO website and will never be sold or anything like that. How should I give credit for the line of code in my own code? One line of code? It's either a VERY long line, or not worth worrying about... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! configure Apache as a proxy
On Tue, March 22, 2005 3:30 pm, [EMAIL PROTECTED] said: I configured a Apache server as a proxy. But it's very slow. when I use this server connect internet it is NOT so slow. I think it ss because,my config has some error! Who can help me? WILD GUESS You've got Apache configured to do a reverse DNS lookup to see the domain name of the visitor... Only now it's trying to find a domain name for 192.168.2.100 which is not in your /etc/hosts file and ain't gonna show up in DNS records any time soon... Note that I don't really understand any of this proxy stuff you've done. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with epoch date before 1970 on PHP 4.3.1
On Tue, March 22, 2005 2:56 pm, Dan Rossi said: Hi there we have discovered a bug when trying to format a date which is before 1970 on one of our servers running PHP 4.3.1 , it will convert the 1966 year to 1970, is there any possible workaround for this ? E. Unix epoch dates start with the integer 0 representing midnight 1/1/1970. Rumor has it that the authors of this standard are big Disco fans, but they have only replied with No comment :-) I dunno what you expected to get from 1966 in an epoch date, but it's not kosher input, so there ya go. The only work-around for getting pre-1970 dates is not using Unix epoch to represent your dates. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] count with match probelm
On Tue, March 22, 2005 11:30 pm, Ryan A said: $q=mysql_query(select cno,date_and_time,MATCH(ad_sub, ad_text) AGAINST('$words') AS score from .$tcname.ads WHERE MATCH(ad_sub, ad_text) AGAINST('$words') AND is_confirmed=1 LIMIT $limit1, $limit2); This is pretty much a MySQL question, really... But: There is a new-ish SQL_CALC_FOUND_ROWS constant you can use in your query to get MySQL to tell you how many rows you would have gotten without the LIMIT clause. You may be able to use that. which is running fine...my problem is I am using a class for pagination which requires the total number of records that will be returned to break the query into pagesand which will give me the values of $limit1 and , $limit2 which i will use in the above statement...but running a count() is not working, it gives me an error, what other options do i have other than running the same query twice and using mysql_num_rows? (which i think would be quite intensive/wasteful as i am querying @ 100 rows each time) This is my count() query, maybe theres a problem here? Probably. But since you only told us it gives me an error and don't tell use *WHAT* the error is, we really can't help you, can we? $how_many = mysql_result(mysql_query(SELECT COUNT(*), MATCH(ad_sub, ad_text) AGAINST('$words') AS score from .$tcname.ads WHERE MATCH(ad_sub, ad_text) AGAINST('$words') FROM .$tcname.ads where is_confirmed=1),0); H. Actually, I *can* tell you that you shouldn't have FROM in there twice. You've messed up your query something awful with that. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php: else if problem
On Tue, March 22, 2005 1:47 pm, M. Sokolewicz said: read the manual, you can use both (else if and elseif). The script does exactly what you tell it to. The flaw(s) is(/are) in your logic. else if and elseif are not exactly the same, as the manual indicates (and glosses over a bit). The will behave the same, if everything is parallel, but there is a gotcha when you start embedding nested if/else and if/elseif statements. If I try to give an example, I'm sure to screw it up, as I never use else if for this very reason. But this is the same as in C, and I think any decent C textbook will diagram for you exactly what goes wrong when you confuse the two. If you're not sure of the difference, use elseif when the words appear that close to each other, and you will most likely not hurt yourself that way. You only get burned, and that only rarely, if you use else if in my experience. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [semi OT]: Planning projects
On Tue, March 22, 2005 8:58 am, Chris W. Parker said: Jay Blanchard mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 4:47 AM said: +1 for pencil paper or whiteboard. And in the words of Obi Jay, Use the flowchart Chris I would very much like to use flowcharts but I haven't been able to use them effectively yet. That is, I'm not sure how to split up the macro from the micro. Macro being the flow a user would take through the checkout section of the site and micro being how a function works. Personally, I'd opt for working on the macro first, and making that as clean and clear as you can, really thinking deeply on it. Put it away for a day or two and pull it out. Does it all still make sense? Are you REALLY providing the best functionality for the most users as quickly and efficiently as possible? It's much too easy (guilty!) to start diving in and writing code/functions/pages without reflecting enough on the big picture. Course, you sometimes have the PHB breathing down your neck who will accuse you of not working if you aren't typing code. Sigh. Time to quit *that* job and look for another one. PS I'm looking for a new job. :-^ -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] seraching / indexing in php
On Tue, March 22, 2005 7:01 am, Reinhart Viane said: One question: on most of these search engines I can't seem to find if the index and search dynamically generated pages. Search engines do not generally index a page they can detect is dynamically generated. That means pages that have ? in the URL. You can use $_SERVER['HTTP_PATHINFO'] to alter URLs to not have ? in them, and they will get indexed by the search engines. There are several on-line articles on how to do this. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why not @ ?
On Tue, March 22, 2005 3:42 am, Mário Gamito said: If you care to take a peak at http://www.dte.ua.pt/cv/ and pass your mouse over the link Mário Gamito, you'll see in the status bar that the link is: http://www.dte.ua.pt/cv/[EMAIL PROTECTED] Allright. However, if you click and go to the respective page, you'll see that the @ is switched by %40. But you *WANT* the @ urlencoded into %40 so the email harvesters won't find you, so do *NOT* change it. It works just fine in all browsers except, like, AOHell 4.0 or something like that. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GIF instead of JPG..
Hi, I found this beautiful piece of code on the php site which make a proportional thumbnail, problem is its only working with JPEG files...and not with GIFs, can someone please help me convert it to GIF too? I tried but got a bit confused as there are no functions that are equal to imagecreatetruecolor that is in the below script. The below script works perfectly for jpgs: ?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); if ($width ($width_orig $height_orig)) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ? Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the online manual! Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hello Ryan, Im using the code below and works fine ... Best regards, Andras Kende http://www.kende.com // ?php function resample($src, $srcdir, $destdir, $width = '', $height = '') { if( is_file( $destdir . $src ) ) { $src = $src; return; } $size = GetImageSize($srcdir . $src); if (!$size[0] || !$size[1]) return; $scale = min($width/$size[0], $height/$size[1]); if ( $scale == 1 ) return; $newwidth = (int)($size[0]*$scale); $newheight = (int)($size[1]*$scale); $xpos = (int)(($width - $newwidth)/2); $ypos = (int)(($height - $newheight)/2); $format = ereg_replace(.*\.(.*)$,\\1,$src); $format = strtoupper($format); if ($format == JPG) { $destImg = ImageCreateTrueColor($width, $height); $backColor=ImageColorAllocate($destImg, 255, 255, 255); ImageFilledRectangle($destImg, 0, 0, $width, $height, $backColor); $sourceImg = ImageCreateFromJPEG ($srcdir . $src); ImageCopyResampled($destImg, $sourceImg, $xpos, $ypos, 0, 0, $newwidth, $newheight, $size[0], $size[1]); imagejpeg($destImg, $destdir . $src, 90); } elseif ($format == GIF) { $destImg = ImageCreateTrueColor($width, $height); $backColor=ImageColorAllocate($destImg, 255, 255, 255); ImageFilledRectangle($destImg, 0, 0, $width, $height, $backColor); $sourceImg = ImageCreateFromGIF ($srcdir . $src); ImageCopyResampled($destImg, $sourceImg, $xpos, $ypos, 0, 0, $newwidth, $newheight, $size[0], $size[1]); imagegif($destImg, $destdir . $src, 90); } } ? // -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fopen
On Mon, March 21, 2005 9:29 pm, John Taylor-Johnston said: flock($results, 2); #lock file for writing fwrite($results, $filestr); #write $filestr to $results flock($results, 3); #unlock file fclose($results); #close file This is an incorrect way to try to flock a file for writing. You should: 1) Open the file for READING. 2) flock that file handle, so only YOU have access to that file. 3) Re-open the file for WRITING, now that you have control. 4) Write your data 5) Release the lock. Could you show me a correct method, or example please? I admit I'm a little too newbie with flock. I have not used it since my Perl days, and even then ... http://php.net/flock has several correct examples, along with reasons when to not use flock in the first place, as well as alternative solutions. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [semi OT]: Planning projects
Chris W. Parker wrote: Jay Blanchard mailto:[EMAIL PROTECTED] on Tuesday, March 22, 2005 4:47 AM said: +1 for pencil paper or whiteboard. And in the words of Obi Jay, Use the flowchart Chris I would very much like to use flowcharts but I haven't been able to use them effectively yet. That is, I'm not sure how to split up the macro from the micro. Macro being the flow a user would take through the checkout section of the site and micro being how a function works. +1 on pen and paper. One approach that I liked (I forgot what book it was mentioned in) involves using a whiteboard and post-it notes. You put your entities on the post it notes, then draw flow lines on the whiteboard. This way, you can easily move your entities around. It really helps when ironing out workflow issues. For example, what happens when a user enters the wrong password in a login form? Easy to figure out by just moving around the sticky notes. Once you have your flow dailed down, then its just a matter of copying it on paper and finalizing it. Keep in mind that flowcharts are living docsif you need to make a change to the code somewhere down the line you can (and should) change the flowchart to reflect it. That sticky-notes + whiteboard helps with dynamic flowcharting a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache user can't use exec(), passthru(), etc.
On Mon, March 21, 2005 8:20 pm, Jim Poserina said: If I run this PHP script: ?php echo 'pre'; echo exec('whoami'); The first most biggest thing wrong is that you aren't using the additional arguments to exec() to find out what your output is, and if your command generated an error. For starters, I'm betting that at least one of the following is true: whoami is not in the $PATH/$path of the PHP user. whoami is not executable by the PHP user. You'll never find out which unless you use the extra args to exec http://php.net/exec echo '/pre'; ? from the web, the output is pre/preand from the command line running as the apache user(webuser), the output is. Content-type: text/html X-Powered-By: PHP/4.3.9 pre/pre EXCELLENT attempt to diagnose this, though! But if I run from the command line as root, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 preroot/preand from the command line as a user in the root group, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 prejimpoz/preSafe mode is turned off. As webuser (or any non-root-group user), no shell commands work. Not echo, not ls, not whoami, not touch. And no shell functions work: no exec(), no passthru(), no shell_exec(), no backticks. Every command I'm trying to run is world-readable and world-executable. But are they in the $path of webuser? Use the full path to them if they aren't exec(/bin/whoami, $output, $error); if ($error) echo (OS Error: $error.br /\n); echo implode(br /, $output); If I turn safe mode on, it gives me a safe mode is on warning only about lines that call shell_exec(), and not for exec() or any of the others. Other than that, it doesn't hang or give any kind of error or anything when it comes to a shell function call; apparently it just ignores them. No, it tries to run them, and fails, and provides the error messages and error number in the variables you aren't using :-) Some days, I think the PHP Dev Group should just make those arguments to exec() required. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php