Quisiera que en el siguiente script sólo me aparecieran 25 registros por página, es decir, 25 registros en la primera página, y si hay más registros en sucesivas páginas.
Muchas gracias.
Using perl Syntax Highlighting
- #!/usr/bin/perl
- use CGI::Carp qw( fatalsToBrowser );
- do 'sessions.cgi';
- do 'paidmembers.cgi';
- if ( $ENV{REQUEST_METHOD} eq 'POST' ) {
- read( STDIN, $buffer, $ENV{'CONTENT_LENGTH'} );
- }
- else { $buffer = $ENV{QUERY_STRING} }
- @pairs = split( /&/, $buffer );
- foreach $pair (@pairs) {
- ( $name, $value ) = split( /=/, $pair, 2 );
- $value =~ tr/+/ /;
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
- $in{$name} = $value;
- }
- print "Content-type:text/html\n\n";
- $session = $in{'session'};
- $session =~ /:(\d+)/;
- unless ( $in{'submit'} ) { #'submit' not clicked, show form
- $filesize = ( stat("$Database") )[7];
- if ( $filesize % $DBRecSize != 0 ) { die "Database processing error!" }
- $users = $filesize / $DBRecSize;
- print qq~
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- <title>Search account information</title>
- </head>
- <body background="$SiteURL/bg.jpg">
- <h2 align="center">Search/Browse account information<br></h2>
- <form action="searchb.cgi" method="POST">
- <center>
- <table border="1" cellpadding="1" cellspacing="0" bgcolor="#FFFFCC">
- <tr><td>User ID#: </td><td><input type="text" size="6" name="userid"></td></tr>
- <tr><td>Name: </td><td><input type="text" size="40" name="name"></td></tr>
- <tr><td>Socio: </td><td><input type="text" size="40" name="socio"></td></tr>
- <tr><td>Email: </td><td><input type="text" size="40" name="email"></td>
- <tr><td>Search from#: </td><td><input type="text" size="6" name="startid" value="2"></td></tr>
- <tr><td>Search to#: </td><td><input type="text" size="6" name="endid" value="$users"></td></tr>
- <INPUT type="hidden" name="session" value="$session"></tr>
- <tr><td colspan="2"><BR />
- <CENTER>
- <input type="submit" value="Search" name="submit" style="font-size: 17px">
- </CENTER><BR />
- <INPUT type="hidden"></td></tr>
- </table>
- </center>
- </form>
- <center>Note: Search results for User ID# are instant, but for name and email can take some time.<center>
- ~;
- exit;
- }
- #if clicked 'submit'
- $userid = $in{'userid'};
- if ( $userid != undef ) { $userid = int($userid) }
- $name = uc( $in{'name'} );
- $email = uc( $in{'email'} );
- $socio = uc( $in{'socio'} );
- $startid = int( $in{'startid'} );
- $endid = int( $in{'endid'} );
- print qq~
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- </head>
- <body background="$SiteURL/bg.jpg">
- ~;
- $filesize = ( stat("$Database") )[7];
- if ( $filesize % $DBRecSize != 0 ) { die "Database processing error!" }
- $users = $filesize / $DBRecSize;
- if ( $startid == undef ) { $startid = 2 }
- if ( $endid == undef ) { $endid = $users }
- if ( $startid < 2 ) { $startid = 2 }
- elsif ( $startid > $users ) { $startid = $users }
- if ( $endid < 2 ) { $endid = 2 }
- elsif ( $endid > $users ) { $endid = $users }
- if ( $users == 1 ) { $startid = 3 }
- if ( ( $userid != undef ) && ( ( $userid < 1 ) || ( $userid > $users ) ) ) {
- print "Such user doesn't exists!";
- exit;
- }
- if ( $startid == 1 ) { $startid = 2 }
- open( USERS, "<$Database" ) or die "Error opening database! $!\n";
- if ( $userid != undef ) {
- ReadLock( *USERS, ( $userid - 1 ) * $DBRecSize, $DBRecSize );
- sysseek( USERS, ( $userid - 1 ) * $DBRecSize, 0 ) or die "Error seeking database! $!\n";
- }
- else {
- ReadLock( *USERS, ( $startid - 1 ) * $DBRecSize, ( $endid - $startid + 1 ) * $DBRecSize );
- sysseek( USERS, ( $startid - 1 ) * $DBRecSize, 0 ) or die "Error seeking database! $!\n";
- }
- print
- "<CENTER><table border=1 cellspacing=0><tr><td><B>Foto</B></td><td><B>ID#</B></td><td><B>Name</B></td><td><B>Socio</B></td><td><B>D</B></td><td><B>I</B></td><td><B>R#</B></td><td><B>$PaidName?</B></td><td><B>Balance</B></td></tr>";
- if ( $userid != 1 ) {
- for ( $n = $startid; $n <= $endid; $n++ ) {
- sysread( USERS, $buffer, $DBRecSize ) or die "Error reading database! $!\n";
- @user = split( /$DBFieldSepChar/, $buffer );
- $db_name = uc( $user[$DBName] );
- $db_socio = uc( $user[$DBSocio] );
- $db_password = $user[$DBPassword];
- $db_email = uc( $user[$DBEmail] );
- $dr = $user[$DBDirectReferrals];
- $ir = $user[$DBIndirectReferrals];
- $referrer = $user[$DBReferrer];
- $paid = "-";
- if ( $user[$DBStatus] == 1 ) { $paid = "<FONT color=green><B>$PaidName</B><FONT>" }
- if ( ( $db_password ne "" )
- and ( $user[$DBStatus] == 1 )
- and (
- ( $userid != undef )
- or (( ( $name eq undef ) or ( $db_name =~ /$name/ ) )
- and ( ( ( $socio eq undef ) or ( $db_socio =~ /$socio/ ) )
- and ( ( $email eq undef ) or ( $db_email =~ /$email/ ) ) )
- )
- )
- ) {
- if ( $userid != undef ) { $n = $userid }
- $f = $startid++;
- if ( $f / 2 == int( $f / 2 ) ) { $color = "#DFDFDF" }
- else { $color = "#EFEFEF" }
- print "<tr bgcolor=\"$color\">
- <td><img src=\"http:\/\/clubbeeteam.com\/fotos\/$n.jpg\" width=\"122\" height=\"162\"></td><td>$n</td><td>$user[$DBName]</td><td>$user[$DBSocio]</td><td>$dr</td><td>$ir</td><td>$referrer</td><td>$paid</td><td>$user[$DBBalance]</td>
- </tr>";
- }
- if ( $userid != undef ) {last}
- }
- }
- print "</table>";
- close(USERS);
- print "<H2>Search completed</H2></CENTER>";
Coloreado en 0.010 segundos, usando GeSHi 1.0.8.4