complicated blog problem
Posted: Thu Aug 04, 2005 11:03 pm
I am making a website for a fraternity and I am working on this blog and its getting complicated and I can't get it to work. The blog can be posted to by two different user groups, brothers and alumni. If a brother posts I want the link at the bottom to say posted by and then a link to "brotherprofile.php..." where as when an alumni posts I want the link at the bottom to go to "alumniprofile.php..." . Currently I am determining whether someone is an alumni or not by selecting the email address from a list of alumni and then using and if statement. RIght now when I run the script the links at the bottom are all the same and are controled by who ever is the last person that posted. Anyway heres the code:
feyd |
Code: Select all
<?php
session_start();
require '../req.php';
require 'header.php';
require_once '../pager.php';
require 'auth.php';
adminsessionAuthenticate();
$connection = mysql_connect($hostname, $username, $password);
$p = new Pager;
$limit = 5;
$start = $p->findStart($limit);
mysql_select_db("betasigma", $connection);
$result = mysql_query ("SELECT Subject FROM alumniblog", $connection);
$count = mysql_num_rows($result);
$pages = $p->findpages($count, $limit);
print "\n<table width='650' class='blogtitle'>\n<tr>\n<td align='left' valign='top'>Alumni Blog\n</td>\n</tr>\n</table>\n<br>";
print "\n<table width='650'>\n<tr>\n<td width='450' valign='top' align='left'>";
mysql_select_db("betasigma", $connection);
$result = mysql_query ("SELECT Date, Subject, FirstName, LastName, Year, Email, Message, Picture FROM alumniblog LIMIT ".$start.", ".$limit, $connection);
while($row = mysql_fetch_array($result))
{
$posttime = "{$row["Date"]}";
$offset = "3600";
$posttime += $offset;
$date = date("F jS Y", $posttime);
$time = date("g:i A", $posttime);
$message = "{$row["Message"]}";
$firstname = "{$row["FirstName"]}";
$lastname = "{$row["LastName"]}";
$year = "{$row["Year"]}";
$subject = "{$row["Subject"]}";
$picture = "{$row["Picture"]}";
$messagestripped = stripslashes($message);
$email = "{$row["Email"]}";
$result1 = mysql_query ("SELECT Email FROM regalumni WHERE Email = '$email'", $connection);
while($row = mysql_fetch_array($result1))
{
$alum = "{$row["Email"]}";
}
if ($alum == "")
{
print "\n<span class='blogsubject'> $subject \n</span><br><img src='".$picture."'><br><span class='blogtext'>$messagestripped \n</span>\n<br>\n<span class='blogstamp'>Posted by: \n<a href='brotherprofile.php?brother=".$lastname."'>$firstname $lastname</a> (".$year.") on $date at $time EST\n</span>\n<br>\n<br>";
}
else
{
print "\n<span class='blogsubject'> $subject \n</span><br><img src='".$picture."'><br><span class='blogtext'>$messagestripped\n</span>\n<br>\n<span class='blogstamp'>Posted by: \n<a href='alumniprofile.php?lastname=".$lastname."&firstname=".$firstname."&year=".$year."'>$firstname $lastname</a> (".$year.") on $date at $time EST\n</span>\n<br>\n<br>";
}
}
$next_prev = $p->nextPrev($_GET['page'], $pages);
print "\n<table width='100%'><tr><td align='right'><span class='text'>$next_prev</span></td></tr></table>";
print "\n</td>\n<td width='200' valign='top' align='left'>";
include "alumrecentupdates.php";
print "\n</td>\n</tr>\n</table>";
require 'footer.php';
?>feyd |