błedy na stronie i w bazie

0

witam

Wyskakuje mi taki blad jak loguje sie do php admin

Błąd

zapytanie SQL:  

SELECT USER( ) ;


MySQL zwrócił komunikat:  
#1226 - User 'koncertydp_2' has exceeded the 'rows_sent' resource (current value: 10000000)

a na stronie wyskakuja takie błedy np:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/koncertydp/ftp/module/bonus.inc.php on line 226

najczesciej to sie dzieje po aktulizacji
optymalizowałem baze danych automatycznie ale to nie pomogło
Co może byc przyczyną tych błedów
strona to www.disco-polo.org.pl
serwer nazwa.pl
Dziekuje

0

Nie jestem ekspertem ale samo zapytanie jest dziwne bo nie ma wskazania z jakiej tabeli ma ciągnąć dane. A jeśli chodzi o błędy ze wskazaniem pliku to dobrze byłoby wkleić kawałek kodu z linią gdzie wskazuje błąd bo tak jest ciężko cokolwiek domniemywać.

0

Domniemywac mozna wiele, bo przeciez blad dokladnie wyjasniony:

User 'koncertydp_2' has exceeded the 'rows_sent' resource (current value: 10000000)

Po polsku: Uzytkownik ... przekroczyl zakres 'rows_sent' (ilosc wyslanych wierszy) (aktualna wartosc: 10000000).

A na nasze - masz ustawiony mysql tak, ze masz mozliwosc pobrania do takiej ilosci wierszy dla danego uzytkownika, prawdopodobnie na sesje (ale tego nie jestem pewien). Jezeli to na sesje (a sprawdzic mozesz w dokumentacji), to albo zwieksz ta wartosc (niezalecane) albo zoptymalizuj zapytania, bo pobieranie 10 mln wierszy w jednym/kilku podejsciach to troche duzo jak na jednego uzytkownika.

0
johny_bravo napisał(a)

Domniemywac mozna wiele, bo przeciez blad dokladnie wyjasniony:

User 'koncertydp_2' has exceeded the 'rows_sent' resource (current value: 10000000)

Po polsku: Uzytkownik ... przekroczyl zakres 'rows_sent' (ilosc wyslanych wierszy) (aktualna wartosc: 10000000).

A na nasze - masz ustawiony mysql tak, ze masz mozliwosc pobrania do takiej ilosci wierszy dla danego uzytkownika, prawdopodobnie na sesje (ale tego nie jestem pewien). Jezeli to na sesje (a sprawdzic mozesz w dokumentacji), to albo zwieksz ta wartosc (niezalecane) albo zoptymalizuj zapytania, bo pobieranie 10 mln wierszy w jednym/kilku podejsciach to troche duzo jak na jednego uzytkownika.

A jak zoptymalizować zapytania?

a to jest kod php pliku w ktorym wyskakuja błedy

<?

/*****************************************************/
/*      jPORTAL - internetowy system portalowy       */
/*****************************************************/
/* autor: Pawel 'jaco' Jaczewski                     */
/* email: [email protected]                             */
/*****************************************************/

#=====================================================#

if(eregi("main.php",$PHP_SELF)) { header("Location: index.php"); exit; }

###############################################################################
###############################################################################
###############################################################################
set_theme();
include($o.'forum_theme/'.$config['forum_image'].'.cfg');
include("theme/$theme/functions.inc.php");
###############################################################################
###############################################################################
###############################################################################

function left_menu() {

global $menu_tbl, $PHP_SELF;

left_menu_open();

$query = "SELECT * FROM $menu_tbl WHERE posx='left' AND status=1 ORDER BY posy";
$result = mysql_query($query);

while($r = mysql_fetch_array($result)) {

$title = $r['title'];
$text = $r['text'];
$id = $r['id'];

$title = stripslashes($title);
$text = stripslashes($text);





left_menu_title_open();
echo $title;
left_menu_title_close();

left_menu_text_open();


$text = '?>'.$text.'<?';
eval($text);


left_menu_text_close();

}

left_menu_close();

}

###############################################################################
###############################################################################
###############################################################################

function right_menu() {

global $menu_tbl;

right_menu_open();

$query = "SELECT * FROM $menu_tbl WHERE posx='right' AND status=1 ORDER BY posy";
$result = mysql_query($query);

while($r = mysql_fetch_array($result)) {

$title = $r['title'];
$text = $r['text'];
$id = $r['id'];

$title = stripslashes($title);
$text = stripslashes($text);

right_menu_title_open();
echo $title;
right_menu_title_close();

right_menu_text_open();


$text = '?>'.$text.'<?';
eval($text);


right_menu_text_close();

}

right_menu_close();
}

###############################################################################
###############################################################################
###############################################################################

function set_theme() {

global $set_theme, $logs, $theme, $default_theme;


if($set_theme<>'') {
if(file_exists("theme/$set_theme")) {
$theme = $set_theme;
$czas = mktime(0,0,0,date("m"),date("d"),date("Y")+5);
setcookie("theme", $set_theme, $czas);
header("Location: index.php");
exit;
}
}

if($theme=='' OR !file_exists("theme/$theme")) {

$theme = $default_theme;

} else {

if(!file_exists("theme/$set_theme"))
$theme = $default_theme;
}
}

###############################################################################
###############################################################################
###############################################################################

function poll_form($punkt='') {

global $poll_a_tbl, $poll_b_tbl;


$query = "SELECT * FROM $poll_a_tbl ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_num_rows($result);

if($num==0) {

echo '<br><center>aktualnie nie jest prowadzona żadna ankieta<br><br>';

} else {

$r = mysql_fetch_array($result);
$id = $r['id'];
$votes = $r['votes'];
$title = $r['title'];

echo '<form method="post" name="vote" action="poll.php">';
echo $punkt.$title.'<br>';

echo '<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">';

$qu_ = "SELECT * FROM $poll_b_tbl WHERE vid='$id' ORDER BY id";
$re_ = mysql_query($qu_);


while($r_ = mysql_fetch_array($re_)) {

$value = $r_['value'];
$title = $r_['title'];


if($title<>'')

echo '<tr>
<td valign="top"><input class="poll" type="radio" name="voteVALUE" value="'.$value.'"></td>
<td class="uni_01" width="90%">'.$title.'</td>
</tr>';


}

echo '
<tr>
<td colspan="2" class="uni_01">
<center><input type="submit" name="ok" value="głosuj" style="font-weight: bold"><br>
[<a href="poll.php">wyniki</a> | <a href="poll.php?cmd=old">ankiety</a>]</td>
</tr>
</table>
<input type="hidden" name="cmd" value="count">
<input type="hidden" name="pollID" value="'.$id.'">
</form>';

}
}
###############################################################################
###############################################################################
###############################################################################

function print_main() {

global $error;

if($error=='') {
site_main();
} else {
site_error($error);
}

}

###############################################################################
###############################################################################
###############################################################################

function is_login()
{
    global $user_tbl;
    static $re;

    if($_SESSION['nick']<>'')
    {

        if($re=='')
        {
            $res = mysql_query("SELECT * FROM $user_tbl WHERE nick='{$_SESSION['nick']}' AND access='{$_SESSION['access']}' AND pass='".$_SESSION['pass']."'");

            $re = (mysql_num_rows($res)==1 ? 'yes' : 'no' );

        }
        else
        {
            return $re;
        }

        return $re;
    }
}


###############################################################################
###############################################################################
###############################################################################

function is_user_login() {

global $gnick, $gpass, $guest_tbl;

$query = "SELECT * FROM $guest_tbl WHERE nick='$_SESSION[gnick]' AND stat='ok'";
$result = mysql_query($query);
$r = mysql_fetch_array($result);
$d = mysql_num_rows($result);

if($d==1) {

$nick_ = $r['nick'];
$pass_ = md5(stripslashes($r['pass']));

if($_SESSION[gnick]==$nick_ AND $_SESSION[gpass]==$pass_ ) $re = 'yes'; else $re = 'no';


} else {

$re = 'no';

}

return $re;

}

###############################################################################
###############################################################################
###############################################################################

function pl_date() {

  $dzie2 = date("j");
  $dzien = date("D");
        if ($dzien == Mon) {$dzien = "poniedziałek";}
        if ($dzien == Tue) {$dzien = "wtorek";}
        if ($dzien == Wed) {$dzien = "¶roda";}
        if ($dzien == Thu) {$dzien = "czwartek";}
        if ($dzien == Fri) {$dzien = "pi±tek";}
        if ($dzien == Sat) {$dzien = "sobota";}
        if ($dzien == Sun) {$dzien = "niedziela";}

  $miesiac = date("m");
        if ($miesiac == 1) {$miesiac = "stycznia";}
        if ($miesiac == 2) {$miesiac = "lutego";}
        if ($miesiac == 3) {$miesiac = "marca";}
        if ($miesiac == 4) {$miesiac = "kwietnia";}
        if ($miesiac == 5) {$miesiac = "maja";}
        if ($miesiac == 6) {$miesiac = "czerwca";}
        if ($miesiac == 7) {$miesiac = "lipca";}
        if ($miesiac == 8) {$miesiac = "sierpnia";}
        if ($miesiac == 9) {$miesiac = "wrze¶nia";}
        if ($miesiac == 10) {$miesiac = "pa&#188;dziernika";}
        if ($miesiac == 11) {$miesiac = "listopada";}
        if ($miesiac == 12) {$miesiac = "grudnia";}

  $rok = date("Y");

  $rok = $dzien.', '.$dzie2.' '.$miesiac.' '.$rok;

return $rok;

}

###############################################################################
###############################################################################
###############################################################################

function  make_clickable($text, $mode='normal') {

$ret = " " . $text;
if($mode=='normal') {
$ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
$ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
$ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);

$ret = preg_replace("#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si", "<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>", $ret);
$ret = preg_replace("#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $ret);

$ret = preg_replace("#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si", "<a href=\"\\1\\2\" target=\"_blank\">\\3</a>", $ret);
$ret = preg_replace("#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $ret);

$ret = preg_replace("#\[link\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/link\]#si", "<a href=\"\\1\">\\1</a>", $ret);
$ret = preg_replace("#\[link=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/link\]#si", "<a href=\"\\1\">\\2</a>", $ret);

#$ret = preg_replace("#\[img=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\]#si", "<img src=\"\\1\" border=\"0\">", $ret);
#$ret = preg_replace("#\[img\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/img\]#si", "<img src=\"\\1\" border=\"0\">", $ret);

#$image_url = eregi_replace(".*\[img\](.*)\[/img\].*","\\1", $ret);
#$img=getimagesize_remote($image_url);

 #if($img[0]<=300 AND $img[1]<=300 AND $img[0] != 'brak'){
$ret = preg_replace("#\[img=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\]#si", "<img src=\"\\1\">", $ret);
$ret = preg_replace("#\[img\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/img\]#si", "<img src=\"\\1\" border=\"0\">", $ret);

 #}

$ret = preg_replace("#\[color=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/color\]#si", "<font color=\"\\1\">\\2</font>", $ret);

$ret = preg_replace("#\[size=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/size\]#si", "<font size=\"\\1\">\\2</font>", $ret);

$ret = preg_replace("#\[marq=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/marq\]#si", "<marquee behavior=\"\\1\">\\2</marquee>", $ret);
} else {

$ret = preg_replace("#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si", "\\1\\2", $ret);
$ret = preg_replace("#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si", "\\1", $ret);

$ret = preg_replace("#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si", "\\3", $ret);
$ret = preg_replace("#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si", "\\2", $ret);

$ret = preg_replace("#\[link\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/link\]#si", "\\1", $ret);
$ret = preg_replace("#\[link=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/link\]#si", "\\2", $ret);



}

$ret = preg_replace("#\[code\]\s<br />#si", "<div class=code>", $ret);
$ret = preg_replace("#<br />\s\[/code\]\s<br />#si", "</div>", $ret);

$ret = preg_replace("#\[cytat\]\s<br />#si", "<div class=cytat>", $ret);
$ret = preg_replace("#<br />\s\[/cytat\]\s<br />#si", "</div>", $ret);

$ret = preg_replace("#\[moder\]\s<br />#si", "<div class=moder>", $ret);
$ret = preg_replace("#<br />\s\[/moder\]\s<br />#si", "</div>", $ret);

$ret = str_replace("[code]", "<div class=code>", $ret);
$ret = preg_replace("#\[/code\]\s<br />#si", "</div>", $ret);

$ret = str_replace("[cytat]", "<div class=cytat>", $ret);
$ret = preg_replace("#\[/cytat\]\s<br />#si", "</div>", $ret);

$ret = str_replace("[moder]", "<div class=moder>", $ret);
$ret = preg_replace("#\[/moder\]\s<br />#si", "</div>", $ret);

$ret = preg_replace("#\[/code\]#si", "</div>", $ret);
$ret = preg_replace("#\[/cytat\]#si", "</div>", $ret);
$ret = preg_replace("#\[/moder\]#si", "</div>", $ret);

//=========

$ret = str_replace("[b]", "<b>", $ret);
$ret = str_replace("[/b]", "</b>", $ret);

$ret = str_replace("[i]", "<i>", $ret);
$ret = str_replace("[/i]", "</i>", $ret);

$ret = str_replace("[u]", "<u>", $ret);
$ret = str_replace("[/u]", "</u>", $ret);
///////////////dodatki//////////////////////////////
$ret = str_replace("[marq]", "<marquee behavior=\"alternate\">", $ret);
$ret = str_replace("[/marq]", "</marquee>", $ret);

$ret = str_replace("[sub]", "<sub>", $ret);
$ret = str_replace("[/sub]", "</sub>", $ret);

$ret = str_replace("[sup]", "<sup>", $ret);
$ret = str_replace("[/sup]", "</sup>", $ret);

$ret = str_replace("[strike]", "<strike>", $ret);
$ret = str_replace("[/strike]", "</strike>", $ret);

$ret = str_replace("[list]", "<ol type=\"disc\">", $ret);
$ret = str_replace("[/list]", "</ol>", $ret);

$ret = str_replace("[*]", "<li>", $ret);
$ret = str_replace("[x]", "<li type=\"1\">", $ret);

$ret = str_replace("[center]", "<center>", $ret);
$ret = str_replace("[/center]", "</center>", $ret);

$ret = substr($ret, 1);
return($ret);

}

function smilies($text) {

global $smilies, $forum_emots;

if($smilies<>'off') {

         $query = "SELECT * FROM $forum_emots ORDER BY expression";
         $result = mysql_query($query);

         while($r = mysql_fetch_array($result)) {
                  $id = $r['id'];
                  $znak = $r['expression'];
                  $zast = $r['exchange'];

        $text = str_replace("$znak"," <img src='images/smilies/$zast' align='absbottom' border='0'>",$text);

         } }
return $text;
}


function censor_make_text($text) {
         global $forum_censor;

         $query = "SELECT * FROM $forum_censor ORDER BY expression";
         $result = mysql_query($query);

         while($r = mysql_fetch_array($result)) {
                  $id = $r['id'];
                  $slowo = $r['expression'];
                  $zast = $r['exchange'];
                  $zast='*'.$zast.'*';

                   $text = preg_replace ("'$slowo'", $zast, $text);

         }
return $text;
}


###############################################################################
###############################################################################
###############################################################################


function login_guest($goto='') {

global $guest_tbl, $ga10, $gb10, $gnick, $gmail, $gpass, $REMOTE_ADDR, $config, $klucz, $prefix;

if($ga10<>'' AND $gb10<>'') {

$gb10 = (!isset($klucz) && $config['md5_pass']=='1')? md5($gb10): $gb10;

$query = "SELECT * FROM $guest_tbl WHERE nick='$ga10' AND stat='ok'";
$result = mysql_query($query);


$r = mysql_fetch_array($result);
$nick_ = $r['nick'];
$pass_ = $r['pass'];
$mail_ = $r['mail'];

if($nick_==$ga10 AND $pass_==$gb10) {

$_SESSION[gnick] = $nick_;
$_SESSION[gpass] = md5($pass_);
$_SESSION[gmail] = $mail_;

if($_POST['gautolog']=='t')
{
setcookie("g_auto", "tak", mktime(1,1,1,1,1,date("Y")+5));
setcookie("g_nick", "$_SESSION[gnick]", mktime(1,1,1,1,1,date("Y")+5));
setcookie("g_pass", "$_SESSION[gpass]", mktime(1,1,1,1,1,date("Y")+5));
setcookie("g_mail", "$_SESSION[gmail]", mktime(1,1,1,1,1,date("Y")+5));
}

$result = mysql_query("INSERT INTO ".$prefix."visitors VALUES (NULL, '$nick_', now(), '$REMOTE_ADDR')");
$result = mysql_query("SELECT * FROM ".$prefix."visitors_list WHERE nick='$nick_'");
$num = @mysql_num_rows($result);
if($num<>0) {
$result = mysql_query("UPDATE ".$prefix."visitors_list SET visit=visit+1 WHERE nick='$nick_'");
} else {
$result = mysql_query("INSERT INTO ".$prefix."visitors_list VALUES (NULL, '$nick_', '1')");
}

if(file_exists($o.'online_g/'.$REMOTE_ADDR)) unlink($o.'online_g/'.$REMOTE_ADDR);

if($goto=='')
{
if(isset($klucz))header("Location: login.php?cmd=profil");
else header("Location: login.php?cmd=pw_get");
}
else
header("Location: $goto");
exit;

} else {

return 'no';

}

} else {

return 'no';

}
}


###############################################################################
###############################################################################
###############################################################################

function get_user_info($aaa='nic', $abc='') {

global $guest_tbl, $gnick, $gmail, $gpass, $forum_a;


if($abc=='') {

if($aaa=='nic') $aaa = $_SESSION['gnick'];

$query = "SELECT * FROM $guest_tbl WHERE nick='$aaa' AND stat='ok'";
$result = mysql_query($query);

$r = mysql_fetch_array($result);
$in[0] = $r['post'];
$in[1] = $r['nick'];
$in[2] = $r['mail'];
$in[3] = $r['sign'];
$in[4] = $r['www'];
$in[5] = $r['iname'];
$in[6] = $r['admin'];
$in[7] = $r['date'];
$in[8] = $r['avatar'];
$in[9] = mysql_result(mysql_query("SELECT count(*) FROM $forum_a WHERE author ='$aaa'"),0);
$in[10] = $r['gg'];
$in[12] = $r['avatar_typ'];
$in[13] = $r['icq'];

return $in;

}
else
{
    $res = mysql_query("SELECT * FROM {$guest_tbl} WHERE nick IN('$abc') AND stat='ok'");

    while($r = mysql_fetch_array($res))
    {
        $in[$r['nick']][0] = $r['post'];
        $in[$r['nick']][1] = $r['nick'];
        $in[$r['nick']][2] = $r['mail'];
        $in[$r['nick']][3] = $r['sign'];
        $in[$r['nick']][4] = $r['www'];
        $in[$r['nick']][5] = $r['iname'];
        $in[$r['nick']][6] = $r['admin'];
        $in[$r['nick']][7] = $r['date'];
        $in[$r['nick']][8] = $r['avatar'];
        $in[$r['nick']][10] = $r['gg'];
        $in[$r['nick']][12] = $r['avatar_typ'];
        $in[$r['nick']][13] = $r['icq'];
    }

          $re_count = mysql_query("SELECT count(*) as post, author FROM $forum_a WHERE author IN('$abc') GROUP by author");

          while($rc = mysql_fetch_object($re_count))
          {
            $in[$rc->author][9] = $rc->post;
          }

    return $in;
}
}

###############################################################################
###############################################################################
###############################################################################

function user_logout() {
global $jpu_stat, $gnick, $gpass, $members, $guests;

setcookie("g_auto", "nie", mktime(1,1,1,1,1,date("Y")+5));
setcookie("g_nick", "***************", mktime(1,1,1,1,1,date("Y")+5));
setcookie("g_pass", "***************", mktime(1,1,1,1,1,date("Y")+5));
setcookie("g_mail", "***************", mktime(1,1,1,1,1,date("Y")+5));

if(file_exists('online/'.$_SESSION[gnick])) unlink('online/'.$_SESSION[gnick]);
$_SESSION[gnick] = '**************************';
$_SESSION[gpass] = '**************************';
$guests++;
$members = $members-1;
header("Location: index.php");
exit;
}

###############################################################################
###############################################################################
###############################################################################


function set_info($var_name, $data) {
global $gnick, $guest_tbl;

$query = "SELECT * FROM $guest_tbl WHERE nick='$_SESSION[gnick]' AND stat='ok'";
$result = mysql_query($query);
$r = mysql_fetch_array($result);
$info = $r['post'];


if($data=='allallall') {

eval($info);
eval($var_name);

foreach($p AS $v_name => $v_data) {
$inf = $inf."\n".'$p['.$v_name.']="'.$v_data.'";';
}
$info = $inf;


} else {


if(substr_count($info, '$p['.$var_name.']')==0) {
$info = $info."\n".'$p['.$var_name.']="'.$data.'";';
} else {
eval($info);
$p[$var_name] = $data;
foreach($p AS $v_name => $v_data) {
$inf = $inf."\n".'$p['.$v_name.']="'.$v_data.'";';
$info = $inf;
}
}



}

$query = "UPDATE $guest_tbl SET post='$info' WHERE nick='$_SESSION[gnick]'";
$result = mysql_query($query);

}

###############################################################################
###############################################################################
###############################################################################


function user_block($size, $punkt)
{
    global $pw_tbl, $gnick;

    if(is_user_login()=='yes')
    {
        $pw = (int) mysql_num_rows(mysql_query("SELECT * FROM $pw_tbl WHERE receiver='$_SESSION[gnick]' AND readed='no'"));
        echo '
        '.$punkt.'<a href="login.php?cmd=users">lista użytkowników</a><br>
        '.$punkt.'<a href="login.php?cmd=profil">ustawienia profilu</a><br>
        '.$punkt.'<a href="login.php?cmd=pw_get">wiadomo¶ci ('.$pw.')</a><br><br>
        '.$punkt.'<a href="login.php?cmd=logout">wyloguj</a>';
    }
    else
    {
        $size = 140;




echo '
<form method="post" action="login.php">
<table align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="3"><input type="text" name="ga10" value="twój login" style="width: '.$size.'px; font-size: 10px" onblur="if(this.value==\'\')this.value=\'twój login\';"  onfocus="if(this.value==\'twój login\')this.value=\'\';"></td>
</tr>
<tr>
<td colspan="3"><input type="password" name="gb10" value="" style="width: '.$size.'px; font-size: 10px"></td>
</tr>
<tr>
<td align="left" class="uni_01" ><input type="checkbox" name="gautolog" value="t" checked></td>
<td align="left" class="uni_01" >Auto<br>Logowanie </td>
<td align="right" class="uni_01"><input type="submit" name="ok" value="GO" style=" font-weight: bold; font-size: 10px " ></td>
</tr>
</table>
<input type="hidden" name="cmd" value="glogin">
<center>Nie masz jeszcze konta? Możesz <a href="login.php?cmd=#reg">sobie założyć</a>!
</center></td></form>
';
    }
}



###############################################################################
###############################################################################
###############################################################################


function save_member($nick) {

global $o;

if(is_user_login()=='yes') {
$date = time();
$file=@fopen($o."online/"."$nick", "w");

@flock($file, 2);
@fwrite($file, $date);
@flock($file, 3);
@fclose($file);
}
}

function act_member($ile) {
global $guest_tbl, $o;

$date = time();
$dir = opendir($o."online");
while($file = readdir($dir)) {

if($file<>'..' AND $file<>'.' AND $file<>'g') {
$when = file($o.'online/'.$file);
$aaa = $when[0]+$ile;
if($date>$aaa) {
if(file_exists($o.'online/'.$file)) unlink($o.'online/'.$file);
} else {

$a++;

}
}
}

return $a;
}

###############################################################################
###############################################################################
###############################################################################


function save_fmember($nick) {

global $o;

if(is_user_login()=='yes') {
$date = time();
$file=fopen($o."online_f/users/"."$nick", "w");

flock($file, 2);
fwrite($file, $date);
flock($file, 3);
fclose($file);
}
}

function act_fmember($ile) {
global $guest_tbl, $o;

$date = time();
$dir = opendir($o."online_f/users");
while($file = readdir($dir)) {
if($file<>'..' AND $file<>'.' AND $file<>'g') {
$when = file($o.'online_f/users/'.$file);
$aaa = $when[0]+$ile;
if($date>$aaa) {
if(file_exists($o.'online_f/users/'.$file)) unlink($o.'online_f/users/'.$file);
} else {

$a++;

}
}
}

return $a;
}


###############################################################################
###############################################################################
###############################################################################

function save_fguest($ile) {

global $REMOTE_ADDR, $o;

if(is_user_login()<>'yes') {
$date = time();
$file=fopen($o."online_f/guests/"."$REMOTE_ADDR", "w");

flock($file, 2);
fwrite($file, $date);
flock($file, 3);
fclose($file);
}

}


function act_fguest($ile) {

global $REMOTE_ADDR, $o;

$date = time();
$dir = opendir($o."online_f/guests");
while($file = readdir($dir)) {

if($file<>'..' AND $file<>'.' AND $file<>'g') {
$when = file($o.'online_f/guests/'.$file);
$aaa = $when[0]+$ile;
if($date>$aaa) {
if(file_exists($o.'online_f/guests/'.$file)) unlink($o.'online_f/guests/'.$file);
} else {

$a++;

}
}
}

return $a;
}

###############################################################################
###############################################################################
###############################################################################

function save_guest($ile) {

global $REMOTE_ADDR, $o;

if(is_user_login()<>'yes') {
$date = time();
$file=fopen($o."online_g/"."$REMOTE_ADDR", "w");

flock($file, 2);
fwrite($file, $date."\n".$_SERVER[PHP_SELF]);
flock($file, 3);
fclose($file);
}

}


function act_guest($ile) {

global $REMOTE_ADDR, $o;

$date = time();
$dir = opendir($o."online_g");
while($file = readdir($dir)) {

if($file<>'..' AND $file<>'.' AND $file<>'g') {
$when = file($o.'online_g/'.$file);
$aaa = $when[0]+$ile;
if($date>$aaa) {
if(file_exists($o.'online_g/'.$file)) unlink($o.'online_g/'.$file);
} else {

$a++;

}
}
}

return $a;
}

###############################################################################
###############################################################################
###############################################################################


function save_anonim($nick, $mail) {

setcookie("f_author", "$nick", mktime(1,1,1,1,1,date("Y")+5));
setcookie("f_mail", "$mail", mktime(1,1,1,1,1,date("Y")+5));

}


###############################################################################
###############################################################################
###############################################################################


function save_sort($co, $jak) {

$jak = str_replace("-"," ", $jak);

if($co=='art') setcookie("uart_sort", "$jak", mktime(1,1,1,1,1,date("Y")+5));
if($co=='link') setcookie("ulink_sort", "$jak", mktime(1,1,1,1,1,date("Y")+5));
if($co=='down') setcookie("udown_sort", "$jak", mktime(1,1,1,1,1,date("Y")+5));


return $jak;
}


###############################################################################
###############################################################################
###############################################################################



function avatar($icon, $err='no') {
if($icon<>'') {
if(ereg("^[a-zA-Z0-9]+://[^ ]+$", $icon)) {

//$size = @getimagesize($icon);

if($size[0]<=110 AND $size[1]<=110)
return '<img src="'.$icon.'" border="0" vspace="7" '.$size[3].'>';
else {

if($err=='no') return '<br>'; else return '(maksymalny rozmiar obrazka to 110px na 110px)';

}
} else {

if($err=='no') return '<br>'; else return '(niepoprawny format adresu)';

}
}
}

###############################################################################
###############################################################################
###############################################################################



function is_forum_auth() {

global $forum_c, $forum_a, $gnick, $id;

if(is_user_login()=='yes') {
$result_c = mysql_query("SELECT moderator FROM $forum_c, $forum_a WHERE $forum_a.id='$id' AND $forum_c.id = $forum_a.cat");
$r = mysql_fetch_object($result_c);

$nick_i = get_user_info();

return ( (in_array_multi($gnick, $r->moderator) == 'yes' || $nick_i[6] == 'yes')? 'yes': 'no');

}
}



###############################################################################
###############################################################################
###############################################################################

function is_forum_admin() {

 if(is_user_login()=='yes') {

  $a = get_user_info();
  if($a[6]=='yes') return 'yes';
  else return 'no';

 }
}


###############################################################################
###############################################################################
###############################################################################
function in_array_multi($mod, $tab) {

 $tab = explode(';',$tab);

       if (!is_array($tab)) return 'no';

       if (in_array($mod, $tab,TRUE)) return 'yes';
       else  return 'no';
}

function is_group_admin($id) {

global $forum_groups, $gnick;

 if(is_forum_admin()=='yes') {

$admin = m_query('group_admin',$forum_groups,"id = '$id'",'',0,'row');

if($gnick == $admin[0] OR $admin[0] == '') return 'yes';
 }
}
###############################################################################
###############################################################################
###############################################################################
function ban_list($typ,$gnick,$mail){

global $forum_ban, $REMOTE_ADDR;

$qui = "SELECT ip FROM $forum_ban WHERE ip = '$REMOTE_ADDR' ";
  $rei = mysql_query($qui);

if(mysql_num_rows($rei)=='0'){

if($mail=='') $co='user= \''.$gnick.'\'';
else $co='email=\''.$mail.'\'';

$qu = "SELECT ban FROM $forum_ban WHERE $co ";
  $re = mysql_query($qu);

if(mysql_num_rows($re)=='0'){

 return 'no';

}else{
$ban = mysql_fetch_row($re);

if($typ==''){

if($ban[0][0]=='0' AND $ban[0][4]=='0') return 'no';
else return 'yes';

}else{

if($ban[0][$typ]=='0') return 'no';
else return 'yes';

}
}
}else return 'yes';
}


function forum_access($category,$t){

global $forum_c, $forum_ban, $gnick, $forum_groups;


if(is_forum_admin()=='yes') return 'yes';

elseif(ban_list(0,$gnick,'')=='yes') return 'ban';


$qu = "SELECT what FROM $forum_c WHERE id='$category'";
  $re = mysql_query($qu);
  $r = mysql_fetch_array($re);

  $a_f=explode('-',$r['what']);

 $result = mysql_query("SELECT group_users FROM $forum_groups WHERE id = '$a_f[$t]'");

  $grupa = mysql_fetch_array($result);

if(is_user_login()=='yes' && in_array_multi($_SESSION['gnick'], $grupa[group_users])=='yes') return 'yes';

elseif($a_f[$t]=='0') return 'yes';

else return 'no';
}





###############################################################################
###############################################################################
###############################################################################


function shout_access(){

global $shout_box, $gnick;

if(is_forum_admin()=='yes') return 'yes';
elseif(ban_list(0,$gnick,'')=='yes') return 'no';
else{
$qu = "SELECT * FROM $shout_box ORDER by id DESC";
  $re = mysql_query($qu);
  $r = mysql_fetch_array($re);
  $acc = $r['what'];

if(is_user_login()=='yes' &&  $acc == '1'){
return 'yes';
}else{

if($acc=='0'){
return 'yes';
}else{
return 'no';

}

}
}
}

###############################################################################
###############################################################################
###############################################################################

function special_ranks($ranga){

global $forum_ranks;

         $re1 = mysql_query("SELECT plik,description FROM $forum_ranks Where ranks='$ranga'");

  return mysql_fetch_array($re1);
}

function user_ranks($ranga){

  global $forum_ranks;

    $d = mysql_query("SELECT plik,description FROM $forum_ranks WHERE $ranga BETWEEN ranks AND maks AND ranks != '-' AND ranks != '--' AND ranks != '~~'");

    return  mysql_fetch_array($d);
}



###############################################################################
###############################################################################
###############################################################################

function check_ip() {

global $REMOTE_ADDR, $ban_tbl, $site_name, $mailer;

  $qu = "SELECT * FROM $ban_tbl WHERE ip='$REMOTE_ADDR'";
  $re = mysql_query($qu);
  $nu = mysql_num_rows($re);
$r = mysql_fetch_object($re);
$ban_reason = $r->reason;
  if($nu>0 AND is_login()<>'yes') {

echo '<html>
<head>
<title>'.$site_name.' - brak dostępu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css"><!--

.text     { font-family: Verdana; font-size: 12px; text-align: justify; padding-top: 3px; padding-right: 5px; padding-bottom: 3px; padding-left: 5px; color: #363636; font-weight: normal}

--></style>
</head>
<body><br>
<br>
<table align="center" width="500" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="text"><b>Brak dostępu!</b></td>
</tr>
<tr>
<td bgcolor="#000000"><img src="images/separ.gif" height="1"></td>
</tr>
<tr>
<td class="text">
<br>
Dostęp dla IP tego komputera ('.$REMOTE_ADDR.') jest zablokowany! Jeżeli ten komputer jest ogólnie
dostępny (kafejka internetowa, biblioteka, szkoła, ¶wietlica itp.) poinformuj o tym administratora
strony pisz±c na <i><a href="mailto:'.$mailer['admin'].'">ten</a></i> adres.
<br>
<br>
</td>
</tr>
<tr>
<td bgcolor="#000000"><img src="images/separ.gif" height="1"></td>
</tr>
<tr>
<td class="text">
<br>
<b>Przyczyna:</b> ';
if ($ban_reason<>'') { echo $ban_reason; } else { echo 'Brak powodu'; }
echo'
<br>
<br>
</td>
</tr>
</table>
</body>
</html>';
exit;

 }
}


function odetnij($co, $ile) {

$i = strlen($co);
$co = substr($co, 0, $ile);
$co = str_replace(' ', '&nbsp;', $co);
return $co;

}

function getimagesize_remote($image_url) {

$gis = @getimagesize($image_url);
if($gis[0]!='') return $gis;
  else
  $handle = @fopen ($image_url, "rb");
   $contents = "";
   if ($handle) {
   do {
       $count += 1;
      $data = fread($handle, 8192);
       if (strlen($data) == 0) {
           break;
       }
   $contents .= $data;
   } while(true);
   } else {
       $gis[0]='brak';
       return $gis;
    }
   fclose ($handle);

   $im =@ ImageCreateFromString($contents);
   if (!$im) {
    $gis[0]='brak';
       return $gis;;
     }
   $gis[0] = ImageSX($im);
   $gis[1] = ImageSY($im);
   $gis[3] = "width={$gis[0]} height={$gis[1]}";

   ImageDestroy($im);
   return $gis;
}

function date_diff($date_from,$date_to)
/*
Calculates difference in days from date_from to date_to, taking into account leap years
if date_from > date_to, the number of days is returned negative
date_from and date_to format is: "dd-mm-yyyy"
It can calculate ANY date difference, for example between 21-4-345 and 11-11-3412
This is possible by mapping any date to the "range 0" dates, as this table shows:

INI END RANGE LEAP YEARS
... ... ... ...
01/01/1920 01/01/1939 -3 5
01/01/1940 01/01/1959 -2 5
01/01/1960 01/01/1979 -1 5
01/01/1980 01/01/1999 0 5 * this is the range used for calculations with mktime
01/01/2000 01/01/2019 1 5
01/01/2020 01/01/2039 2 5
01/01/2040 01/01/2059 3 5
01/01/2060 01/01/2079 4 5
... ... ... ...
*/

{
$date_from_parts = explode('-', $date_from);
$date_to_parts = explode('-', $date_to);
$day_from = $date_from_parts[0];
$mon_from = $date_from_parts[1];
$year_from = $date_from_parts[2];
$day_to = $date_to_parts[0];
$mon_to = $date_to_parts[1];
$year_to = $date_to_parts[2];

//if date_from is newer than date to, invert dates
$sign=1;
if ($year_from>$year_to) $sign=-1;
else if ($year_from==$year_to)
{
if ($mon_from>$mon_to) $sign=-1;
else if ($mon_from==$mon_to)
if ($day_from>$day_to) $sign=-1;
}

if ($sign==-1) {//invert dates
$day_from = $date_to_parts[0];
$mon_from = $date_to_parts[1];
$year_from = $date_to_parts[2];
$day_to = $date_from_parts[0];
$mon_to = $date_from_parts[1];
$year_to = $date_from_parts[2];
}

$yearfrom1=$year_from; //actual years
$yearto1=$year_to; //(yearfrom2 and yearto2 are used to calculate inside the range "0")

//checks ini date
if ($yearfrom1<1980)
{//year is under range 0
$deltafrom=floor((1999-$yearfrom1)/20)*20; //delta t1
$yearfrom2=$yearfrom1+$deltafrom; //year used for calculations
}
else if($yearfrom1>1999)
{//year is over range 0
$deltafrom=floor(($yearfrom1-1980)/20)*20; //delta t1
$yearfrom2=$yearfrom1-$deltafrom; //year used for calculations
}
else
{//year is in range 0
$deltafrom=0;
$yearfrom2=$yearfrom1;
}

//checks end date
if ($yearto1<1980)
{//year is under range 0
$deltato=floor((1999-$yearto1)/20)*20; //delta t2
$yearto2=$yearto1+$deltato; //year used for calculations
}
else if($yearto1>1999)
{//year is over range 0
$deltato=floor(($yearto1-1980)/20)*20; //delta t2
$yearto2=$yearto1-$deltato; //year used for calculations
}
else
{//year is in range 0
$deltato=0;
$yearto2=$yearto1;
}

//Calculates the UNIX Timestamp for both dates (inside range 0)
$ts_from = mktime(0, 0, 0, $mon_from, $day_from, $yearfrom2);
$ts_to = mktime(0, 0, 0, $mon_to, $day_to, $yearto2);
$diff = ($ts_to-$ts_from)/86400;
//adjust ranges
$diff += 7305 * (($deltafrom+$deltato) / 20);
return $sign*$diff;
}
function month_name_login($m){
 $month= array("Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpien","Wrzesień","Pa&#188;dziernik","Listopad","Grudzień");
  $name = $month[$m - 1];
  return "$name";
}

$head_info .= '
<SCRIPT LANGUAGE="JavaScript">
function selecturl(s) {
var gourl = s.options[s.selectedIndex].value;        window.top.location.href = gourl;
}
</SCRIPT>
';

function rekord_ludzi(){

$ileludzi=$GLOBALS['members']+$GLOBALS['guests'];
$r=mysql_fetch_array(mysql_query("SELECT * FROM rekord_ludzi WHERE id='1'"));
$ilosc=$r['ilosc'];
$data=$r['data'];
if($ilosc<$ileludzi){
mysql_query("UPDATE rekord_ludzi SET data=now(), ilosc='$ileludzi' WHERE id='1'");
echo mysql_error();
echo'<br><br>Własnie padł nowy rekord w ilosci osób na stronie jest nas teraz : <b>'.$ileludzi.'</b>';
}else{
echo'<br>Najwięcej osób : <b>'.$ilosc.'</b><br>Było dnia : <b>'.$data.'</b>';
}
}

function onl_usr() {
global $REMOTE_ADDR, $REQUEST_URI, $guest_tbl, $gnick;

$req = $REQUEST_URI;
$cadena = explode("?", $req);
$mi_url = $cadena[0];
$resto = $cadena[1];
$warianty='/script|http|<|>|%3c|%3e|SELECT|UNION|UPDATE|AND|INSERT|tmp/i';
$gnick2 = '<a href=user.php?cmd=info&id='.$gnick.'>'.$gnick.'</a>';
 $req = explode('&',$req);
 $d = $req[2];
 $m = $req[1];
 $r = $req[0];
 
if (preg_match($warianty, $resto)) {
echo 'Zly adres... Przyczyna: Najprawdopodobniej próba włamu na strone';
die();
}

  if(is_user_login()=='yes'){
  $ip2 = $gnick2;
  } else {
  $ip2 = $REMOTE_ADDR;
  }

$limit = 60;
$t_time = time();
$time = $t_time - $limit;

$result_site = mysql_query("SELECT DISTINCT ip FROM onl WHERE url='$r'");


if($servis == 1) {
echo '<b>Serwis:</b><br>Tylko Ty znajdujesz sie online w serwisie.<br>';
} else {
echo '<b>Serwis:</b><br>'.$servis.' użytkowników.<br>';
}

if($site == 1) {
echo '<b>Podstrona:</b><br>Tylko Ty przegladasz t± podstrone.<br>';
} else {
echo '<b>Podstrona:</b><br>'.$site.' użytkowników.<br>';
}


}

function hacking_alert () {
global $REMOTE_ADDR, $prefix, $REQUEST_URI;

$result = mysql_query("INSERT INTO {$prefix}hack_alert VALUES(NULL, '$REMOTE_ADDR', now(), '$REQUEST_URI')");
$query = mysql_query("INSERT INTO {$prefix}ban VALUES(NULL, '$REMOTE_ADDR', now(), 'Próba włamania na strone przy pomocy SQL Injection.')");

echo '<p align="center"><h1>Próbowałeś użyć niewłaściwego odwołania</h1><br>
<h3>Może to być skutek niepoprawnego odwołania.
Jeżeli jednak zrobiłeś to świadomie, musisz liczyć się konsekwencjami prawnymi.
Twoja próba została zarejestrowana.</h3><br>
<h4><a href="http://bap-psp.lex.pl/serwis/kodeksy/akty/97.88.553.htm">Kodeks Karny, Rozdział XXXIII Przestępstwa przeciwko ochronie informacji</a></h4></p>';

echo $REMOTE_ADDR;
exit;
}
function spam_cenzor($text) {
$restricted = array (
"www",
"http",
"great",
"site",
"visit",
"money",
"woman",
"women",
"that",
"seite",
"liebe",
"buenos",
"uns",
"professional",
"credit",
"drugs",
"collection",
"medicine",
"browse",
"large",
"lowest",
"price",
"accept",
"payment",
"worldwide",
"girl",
"keep",
"wanted",
"Thank",
"our",
"Hello",
"guys"
);

for ( $x=0; $x<count($restricted); $x++ ){
if (eregi($restricted[$x], $text)) $c = 1;
}
return $c;
}


function spam_cenzor_sb($text) {
$restricted = array (
"wiadomosć",
"www",
"http",
"great",
"site",
"visit",
"money",
"woman",
"women",
"that",
"seite",
"liebe",
"buenos",
"uns",
"professional",
"credit",
"drugs",
"collection",
"medicine",
"browse",
"large",
"lowest",
"price",
"accept",
"payment",
"worldwide",
"girl",
"keep",
"wanted",
"Thank",
"our",
"Hello",
"guys"
);

for ( $x=0; $x<count($restricted); $x++ ){
if (eregi($restricted[$x], $text)) $c = 1;
}
return $c;
}

?>
0

Wybacz, ale nie chce mi sie tego czytac. Przeczytaj jeszcze raz to co napisalem i zastanow sie jak to mozliwe, ze wykorzystujesz cala pule 10 mln zwroconych wierszy. Ew. powycinaj z tego kodu powyzej zapytania, przegladnij je i zobacz ile wierszy kazdy z nich zwraca. W tym wypadku podejrzewam zapytanie w stylu 'pobierz wszystko' a w php wybierasz sobie 10 pierwszych wierszy.

0
johny_bravo napisał(a)

Wybacz, ale nie chce mi sie tego czytac. Przeczytaj jeszcze raz to co napisalem i zastanow sie jak to mozliwe, ze wykorzystujesz cala pule 10 mln zwroconych wierszy. Ew. powycinaj z tego kodu powyzej zapytania, przegladnij je i zobacz ile wierszy kazdy z nich zwraca. W tym wypadku podejrzewam zapytanie w stylu 'pobierz wszystko' a w php wybierasz sobie 10 pierwszych wierszy.

a w ktorym to miejscu sa te zapytania bo nie mam pojecia

0

To raczej nie tyczy się jednorazowego pobrania danych a ogólnie. Pewnie co miesiąc restartują statystyki - taki hosting, który limituje mysqla.

0

hosting mam na nazwa.pl
Przyslali mi ze jest za duzo zapytań

0
disco-polo napisał(a)

hosting mam na nazwa.pl
Przyslali mi ze jest za duzo zapytań

No i? Juz wczesniej napisano Ci co powinienes zrobic i czego poszukac.

1 użytkowników online, w tym zalogowanych: 0, gości: 1