Sunday, February 28, 2010

Htaccess Custom Error Pages

Many of U may have a website. So this is something that U might know, but if U don't then this might B a little helpful 2 U.
Do U know what happens when a user enters D url of a page that is not present on your server???
Well in normal cases & in most cases, D user will see a 404 Error (File Not Found) Page generated by D browser. Now that is really annoying as D user has 2 go back & find another page. So what is D solution.
Simple just follow the steps & U'll get results that'll make your site look more professional.
  1. Create a page with D theme of your site. U can add anything like ads, menus, just think what U want 2 do with a page.
  2. Next save it with a suitable name like 404.html.
  3. Create a text file and save it as htaccess.txt.
  4. In htaccess.txt type, ErrorDocument 404 /404.html
  5. Save all the files & upload them on your server in your main directory.
  6. IMPORTANT : Rename D htaccess.txt to .htaccess (do not add any extension)
  7. Done now if the user types any url that is not found, then D user will B directed 2 this custom page.
One more thing many servers have their own .htaccess file, if they use access database. Then U might have 2 edit D existing file. If U do that then it might cause some problems & in that case don't blame me.

Now U can also make custom pages 4 any error, just add another line ErrorDocument 404 /404.html & replace D 404 with D error U want 2 make D page 4 & 404.html with D page name.
Here are a short list of error numbers:
  1. 400 - Bad Request
  2. 401 - Not Authorised
  3. 403 - Forbidden
  4. 404 - Not Found
  5. 408 - Request Timeout
  6. 410 - Gone
  7. 415 - Unsupported Media Type
  8. 500 - Internal Server Error
  9. 503 - Service Unavailable
If U have any other problem then U can always ask me.

Saturday, February 27, 2010

Donate button in Alertpay

Many times I have read about a donate button. U know those button where D users can donate small amount 2 D site. But finding 1 is really tough. Paypal™ has a donate button, but U can donate only if U have a Paypal™ account. But everyone doesn't has a Paypal™ account.
So D other option is 2 allow people 2 use their credit-cards 2 donate. But 2 enable this feature U have 2 pay an excess of 20-25%. Now that is a real ripoff.
Another option is Alertpay™, they allow credit-card transaction 4 free after a simple site verification. But D problem is they don't have a ready made donate button. So D option is 2 use a buy button as a donate button.
But now D problem is that D amount 4 a buy button is fixed (as U don't want D user 2 decide D amount 4 a purchase), but in case of a donation D user wishes 2 select D amount 2 donate.
Now I searched D net 4 sometime & finally found a code which allows D user 2 change D amount 2 donate as per their wish. But it had some problem, just a glitch as U can add any text in D text box. Now that  is silly as no one would enter alphabet in that text box but Y take D risk so I found a script & modified D code so that only positive integers can B entered in D text box.
So here is D code:

<!-- Code written by someone else but the whole thing is made by Tanmay Das -->
<script language="JavaScript">
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "This field accepts numbers only."
        return false
    status = ""
    return true
Enter Donation Amount:
<form method="post" action="">
     <input type="hidden" name="ap_purchasetype" value="item-goods">
     <input type="hidden" name="ap_merchant" value="">
     <input type="hidden" name="ap_itemname" value="Donate">
     <input type="hidden" name="ap_returnurl" value="">
     <input type="hidden" name="ap_quantity" value="1">
     <input type="hidden" name="ap_description" value="Description of your donation">
     <input type="text" name="ap_amount" value="" onKeyPress="return checkIt(event)">
<select name="ap_currency">
<option value="AUD">AUD</option>
<option value="BGN">BGN</option>
<option value="CAD">CAD</option>
<option value="CHF">CHF</option>
<option value="CZK">CZK</option>
<option value="DKK">DKK</option>
<option value="EEK">EEK</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
<option value="HKD">HKD</option>
<option value="HUF">HUF</option>
<option value="LTL">LTL</option>
<option value="MYR">MYR</option>
<option value="NOK">NOK</option>
<option value="NZD">NZD</option>
<option value="PLN">PLN</option>
<option value="RON">RON</option>
<option value="SEK">SEK</option>
<option value="SGD">SGD</option>
<option value="USD" selected="selected">USD</option>
<option value="ZAR">ZAR</option>
     <input type="hidden" name="ap_cancelurl" value="">
     <input type="image" name="ap_image" src="donate.gif">

Doo tell me if U find it handy

Sunday, February 21, 2010

The greatest prison is the one we make ourselves with our fear and remorse

Sounds strange? Well for those who understood the meaning of the title and for those who didn't, here is what it means to me. There were some moments in my life when I thought that I could have done something else that I didn't do, why I don't know. But it always bites me. Maybe some decisions that I took in my life that well not taken or should I say if I had taken the other path, my life would have been different from what it is now.
But maybe for good, bad or worse, I had taken those decisions and no matter what I think or I do, I believe in my heart that I have done the right and I am not going back.
You might also have encountered similar may not be the same situations in your life earlier or not but one thing you must always remember is that you cannot move ahead if you keep your eyes behind you.