summary refs log tree commit diff stats
path: root/includes/comments.php
blob: bf733180b8d317ad286435ade46a695d6f69ddaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/*
       444444444  
      4::::::::4  
     4:::::::::4  
    4::::44::::4  
   4::::4 4::::4   Four Island
  4::::4  4::::4  
 4::::4   4::::4   Written and maintained by Starla Insigna
4::::444444::::444
4::::::::::::::::4  includes/comments.php
4444444444:::::444
          4::::4   Please do not use, reproduce or steal the
          4::::4   contents of this file without explicit
          4::::4   permission from Hatkirby.
        44::::::44
        4::::::::4
        4444444444
*/

if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}

require('headerproc.php');

include('includes/recaptchalib.php');
$publickey = "6LfgvgEAAAAAAG_BJMkWk8sNcT1nBaGoXKJYb-JT";
$privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr";

$curID = 0;

$template = new FITemplate('comments');
$template->add('PAGEID',$page_id);
$template->add('USERNAME',(isLoggedIn() ? sess_get('uname') : 'Anonymous'));

if (!isLoggedIn())
{
	$template->add('RECAPTCHA',recaptcha_get_html($publickey));
	$template->adds_block('NOLOG',array('exi'=>1));
}

$getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime";
$getcomments2 = mysql_query($getcomments) or die($getcomments);
$i=0;
while ($getcomments3[$i] = mysql_fetch_array($getcomments2))
{
	$getuser = "SELECT * FROM users WHERE username = \"" . $getcomments3[$i]['username'] . "\"";
	$getuser2 = mysql_query($getuser);
	$getuser3 = mysql_fetch_array($getuser2);

	if ($getuser3['username'] == $getcomments3[$i]['username'])
	{
		$username = $getuser3['username'];
		$email = $getuser3['user_email'];
		$website = $getuser3['website'];
	} else {
		$getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getcomments3[$i]['username'] . "\"";
		$getanon2 = mysql_query($getanon);
		$getanon3 = mysql_fetch_array($getanon2);

		if ($getanon3['username'] == $getcomments3[$i]['username'])
		{
			$username = $getanon3['username'] . ' (Guest)';
			$email = $getanon3['email'];
			$website = $getanon3['website'];
		}
	}

	if (isset($username))
	{
		$template->add_ref($curID, 'COMMENTS', array(	'CODEDEMAIL' => md5(strtolower($email)),
								'USERNAME' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username),
								'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])),
								'ID' => $getcomments3[$i]['id'],
								'TEXT' => parseBBCode($getcomments3[$i]['comment'])));
	}
	$i++;
}
$template->display();

?>