Current location: Hot Scripts Forums » Programming Languages » Perl » view active bids


view active bids

Reply
  #1 (permalink)  
Old 03-17-06, 01:17 PM
kamikaze80 kamikaze80 is offline
New Member
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
view active bids

i'm trying to let bidders view their active bids, showing only their latest bid for an item and whether it is the high bid or not. i'm not a programmer and i've been bumbling around the everyauction forums without any luck. can anyone tell me what's wrong here? (i'm getting 500 internal server error and i've remed out the closetime lines cos i'm not sure if they work)

thanks.

sub viewself2 {

$form{'ALIAS'} = ucfirst(lc($form{'ALIAS'}));
my ($password,$email,$add1,$add2,$add3,@past_bids) = &read_reg_file($form{'ALIAS'});
&oops('Your alias could not be found!') unless ($form{'ALIAS'});
&oops('Your password is incorrect.') unless ((lc $password) eq (lc $form{'PASSWORD'}));

print "<p align=center><font face=tahoma size=2><strong>Your Active Auctions</strong></font></p>";
print "<table align=center border=0 cellpadding=3 cellspacing=0 width=620>";
print "<tr><td bgcolor=C0C0C0><font face=tahoma size=2><strong>Player</strong></font></td><td bgcolor=C0C0C0><font face=tahoma size=2><strong>Position</strong></font></td><td bgcolor=C0C0C0><font face=tahoma size=2><strong>Closes</strong></font></td><td align=center bgcolor=C0C0C0><font face=tahoma size=2><strong>No. of Bids</strong></font></td><td bgcolor=C0C0C0><font face=tahoma size=2><strong>Price</strong></font></td><td bgcolor=C0C0C0></td></tr>";

foreach (sort { int($a) <=> int($b) } @past_bids) {
$_ =~ /^(.+)(\d{10})$/;
my($cat,$item) = ($1,$2);

next unless(-e "$config{'basepath'}$cat/$item.dat");
my ($title, $reserve, $inc, $desc, $image, @bids) = &read_item_file($cat,$item);
next unless $title;
my @firstbid = &read_bid($bids[0]);
next unless($firstbid[0] ne "$form{'ALIAS'}");
my @lastbid = &read_bid($bids[$#bids]);
#my $closetime = localtime($file);

print "<TR><TD width=25%><A HREF=$ENV{'SCRIPT_NAME'}\?category=$key\&item=$fil e><font face=tahoma size=2>$title</font></A>";
print "</TD><TD><font face=tahoma size=2><A HREF=$ENV{'SCRIPT_NAME'}\?category=$key\&sort=item >$category{$key}</a>";
#print "</TD><TD width=30%><font face=tahoma size=2>$closetime</font></TD>";
print "<TD align=center><font face=tahoma size=2>$#bids</font></TD><TD width=7%><font face=tahoma size=2>\$$lastbid[2]</font></TD>";
if ($lastbid[0] eq "$form{'ALIAS'}") {
print "<TD align=right width=9%><font face=tahoma size=2 color=green>High Bid</font></TD>\n";
}
else {
print "<TD align=right width=9%><font face=tahoma size=2 color=red>Outbid</font></TD>\n";
}
print "</TR>";
}
print "</table>";
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-17-06, 02:07 PM
Millennium's Avatar
Millennium Millennium is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
the syntax looks OK to me, the problem must be somewhere else in the script.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-18-06, 06:22 PM
kamikaze80 kamikaze80 is offline
New Member
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
thanks millennium.

i got the script to run, but let me clarify what's wrong. instead of just listing the auctions that the buyer is active in, it lists all auctions that have been bid on, regardless of who the buyer is. anyone see the problem here, or does the script simply not do what i think it does?

here's another script i'm trying, problem with this one is that none of the active auctions seem to be being read. the table comes out blank, and i'm not getting any error messages.

use CGI::Carp qw(fatalsToBrowser);
use strict;

&oops('Your username is invalid.')if((length($form{alias})>20)or($form{ali as}=~/[_\W]/));
if($form{alias}&&$form{password}){
&oops('You must enter what option you would like to view.')unless($form{type}=~/^[1|2|3]$/);
&oops('Your password is invalid.')if((length($form{password})>20)or($form{ password}=~/[_\W]/));
$form{alias}=ucfirst(lc$form{alias});
&oops('Your username is invalid.')if(!-e"$config{basepath}reg/$form{alias}.dat");
my ($password,$email,$add1,$add2,$add3,@past_bids) = &read_reg_file($form{alias});
&oops('Your username is invalid.')unless($password);
&oops('Your password is invalid.')unless(lc$form{password}eq lc$password);
if($form{type}==1 or $form{type}==2){
print "<H2>Auctions In Which You ($form{alias}) Are The Seller<br></H2><TABLE BORDER=1 WIDTH=100\%><TR BGCOLOR=$config{'colortablehead'}><TD><B>Item</B></TD><TD><B>Current Price</B></TD><TD><B>High Bidder</B></TD><TD><B>Ends</B></TD></TR>";
my$rcount=0;
foreach(@past_bids){
$_=~/^(\w+)(\d{10})$/;
my($key,$file)=($1,$2);
next unless(-e"$config{basepath}$key/$file.dat");
my ($title, $reserve, $inc, $desc, $image, @bids) = &read_item_file($form{'category'},$form{'item'} );
next unless$title;
my@firstbid=split(/\[\]/,$bids[0]);
next unless($form{alias}eq$firstbid[0]);
$rcount++;
my($alias, $email, $bid, $time, $add1, $add2, $add3)=split(/\[\]/,$bids[$#bids]);
print"<tr height=40><td><a href=$ENV{'SCRIPT_NAME'}\?category=$form{'category '}\&item=$file>$title</a></td><td>\$$bid";
print"<br>(reserve not met)"if($bid<$reserve);
print"</td><td>";
if($#bids){print"$alias"}
else{print"-"}
my$closetime=localtime($file);
print"</td><td>$closetime</td></tr>";
}
if($rcount==0){print"<tr><td colspan=4><b>No Items To Display</td></tr>"}
print"</table>";
}
print"<br><br>"if$form{type}==1;
if($form{type}==1 or $form{type}==3){
print "<H2>Auctions In Which You ($form{alias}) Are A Bidder<br></H2><TABLE BORDER=1 WIDTH=100\%><TR BGCOLOR=$config{'colortablehead'}><TD><B>Item</B></TD><TD><B>Current Price</B></TD><TD><B>Your Last Bid</B></TD><TD><B>Your Status</B></TD><TD><B>Ends</B></TD></TR>";
my$rcount=0;
foreach(@past_bids){
$_=~/^(\w+)(\d{10})$/;
my($key,$file)=($1,$2);
next unless(-e"$config{basepath}$key/$file.dat");
my ($title, $reserve, $inc, $desc, $image, @bids) = &read_item_file($form{'category'},$form{'item'} );
next unless$title;
my@firstbid=split(/\[\]/,$bids[0]);
next unless($form{alias}ne$firstbid[0]);
$rcount++;
my@lastbid=split(/\[\]/,$bids[$#bids]);
print"<tr height=40><td><a href=$ENV{'SCRIPT_NAME'}\?category=$form{'category '}\&item=$file>$title</a></td><td>\$$lastbid[2]";
print"<br>(reserve not met)"if($lastbid[2]<$reserve);
print"</td><td>";
my$c=1;
for(my$i=$#bids;$i>0;$i--){
my($alias, $email, $bid, $time, $add1, $add2, $add3)=split(/\[\]/,$bids[$i]);
next if($form{alias}ne$alias);
print"\$$bid</td><td>";
if($lastbid[2]eq$bid){print"High Bid"}
else{print"Outbid"}
$c--;
last;
}
print"Unknown</td><td>Bid Retracted"if$c;
my$closetime=localtime($file);
print"</td><td>$closetime</td></tr>";
}
if($rcount==0){print"<tr><td colspan=5><b>No Items To Display</td></tr>"}
print"</table>";
}
}
else{
print"<FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST>
<H2>My Auctions and Bids</H2>
<TABLE WIDTH=100% BORDER=1 BGCOLOR=$config{'colortablebody'}>
<INPUT TYPE=HIDDEN NAME=action VALUE=yourauctions>
<TR><TD COLSPAN=2 VALIGN=TOP> This form will allow you to view your current bids and/or the items you are currently selling.
</TD></TR>
<TR><TD VALIGN=TOP><B>Your Username:<BR></B>Required for verification</TD><TD><INPUT NAME=alias TYPE=TEXT SIZE=30 MAXLENGTH=30>
<TR><TD VALIGN=TOP><B>Your Password:<BR></B>Required for verification</TD><TD><INPUT NAME=password TYPE=PASSWORD SIZE=30>
</TD></TR>
<tr><td colspan=2 valign=top>
<INPUT TYPE=HIDDEN NAME=type VALUE=3>
</td></tr>
</TABLE>
<CENTER><INPUT TYPE=SUBMIT VALUE=\"View Items\"></CENTER>";
}

1;



thanks for the help, guys.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-19-06, 04:07 AM
Millennium's Avatar
Millennium Millennium is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
why are you not asking these questions on the everyauction forums? I doubt anyone here can help unless they are very familiar with everyauction.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-19-06, 05:08 PM
kamikaze80 kamikaze80 is offline
New Member
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
i'm posting in there too, without great success. thanks tho.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
authenticate Active Directory Users wajeeh_r ASP 5 04-27-09 12:36 PM
Internet explorer restricting file from showing active content Torbinsky JavaScript 6 07-24-05 01:58 PM
Disable the Source link in View menu mohank JavaScript 3 03-31-05 11:37 PM
Teachers login to view student's marks. [PHP] hockeykid Script Requests 2 02-09-05 03:28 PM
PHP & MS Active Directory djwayne_2004 PHP 0 02-07-05 06:51 PM


All times are GMT -5. The time now is 09:56 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.