So, ich hab das dann mal soweit funktionstüchtig geschrieben, allerdings noch ohne Bilder oder so, dass sollte allerdings jeder, der dem HTML mächtig ist, selbst einsetzen können;)
Installationsanleitung sollte eigentlich klar sein
install_freunde.php
<?php
define ( 'main' , TRUE );
require_once('include/includes/config.php');
require_once('include/includes/func/db/mysql.php');
db_connect();
if (db_query("CREATE TABLE `prefix_friends` (
`uid` MEDIUMINT NOT NULL ,
`fid` MEDIUMINT NOT NULL ,
PRIMARY KEY ( `uid`, `fid` ))"))
echo 'Tabelle erfolgreich angelegt.<br />install_freunde.php löschen.';
else echo 'Fehler aufgetreten:<br />'.mysql_error();
db_close();
?>
include/contents/freunde.php
<?php
defined('main') or die('no direct access');
$title = $allgAr['title'].' :: Freunde';
$hmenu = 'Freunde';
$design = new design ( $title , $hmenu );
$design->header();
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 />';
if ($fid > 0) {
if (db_query("INSERT INTO `prefix_friends` (uid,fid) VALUES ({$_SESSION['authid']}, $fid)")) {
$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));
}
//Ausgabe
$tpl = new tpl('freunde');
$tpl->out(0);
$dif = date('Y-m-d H:i:s', time() - 60);
$sql = db_query("SELECT `prefix_friends`.fid, `prefix_user`.name, IF(`prefix_online`.uptime > '$dif','online','offline') as status FROM `prefix_friends` LEFT JOIN `prefix_user` ON `prefix_friends`.fid = `prefix_user`.id
LEFT JOIN `prefix_online` ON `prefix_friends`.fid = `prefix_online`.uid
WHERE `prefix_friends`.uid = {$_SESSION['authid']} ORDER BY status DESC");
while ($r = db_fetch_assoc($sql)) {
$class = ($class=='Cmite'?'Cnorm':'Cmite');
$r['class'] = $class;
$tpl->set_ar_out($r,1);
}
$tpl->out(2);
} else {
echo 'Nur für angemeldete User.<br />';
}
$design->footer();
?>
include/templates/freunde.htm
<script language="JavaScript" type="text/javascript">
<!--
function finduser () {
var Fenster = window.open ('index.php?search-finduser', 'finduser', 'status=no,scrollbars=yes,height=165,width=465');
Fenster.focus();
return (false);
}
//-->
</script>
<form action="index.php?freunde" method="POST" name="form">
<table width="100%" border="0" cellspacing="1" class="border" cellpadding="5">
<tr class="Chead"><td>Freund hinzufügen</td></tr>
<tr class="Cmite"><td><input type="text" name="name" size="25" /> <input type="button" value="suchen..." onclick="return finduser();" /></td></tr>
<tr class="Cnorm"><td><input type="submit" value="eintragen" name="sub" /></td></tr>
</table>
</form>
<br /><br />
<table width="100%" border="0" cellspacing="1" class="border" cellpadding="5">
<tr class="Chead"><td>Freunde</td><td>Aktion</td></tr>
{EXPLODE}
<tr class="{class}"><td>{status} {name}</td><td><a href="index.php?forum-privmsg-new=0&empfid={fid}">PM</a> <a href="index.php?freunde-d{fid}">del</a></td></tr>
{EXPLODE}
</table>
include/boxes/freunde.php
<?php
defined('main') or die('no direct access');
if (loggedin()) {
$dif = date('Y-m-d H:i:s', time() - 60);
$sql = db_query("SELECT `prefix_friends`.fid, `prefix_user`.name, IF(`prefix_online`.uptime > '$dif','online','offline') as status FROM `prefix_friends` LEFT JOIN `prefix_user` ON `prefix_friends`.fid = `prefix_user`.id
LEFT JOIN `prefix_online` ON `prefix_friends`.fid = `prefix_online`.uid
WHERE `prefix_friends`.uid = {$_SESSION['authid']} ORDER BY status DESC");
while ($r = db_fetch_object($sql)) {
echo '<a href="index.php?forum-privmsg-new=0&empfid='.$r->fid.'">'.$r->status.' '.$r->name.'</a><br />';
}
echo '<br /><a href="index.php?freunde">Freundeliste bearbeiten</a><br />';
} else {
echo 'Nur für angemeldete User.<br />';
}
?>
Zuletzt modifiziert von Mairu am 27.04.2007 - 14:40:51