ilch Forum » Allgemein » HTML, PHP, SQL,... » Was ist Falsch ?

Geschlossen
  1. #1
    User Pic
    Oldemuche Mitglied
    Registriert seit
    11.04.2006
    Beiträge
    1.027
    Beitragswertungen
    44 Beitragspunkte
    Hallo,
    habe mal was versucht aber naja ich bekomm es einfach nicht hin, darum wollte ich euch mal fragen ob ihr den Fehler in der Datei findet. Bitte helft mir.

    <?php
    #   Copyright by: Manuel
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    
    
    $title = $allgAr['title'].' :: friends';
    $hmenu = 'Friends';
    $design = new design ( $title , $hmenu );
    
    
    
    function friends_find_kat ($kat) {
        
                    $katpfad = 'include/images/friends/';
                    $katjpg = $katpfad.$kat.'.jpg';
                    $katgif = $katpfad.$kat.'.gif';
                    $katpng = $katpfad.$kat.'.png';
                    
                    if ( file_exists( $katjpg ) ) {
                      $pfadzumBild = $katjpg;
                    } elseif ( file_exists ( $katgif ) ) {
                      $pfadzumBild = $katgif;
                    } elseif ( file_exists ( $katpng ) ) {
                      $pfadzumBild = $katpng;
                    }
                    
                    if ( !empty( $pfadzumBild ) ) {
                            $kategorie = '<img style="" src="'.$pfadzumBild.'" alt="'.$kat.'">';
                    } else {
                      $kategorie = '<b>'.$kat.'</b><br /><br />';
                    }
                    
                    return ( $kategorie );
    }
    
    
    
    if ( !is_numeric($menu->get(1)) )  {
      if($menu->get(1) == 'rss' || $menu->get(1) == 'atom')
      {
          #ob_clean();
          $feed_type = $menu->get(1);
    
        $abf = "SELECT MAX(friends_time) AS last_update FROM prefix_friends";
        $erg = db_query($abf);
        $row = db_fetch_assoc($erg);
        $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
    
        $abf = "SELECT
          a.friends_title as title,
          a.friends_id as id,";
        $abf .= ($feed_type == 'atom') ? 'a.friends_time as datum,' : "DATE_FORMAT(a.friends_time,'%a, %e %b %y %H:%i:%s') as datum,";
        $abf .=  
         "a.friends_kat as kate,
          a.friends_text as text,
        a.friends_name as name,
        a.friends_alter as alter,
        a.friends_stand as stand,
        a.friends_wohnort as wohnort,
        a.friends_icq as icq,
          b.name as username
        FROM prefix_friends as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE a.friends_recht = 0
        ORDER BY friends_time ASC LIMIT 15";
        $erg = db_query($abf);
        $tpl = new tpl( 'friends_'.$menu->get(1).'.htm' );
    
        header('Content-type: application/' . $menu->get(1)  . '+xml');
    
        $tpl->set_ar_out(array('FEEDTITLE' => $allgAr['title'],
                               'UPDATED' => $last_update), 0);
        while ($row = db_fetch_assoc($erg))
        {
          if($feed_type == 'atom')
          {
              $row['datum'] = str_replace(' ', 'T', $row['datum']) . 'Z';
          }
          
          $a = explode('[PREVIEWENDE]', $row['text']);
          $tpl->set_ar_out(array('TITLE' => $row['title'],
                                 'TXT' => bbcode($a[0]),
                                 'AUTHOR' => $row['username'],
                                 'DATE' => $row['datum'],
                                 'NAME'  => $row-> friends_name,
                                 'ALTER'  => $row-> friends_alter,
                                 'STAND'  => $row-> friends_stand,
                                 'WOHNORT'  => $row-> friends_wohnort,
                                 'ICQ'  => $row-> friends_icq
                                 ), 1);
        }
        $tpl->out(2);
        exit;
      }
      else
      {
        $design->header();
        $limit = $allgAr['Nlimit'];
        $page = ( $menu->getA(1) == 'p' ? $menu->getE(1) : 1 );
        $MPL = db_make_sites ($page , "WHERE friends_recht >= ".$_SESSION['authright'] , $limit , '?friends' , 'friends' );
        $anfang = ($page - 1) * $limit;
        
        $tpl = new tpl ( 'friends.htm' );
    
        $abf = "SELECT
          a.friends_title as title,
          a.friends_id as id,
          DATE_FORMAT(a.friends_time,'%d. %m. %Y') as datum,
          DATE_FORMAT(a.friends_time,'%W') as dayofweek,
          a.friends_kat as kate,
          a.friends_text as text,
        a.friends_name as name,
        a.friends_alter as alter,
        a.friends_stand as stand,
        a.friends_wohnort as wohnort,
        a.friends_icq as icq,
          b.name as username
        FROM prefix_friends as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE ".$_SESSION['authright']." <= a.friends_recht
           OR a.friends_recht = 0
        ORDER BY friends_time DESC
        LIMIT ".$anfang.",".$limit;
        #echo '<pre>'.$abf.'</pre>';
        
        $erg = db_query($abf);
        echo mysql_error();
        while ($row = db_fetch_assoc($erg)) {
          
          $k0m  = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'friends'");
          $row['kom']  = db_result($k0m,0);
    
          $row['kate'] = friends_find_kat($row['kate']);
          $row['datum'] = $lang[$row['dayofweek']].' '.$row['datum'];
          if ( strpos ( $row['text'] , '[PREVIEWENDE]' ) !== FALSE ) {
            $a = explode('[PREVIEWENDE]' , $row['text']);
            $row['text'] = $a[0];
          }
          $row['text'] = bbcode($row['text']);
          $tpl->set_ar_out($row,0);
        }
        $tpl->set_out('SITELINK', $MPL,1);
        unset($tpl);
      }
    
      
      
    } else {
     
     $design->header();
     $nid = escape($menu->get(1), 'integer');
     $row = db_fetch_object(db_query("SELECT * FROM `prefix_friends` WHERE friends_id = '".$nid."'"));
    
      if ( has_right(array($row->friends_recht)) ) {
        $komsOK = true;
              if ( $allgAr['Ngkoms'] == 0 ) {
          if ( loggedin() ) {
            $komsOK = true;
                    } else {
                      $komsOK = false;
                      }
        }
              if ( $allgAr['Nukoms'] == 0 ) {
                $komsOK = false;
              }
    
        # kommentar add
            if ( (loggedin() OR chk_antispam ('friendskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt']) ) {
          $_POST['txt'] = escape($_POST['txt'],'string');
                      $_POST['name'] = escape($_POST['name'],'string');
          db_query("INSERT INTO `prefix_koms` VALUES ('',".$nid.",'friends','".$_POST['name']."','".$_POST['txt']."')");
              }
              # kommentar add
                    
        # kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(-7, 'friends')) {
          $kommentar_id = escape($menu->getE(2),'integer');
          db_query("DELETE FROM prefix_koms WHERE uid = ".$nid." AND cat = 'friends' AND id = ".$kommentar_id);
        }
        # kommentar loeschen
        $kategorie = friends_find_kat($row->friends_kat);
                    
                    $textToShow = bbcode($row->friends_text);
                    $textToShow = str_replace('[PREVIEWENDE]','',$textToShow);
                    if ( !empty($such) ) {
                      $textToShow = markword($textToShow,$such);
                    }
    
                    $tpl = new tpl ( 'friends.htm' );
                    $ar = array (
          'TEXT'  => $textToShow,
                            'KATE'  => $kategorie,
          'NID' => $nid,
          'uname' => $_SESSION['authname'],
                            'ANTISPAM' => (loggedin()?'':get_antispam ('friendskom', 0)),
                            'NAME'  => $row->friends_title,
                                 'NAME'  => $row-> friends_name,
                                 'ALTER'  => $row-> friends_alter,
                                 'STAND'  => $row-> friends_stand,
                                 'WOHNORT'  => $row-> friends_wohnort,
                                 'ICQ'  => $row-> friends_icq
                    );
                    $tpl->set_ar_out($ar, 2 );
    
                    if ($komsOK) {
                      $tpl->set_ar_out ( array ( 'NAME' => $row->friends_title , 'NID' => $nid ), 3 );
                    }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = ".$nid." AND cat = 'friends' ORDER BY id DESC");
                    $ergAnz1 = db_num_rows($erg1);
                    if ( $ergAnz1 == 0 ) {
                      echo '<b>'.$lang['nocomments'].'</b>';
                    } else {
                      $zahl = $ergAnz1;
                      while ($row1 = db_fetch_assoc($erg1)) {
            $row1['text'] = bbcode(trim($row1['text']));
            if (has_right(-7, 'friends')) {
              $row1['text'] .= '<a href="?friends-'.$nid.'-d'.$row1['id'].'"><img src="include/images/icons/del.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
            }
            $tpl->set_ar_out( array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl ) , 4 );
            $zahl--;
                      }
        }
            }
      $tpl->out(5);
    }
    
    $design->footer();
    
    ?>


    Danke im Voraus !

    mfg oLde
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    SLJ Hall Of Fame
    Registriert seit
    18.05.2004
    Beiträge
    15.492
    Beitragswertungen
    3 Beitragspunkte
    Wo hast du ca. was geändert oder was geht nicht kommt ne fehler meldung. ?
    externer Link
    Ilch 1.0.4 PHP 7.0 und PDO Fähig na klar lächeln
    0 Mitglieder finden den Beitrag gut.
  3. #3
    User Pic
    Oldemuche Mitglied
    Registriert seit
    11.04.2006
    Beiträge
    1.027
    Beitragswertungen
    44 Beitragspunkte
    Jop das kommt

     	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alter, a.friends_stand as stand, a.friends_wohnort as wo
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/web1/html/include/includes/func/db/mysql.php on line 48
    0 Mitglieder finden den Beitrag gut.
  4. #4
    User Pic
    Oldemuche Mitglied
    Registriert seit
    11.04.2006
    Beiträge
    1.027
    Beitragswertungen
    44 Beitragspunkte
    Kann mir keiner Helfen ?
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu HTML, PHP, SQL,...

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten