Unable to jump to row 0

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to jump to row 0

    PHP Code:
    $currD=date("d"time());
    $currm=date("m"time());

    $k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `ank_d_r` = '$currD' and `ank_m_r` = '$currm'",$db), 0);
    $k_bday=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `ank_d_r` = '$currD' and `ank_m_r` = '$currm' LIMIT 1 "),0);
    $bday=mysql_result(mysql_query("SELECT `id` FROM `user` WHERE `ank_d_r` = '$currD' and `ank_m_r` = '$currm' LIMIT 1 "),0);

    $sisa=$k_post-1;

    echo 
    '<div class="p_t2">';


    if(
    $k_post==0){
    echo 
    "";
    }


    if(
    $k_post==1){
    echo 
    "<table class='notif' width='100%'><tr><td width='2%'><img src='/style/icons/ultah.png'> <a href='/info.php?id=$bday'>$k_bday</a> sarbatoreste azi ziua de nastere</td></tr></table>";
    }
    if(
    $k_post>=2){
    echo 
    "<table class='notif' width='100%'><tr><td width='2%'><img src='/style/icons/ultah.png'> <a href='/info.php?id=$bday'>$k_bday</a> si <a href='/list_bday.php?SESS=$sess'> inca $sisa </a> sarbatoresc azi data nasterii </td></tr></table>";


    i received 2 errors in lines:

    PHP Code:
    $k_bday=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `ank_d_r` = '$currD' and `ank_m_r` = '$currm' LIMIT 1 "),0);
    $bday=mysql_result(mysql_query("SELECT `id` FROM `user` WHERE `ank_d_r` = '$currD' and `ank_m_r` = '$currm' LIMIT 1 "),0); 
    what is wrong in this code?

    #2
    PHP Code:
    $k_post=mysql_fetch_row(mysql_query("SELECT COUNT(*)FROM`user`WHERE`ank_d_r`='$currD'&&`ank_m_r`='$currm'",$db));
    $k_post=$k_post[0];
    $k_bday=mysql_fetch_row(mysql_query("SELECT`nick`FROM`user`WHERE`ank_d_r`='$currD'&&`ank_m_r`='$currm' LIMIT 1"));
    $k_bday=$k_bday[0];
    $bday=mysql_fetch_row(mysql_query("SELECT`id`FROM`user`WHERE`ank_d_r`='$currD'&&`ank_m_r`='$currm' LIMIT 1"));
    $bday=$bday[0]; 
    i put like this and it work. Sorry for the topic. You cand delete or close.

    Comment


      #3
      A "like" for finding out the answer yourself

      Comment


        #4
        thanks :D but now i have another problem . Not an error , but i don't like how the code works:
        PHP Code:
        $q1=mysql_query("SELECT * FROM `banned_word`");
        while (
        $spam mysql_fetch_assoc($q1))
        {
        $str=str_replace($spam['text'],$spam['word'],$str);

        I want to make a spam detection, i put in db a word like : mama and should appear m*m* . Untill now is perfect, but when i write mamamia appera m*m*mia. How to change the code to appear the word mamamia corect? without spam filter.

        Comment


          #5
          So why not put it in your spam block as "mama " (with space at end)

          Comment


            #6
            if i put with space end the word mama appear mama :P without censure

            Comment


              #7
              PHP Code:
              $str=str_replace($spam['text'].' ',$spam['word'],$str); 
              Advertise your mobile site for FREE with AdTwirl

              Comment


                #8
                Originally posted by GumSlone View Post
                PHP Code:
                $str=str_replace($spam['text'].' ',$spam['word'],$str); 
                I would go for:
                PHP Code:
                $str=str_replace($spam['text'],$spam['word'],$str.' '); 
                to avoid breaking any existing string replacements

                Comment


                  #9
                  Originally posted by GumSlone View Post
                  PHP Code:
                  $str=str_replace($spam['text'].' ',$spam['word'],$str); 
                  if i put this code the word's appears without cenzure, and the other code appear the same: mama = m*m*

                  PHP Code:
                  <?
                  // 
                  // 
                  function output_text($str,$br=1,$html=1,$smiles=1,$links=1,$bbcode=1)
                  {
                      global $theme_ini;
                      
                  $q1=mysql_query("SELECT * FROM `spam`");
                  while ($spam = mysql_fetch_assoc($q1))
                  {
                  $str=str_ireplace($spam['text'],$spam['sait'],$str);

                  }




                      //if ($br && isset($theme_ini['text_width']))$str=wordwrap($str, $theme_ini['text_width'], ' ',1);

                      if ($html)$str=htmlentities($str, ENT_QUOTES, 'UTF-8'); // 

                      if ($links)$str=links($str); //

                      if ($smiles)

                          $str=smiles($str); // 

                      if ($bbcode)
                      {
                          $tmp_str=$str;
                          $str=bbcode($str); // 
                      }

                      if ($br)
                      {
                          $str=br($str); // 
                      }

                      return stripslashes($str); // 
                  }


                  // 

                  function input_value_text($str){return output_text($str,0,1,0,0,0);}

                  function rez_text( $text, $maxwords = 15, $maxchar = 100 ){
                      $sep=' ';

                      $sep2=' &raquo;';

                      $words = explode($sep,$text);

                      $char = iconv_strlen($text,'utf-8');

                      if (count($words) > $maxwords){        $text = join($sep, array_slice($words, 0, $maxwords));
                      }

                      if ( $char > $maxchar ){
                          $text = iconv_substr( $text, 0, $maxchar, 'utf-8' );

                      }

                      return $text.$sep2;
                  }

                  function rez_text2( $text, $maxwords = 70, $maxchar = 700 )
                  {
                  $sep=' ';

                  $sep2='';

                  $words = explode($sep,$text);

                  $char = iconv_strlen($text,'utf-8');

                  if (count($words) > $maxwords){
                  $text = join($sep, array_slice($words, 0, $maxwords));

                  }

                  if ( $char > $maxchar ){
                  $text = iconv_substr( $text, 0, $maxchar, 'utf-8' );

                  }

                  return $text.$sep2;

                  }

                  function rez_text3( $text, $maxwords = 150, $maxchar = 1500 ){
                  $sep=' ';

                  $sep2='';

                  $words = explode($sep,$text);

                  $char = iconv_strlen($text,'utf-8');

                  if (count($words) > $maxwords){
                  $text = join($sep, array_slice($words, 0, $maxwords));

                  }

                  if ( $char > $maxchar ){
                  $text = iconv_substr( $text, 0, $maxchar, 'utf-8' );

                  }

                  return $text.$sep2;
                  }
                  ?>
                  this is my output text php file

                  Comment


                    #10
                    Originally posted by something else View Post
                    So why not put it in your spam block as "mama " (with space at end)
                    Originally posted by something else View Post
                    I would go for:
                    PHP Code:
                    $str=str_replace($spam['text'],$spam['word'],$str.' '); 
                    to avoid breaking any existing string replacements
                    These 2 work together correctly - if they are not working for you, then you need to delete the original "mama"

                    Comment


                      #11
                      i deleted, i try with space at the end, et the beggining. The same, when i write mamamia appear m*m*mia

                      Comment


                        #12
                        Originally posted by tzapone View Post
                        i deleted, i try with space at the end, et the beggining. The same, when i write mamamia appear m*m*mia
                        you could try using preg_replace instead. using the \b modifier and the i modifier. you can match just the words your looking for exactly. and also upper and lower case char.

                        something like:

                        PHP Code:
                        $str preg_replace(trim('/\b'.$spam['text'].'\b/i'), trim($spam['word']), $str); 
                        which should then match mama. Mama. MaMa etc.
                        but not match mamamia
                        <?php
                        include ('Ghost');
                        if ($Post == true) {
                        echo '

                        sigpic
                        alt='coding-talk.com!!' />';
                        echo 'Sharing Is Caring!';
                        } else {
                        echo '

                        alt='the username GHOST has been comprimised!' />';
                        echo 'OMG SOMEBODY HELP ME!!';
                        }
                        ?>

                        Comment


                          #13
                          Originally posted by Ghost View Post
                          you could try using preg_replace instead. using the \b modifier and the i modifier. you can match just the words your looking for exactly. and also upper and lower case char.

                          something like:

                          PHP Code:
                          $str preg_replace(trim('/\b'.$spam['text'].'\b/i'), trim($spam['word']), $str); 
                          which should then match mama. Mama. MaMa etc.
                          but not match mamamia
                          yes is very good :D but need one more update. If i put wink for example like spam word , and i write .wink. ( to show smiley ) appear .wi*k. If you can fix that is a perfect code.

                          Comment


                            #14
                            Originally posted by tzapone View Post
                            i deleted, i try with space at the end, et the beggining. The same, when i write mamamia appear m*m*mia
                            exactly you put a space at the start which matched " mama"mia - where as just at the end would have matched lol

                            Comment


                              #15
                              thank you all for help

                              One more important question i have for you guy. I put on my site VIPMEMBERS activated by time ( 1 day, 2 days etc... ) . Everything is good, but if a member activated for example the option color text, this option will remain after the vip period expires and i don't want that. I try something like this:
                              PHP Code:
                              $membruvip mysql_result(mysql_query("SELECT COUNT(*) FROM `vipuri` WHERE `id_utilizator` = '$user[id]' AND `time` > '$time'"), 0);
                              if (
                              $membruvip==0)
                              {
                              echo 
                              " ".output_text($statuse['msg'])." ";
                              }else{
                              echo 
                              "<span style=\"color:$profil[culoaretext]\">";
                              echo 
                              " ".output_text($statuse['msg'])." ";
                              echo 
                              "</span>\n";

                              but not work very well. If you are not a vip member you can't see any color and if you are a vip member you can see all the color ( even if the user cu vip expires post a message).
                              this is the page where you can activate vip member. Maybe you may know how after the vip expires the color text , and color nick set to mod default.
                              PHP Code:
                              <?
                              include_once '../../sys/inc/start.php';
                              include_once '../../sys/inc/compress.php';
                              include_once '../../sys/inc/sess.php';
                              include_once '../../sys/inc/home.php';
                              include_once '../../sys/inc/settings.php';
                              include_once '../../sys/inc/db_connect.php';
                              include_once '../../sys/inc/ipua.php';
                              include_once '../../sys/inc/fnc.php';
                              include_once '../../sys/inc/adm_check.php';
                              include_once '../../sys/inc/user.php';

                              $set['title'] = 'Membri vip';
                              include_once '../../sys/inc/thead.php';
                              title();

                              if (!isset($user))
                              header("location: /index.php?");

                              err();
                              aut();

                              if (isset($user))
                              {
                              if (isset($_POST['stav']) && isset($_POST['msg']))
                              {
                              if ($_POST['stav']==1)
                              {
                                  $st=1;
                                  $tm=$time+86400;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==2)
                              {
                                  $st=2;
                                  $tm=$time+172800;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==3)
                              {
                                  $st=3;
                                  $tm=$time+259200;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==4)
                              {
                                  $st=4;
                                  $tm=$time+345600;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==5)
                              {
                                  $st=5;
                                  $tm=$time+432000;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==6)
                              {
                                  $st=6;
                                  $tm=$time+518400;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==7)
                              {
                                  $st=7;
                                  $tm=$time+604800;
                                  $vipstatut=1;
                              }


                              else if ($_POST['stav']==8)
                              {
                                  $st=30;
                                  $tm=$time+2592000;
                                  $vipstatut=1;
                              }
                              else if ($_POST['stav']==9)
                              {
                                  $st=365;
                                  $tm=$time+31536000;
                                  $vipstatut=1;
                              }
                              $msg=my_esc($_POST['msg']);

                              if ($user['money']>=$st)
                              {
                              if (mysql_result(mysql_query("SELECT COUNT(*) FROM `liders` WHERE `id_user` = '$user[id]'"), 0)==0)
                              {
                                  //mysql_query("INSERT INTO `liders` (`id_user`, `stav`, `msg`, `time`, `time_p`) values('$user[id]', '$st', '".$msg."', '$tm', '$time')");
                                  mysql_query("INSERT INTO `liders` (`id_user`, `stav`, `msg`, `time`, `time_p`, `vipstatut`) values('$user[id]', '$st', '".$msg."', '$tm', '$time', '$vipstatut')");
                                  
                              }
                              else
                              {
                                  //mysql_query("UPDATE `liders` SET `time` = '$tm', `time_p` = '$time', `msg` = '$msg', `stav` = '$st' WHERE `id_user` = '$user[id]'");
                                  
                                  mysql_query("UPDATE `liders` SET `time` = '$tm', `time_p` = '$time', `msg` = '$msg', `stav` = '$st', `vipstatut` = '$vipstatut' WHERE `id_user` = '$user[id]'");
                              }

                              mysql_query("UPDATE `user` SET `money` = '".($user['money']-$st)."' WHERE `id` = '$user[id]' LIMIT 1");

                              $_SESSION['message'] = 'Ai devenit cu succes membru vip!!';
                              header("Location: /user/liders/index.php?ok");
                              exit;

                              }else{
                              $err='Nu ai suficiente monede pentru a deveni membru vip';
                              }
                              }else{
                              $err='Statusul nu poate fi gol';
                              }
                              err();

                              echo '<div class="foot">';
                              echo '<img src="/style/icons/str2.gif" alt="S"/> <a href="/user/money/">Servicii extra</a> | <b>Membru vip</b>';
                              echo '</div>';

                              echo '<div class="mess">';
                              echo 'Pentru a ajunge membru vip trebuie sa ai in cont cel putin <b style="color:red;">1</b> <b style="color:green;"> diamant </b>. Acest serviciu este 
                              calculat pe zi, zi in care ne vom asigura ca vei in TOP. Pozitia ta in TOP depinde de numarul de diamante (timpul total de inchiriere)! 
                              In plus, profilul tau va putea fi vizibil prin rotatie in sectiunea Dating si Conectati!';
                              echo '</div>';

                              echo '<form class="main" method="post" action="?">';
                                  echo '<span style="color: red">Vreau sa fiu vip timp de:</span> <select name="stav">
                                  <option value="1">1</option>
                                  <option value="2">2</option>
                                  <option value="3">3</option>
                                  <option value="4">4</option>
                                  <option value="5">5</option>
                                  <option value="6">6</option>
                                  <option value="7">7</option>
                                  <option value="8">30</option>
                                  <option value="9">365</option>
                                  </select> zile<br />';
                                  
                              echo 'Status membru vip (100 caractere)<textarea name="msg"></textarea><br />';

                              echo '<input value="Fa-ma vip" type="submit" />';
                              echo '</form>';
                              }


                              echo '<div class="foot">';
                              echo '<img src="/style/icons/str2.gif" alt="S"/> <a href="/user/money/">Servicii extra</a> | <b>Membru vip</b>';
                              echo '</div>';


                              include_once '../../sys/inc/tfoot.php';
                              ?>
                              Added after 6 minutes:

                              I think with something like this can be done:

                              PHP Code:
                              mysql_query("UPDATE `user` SET `color` = '"default"' WHERE `id` = '$user[id]' LIMIT 1"); 
                              but i don' know where to put it in this file

                              Added after 42 minutes:

                              problem solved with:
                              PHP Code:
                              $membruvip mysql_result(mysql_query("SELECT COUNT(*) FROM `liders` WHERE `id_user` = '$user[id]' AND `time` > '$time'"), 0);
                              if (
                              $membruvip==0)
                              {
                              mysql_query("UPDATE `user` SET `mcolor` = '#000000' WHERE `id` = '$user[id]' LIMIT 1");
                              mysql_query("UPDATE `user` SET `ncolor` = '#3251FF' WHERE `id` = '$user[id]' LIMIT 1");
                              mysql_query("UPDATE `user` SET `ncolor2` = '#3251FF' WHERE `id` = '$user[id]' LIMIT 1");

                              in a file that is included in all the site. Somethimes i am so stupid sorry for all my stupid posts.
                              Last edited by tzapone; 19.12.13, 11:44.

                              Comment

                              Working...
                              X