6
2012
Login into phpmyadmin without username and password
Auto login When working or developing on localhost , its better to make phpmyadmin login automatically without asking for username and password everytime. It is a time wasting thing. Edit config.inc.php To do this the config.inc.php file needs to be edited as follows : 1. Make auth_type = config $cfg['Servers'][$i]['auth_type'] = ‘config’; 2. Add your mysql username and password to the config file : $cfg['Servers'][$i]['auth_type'] = ‘config’; $cfg['Servers'][$i]['username'] = ‘root’; $cfg['Servers'][$i]['password'] = ‘your_password’; 3. Save [...]
14
2012
10+ tips to localise your php application
The tips Localisation involves changing various parts of application output like display of dates , time , numbers , language etc according to the standards of the geographical region of a user. Localisation is an important feature of applications that targets users across the globe and not just one region. So here are a set of simple tips and techniques every php application can do to make itself more locale-friendly. 1. Set timezone of the [...]
7
2012
40+ Techniques to enhance your php code – Part 3
Part 2 26. Avoid direct SQL query , abstract it Writing too many queries like this : Not a robust approach. It has drawbacks : escape the values everytime manually Verify if the query is correct Wrong queries may go undetected for a long time (unless if else checking done everytime) Difficult to maintain large queries like that Therefore write up for yourself simple functions like these : Saw that ? it makes things simpler [...]
7
2012
40+ Techniques to enhance your php code – Part 2
Part 1 11. Do not gzip output in your application , make apache do that Thinking of using ob_gzhandler ? No dont do that. It doesnt make sense. Php is supposed to write your application. Dont worry about how to optimise data transfer between server and browser inside Php. Use apache mod_gzip/mod_deflate to compress content via the .htaccess file. 12. Use json_encode when echoing javascript code from php There are times when some javascript code [...]
29
2012
40+ Techniques to enhance your php code – Part 1
The Techniques 1. Do not use relative paths , instead define a ROOT path Its quite common to see such lines : This approach has many drawbacks : It first searches for directories specified in the include paths of php , then looks from the current directory. So many directories are checked. When a script is included by another script in a different directory , its base directory changes to that of the including script. [...]
29
2012
CSSDeck – Collection of Pure CSS Creations
One of the great aspects of Frontend development compared to the world of programming is the ease of access to source code. You can find the source code easily by accessing few source files. For example, if you have a website opened in front of you, you can view the HTML source in the browser, view the CSS and JS source too. Browsers like Firefox have tools like firebug while Chrome has Web Developer Tools [...]
27
2012
Execute shell commands in PHP
There are a number of ways shell commands can be executed in php. 1. system “system() is just like the C version of the function in that it executes the given command and outputs the result. The system() call also tries to automatically flush the web server’s output buffer after each line of output if PHP is running as a server module.” 2. passthru “The passthru() function is similar to the exec() function in that [...]
26
2012
Php get list of locales installed on system
On linux , the list of locales installed on the system can be fetched through the terminal command locale -a : Now this command can be used inside php to get the list. Along with this list we can also add some information like language name and country name using a list of countries and languages. Here is a list of country codes : And now a list of languages : Now the list of [...]
22
2012
Sound cracking in Ubuntu 11.10
I recently upgraded my ubuntu 11.04 to 11.10 and then noticed that sound output started cracking when I played mp3 files or youtube videos. The only solution at the moment is to reduce PCM value in alsamixer terminal window Type alsamixed at terminal : A window would come up with multiple vertical bars. 3rd one in them is PCM. Reduce it , this should remove the cracking sound problem. Or you can try reducing the [...]
20
2012
PHP script to perform IP whois
Theory To fetch the whois data of an IP address , the steps are as follows : 1. Contact whois.iana.org and ask for the RIR whois server of the ip address. 2. Contact the whois server of the RIR and get the whois details of the ip address. Code The function get_whois_from_server is a generic function that can contact any whois server and make a request based on the ip address provided. It then collects [...]
Subscribe
Recent Posts
- Login into phpmyadmin without username and password
- 10+ tips to localise your php application
- 40+ Techniques to enhance your php code – Part 3
- 40+ Techniques to enhance your php code – Part 2
- 40+ Techniques to enhance your php code – Part 1
- CSSDeck – Collection of Pure CSS Creations
- Execute shell commands in PHP
- Php get list of locales installed on system
- Sound cracking in Ubuntu 11.10
- PHP script to perform IP whois
An article by