41 users online (0 members and 41 guests)  


  Results 1 to 13 of 13
  1. #1
    Morykwas's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    6

    Question FamousBirthdays.com needs your help!

    Thank you for reading my question.

    FamousBirthdays.com has been on the Internet since 1996. It's a listing of the birthdays of famous people. I am its creator and webmaster.

    ORIGINAL DESIGN
    --Each month is a single web page.
    --The names are three letters each: jan.html, feb.html
    --I use internal linking to the individual dates: 08, 09, 10
    --Someone wrote a CGI script for me a long time ago.
    --The script reads the date from the server and links to Today's Famous Birthdays.
    http://www.famousbirthdays.com/today.cgi

    NEW DESIGN
    --I recently added a new section for mobile devices.
    --In that section, each date is a single web page.
    --The names follow this pattern: jan01.html, jan02.html
    --I need your help in modifying the CGI script to work in the mobile section.

    This should be a quick and easy task for an experienced CGI programmer. Please reply if you would like to see the existing code.

    Last edited by HTML; 08-01-2010 at 08:34 AM.

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: FamousBirthdays.com needs your help!

    I would like to give this a go. If you are happy, please provide your existing CGI code.

    Chris

  3. #3
    Morykwas's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    6

    Re: FamousBirthdays.com needs your help!

    Thank you, Chris. I look forward to working with you.

    I have posted the original script as a TXT file here:

    http://www.famousbirthdays.com/today.txt

    I hope that's what you need. --Ed
    Last edited by HTML; 08-01-2010 at 08:34 AM.

  4. #4
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: FamousBirthdays.com needs your help!

    Hey,

    Well this line:
    print "Location: $mon.html#$day\n\n";

    Could be changed to:
    print "Location: $mon$day.html\n\n";

    Which redirects to e.g. jan01.html

    However the code you provided is slightly convulted. It would be better to use Date::Format, to be a little more efficient:

    Code:
    #!/usr/bin/perl
    use strict;
    use Date::Format;
    
    my $epoch = time;
    my $day = time2str("%d", $epoch);
    my $mon = lc(time2str("%b", $epoch));
    
    print "Location: $mon$day.html\n\n";
    What time zone are you working with?

    Let me know if you are unable to implement any of the above.

    Chris
    Last edited by xmassey; 07-31-2010 at 06:12 PM.

  5. #5
    Morykwas's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    6

    Re: FamousBirthdays.com needs your help!

    Yes, I do need help in implementing it, please.

    HERE'S WHAT I TRIED:
    1. Start a new file in Windows Notepad.
    2. Copy your seven lines of code into it.
    3. Save the file as test.cgi
    4. FTP it into the famousbirthdays.com/mobile directory.
    5. Try to access the file from Internet Explorer.
    http://www.famousbirthdays.com/mobile/test.cgi

    HERE'S WHAT HAPPENED:
    I got a message that said "Internal Server Error -- The server encountered an internal error or misconfiguration and was unable to complete your request."
    Last edited by HTML; 08-01-2010 at 08:35 AM.

  6. #6
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: FamousBirthdays.com needs your help!

    Change the code to this:

    Code:
    #!/usr/bin/perl
    use strict;
    use CGI ':standard';
    use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
    use Date::Format;
    
    my $epoch = time;
    my $day = time2str("%d", $epoch);
    my $mon = lc(time2str("%b", $epoch));
    
    print "Location: $mon$day.html\n\n";
    What error do you recieve now? If you are unable to use the module Date::Format, then this option isn't going to work.

    This is your code, I edited:

    Code:
    #!/usr/bin/perl 
    
    $dmod = "America/New_York";
    $get_date = "/usr/bin/env TZ=$dmod date";
    #Get Date and Time from Server
    $date = `$get_date +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
    
    $date=~s/Monday/Mon/;
    $date=~s/Tuesday/Tues/;
    $date=~s/Wednesday/Wed/;
    $date=~s/Thursday/Thurs/;
    $date=~s/Friday/Fri/;
    $date=~s/Saturday/Sat/;
    $date=~s/Sunday/Sun/;
    
    $date=~s/November/Nov/;
    $date=~s/December/Dec/;
    $date=~s/January/Jan/;
    $date=~s/February/Feb/;
    $date=~s/March/Mar/;
    $date=~s/April/Apr/;
    $date=~s/June/Jun/;
    $date=~s/July/Jul/;
    $date=~s/August/Aug/;
    $date=~s/September/Sep/;
    $date=~s/October/Oct/;
    
    ($day,$mon) = split(", ",$date);
    ($mon,$day) = split(" ",$mon);
    $mon=lc($mon);
    #$day=~s/^0//gi;
    
    print "Location: $mon$day.html\n\n";
    Chris
    Last edited by xmassey; 07-31-2010 at 09:58 PM.

  7. #7
    Morykwas's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    6

    Re: FamousBirthdays.com needs your help!

    Chris, I'm still seeing the "Internal Server Error" message. Your code looks perfect to me. Do you think I should contact my web hosting company? Perhaps it's a permissions issue.

  8. #8
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: FamousBirthdays.com needs your help!

    The code works find for me on my web host (1and1), however I use the extension .pl instead of .cgi. You could temporarily use the original code that I edited, then you could try contacting your host, or looking through their FAQ's to see what could be the problem (i.e. cgi bin issues). If you want to try changing the permissions, ensure they are 755 or 711.

    Chris

  9. #9
    Morykwas's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    6

    Re: FamousBirthdays.com needs your help!

    Chris, I will contact my web hosting company and let you know what they say. It usually takes 24 hours for them to answer. Please stand by...

  10. #10
    Yesideez's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2010
    Location
    Devon, UK
    Posts
    8

    Re: FamousBirthdays.com needs your help!

    You still having problems with this?

  11. #11
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: FamousBirthdays.com needs your help!

    Still a problem getting the CGI to run on the web server, once uploaded.

    The original (edited) script should work fine.

    If your web host was unable to help:
    - Who is your web host?
    - Make sure you upload the CGI in ASCII format (via FTP).
    - Ensure permissions of the CGI are 755.
    - Do CGI's have to go inside a cgi-bin directory?

    Chris

  12. #12
    Morykwas's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2010
    Posts
    6

    Smile Re: FamousBirthdays.com needs your help!

    I am happy to report that my problem is solved! Chris, thanks to your expert help and advice, the CGI script is now working perfectly.

    http://www.famousbirthdays.com/mobile/todaymobile.cgi

    My web hosting company said that the permissions were wrong. They agreed that 755 is the correct setting, which translates to this:

    r w x r -
    x r -
    x

    I will add a link from my home page to AHFB2000.com in gratitude for your kindness. I couldn't have done it without you!

    Best wishes,
    Ed

  13. #13
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: FamousBirthdays.com needs your help!

    Hey, no problem, glad you got it working! Goodluck with your website.

    Chris



Tags for this Thread