|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#61
|
||||
|
||||
|
Quote:
Also, just think about it. In the code sample given by chads2k2 when the PHP page is loaded it is parsed into HTML. At that point your prompt hasn't even been displayed and the user hasn't even had the chance to set your NAME variable, much less let the PHP engine parse it and place it in the place where you're calling $_GET['NAME']. JavaScript is executed after the page is loaded.
__________________
Reinventing the wheel again |
|
#62
|
||||
|
||||
|
#47 - How do I get PHP to work based upon the location of their IP address.
There are a couple of things that you need to know before you start doing this. The first being that the IP address could be a spoof, or could be based on a proxy server. This means that you will not always be assured to get the IP address of the actual user. The second thing that you must know is that even if you get the IP address it might be from AOL, MSN, Earthlink, ect which setup a block of addresses that always look like they are coming from the United States. So, if you are going to use this information to determine what language to have your website display you might want to consider these. However, if you evaluated the risks and you see nothing wrong with doing what you are doing then here are some links that can help you out with the code and such: http://www.maxmind.com/app/geoip_country They even have a PHP api: http://www.maxmind.com/app/php
__________________
Get A Supplier LLC | Hilarious Comic --- Pretty much retired from the forum. I will get back on every now and then, and maybe answer a few questions. Last edited by chads2k2 : May 2nd, 2006 at 07:06 AM. Reason: Coloring the top |
|
#63
|
||||
|
||||
|
Regarding the above post: It's not a good idea to use IP address as a unique identifier of your user because (among many other reasons) dial-up services in particular give dynamic IP addresses. Basically, every time the user connects they get a new IP address.
|
|
#64
|
||||
|
||||
|
#48 - Resizing an image with PHP
Many have asked this in the past and a couple of people have responded in a way that doesn't actually answer the question. The question being, how do I resize an image with PHP? Yes this will work for larger images going to smaller, but smaller images to larger the math doesn't work out really well. PHP Code:
PHP Code:
Hope that clears it up, Chad Last edited by chads2k2 : May 11th, 2006 at 10:21 AM. Reason: Kicken brought up a good point. |
|
#65
|
||||
|
||||
|
Quote:
Actually, with that code you don't need the GD library at all. Quote:
Also note, that unless the scaling you're doing is minor (as in only around a 50-100 pixel change) then you'd probably be better off using gd to actually resize the image, for two reasons: 1) The quality will almost certainly be better. Browsers generally do a fast resize resulting in a poor but quick resize operation. 2) You save bandwidth because the file size actually is reduced. By having the browser resize the image, the entire file must still be downloaded rather than just a small thumbnail like version.
__________________
Spidermonkey Tutorial http://www.aoeex.com/gmap.php - Put yourself on the map |
|
#66
|
||||
|
||||
|
This should give you most of the detail: http://www.tutorialized.com/tutoria...-with-PHP/11878
__________________
~James [Not currently seeking freelance work] Like philosophy or interested in spirituality? Philosophorum. Game Dev Experts Forums Foresight Linux - Because your desktop should be cool! Linux FAQ FedoraFAQ UbuntuGuide |
|
#67
|
||||
|
||||
|
#50 - Windows Apache MySQL PHP (NOT XAMPP,WAMP,appserv)
Recently there has been far more discussion about security and setting up a server the proper way than I care to think about again. Every answer seems to be some prebuilt solution that everyone swears is the end all to server setup. I disagree completely with using a premade system such as appserv, XAMPP, WAMP, or anyother system that is developed for the sole purpose of double clicking and having the entire system setup correctly the first time. That is not how you setup a server. Nor will it ever be that way. I mean MySQL, PHP, and Apache are free. You would think that one of them would already have thought about incorporating it all into one package, ask yourself why they haven't done so? It comes down to security for one company may not be secure enough for another, one size does not fit all. Some have said that it is hard. That by doing this it will be difficult getting it setup. I agree that in the beginning it is a bit difficult, I mean with all the reading you will have to do. The reading that is required is reading the installation text files and maybe a config file or two. Where even those configuration files are so well commented it's amazing. Take the time to read php.ini file line by line. You will walk away with a greater sense of how the system works, moreso that just having something else configure it for you. I can assure you one thing. If you setup your own server you will gain experience, and knowledge, but more importantly you will gain the self rewarding notion that you took the time to do it right the first time. You didn't cut to the easy way when you had a choice. Every pre-made system was put together in what they think is a "perfect" system. Will it work for your own server? Sure, but will it be the most secured perfect system for your application? No. Ask any hosting company if they use XAMPP, or WAMP, appserv and they will (or should) laugh at you. It is fine (I guess) for localhost checking to ensure that your scripts work. But what will you say if your boss (present, or future) asks you to setup the server for your companies website? Will you tell them that you double clicked a setup.exe file and you're ready to go? Hopefully not. Where to get the stuff: PHP (GET THE ZIP FILE!!!) Apache2 MySQL 4 or 5 Instructions (other than the install.txt file in PHP's zip) Very good tutorial! Well written that has easy instructions. http://www.webmasterstop.com/48.html http://www.apachemysqlphp.com/ Doing it right the first time will make all the difference in the world, Chad Last edited by chads2k2 : July 19th, 2006 at 08:06 AM. Reason: Added another tutorial. |
|
#68
|
||||
|
||||
|
Quote:
Easier, I think, to do a preg_replace with the i modifier: PHP Code:
Faster than jpenn's implementation I think. Although that's pretty good as well. -Dan |
|
#69
|
|||
|
|||
|
You can use the inbuilt function str_ireplace(search, replace, source)
|
|
#70
|
||||
|