cvs: php-hosts-web /msgboard message.php shared-msgboard.inc

From: Date: Mon, 22 Apr 2002 00:02:20 +0000
Subject: cvs: php-hosts-web /msgboard message.php shared-msgboard.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-9732@lists.php.net to get a copy of this message
jimw Sun Apr 21 20:02:20 2002 EDT Modified files: /php-hosts-web/msgboard message.php shared-msgboard.inc Log: read message text from database Index: php-hosts-web/msgboard/message.php diff -u php-hosts-web/msgboard/message.php:1.1 php-hosts-web/msgboard/message.php:1.2 --- php-hosts-web/msgboard/message.php:1.1 Sun Apr 21 16:58:04 2002 +++ php-hosts-web/msgboard/message.php Sun Apr 21 20:02:20 2002 @@ -2,15 +2,12 @@ include("shared-msgboard.inc"); -$q1=mysql($DBASE,"select * from $TABLE_MSGS where id=$id"); -$parent=intval(mysql_result($q1,0,"parent")); -$subj=mysql_result($q1,0,"subj"); -$email=mysql_result($q1,0,"email"); -$name=mysql_result($q1,0,"name"); -$date=mysql_result($q1,0,"date"); +$q1=mysql_query("SELECT * FROM $TABLE_MSGS WHERE id=$id") + or die("query failed: ".mysql_error()); + +# TODO: this is ugly. fix. +extract(mysql_fetch_assoc($q1)); $date=date($DATE_FORMAT,$date); -$document=mysql_result($q1,0,"document"); -$subgroup=mysql_result($q1,0,"subgroup"); $section=getSubgroupName($subgroup); commonHeader("Message: $section"); title("Message: $section"); Index: php-hosts-web/msgboard/shared-msgboard.inc diff -u php-hosts-web/msgboard/shared-msgboard.inc:1.1 php-hosts-web/msgboard/shared-msgboard.inc:1.2 --- php-hosts-web/msgboard/shared-msgboard.inc:1.1 Sun Apr 21 16:58:04 2002 +++ php-hosts-web/msgboard/shared-msgboard.inc Sun Apr 21 20:02:20 2002 @@ -1,7 +1,11 @@ <?php require ("shared.inc"); -$conn = mysql_pconnect("localhost","www"); +mysql_pconnect("localhost","nobody") + or die("unable to connect to database: ".mysql_error()); + +mysql_select_db("phphosts") + or die("unable to select database: ".mysql_error()); $DBASE="phphosts"; $SYSOP="webmaster@php.net"; @@ -48,7 +52,6 @@ $ROOT_DIR=$SERVER['DOCUMENT_ROOT'].'/msgboard'; $ROOT_URL="http://hosts.php.net/msgboard"; $HOME_URL="http://hosts.php.net"; -$MSGS="$ROOT_DIR/msgs"; $GIFS="$ROOT_URL/gifs"; $STAFF_URL="http://hosts.php.net/staff"; $MOD_URL="$ROOT_URL/etc"; @@ -191,7 +194,7 @@ * Threads the message headers * if $mode=1, it's the moderator function */ - global $DBASE, $TABLE_MSGS, $ROOT_DIR, $MSGS, $ROOT_URL, $MOD_URL, $LIL_DOC_IMG; + global $DBASE, $TABLE_MSGS, $ROOT_DIR, $ROOT_URL, $MOD_URL, $LIL_DOC_IMG; global $BGCOLOR, $DATE_FORMAT,$jjj; $query="select * from $TABLE_MSGS where parent=$parent and subgroup=$subgroup order by date desc"; $q1=mysql_db_query($DBASE, $query); @@ -255,7 +258,7 @@ /* * Displays a message (!) */ - global $FONTFACE, $LIL_DOC_IMG, $MSGS, $DBASE, $USE_DOC_UPLOAD; + global $FONTFACE, $LIL_DOC_IMG, $DBASE, $USE_DOC_UPLOAD; global $TABLE_WIDTH, $TABLE_MSGS, $MSG_FRAME_COLOR, $MSG_FRAME_COLOR2, $MSG_TEXT_COLOR; global $TEXT_COLOR1, $TEXT_COLOR2; $FT1="<FONT FACE=\"$FONTFACE\" COLOR=\"$TEXT_COLOR1\" SIZE=-1>"; @@ -294,15 +297,10 @@ endif; echo "<TR VALIGN=top BGCOLOR=\"$MSG_TEXT_COLOR\"><TD colspan=2>$FT2\n"; if ($mode=="preview"): - $show=ereg_replace(10,"<BR>",$post); - echo "$show\n"; + echo nl2br($post); else: - $show=file("$MSGS/$post"); - $i=0; - while($i<count($show)): - echo "$show[$i]<BR>\n"; - $i++; - endwhile; + $show = mysql_get_one("SELECT message FROM $TABLE_MSGS WHERE id=$post"); + echo nl2br($show); endif; echo "</TD></TR>\n"; };

« previous php.mirrors (#9732) next »