Проблем с един скрипт

C++ JAVA
Post Reply
Bummer
Много Редовен
Много Редовен
Posts: 1744
Joined: Tue May 22, 2007 9:08 am
Answers: 53
Contact:

Проблем с един скрипт

Post by Bummer » Sun Aug 05, 2007 6:05 pm

Вижте ето тази картинка http://img63.imageshack.us/my.php?image=problemll7.jpg
Искам скрипта, където пише за колко време е била заредена страницата да отиде в най-долната част на страницата.Но как ?
Благодаря :)

User avatar
Galli
Гуру
Гуру
Posts: 2012
Joined: Sat Nov 11, 2006 6:02 pm
Answers: 359

Post by Galli » Sun Aug 05, 2007 6:22 pm

За да го направи някой ще му трябва кода на страницата ти.
Иначе слагаш всичко в таблица така:

Code: Select all

<table>
<tr>
<td height='95%'>
тука кода без този за времето
</td>
</tr>
<tr>
<td height='5%' valign='botton'>
тука кода за времето
</td>
</tr>
</table>

Bummer
Много Редовен
Много Редовен
Posts: 1744
Joined: Tue May 22, 2007 9:08 am
Answers: 53
Contact:

Post by Bummer » Sun Aug 05, 2007 6:31 pm

ами пробвах с таблицата, ама не става :(

User avatar
Galli
Гуру
Гуру
Posts: 2012
Joined: Sat Nov 11, 2006 6:02 pm
Answers: 359

Post by Galli » Sun Aug 05, 2007 6:45 pm

Ами казах ти, че най лесно е да дадеш кода, а не да налучквам.

Code: Select all

<head>
<style>
table.edno&#123;
height&#58;95%
&#125;
table.dve&#123;
height&#58;5%
&#125;
</style>
</head>
<table class='edno'>
<tr>
<td>
	<table class='dve'>
	<tr>
	<td height='100%'>
	тука кода без този за времето
	</td>
	</tr>
	</table>
</td>
</tr>
<tr>
<td>
тука кода за времето
</td>
</tr>
</table>

User avatar
cToKaTa
Турист
Турист
Posts: 257
Joined: Mon May 21, 2007 11:23 am
Location: Sliven
Contact:

Post by cToKaTa » Sun Aug 05, 2007 7:18 pm

<img src="http://url/kartinka.format" align="bottom" ></img> ?
Търсят се модератори -Виж
Посетете сайта ми - http://OurGroup.data.bg

Bummer
Много Редовен
Много Редовен
Posts: 1744
Joined: Tue May 22, 2007 9:08 am
Answers: 53
Contact:

Post by Bummer » Sun Aug 05, 2007 7:36 pm

Code: Select all

<?php
function compress_output&#40;$output&#41;
&#123;
$crc = pack&#40;'V',crc32&#40;$output&#41;&#41;;
$size = pack&#40;'V',strlen&#40;$output&#41;&#41;;
$output = gzcompress&#40;$output, 9&#41;;

$data = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
$data .= substr&#40;$output, 0, strlen&#40;$output&#41; - 4&#41;;
$data .= $crc;
$data .= $size;

return $data;
&#125;
header&#40;"Content-Encoding&#58; gzip"&#41;;
ob_start&#40;"compress_output"&#41;;
?>
<html>
<head>
<meta content="Ивайло Петров" name="Owner">
<center><title>Search Engine</title></center>
<meta http-equiv="Contеnt-Type" content="text/html; charset=windows-1251">
</head>
<center><img src=./logo.jpg></center>
<BODY BACKGROUND=./bg.jpg>
</body>
<center>
        <tr>

          <td>
            <table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-collapse&#58; collapse; border-color&#58; #000000; height&#58; 13px;">
              <tr>
                <td bgcolor="#3D93FF" onmouseover="this.style.backgroundColor=&quot;#0061D7&quot;;" onmouseout="this.style.backgroundColor=&quot;#3D93FF&quot;;">
                  <div align="center">
                    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
                       <a href="http&#58;//10.23.20.35/search/links.php" target="_blank">Индексирай сайта си &#40;само http&#41;</a>
                    </font>

                  </div>
                </td>
                <td bgcolor="#3D93FF" onmouseover="this.style.backgroundColor=&quot;#0061D7&quot;;" onmouseout="this.style.backgroundColor=&quot;#3D93FF&quot;;">
                  <div align="center">
                    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
                       <a href="http&#58;//10.23.20.35/indexed.php" target="_blank">Списък с индескираните сайтове</a>
                    </font>
                  </div>

                </td>
                <td bgcolor="#3D93FF" onmouseover="this.style.backgroundColor=&quot;#0061D7&quot;;" onmouseout="this.style.backgroundColor=&quot;#3D93FF&quot;;">
                  <div align="center">
                    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
                       <a href="http&#58;//10.23.20.35/search/guestbook/" target="_blank">Коментари</a>
                    </font>
                  </div>
                </td>
<td bgcolor="#3D93FF" onmouseover="this.style.backgroundColor=&quot;#0061D7&quot;;" onmouseout="this.style.backgroundColor=&quot;#3D93FF&quot;;">
                  <div align="center">
                    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
                       <a href="http&#58;//10.23.20.35/search/login.html" target="_blank">Админ панел</a>
                    </font>
                  </div>
                </td>

</center>
<center>
 <?php
$countfile = "count.dat";
$ipcounter = "today.dat";
$countdate = date&#40;"j-n-Y"&#41;;
$visitorip = $_SERVER&#91;REMOTE_ADDR&#93;;
$maxrecord = date&#40;"d.m.Y &#40;H&#58;i&#41;"&#41;;

if &#40;!file_exists&#40;$ipcounter&#41;&#41; &#123; $fp = fopen&#40;$ipcounter, 'w+'&#41;; &#125;
if &#40;!file_exists&#40;$countfile&#41;&#41; &#123; $fp = fopen&#40;$countfile, 'w+'&#41;; fwrite&#40;$fp, "0|0|0|1|$countdate|0|$maxrecord"&#41;; &#125;

$fcontents = file_get_contents&#40;$countfile&#41;;
list&#40;$today, $yesterday, $total, $days, $nowdate, $max, $nowrecord&#41; = explode&#40;"|", $fcontents&#41;;

if&#40;$countdate != $nowdate&#41; &#123;
$ipfile2 = fopen&#40;$ipcounter, 'w'&#41;;
$line = "$visitorip\n";
fwrite&#40;$ipfile2, $line, strlen&#40;$line&#41;&#41;;
fclose&#40;$ipfile2&#41;;

if&#40;$today > $max&#41; &#123; $max = $today; $nowrecord = $maxrecord; &#125;
$yesterday = $today;
$today = 1;
$total++;
$days++;

$fp = fopen&#40;$countfile, 'w'&#41;;
fwrite&#40;$fp, "1|$yesterday|$total|$days|$countdate|$max|$nowrecord"&#41;;
fclose&#40;$fp&#41;;
&#125;

else &#123;
$ipfile = fopen&#40;$ipcounter, 'rb'&#41;;
$line = array&#40;&#41;;
while &#40;!feof&#40;$ipfile&#41;&#41; $line&#91;&#93;=fgets&#40;$ipfile,1024&#41;;
for &#40;$i=0; $i<&#40;count&#40;$line&#41;&#41;; $i++&#41; &#123;
list&#40;$visitorip_x&#41; = split&#40;"\n",$line&#91;$i&#93;&#41;;
if &#40;$visitorip == $visitorip_x&#41; &#123;$found = 1;&#125;
&#125;
fclose&#40;$ipfile&#41;;

if &#40;!$found&#41; &#123;
$ipfile2 = fopen&#40;$ipcounter, 'ab'&#41;;
$line = "$visitorip\n";
fwrite&#40;$ipfile2, $line, strlen&#40;$line&#41;&#41;;
fclose&#40;$ipfile2&#41;;

$today++;
$total++;

if&#40;$today > $max&#41; &#123; $max = $today; $nowrecord = $maxrecord; &#125;
$fp = fopen&#40;$countfile, 'r+'&#41;;
fwrite&#40;$fp, "$today|$yesterday|$total|$days|$countdate|$max|$nowrecord"&#41;;
fclose&#40;$fp&#41;;
&#125;
&#125;
if&#40;$days == 1&#41; &#123; $dendni = "ден"; &#125;
else &#123; $dendni = "дни"; &#125;
?>

<div style="font-family&#58;verdana;font-size&#58;11px;color&#58;#3D93FF;">
<b>Уникални посещения&#58;</b>
Днес <b><?php echo $today; ?></b> /
Вчера <b><?php echo $yesterday; ?></b> /
Общо <b><?php echo $total."</b> за <b>$days</b> ".$dendni; ?> /
Средно дневно <b><?php echo ceil&#40;$total/$days&#41;; ?></b> /
Рекорд <b><?php echo $max."</b> на <b>$nowrecord"; ?></b>
</div>
</center>
<?php

include "config.php";

//Set the page size

$StartRow = 0;

//Set the page no
if&#40;empty&#40;$_GET&#91;'PageNo'&#93;&#41;&#41;&#123;
    if&#40;$StartRow == 0&#41;&#123;
        $PageNo = $StartRow + 1;
    &#125;
&#125;else&#123;
    $PageNo = $_GET&#91;'PageNo'&#93;;
    $StartRow = &#40;$PageNo - 1&#41; * $PageSize;
&#125;

//Set the counter start
if&#40;$PageNo % $PageSize == 0&#41;&#123;
    $CounterStart = $PageNo - &#40;$PageSize - 1&#41;;
&#125;else&#123;
    $CounterStart = $PageNo - &#40;$PageNo % $PageSize&#41; + 1;
&#125;

//Counter End
$CounterEnd = $CounterStart + &#40;$PageSize - 1&#41;;
?>

<html>
<head>
<title>Free Search Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">

BODY &#123;
	FONT-SIZE&#58; 8pt; COLOR&#58; #526ba5; FONT-FAMILY&#58; Arial
&#125;
H3 &#123;
	COLOR&#58; #526ba5
&#125;
H4 &#123;
	COLOR&#58; #526ba5
&#125;
.Issue &#123;
	BACKGROUND-COLOR&#58; #c6c6ce
&#125;
.NormalField &#123;
	FONT-WEIGHT&#58; bold; FONT-SIZE&#58; 10pt; COLOR&#58; black; FONT-FAMILY&#58; Verdana;BACKGROUND-COLOR&#58; #ffffff
&#125;
.NormalFieldTwo &#123;
	FONT-SIZE&#58; 7pt;

	FONT-FAMILY&#58; Verdana;
	background &#58; #E4E4E4;
	font-weight &#58; bold
&#125;
.NormalFieldThree &#123;
	FONT-SIZE&#58; 10pt;
	COLOR&#58; Yellow;
	FONT-FAMILY&#58; Verdana;
	background &#58; #0C79B4;
	font-weight &#58; bold;
	text-align &#58; center;
&#125;

.NormalFieldFour &#123;
	FONT-SIZE&#58; 10pt;
	COLOR&#58; Yellow;
	FONT-FAMILY&#58; Verdana;
	background &#58; Black;
	font-weight &#58; bold;
	text-align &#58; center;
&#125;
.NormalFieldFive &#123;
	FONT-WEIGHT&#58; bold;
	FONT-SIZE&#58; 10pt;
	COLOR&#58; Navy;
	FONT-FAMILY&#58; Verdana;
	BACKGROUND-COLOR&#58; #ffffff
&#125;
.NormalFieldSix &#123;
		FONT-WEIGHT&#58; bold; FONT-SIZE&#58; 8pt; COLOR&#58; #526ba5; FONT-FAMILY&#58; Arial
&#125;

.TableText &#123;
	FONT-SIZE&#58; 8pt; COLOR&#58; #000000; FONT-FAMILY&#58; Arial
&#125;
.TableBorder&#123;
	border-color &#58; Black;
&#125;
.NormalTable &#123;
	BACKGROUND-COLOR&#58; #ffffff
&#125;
.NormalTableTwo &#123;
	BACKGROUND-COLOR&#58; #eeeeee
&#125;
.UsePageBG &#123;
	BACKGROUND-COLOR&#58; #cccccc
&#125;
.UseTableBG &#123;
	BACKGROUND-COLOR&#58; #526ba5
&#125;
.UseDialogBG &#123;
	BACKGROUND-IMAGE&#58; url&#40;../Graphics/Images/DialogBackGround.gif&#41;
&#125;
.ReadOnlyField &#123;
	FONT-WEIGHT&#58; bold; FONT-SIZE&#58; 8pt; COLOR&#58; #526000; FONT-FAMILY&#58; Arial
&#125;
.InternalHeader &#123;
	FONT-WEIGHT&#58; bold; FONT-SIZE&#58; 8pt; COLOR&#58; #ffffff; FONT-FAMILY&#58; Arial; BACKGROUND-COLOR&#58; #526ba5;
&#125;
.AttachedFiles &#123;
	BACKGROUND-COLOR&#58; #99ccff;
	color &#58; Black
&#125;
.SpecialAnchor &#123;
	FONT-FAMILY&#58; Arial; TEXT-DECORATION&#58; none
&#125;
UNKNOWN &#123;
	FONT-WEIGHT&#58; lighter; FONT-SIZE&#58; 8pt; TEXT-TRANSFORM&#58; capitalize; COLOR&#58; navy; FONT-STYLE&#58; normal; FONT-FAMILY&#58; 'Arial', Times New Roman, Verdana; FONT-VARIANT&#58; normal; TEXT-DECORATION&#58; underline
&#125;
.SearchResults &#123;
	FONT-WEIGHT&#58; normal; FONT-SIZE&#58; 8pt; COLOR&#58; #000000; FONT-STYLE&#58; normal; FONT-FAMILY&#58; Arial, Helvetica, sans-serif; TEXT-DECORATION&#58; none
&#125;
.MandatoryFields &#123;
	FONT-WEIGHT&#58; normal; FONT-SIZE&#58; 10pt; COLOR&#58; #000000; FONT-STYLE&#58; normal; FONT-FAMILY&#58; Arial, Helvetica, sans-serif; TEXT-DECORATION&#58; none
&#125;
.tab-above-heading &#123;
	FONT-WEIGHT&#58; bold; FONT-SIZE&#58; 12pt; COLOR&#58; #000000; FONT-STYLE&#58; normal; FONT-FAMILY&#58; Arial, Helvetica, sans-serif; TEXT-DECORATION&#58; none
&#125;
.textareaLabel &#123;
	FONT-WEIGHT&#58; bolder; FONT-SIZE&#58; 10pt; COLOR&#58; #526ba5; FONT-FAMILY&#58; Arial
&#125;
.linkStyle &#123;
	TEXT-DECORATION&#58; none
&#125;
.PageTitle &#123;
	FONT-WEIGHT&#58; bold; FONT-SIZE&#58; 16pt; COLOR&#58; #526ba5; FONT-FAMILY&#58; Tahoma
&#125;
.smallfont &#123;
	FONT-SIZE&#58; 7.5pt; COLOR&#58; #000000; FONT-FAMILY&#58; Arial
&#125;
A &#123;
	COLOR&#58; Red;
	TEXT-DECORATION&#58; none
&#125;

 #nav &#123;
background-color&#58; #D5D5D5;
border&#58; 1px solid #B8B8B8;
padding-top&#58; 8px;
height&#58; 21px;
padding-left&#58; 3px;
&#125;
#nav a &#123;
border&#58; 1px solid #B7B7B7;
padding&#58; 4px;
background-color&#58; #F3F3F3;
color&#58; #0077B4;
font-weight&#58; bold;
text-decoration&#58; none;
font-family&#58; Verdana, Sans-Serif;
font-size&#58; 12px;
&#125;
#nav a&#58;hover &#123;
color&#58; #00A8FF;
background-color&#58; #ffffff;
border&#58; 1px solid #727272;
border-bottom&#58; 1px solid #ffffff;
&#125;
</style>
</head>
<body class="UsePageBg">
<form method="GET" action="">
<table cellpadding="0" cellspacing="0" width="300px" align="center" cellpadding="0" >
<tr>
<td align="right" width="200px"><input type="text" name="q" size="30"></td>
<td align="right" width="100px"><input type="submit" value="Търсене"></td>
</tr>
</table>
</form>
<?php
$tarsene = $_GET&#91;'q'&#93;;

if&#40;$_GET&#91;'q'&#93;&#41;
&#123;
$trimmed = trim&#40;$tarsene&#41;; 
$var = explode&#40;" ",$trimmed&#41;; 
$count = count&#40;$var&#41;; 


for&#40;$i = $count-1;$i < sizeof&#40;$var&#41;; $i++&#41; &#123;

$abc = $var&#91;$i&#93;; 

 mysql_connect&#40;$server, $dbusername, $dbpassword&#41;or die&#40;"Сайтът не може да се свърже към базата данни"&#41;;
 @mysql_select_db&#40;$db_name&#41; or die&#40;"Грешна база данни"&#41;;
 $TRecord = mysql_query&#40;"SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%'"&#41;;
 $result = mysql_query&#40;"SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%' ORDER BY `id` DESC LIMIT $StartRow,$PageSize"&#41;;

 //Total of record
 $RecordCount = mysql_num_rows&#40;$TRecord&#41;;

 //Set Maximum Page
 $MaxPage = $RecordCount % $PageSize;
 if&#40;$RecordCount % $PageSize == 0&#41;&#123;
    $MaxPage = $RecordCount / $PageSize;
 &#125;else&#123;
    $MaxPage = ceil&#40;$RecordCount / $PageSize&#41;;
 &#125;
?>

<table width="100%" border="0" class="InternalHeader">
  <tr>
    <td width="24%"></td>
    <td width="76%">
      <div align="right"> 
        <?php print "$RecordCount запис&#40;а&#41; намерен&#40;и&#41; - Вие сте на страница $PageNo от $MaxPage" ?></div>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="0" class="NormalTableTwo">
  <tr> 
    <td class="InternalHeader" width="5%">Номер</td>
    <td class="InternalHeader" width="60%">Име</td>
	<td class="InternalHeader" width="20%">Тип</td>
    <td class="InternalHeader" width="15%">Добавен</td>
  </tr>
<?php
$i = 1;
while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;
&#123;
$id=$row&#91;id&#93;; 
$data=$row&#91;data&#93;; 
$fulllinks=$row&#91;fulllinks&#93;; 
$files=$row&#91;files&#93;;
$tipfail=$row&#91;tipfail&#93;;

 
    $bil = $i + &#40;$PageNo-1&#41;*$PageSize;
	
?>

  <tr> 
    <td class="NormalFieldTwo" width="5%"><?php echo $bil ?></td>
    <td class="NormalFieldTwo" width="60%"><a href="s.php?id=<?php echo $id; ?>" target="_new"><?php echo $files ?></a></td>
	<td class="NormalFieldTwo" width="20%"><?php echo $tipfail ?></td>
	<td class="NormalFieldTwo" width="15%"><?php echo $data ?></td>
 </tr>
<?php
  $i++;
&#125;?>
</table><br>
<table width="100%" border="0" class="InternalHeader">
  <tr>
    <td>

      <div align="center">
      <?php
        //Print First & Previous Link is necessary
        if&#40;$CounterStart != 1&#41;&#123;
            $PrevStart = $CounterStart - 1;
            print "<a href=?q=$tarsene&PageNo=1>Първи </a>&#58; ";
            print "<a href=?q=$tarsene&PageNo=$PrevStart>Предишни $PageSize </a>";
        &#125;
        print " &#91; ";
        $c = 0;

        //Print Page No
        for&#40;$c=$CounterStart;$c<=$CounterEnd;$c++&#41;&#123;
            if&#40;$c < $MaxPage&#41;&#123;
                if&#40;$c == $PageNo&#41;&#123;
                    if&#40;$c % $PageSize == 0&#41;&#123;
                        print "$c ";
                    &#125;else&#123;
                        print "$c ,";
                    &#125;
                &#125;elseif&#40;$c % $PageSize == 0&#41;&#123;
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
                &#125;else&#123;
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ,";
                &#125;//END IF
            &#125;else&#123;
                if&#40;$PageNo == $MaxPage&#41;&#123;
                    print "$c ";
                    break;
                &#125;else&#123;
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
                    break;
                &#125;//END IF
            &#125;//END IF
       &#125;//NEXT

      echo "&#93; ";

      if&#40;$CounterEnd < $MaxPage&#41;&#123;
          $NextPage = $CounterEnd + 1;
          echo "<a href=?q=$tarsene&PageNo=$NextPage>Следващи $PageSize</a>";
      &#125;
      
      //Print Last link if necessary
      if&#40;$CounterEnd < $MaxPage&#41;&#123;
       $LastRec = $RecordCount % $PageSize;
        if&#40;$LastRec == 0&#41;&#123;
            $LastStartRecord = $RecordCount - $PageSize;
        &#125;
        else&#123;
            $LastStartRecord = $RecordCount - $LastRec;
        &#125;

        print " &#58; ";
        echo "<a href=?q=$tarsene&PageNo=$MaxPage>Последни</a>";
        &#125;
      ?>
      </div>
    </td>
  </tr>
</table>
<?php
    mysql_free_result&#40;$result&#41;;

    mysql_free_result&#40;$TRecord&#41;;
	&#125;&#125;
?>
<br>

</body>
<center>Реклами&#58;<br>Продават се домейни, 7 лева бройката.За повече информация - <a href=http&#58;//10.10.0.99/forum/privmsg.php?mode=post&u=3952>тук</а></br>

</html>
<?
$mtime = microtime&#40;&#41;;
$mtime = explode &#40;" ", $mtime&#41;;
$mtime = $mtime&#91;1&#93; + $mtime&#91;0&#93;;
$tstart = $mtime; // Start time

$mtime = microtime&#40;&#41;;
$mtime = explode &#40;" ", $mtime&#41;;
$mtime = $mtime&#91;1&#93; + $mtime&#91;0&#93;;
$tend = $mtime; // End time
$totaltime = &#40;$tend - $tstart&#41;;
printf &#40;"Страницата бе заредена за %f секунди!", $totaltime&#41;;
?>


Bummer
Много Редовен
Много Редовен
Posts: 1744
Joined: Tue May 22, 2007 9:08 am
Answers: 53
Contact:

Post by Bummer » Mon Aug 06, 2007 8:17 am

някакви идеи, как да се направи ?

Post Reply