Thursday, October 08, 2009

Solution: PHP Form Not Working in Internet Explorer (IE)

What happens is that fill out the form click submit and the form page is returned totally blanked, however works just fine if Firefox etc. Now are you using an IMAGE instead of the default gray submit button? YES then BINGO you are probably checking in your code to see if the submit button has been pressed and you didn't know that IE as usual does it differently. IE only returns the X,Y co-ordinates of where you clicked on the Image Button, it appends _x and _y to the submit button name. So say the button is called submit_button

So IE returns submit_button_x,submit_button_y

While FF returns submit_button AND submit_button_x,submit_button_y


So Browser proof PHP Code :

if( isset( $_REQUEST["submit_button"] ) or isset( $_REQUEST["submit_button_x"] ) )

This has caught me out several times!!

Labels: ,

Thursday, August 20, 2009

Happy 40th Birthday Unix

Unix, Linux is more than an operating system for us Techies it's a kind of way of life. I get great intellectual pleasure from finding clever ways to write scripts using Bash, Zsh, Perl, AWK or whatever. These days I spend more time using Cygwin on Vista which kind of gives me the best of both worlds. I would like to abandon Microsoft completely but have to work with so many clients that just have Windows.

I've recently had some fairly horrific experiences of using Microsoft software Visual Studio, ASP etc and found myself having download 100's of MB of code just to set a few miserable flags. Everything Microsoft do seems to overloaded with bureaucratic heaviness, endless series of black boxes, wizards where I feel I control very little.

Anyway thank heavens for LAMP Linux-Apache-MySQL-PHP/Perl and the wonderful community of users that surround it

Labels: , , , ,

Tuesday, August 04, 2009

PHP CURL Based Twitter Feed for websites when fopen() is not allowed

<?php
// twitFeed.php
// curl based twitter feed
// 04Aug09
$url = 'http://twitter.com/statuses/user_timeline.xml?screen_name=thesuccess';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
print "<pre>".curl_exec ($ch);
curl_close ($ch);
?>

Labels: , , , , ,

Thursday, February 19, 2009

Redirect your old site to your new site with 301 Redirects

301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".

PHP Redirect
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

CGI PERL Redirect
$q = new CGI;
print $q->redirect("http://www.new-url.com/");

Redirect Old domain to New domain (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Please REPLACE www.newdomain.com in the above code with your actual domain name.


Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Get redirects for other scripts from http://www.webconfs.com/how-to-redirect-a-webpage.php

Labels: , ,

Monday, June 02, 2008

ASP / PHP Cross Reference

The following page allows you to quickly convert ASP to PHP or vice-versa by showing at a glance the different syntax for say comments, concatenation etc

http://www.design215.com/toolbox/asp.php

Labels: ,