Hallo @all
ich habe da ein Problem mit der Freude liste
das geht nicht so wie ich das gerne hätte kann sich das mal jemand an schauen
das ist mir sehr Wichtig
<?php
defined('main') or die('no direct access');
$title = $allgAr['title'].' :: Freunde';
$hmenu = 'Freunde';
$design = new design ( $title , $hmenu );
$design->header();
$gb = ($allgAr['forum_usergb']);
$gallery = ($allgAr['forum_usergallery']);
$pm = ($allgAr['Fpmf']);
if (loggedin()) {
//Eintragen
if (isset($_POST['sub'])) {
$name = escape($_POST['name'],'string');
$fid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"),0);
$msg = 'Fehler beim Eintragen aufgetreten.<br />';
$user = @db_result(db_query('SELECT name FROM prefix_user WHERE id='.$_SESSION['authid']),0);
$bet = "Erlaubnisanfrage!";
$txt = "Hallo ".$name.", der User ".$user." wartet auf ihre Freischaltung.
Hier können sie den User sofort Freischalten: [url=index.php?freunde-f".$_SESSION['authid']."]Link[/url]";
if ($fid > 0) {
if ($user != $name)
{
if (db_query("INSERT INTO `prefix_friends` (uid,fid) VALUES ({$_SESSION['authid']}, $fid)")) {
sendpm(1, $fid, $bet, $txt);
$msg = 'Erfolgreich eingetragen.<br />';
}
} else {
$msg = "Du kannst dich nicht selbst adden!<br />";
}
}
echo $msg;
}
//Eintragen
if (isset($_POST['sub1'])) {
$name = escape($_POST['name1'],'string');
$fid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"),0);
$msg = 'Fehler beim Eintragen aufgetreten.<br />';
$recht = @db_result(db_query("SELECT recht FROM prefix_user WHERE name = BINARY '".$name."'"),0);
$user = @db_result(db_query('SELECT name FROM prefix_user WHERE id='.$_SESSION['authid']),0);
$recht1 = @db_result(db_query("SELECT recht FROM prefix_user WHERE name = BINARY '".$user."'"),0);
if ($fid > 0) {
if ($user == $name)
{
$msg = "Du kannst dich nicht selbst adden!<br />";
} elseif (($recht <= -5) AND ($recht1 >= -5)) {
$msg = "Dieser User hat einen zu hochen Rang um ihn auf die Ignorelist zu setzten!";
} else {
if (db_query("INSERT INTO `prefix_friends` VALUES ({$_SESSION['authid']}, $fid, '1', '')")) {
$msg = 'Erfolgreich eingetragen.<br />';
}
}
}
echo $msg;
}
//Löschen
if ($menu->getA(1) == 'd') {
db_query("DELETE FROM `prefix_friends` WHERE uid = {$_SESSION['authid']} AND fid = ".$menu->getE(1));
echo mysql_error();
}
//Nicht Freischalten
if ($menu->getA(1) == 'n') {
db_query("DELETE FROM `prefix_friends` WHERE fid = {$_SESSION['authid']} AND uid = ".$menu->getE(1));
echo mysql_error();
$user=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$menu->getE(1)),0);
$user1=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$_SESSION['authid']),0);
$bet = "Ihre Erlaubnisanfrage wurd abgelehnt!";
$txt = "Hallo ".$user.", sie wurden vom User ".$user1." abgelehnt.";
sendpm(1, $menu->getE(1), $bet, $txt);
}
//Freischalten
if ($menu->getA(1) == 'f') {
db_query("UPDATE `prefix_friends` SET buddy = '1' WHERE fid = {$_SESSION['authid']} AND uid = ".$menu->getE(1));
$user=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$menu->getE(1)),0);
$user1=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$_SESSION['authid']),0);
$bet = "Sie wurden akzeptiert!";
$txt = "Hallo ".$user.", der User ".$user1." hat sie akzeptiert.";
sendpm(1, $menu->getE(1), $bet, $txt);
echo mysql_error();
}
//Ignore
if ($menu->getA(1) == 'i') {
$recht = @db_result(db_query("SELECT recht FROM prefix_user WHERE id = '".$menu->getE(1)."'"),0);
$user = @db_result(db_query('SELECT name FROM prefix_user WHERE id='.$_SESSION['authid']),0);
$recht1 = @db_result(db_query("SELECT recht FROM prefix_user WHERE name = BINARY '".$user."'"),0);
if (($recht <= -5) AND ($recht1 >= -5)) {
$msg = "Dieser User hat einen zu hochen Rang um ihn auf die Ignorelist zu setzten!";
} else {
db_query("DELETE FROM `prefix_friends` WHERE uid = {$_SESSION['authid']} AND fid = ".$menu->getE(1));
db_query("INSERT INTO `prefix_friends` VALUES ('".$_SESSION['authid']."', '".$menu->getE(1)."', '1', '')");
echo mysql_error();
}
echo $msg;
}
//freund
if ($menu->getA(1) == 'j') {
$user=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$menu->getE(1)),0);
$user1=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$_SESSION['authid']),0);
$bet = "Erlaubnisanfrage!";
$txt = "Hallo ".$user.", der User ".$user1." wartet auf ihre Freischaltung.
Hier können sie den User sofort Freischalten: [url=index.php?freunde-f".$_SESSION['authid']."]Link[/url]";
db_query("DELETE FROM `prefix_friends` WHERE uid = {$_SESSION['authid']} AND fid = ".$menu->getE(1));
db_query("INSERT INTO `prefix_friends` VALUES ('".$_SESSION['authid']."', '".$menu->getE(1)."', '', '')");
sendpm(1, $menu->getE(1), $bet, $txt);
echo mysql_error();
}
//Ausgabe
$tpl = new tpl('freunde');
$tpl->out(0);
$dif = date('Y-m-d H:i:s', time() - 60);
$sql = db_query("SELECT a.fid as aktfid, b.name, IF(c.uptime > '$dif','online','offline') as status
FROM `prefix_friends` a
LEFT JOIN `prefix_user` b ON a.fid = b.id
LEFT JOIN `prefix_online` c ON a.fid = c.uid AND c.sid = (SELECT sid FROM `prefix_online` WHERE uid = aktfid ORDER BY uptime DESC LIMIT 1)
WHERE a.uid = {$_SESSION['authid']} AND a.buddy = 1 ORDER BY status DESC");
while ($r = db_fetch_assoc($sql)) {
$class = ($class=='Cnorm'?'Cmite':'Cnorm');
$color = ($color=='#e5e5e5'?'#B4C6D8':'#e5e5e5');
$name=@db_result(db_query('SELECT name, opt_pm FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($gallery == '1'){
$gallery1 = '<a href="index.php?user-usergallery-'.$r['aktfid'].'"> <img src="include/images/icons/usergallery.gif" alt="Gallery" border="0" title="Gallery von '.$name.' ansehen"></a> ';
} else {
$gallery1 = "";
}
if ($gb == '1'){
$gb1 = '<a href="index.php?user-usergb-view-'.$r['aktfid'].'"> <img src="include/images/icons/usergb.gif" alt="User GB" border="0" title="User GB von '.$name.' ansehen"></a> ';
} else {
$gb1 = "";
}
$pmon=@db_result(db_query('SELECT opt_pm FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($pm == '1'){
if ($pmon == '1') {
$pm1 = '<a href="index.php?forum-privmsg-new=0&empfid='.$r['aktfid'].'"><img src="include/images/icons/pm.gif" alt="P.M Schreiben" border="0" title="P.M an '.$name.' Schreiben"></a> ';
} else {
$pm1 = '';
}
} else {
$pm1 = "";
}
$emailon=@db_result(db_query('SELECT opt_mail FROM prefix_user WHERE id='.$r['aktfid']),0);
$email2=@db_result(db_query('SELECT email FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($emailon == '1'){
$email1 = '<a class="freunde" href="index.php?user-mail-'.$r['aktfid'].'"><img src="include/images/icons/mail.gif" alt="Email Schreiben" border="0" title="Email an '.$name.' Schreiben"><span>'.$email2.'</span></a> ';
} else {
$email1 = "";
}
$icq=@db_result(db_query('SELECT icq FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($icq == ''){
$icq1 = '';
} else {
$icq1 = '<a class="freunde" href="http://www.icq.com/whitepages/cmd.php?uin='.$icq.'&action=add"><img src="include/images/icons/icq.gif" alt="Icq" border="0" title="Icq"><span>'.$icq.'</span></a> ';
}
$msn=@db_result(db_query('SELECT msn FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($msn == ''){
$msn1 = '';
} else {
$msn1 = '<a class="freunde" href="#INFO"><img src="include/images/icons/msn.gif" alt="Msn" border="0" title="Msn"><span>'.$msn.'</span></a> ';
}
$aim=@db_result(db_query('SELECT aim FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($aim == ''){
$aim1 = '';
} else {
$aim1 = '<a class="freunde" href="aim:goim?screenname='.$aim.'&message=Hello+Are+you+there?"><img src="include/images/icons/aim.gif" alt="Aim" border="0" title="Aim"><span>'.$aim.'</span></a> ';
}
$yahoo=@db_result(db_query('SELECT yahoo FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($yahoo == ''){
$yahoo1 = '';
} else {
$yahoo1 = '<a class="freunde" href="http://edit.yahoo.com/config/send_webmesg?.target='.$yahoo.'&.src=pg"><img src="include/images/icons/yahoo.gif" alt="Yahoo" border="0" title="Yahoo"><span>'.$yahoo.'</span></a> ';
}
$hp=@db_result(db_query('SELECT homepage FROM prefix_user WHERE id='.$r['aktfid']),0);
if ($hp == ''){
$hp1 = '';
} else {
$hp1 = '<a class="freunde" href="'.$hp.'"><img src="include/images/icons/page.gif" alt="Homepage" border="0" title="Homepage"><span>'.$hp.'</span></a> ';
}
$r['class'] = $class;
$r['color'] = $color;
$r['icq'] = $icq1;
$r['msn'] = $msn1;
$r['aim'] = $aim1;
$r['hp'] = $hp1;
$r['yahoo'] = $yahoo1;
$r['email'] = $email1;
$r['pm'] = $pm1;
$r['gb'] = $gb1;
$r['gallery'] = $gallery1;
$tpl->set_ar_out($r,1);
}
$tpl->out(2);
$sql1 = db_query("SELECT a.fid as aktfid, b.name, IF(c.uptime > '$dif','online','offline') as status
FROM `prefix_friends` a
LEFT JOIN `prefix_user` b ON a.fid = b.id
LEFT JOIN `prefix_online` c ON a.fid = c.uid AND c.sid = (SELECT sid FROM `prefix_online` WHERE uid = aktfid ORDER BY uptime DESC LIMIT 1)
WHERE a.uid = {$_SESSION['authid']} AND a.ignoren = 1 ORDER BY status DESC");
while ($r1 = db_fetch_assoc($sql1)) {
$class1 = ($class1=='Cnorm'?'Cmite':'Cnorm');
$r1['class1'] = $class1;
$tpl->set_ar_out($r1,3);
}
$tpl->out(4);
$sql2 = db_query("SELECT a.fid as aktfid, b.name, IF(c.uptime > '$dif','online','offline') as status
FROM `prefix_friends` a
LEFT JOIN `prefix_user` b ON a.fid = b.id
LEFT JOIN `prefix_online` c ON a.fid = c.uid AND c.sid = (SELECT sid FROM `prefix_online` WHERE uid = aktfid ORDER BY uptime DESC LIMIT 1)
WHERE a.uid = {$_SESSION['authid']} AND a.ignoren = 0 AND a.buddy = 0 ORDER BY status DESC");
while ($r2 = db_fetch_assoc($sql2)) {
$class2 = ($class2=='Cnorm'?'Cmite':'Cnorm');
$r2['class2'] = $class2;
$tpl->set_ar_out($r2,5);
}
$tpl->out(6);
$sql3 = db_query("SELECT a.uid as aktfid, b.name, IF(c.uptime > '$dif','online','offline') as status
FROM `prefix_friends` a
LEFT JOIN `prefix_user` b ON a.uid = b.id
LEFT JOIN `prefix_online` c ON a.fid = c.uid AND c.sid = (SELECT sid FROM `prefix_online` WHERE uid = aktfid ORDER BY uptime DESC LIMIT 1)
WHERE a.fid = {$_SESSION['authid']} AND a.ignoren = 0 AND a.buddy = 0 ORDER BY status DESC");
while ($r3 = db_fetch_assoc($sql3)) {
$class3 = ($class3=='Cnorm'?'Cmite':'Cnorm');
$r3['class3'] = $class3;
$tpl->set_ar_out($r3,7);
}
$tpl->out(8);
} else {
echo 'Nur für angemeldete User.<br />';
}
$design->footer();
?>
Das ich der Link zu der seite wen ihr mal schaiuen wollt
externer Link