server 500 error

  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

k got a prob with a script im working on for a raffle ticket script, here is a snippet of code that im trying to troubleshoot

Code: [ Select ]
if (!$chargetotal) {$chargetotal = '0.00';}
        if (!$phone) {$phone = 'NA';}
        if (!$baddr1) {$baddr1 = 'NA';}
        if ($postips =~ /no/i) {$ip = 'LOGGED';}
        if $chargetotal == 5.00; {
        $rentries = 1;
        }
        else if $chargetotal == 10.00; {
        $rentries = 3;
        }
        else $rentries = $chargetotal / 33.33;
  1. if (!$chargetotal) {$chargetotal = '0.00';}
  2.         if (!$phone) {$phone = 'NA';}
  3.         if (!$baddr1) {$baddr1 = 'NA';}
  4.         if ($postips =~ /no/i) {$ip = 'LOGGED';}
  5.         if $chargetotal == 5.00; {
  6.         $rentries = 1;
  7.         }
  8.         else if $chargetotal == 10.00; {
  9.         $rentries = 3;
  10.         }
  11.         else $rentries = $chargetotal / 33.33;


getting a server 500 error...

see any problems with the code?

http://www.decosterskids.com/cgi-bin/raffle.cgi?action=view
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

You have a few if statements there that aren't in (). I am not sure if that may cause a problem. Also it shouldnt be else if $chargetotal. There is no such statement in PERL. It is elsif in PERL.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

So try this:

Code: [ Select ]
if (!$chargetotal) {$chargetotal = '0.00';}
if (!$phone) {$phone = 'NA';}
if (!$baddr1) {$baddr1 = 'NA';}
if ($postips =~ /no/i) {$ip = 'LOGGED';}
if ($chargetotal == 5.00) {
  $rentries = 1;
}
elsif($chargetotal == 10.00) {
  $rentries = 3;
}
else {
  $rentries = $chargetotal / 33.33;
}
  1. if (!$chargetotal) {$chargetotal = '0.00';}
  2. if (!$phone) {$phone = 'NA';}
  3. if (!$baddr1) {$baddr1 = 'NA';}
  4. if ($postips =~ /no/i) {$ip = 'LOGGED';}
  5. if ($chargetotal == 5.00) {
  6.   $rentries = 1;
  7. }
  8. elsif($chargetotal == 10.00) {
  9.   $rentries = 3;
  10. }
  11. else {
  12.   $rentries = $chargetotal / 33.33;
  13. }
  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

ok ill give it a shot and post my results here.. thanks
  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

ok tried it and still getting server 500 error. so i telnet into the machine to get a more detailed desciption of the error, and i got this


bash-2.05a$ perl raffle.cgi
syntax error at raffle.cgi line 125, near "if $chargetotal "
syntax error at raffle.cgi line 128, near "elsif"
syntax error at raffle.cgi line 131, near "else"
syntax error at raffle.cgi line 201, near "}"
Execution of raffle.cgi aborted due to compilation errors.
bash-2.05a$
  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

ok i fixed that part of the syntax error, now i am getting a computational/logical problem now heres the scenario

$5 for 1 ticket
$10 for 3 tickets
$30 for 10 tickets

but when i use an example page for say spending $120

it gives me a resulting answer of 3.600360036


argh this is racking my brain
  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

WOO HOO! got it... i changed the code a bit and its all good now..


else {
$rentries = $chargetotal / 33.33;

GOT CHANGED TO


else {
$rentries = $chargetotal / 3;
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Great I am glad it works now :D

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 93 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.