setcookie() - able to set cookies but not access through $_COOKIE

Posted by Vishal on August 14th, 2010

Came across a strange problem today. I was setting a few cookies using the setcookie() and when trying to access them through $_COOKIE, they weren’t appearing in the array. The cookie is shown in browser but not accessible in $_COOKIE. Initially, I was just using:

setcookie(”cookie_name”,$cookie_value);

My script was residing in a folder ‘/abc’ on the server, which is present in the document root. Then I had to change the above to:

setcookie(”cookie_name”,$cookie_value, time()+(86400*365), “/”, “.example.com”, 1);

I put in the expiry date as 1 year from today, put in the path of the document root i.e. ‘/’ & also made the cookie to be available on all subdomains on my main domain (by using a .) rather than only on www.

The above line also didn’t solve the problem. Finally, I turned the last argument from ‘1′ to ‘0′. It specifies that the cookie will not be accessible by any scripting language & hence PHP was unable to access the cookie, though it was appearing in the browser cookies. What solved the problem was:

setcookie(”cookie_name”,$cookie_value, time()+(86400*365), “/”, “.example.com”, 0);

Hope this helps. :)

Twitter Weekly Updates for 2010-04-04

Posted by Vishal on April 4th, 2010

Powered by Twitter Tools.

SHTML Wrapper - 500 Server Error

Posted by Vishal on January 6th, 2010

I was getting the above error when I moved my Magento installation from one host to Bluehost (Hostmonster). What I used to get was nothing on the screen with the error:

<!– SHTML Wrapper - 500 Server Error –>

appearing in the source of the page.

I tried various things like reinstalling the database, reinstalling Magento, tried to see the logs I had access to. None of them worked.

Then I came across a link that said enabling FastCGI option for PHP would fix this. That’s exactly what I did & the bug was fixed. The Magento installation then started working smoothly.

Strangely, I had come across a link that said disabling FastCGI will fix this, but that wasn’t the case.

Twitter Weekly Updates for 2009-10-25

Posted by Vishal on October 25th, 2009
  • Explaining what twitter is to a friend… #

Powered by Twitter Tools.

Twitter Weekly Updates for 2009-10-18

Posted by Vishal on October 18th, 2009

Powered by Twitter Tools.

Breaking News - Copy paste does get readers!

Posted by Vishal on October 12th, 2009

It was a normal routine for me. I finished my dinner, started my computer & opened up a couple of websites to read articles about yesterday’s & today’s matches of the Airtel Champions League T20. I read one article on www.espnstar.com. The second site that I follow is www.rediff.com & opened up that too. To make sure I don’t miss out anything, I read the article for the same match from both of these websites as usually they cover it pretty extensively.

To my surprise, I found the article word to word similar on both the websites. I was disappointed when I discovered this. I didn’t open up the sites expecting this to come.

After that, I decided to check this article on other websites. Result? No different! Check the URLs below:

ESPNSTAR - http://www.espnstar.com/cricket/cl-t20/news/detail/item337058/Gambhir:-Viru-set-the-game-for-us/

REDIFF - http://cricket.rediff.com/report/2009/oct/12/gautam-gambhir-on-virender-sehwag.htm

IN.COM / CRICKETNEXT - http://cricketnext.in.com/news/viru-set-up-the-game-for-us-gambhir/44473-31.html

MID-DAY:

http://www.mid-day.com/sports/2009/oct/121009-Virender-Sehwag-Gautam-Gambhir-Champions-League-Twenty20-Delhi-Daredevils-Wayamba-Elevens.htm

DECCAN HERALD: http://www.deccanherald.com/content/30122/viru-set-game-us-gambhir.html

All of the above mentioned websites, have a certain amount of respect for their names. Who copied from whom, still remains a question.

Strangely, a couple of days ago, I read an article, it was a meetup of News Corp’s Rupert Murdoch & Tom Curley of the Associated Press. They were saying that the search engines will have to pay for Online News. You can read the article at:

http://www.google.com/hostednews/ap/article/ALeqM5j-QHPkd1wPcAZL8SOqSTACDn33TgD9B7G7TG0

My friends, no one would pay if you continue doing copy paste.

Twitter Weekly Updates for 2009-09-27

Posted by Vishal on September 27th, 2009
  • Greame Smith - 50 off 42 balls… Good going South Africa! Keep it up Smith! #
  • Ah…Smith is out. :( #

Powered by Twitter Tools.

Twitter Weekly Updates for 2009-09-27

Posted by Vishal on September 27th, 2009
  • Greame Smith - 50 off 42 balls… Good going South Africa! Keep it up Smith! #
  • Ah…Smith is out. :( #

Powered by Twitter Tools.

Twitter Weekly Updates for 2009-09-27

Posted by Vishal on September 27th, 2009
  • Greame Smith - 50 off 42 balls… Good going South Africa! Keep it up Smith! #
  • Ah…Smith is out. :( #

Powered by Twitter Tools.

Facebook apps - Are they spamming?

Posted by Vishal on September 16th, 2009

Facebook

I have been playing with Facebook recently & trying out different apps. I thought I would just write down my reviews for each of the apps I tried & share some views as well.

Applications tried so far:

  1. What does your day of the birth say?
    1. Asks to enter birth date – doesn’t have it pre-populated from Facebook
    2. Says something about the day I was born like: Adventurous, Great sense of humor, Loves to enjoy life, etc.
    3. Has ads of other apps
    4. My Review: Not exciting.
  2. Magic Fortune Cookie
    1. Simply flashes a line of text that says what I am going to do today or in the near future. Also has some numbers being displayed.
    2. Has ads of other apps & other external ads also
    3. My Review: Just shows randomly things you might do, but unreal. Not exciting, except for the things that it shows.
  3. Love personality test
    1. Has a questionnaire of around 8 to 10 questions. Based on that, gives the result.
    2. My Review: Didn’t complete this. I think I hate apps that answer more than 4-5 questions. :)
  4. How sexy is your name?
    1. Asks to add up certain numbers associated with letters in your name. Based on the sum, it determines whether your name is sexy or not.
    2. Has external ads & ads of other apps like ‘Find out your top follower’.
    3. My Review: Didn’t complete this one too. I think it’s something unreal & I found it to be a waste of time to sit & add the numbers associated with my alphabets to tell me how sexy is my name. :)
  5. Farmville - Game
    1. Provides the user with a farm. Allows user to plough, harvest, etc. After ploughing a crop, asks the user to come after a particular time (time taken by the crop to grow). This way, user keeps coming back again & again.
    2. My Review: This is one of the popular games on Facebook. I hate the idea of going back again & again when my crop is fully grown & then harvest.
  6. Think fast challenge
    1. Directly asks for Name, email & mobile number on the first page of the application itself. A good way to collect email addresses. But even after I entered my correct number, it said “Please Enter Valid Mobile No.” J
    2. My Review: It said it will ask 200 questions which we need to answer in 60 seconds. But they didn’t let me go off the first page itself where they kept asking for my mobile number despite providing it correct 3-4 times. I am not sure what the questions would be, but this app is definitely not something which it says it is, people won’t sit & answer 200 questions…
  7. Death’s time
    1. Simply populates your birth date from Facebook by default & asks you to Submit. After hitting Submit, gives a random day of death along with a random cause.
    2. My Review: This app catches your attention once you see it on your WALL. Same happened with me. I went to the app, it had my birthday pre-populated from Facebook. All I had to do was click ‘Submit’ & it showed me randomly what my death time & reason was. I am going to heaven in 2014 :)
  8. What do your friends think about you?
    1. Asks to choose 4 friends from your friend list. Wasn’t able to complete this one as I couldn’t really understand what this app was doing. J
    2. My Review: Refer to ‘a’ :)
  9. Are you going to heaven or hell?
    1. Another quiz type app which asks questions whether you believe in God, whether you forgive your enemy, etc. And of course, you go to heaven or hell based on your answers to those 5-6 questions.
    2. My Review: Found this one to be an average app. Not exciting, but since they kept it to 5-6 questions, I took it & the options have been formed well too.

After reviewing all the above apps, what I found was 80% of the apps have either external ads or have ads of other Facebook apps on them. The first thing that came to my mind was: Is this spamming of applications? I think yes.

There are way too many meaningless apps or apps that simply seem to be have made to host other ads & have more clicks. I am not sure if that is acceptable under Facebook terms or not.

Facebook is definitely changing the way people interact & changing it in a big way.


Copyright © 2007 Vishal Kothari. All rights reserved.