Page 2 of 2 First 12
  • Jump to page:
    #16
  1. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,221
    Rep Power
    1809
    Is that a working version of the script? It's giving me 'Premature end of script headers'.
  2. #17
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    9
    Rep Power
    0
    This script page is a part of the software program I have that depends on other .pl pages to display properly. It cannot run separately on its own...
  4. #18
  5. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,221
    Rep Power
    1809
    Well, it's really a huge script, and without being able to run it locally I'm not going to be able to give any specific help.

    So let's just talk about the basics.

    Your script is a perl script, probably run from the cgi directory. It's a pretty old script. I'm not even sure why it's using the CGI.pm module (would be great if it did) since it is then parsing the form data in a really old fashioned way. And as I said originally, it would be much better if you could separate the HTML from the perl, but those kinds of big changes are beyond the scope of your question.

    But what I have in this script is a bunch of subroutines, many of which are never called. I'm not even sure what the entry point is. Perhaps it's in some other module. The reason I mention that is because if the script is organized as a bunch of subroutines, each of which handles the display of some section of the page, you might be able to do a lot of the reorganization simply by reordering the calling of those functions from within the main routine.

    Other than that, I can only guess at what you need to do based on the earlier messages:

    Code:
    #!/usr/bin/perl
    use strict;
    use warnings;
    
    # This entire first sections merely populates the values 
    # you have in your table with some default values.  
    # Presumably, you won't need to do this manually
    # but if you have errors about symbols not being defined, remember
    # that any variables must be declared before they can be used
    
    my @bids = ();
    my %form = (
    	'category' => 'farm',
    	'item' => 'implement'
    );
    
    my %config = (
    	'buyitnow' => 1,
    	'scripturl' => ''
    );
    
    my $bidhistory = 'good';
    my $buyit = 1;
    my $chklastbid = 1;
    my $closetime = 2;
    my $condition = 'good';
    my $currency = '$';
    my $dutch = 0;
    my $image1 = '/images/thing.jpg';
    my $lastbid = '12.00';
    my $location = 0;
    my $numbids = 10;
    my $pay = '$12.50';
    my $qacount = "";
    my $reserve = '.50';
    my $reservemsg = 'not met';
    my $selleralias = 'dougie';
    my $sellerpage = "";
    my $sellerrating = 'fair';
    my $sellersstore = "";
    my $shippfee1 = '$30.00';
    my $shippservice1 = 'ups';
    my $shipsto = 'home';
    my $star1s = 1;
    my $star2s = 2;
    my $star3s = 3;
    my $star4s = 4;
    my $star5s = 5;
    my $timeremain = '2 hours';
    my $title = 'a great thing';
    
    # That's the end of your variables, and now I'll define one
    # this is going to be the default string that appears in your table
    # if the conditions are not met
    
    my $buyitnow = "BUY IT NOW";
    
    if (($config{'buyitnow'} eq 'yes') && ($buyit > '0') && ($#bids eq '0') && ($dutch eq 'no') && ($reserve <= '0')) {
    # if the above condition is met, put all the text that follows 
    # up to EOF into the $buyitnow variable
    $buyitnow = <<"EOF";
    <p>
    <div align="center">
    <table align="center" border="0" width="30%" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" bgcolor="#000000"><a HREF="$config{'scripturl'}?action=buyit&CATEGORY=$form{'category'}&ITEM=$form{'item'}">Buy It</a> for $currency$buyit<br>This option disappears once a bid is placed.</td>
    </tr>
    </table>
    </div>
    EOF
    }
    
    if (($config{'buyitnow'} eq 'yes') && ($buyit > '0') && ($dutch eq 'no') && ($reserve > '0') && ($reserve > "$chklastbid")) {
    # if the above condition is met, put all the text that follows
    # up to EOF into the $buyitnow variable
    $buyitnow = <<"EOF";
    <p>
    <div align="center">
    <table border="0" width="35%" cellpadding="0" cellspacing="0">
    <tr>
    <td bgcolor="#000000"><a HREF="$config{'scripturl'}?action=buyit&CATEGORY=$form{'category'}&ITEM=$form{'item'}">Buy It</a> for $currency$buyit<BR>This option disappears once the reserve price has been met.</td>
    </tr>
    </table>
    </div>
    EOF
    }
    
    # If you notice, you can either save the HEREDOC into a variable
    # to be used later, or printed right now
    # Since we have everything we need, we are ready to print
    
    print <<TABLE;
    <div align="center">
    <table align="center" width="85%" border="0" cellspacing="0">
    <tr>
    <th valign="top" rowspan="23" scope="col"><a name="IMG"><img name="large" SRC="$image1" border="1"></th>
    <th align="left" colspan="5" scope="col"><font size="6"><b>$title</b></font></th>
    </tr>
    <tr>
    <td width="10%" align="right" valign="top">Item Condition:</td>
    <td width="30%" valign="top"><b>$condition</b></td>
    <td width=1%></td>
    <td width="25%"></td>
    <td width="2%"></td>
    </tr>
    <tr>
    <td align="right" valign="top">Time Left:</td>
    <td valign="top"><b>$timeremain</b><BR>
    <font size="2"><B>Ends: </b>$closetime</font></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td style="border: 3px solid; border-color:#9900FF;" bgcolor="e5e5e5"><font color="#9900CC" size="5"><b>Seller Information</B></font></td>
    <td></td>
    </tr>
    <tr>
    <td style="border-bottom: 3px solid; border-color:#9900FF" align="right" valign="top">Dutch Auction:</td>
    <td style="border-bottom: 3px solid; border-color:#9900FF" valign="top"><b>$dutch</b></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3"><b>$selleralias</b> <a HREF="$config{'scripturl'}?action=viewrate&ALIAS=$selleralias&ITEM=$form{'item'}">( $sellerrating ) $star1s $star2s $star3s $star4s $star5s</a></span></td>
    <td></td>
    </tr>
    <tr>
    <td valign="top"></td>
    <td valign="top"></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3">$sellerrating Positive Feedback</span></td>
    <td></td>
    </tr>
    <tr>
    <td align="right" valign="top">Current Bid: </td>
    <td valign="middle"><b><font size="5" color="Green">$currency$lastbid</font> ($numbids)</b> $bidhistory<BR>$reservemsg</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><P><span class="style2"><span class="style3"></span></span></td>
    <td></td>
    </tr>
    <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><a HREF="$config{'scripturl'}?action=askquestion&category=$form{'category'}&item=$form{'item'}" class="style3">Ask question or view Q&A ( $qacount )</a></td>
    <td></td>
    </tr>
    <tr>
    <td colspan="2" align="center" valign="top">$buyitnow</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3"><a href="$config{'scripturl'}?action=search&searchtype=viewother&searchstring=$selleralias">$selleralias 's other auctions</a> $sellerpage $sellersstore</span></td>
    <td></td>
    </tr>
    <tr>
    <td valign="top"></td>
    <td valign="top"></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><a href="$config{'scripturl'}?action=mailto&category=$form{'category'}&item=$form{'item'}" class="style3">Email this to a friend</a></td>
    <td></td>
    </tr>
    <tr>
    <td valign="top">bid button</td>
    <td valign="top">Your Bid Field}</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><P><span class="style2"><span class="style3"></span></span></td>
    <td></td>
    </tr>
    <tr>
    <td align="left" valign="top" colspan="2"><font size="2">Enter lowest bid or more in bid inc increments</font></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3">Buyer</span></td>
    <td></td>
    </tr>
    <tr>
    <td align="left" valign="top" colspan="2"><font size="2">Registered user required to bid.</font></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3">Retract Bid</span></td>
    <td></td>
    </tr>
    <tr>
    <td align="right" valign="top">User Name:</td>
    <td valign="top">user name field</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><P><span class="style2"><span class="style3"></span></span></td>
    <td></td>
    </tr>
    <tr>
    <td align="right" valign="top">Password:</td>
    <td valign="top">password field</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3">Seller</span></td>
    <td></td>
    </tr>
    <tr>
    <td style="border-bottom: 3px solid; border-color:#9900FF"><p></td>
    <td style="border-bottom: 3px solid; border-color:#9900FF"><p></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><span class="style3">Ban a Bidder</span></td>
    <td></td>
    </tr>
    <tr>
    <td align="right" valign="top">Shipping:</td>
    <td valign="top">$currency$shippfee1 via $shippservice1</td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#F2F2F2"><a HREF="$config{'scripturl'}?action=sellerlogon&category=$form{'category'}&item=$form{'item'}" class="style3">Edit item if no bids placed</a></td>
    <td></td>
    </tr>
    <tr>
    <td valign="top"></td>
    <td valign="top"><font size="2">Item Location: <b>$location</b></font></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#f2f2f2"><P><span class="style3"></span></td>
    <td></td>
    </tr>
    <tr>
    <td valign="top"></td>
    <td valign"Top"><font size="2">Ships to: <b>$shipsto</b></font></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#f2f2f2"><P><span class="style3"></span></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-color:#9900FF" bgcolor="#f2f2f2"></td>
    <td></td>
    </tr>
    <tr>
    <td align="right" valign="top">Payments:</td>
    <td valign="top">$pay <a href="#PAYMENTACCEPTED">(See Details)</a></td>
    <td></td>
    <td style="border-left: 3px solid; border-right: 3px solid; border-bottom: 3px solid; border-color:#9900FF" bgcolor="#f2f2f2"><P><span class="style3"></span></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    </table>
    </div>
    TABLE
    This isn't the way I would code normally, just trying to work with what you have.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo