"Fossies" - the Fresh Open Source Software Archive 
Member "faqadmin/faq/faqhist.php" (31 Oct 2006, 9347 Bytes) of package /linux/www/old/faqadmin-current.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 <?
2 if (!isset($submit)) {
3 if($fid && $fodrx && $m1 && $fm){
4 ?>
5
6 <html>
7 <body bgcolor="ffffff">
8 <font size=2 color=blue>Powered by <a href=http://www.campbus.com/faqadministrator.html>Faq Administrator</a></font>
9 <P>
10 <?
11 session_start();
12 include ("connect.php");
13 include ("links.php");
14 print "<P>";
15 ?>
16 <table border="0" width="15%">
17 <tr>
18 <td bgcolor="#000000"><font color="#ffffff" face="arial" size="2"><b>Total Replies</b> </font></td></tr>
19
20 <?php
21
22 print ("<tr>");
23 print ("<td bgcolor=#c3c3c3 align=center><font color=#000000 face=arial size=2>");
24 print ("<B><FONT COLOR=\"#000000\">");
25
26 ///
27
28 $zresult = mysql_query ("SELECT count(*) as replies
29 from faq_dat, faq_re_dat
30 WHERE faq_re_dat.fodr = faq_dat.fodr
31 AND faq_dat.fodr = '$fodrx'
32 ");
33
34 if ($myrow = mysql_fetch_array($zresult)) {
35
36 do {
37
38 print $myrow["replies"];
39
40 } while ($myrow = mysql_fetch_array($zresult));
41 }
42
43
44 # include ("hist_replycount.php");
45
46 ///
47
48 print ("</FONT></B>");
49 print ("</font></td></tr>");
50 ?>
51
52 </table>
53 <BR><BR>
54
55 <?
56
57 $result = mysql_query ("SELECT *
58 FROM faq_dat
59 where fodr = '$fodrx'
60 ");
61 if ($myrow = mysql_fetch_array($result)) {
62 do {
63
64 $fuemail = $myrow["faq_user_email"];
65 $fuemail = str_replace("@", "[at]", $fuemail);
66 print ("<FONT COLOR=black><TT>");
67 print $myrow["faq_user"];
68 print (" ");
69 print "$fuemail";
70 print ("<BR>");
71 print $myrow["faq_date"];
72 print ("<BR>");
73 print ("Subject:");
74 print (" ");
75 print $myrow["faq_memo"];
76 print ("<P>");
77 print ("Question:");
78 print ("<br>");
79
80 $alt1=str_replace("\n\r\n", "<p>", $myrow['faq_dat']);
81 $alt1=nl2br($alt1);
82
83 print "$alt1";
84 print ("</TT></FONT>");
85
86 } while ($myrow = mysql_fetch_array($result));
87 } else {
88 echo "<B>Sorry, this FAQ seems to be unavailable</B>";
89 }
90 ?>
91
92 <table border="0" width="100%">
93 <tr><td bgcolor="#000000"><font color="#ffffff" face="arial" size="2"><b>Replies To This Question</b> </font></td></tr>
94
95 <?
96
97 $limit=10; // rows to return
98 $numresults=mysql_query ("SELECT faq_dat.faq_date, faq_re_dat.faq_reuser, faq_re_dat.refac_date, faq_re_dat.refaq_data, faq_re_dat.faq_re_memo, faq_dat.faq_memo, faq_re_dat.faq_reuser_email, faq_dat.fodr, faq_re_dat.fodr
99 FROM faq_re_dat, faq_dat
100 where faq_re_dat.fodr = faq_dat.fodr
101 and faq_dat.fodr = '$fodrx'
102 order by refac_date");
103
104 $numrows=mysql_num_rows($numresults);
105
106 if (empty($offset)) {
107 $offset=0;
108 }
109
110 if ('$faq_date' == "")
111 {'$faq_date' == "";}
112
113 $result = mysql_query ("SELECT faq_dat.faq_date, faq_re_dat.refac_date, faq_re_dat.faq_reuser, faq_re_dat.refaq_data, faq_re_dat.faq_re_memo, faq_dat.faq_memo, faq_re_dat.faq_reuser_email, faq_dat.fodr, faq_re_dat.fodr
114 FROM faq_re_dat, faq_dat
115 where faq_re_dat.fodr = faq_dat.fodr
116 and faq_dat.fodr = '$fodrx'
117 order by refac_date
118 limit $offset,$limit
119 ");
120 if ($myrow = mysql_fetch_array($result)) {
121 do {
122
123 $ruemail = $myrow["faq_reuser_email"];
124 $ruemail = str_replace("@", "[at]", $ruemail);
125
126 $zdate = $myrow['refac_date'];
127 {
128 // split up the timestamp
129 $year=substr($zdate,0,4);
130 $month=substr($zdate,4,2);
131 $day=substr($zdate,6,2);
132 $hh=substr($zdate,8,2);
133 $mm=substr($zdate,10,2);
134 $ss=substr($zdate,12,2);
135 }
136 if ($month == "01") {$month = "Jan";}
137 if ($month == "02") {$month = "Feb";}
138 if ($month == "03") {$month = "Mar";}
139 if ($month == "04") {$month = "Apr";}
140 if ($month == "05") {$month = "May";}
141 if ($month == "06") {$month = "Jun";}
142 if ($month == "07") {$month = "Jul";}
143 if ($month == "08") {$month = "Aug";}
144 if ($month == "09") {$month = "Sep";}
145 if ($month == "10") {$month = "Oct";}
146 if ($month == "11") {$month = "Nov";}
147 if ($month == "12") {$month = "Dec";}
148 $xdate = ("$day-$month-$year@$hh:$mm:$ss");
149 print ("<tr><td bgcolor=#c3c3c3><font color=#000000>");
150 print ("<TT>");
151 print ("From:");
152 print (" ");
153 print $myrow["faq_reuser"];
154 print (" ");
155 print "$ruemail";
156 print (" Date: $xdate");
157 print ("<BR>");
158 print ("RE:");
159 print (" ");
160 print $myrow["faq_memo"];
161 print ("<P>");
162 $alt2=str_replace("\n\r\n", "<p>", $myrow['refaq_data']);
163 $alt2=nl2br($alt2);
164 print "$alt2";
165 print (" ");
166 print ("</TT>");
167 print ("</font></td></tr>");
168 } while ($myrow = mysql_fetch_array($result));
169
170 $pages=intval($numrows/$limit);
171 if ($numrows%$limit) {
172 $pages++;
173 }
174
175 if (!((($page+$limit) / $limit) >= $pages) && $pages !=1) { // If last page don't give next link.
176 $newoffset=$offset+$limit;
177 $next_page = $page + $limit;
178 echo(" <a href=\"$PHP_SELF?fodrx=$fodrx&m1=$m1&fm=$fm&fid=$fid&page=$next_page&offset=$newoffset\">Next</a>");}
179
180 if (((($page-$limit) / $limit) >= 0)) { // If first page don't give previous link.
181 $prevoffset=$offset-$limit;
182 $prev_page = $page - $limit;
183 echo(" <a href=\"$PHP_SELF?fodrx=$fodrx&m1=$m1&fm=$fm&fid=$fid&page=$prev_page&offset=$prevoffset\">Prev</a>");}
184
185 } else {
186 echo "<BR><b>Looks Like you're the first to Reply to this Question.. CONGRATULATIONS !!!!!</b>";
187 }
188 ?>
189
190 </table>
191
192 <BR>
193
194 <b>Post a new Response:</b></font><br><br>
195
196 <?
197
198 $result = mysql_query ("SELECT * FROM faq_dat where fodr = '$fodrx'");
199 if ($myrow = mysql_fetch_array($result)) {
200 do {
201 $email = $myrow["email"];
202 print ("<table border=0>");
203 print ("<FORM METHOD=post ACTION=\"\">");
204 #if($myrow['email']=="Y") {print "<input type=hidden name=email value=mail.php>";}
205 #if($myrow['email']=="N") {print "<input type=hidden name=email value=blank.php>";}
206 print "<input type=\"hidden\" name=\"email\" value=\"$email\">";
207 print "<input type=hidden name=faq_user_email value=";
208 print $myrow["faq_user_email"];
209 print " >";
210 print "<input type=hidden name=faqmem value=";
211 print $myrow["faq_memo"];
212 print " >";
213 print ("<tr><td><font color=#000000 face=arial size=2>");
214 print ("Name:</font></td><td><input type=text name=faq_reuser SIZE=30 maxlength=30></td></tr>");
215 print ("<tr><td><font color=#000000 face=arial size=2>");
216 print ("Email:</font></td><td><input type=text name=faq_reuser_email SIZE=30 maxlength=30> *Optional</td></tr>");
217 print ("<tr>");
218 print ("<td><input type=hidden name=faq_re_memo SIZE=25 value=$myrow[faq_date]>");
219 print ("</td></tr>");
220 print ("<tr>");
221 print ("<td><input type=hidden name=faq_re_fid SIZE=25 value=$fid>");
222 print ("</td></tr>");
223 print ("<tr><td valign=top><font color=#000000 face=arial size=2>");
224 print ("Message:</font></td>");
225 print ("<td valign=top><textarea name=refaq_data cols=40 rows=10></textarea>");
226 print '<P>';
227 print ("<tr>");
228 print ("<td><input type=hidden name=xfm SIZE=25 value=$fm>");
229 print ("<td><input type=hidden name=fodrx SIZE=25 value=$fodrx>");
230 print ("</td></tr>");
231
232 $xresult = mysql_query ("SELECT replies
233 from faq_dat
234 WHERE fodr = '$fodrx'
235 ");
236
237 if ($myrow = mysql_fetch_array($xresult)) {
238
239 print "<input type=hidden name=m2 value=";
240 print $myrow["replies"];
241 print ">";
242
243 }
244
245 $m2= $myrow["replies"];
246 $m3 = $m1 + $m2;
247 print '<input type=hidden name=m3 value=';
248 print "$m3";
249 print '>';
250
251 print ("<tr><td></td><td><font face=arial><input type=submit name=\"submit\" value=Reply> <INPUT TYPE=reset value=Restart>");
252 print ("</font></form></td></tr>");
253 print ("</table>");
254 } while ($myrow = mysql_fetch_array($result));
255
256 }
257
258 session_destroy();
259
260 ?>
261
262 </body>
263 </html>
264 <?
265
266 }else{echo "<h2>ERROR!</h2>";}
267
268 }else{
269
270 if($submit == "Reply"){?>
271
272 <html>
273 <HEAD>
274 <meta HTTP-EQUIV="REFRESH" CONTENT="1;URL=faq.php?fid=<? echo $faq_re_fid ?>">
275 <title>Your Reply has been Saved ! </title>
276 </HEAD>
277 <body bgcolor="ffffff">
278
279 <?
280
281 include ("connect.php");
282
283 // Date formatting
284 function formatDate($val)
285 {
286 // split up the timestamp
287 $year=substr($val,0,4);
288 $month=substr($val,4,2);
289 $day=substr($val,6,2);
290 $hh=substr($val,8,2);
291 $mm=substr($val,10,2);
292 // convert into standard timestamp and format it
293 $date = date("d-M-Y@H:i");
294 return $date;
295 }
296
297 $qdate = formatDate('timestamp');
298
299 $refaq_data = addslashes($refaq_data);
300 $refaq_data = strip_tags($refaq_data, '<a><b><i><u>');
301
302 if(ereg("www","$faq_reuser_email")){header("Location: faqhist.php"); $m1 = "0"; exit();}
303 if(ereg("://","$faq_reuser_email")){header("Location: faqhist.php"); $m1 = "0"; exit();}
304
305 if (preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $faq_reuser_email)){$faq_reuser_email = "";}
306
307 if (ereg(".", $refaq_data) == 1){
308
309 $query = "update faq_dat set replies = '$m3'
310 where fodr = '$fodrx'";
311 $result = mysql_query($query,$connection) or die("Error in form data");
312
313 $sql = "insert into faq_re_dat(refaq_data, faq_reuser, faq_re_memo, faq_reuser_email, faq_re_fid, fodr)
314 values ('$refaq_data', '$faq_reuser', '$faq_re_memo', '$faq_reuser_email', '$faq_re_fid', '$fodrx')";
315 $result = mysql_query($sql);
316
317 $query = "update faq_dat set redate = '$qdate' where fodr = '$fodrx' ";
318 $result2 = mysql_query($query) or die(mysql_error());
319
320 if($email == "Y"){
321
322 $recipient = "$faq_user_email";
323 $subject = "Re: $faqmem";
324 $message = "You have received a responce to your question posted at\nhttp://www.campbus.com/faq/faqhist.php?fodrx=$fodrx&m1=1&fm=$xfm&fid=$faq_re_fid";
325 $extra = "From: Faq Administrator";
326 mail($recipient,$subject,$message,$extra);
327
328 }
329
330 if($email == "N"){echo "\n<BR>Thank You!!\n<BR>";}
331
332 echo "Your Reply Has Been Saved !<BR> Thank You for using Faq Administrator<BR>\n";
333
334 }else{
335 print ("<B>Error:</B> A Subject Title is required. Save was aborted!!");
336 $verify = "bad";
337
338 }
339
340 }else{echo "<h2>ERROR!</h2>";}
341 }
342
343 ?>