| [ PHPXref.com ] | [ Generated: Sun Jul 20 20:25:38 2008 ] | [ SPiD 1.3.1 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <? 2 // Comment adder for SPiD v1.3.0 3 // http://spid.adnx.net/ 4 // by Cariad Ilmāra <cariad@adnx.net> 5 6 require "connect.php"; 7 8 // Support for on the fly theming 9 require "scan_themes.php"; 10 require "scan_lang_insert.php"; 11 12 // Page is called by herself to insert new comment 13 if ($_REQUEST["todo"] == 1) { 14 $mynewname = de_hyphen($_REQUEST["mynewname"]); 15 $comment = de_hyphen($_REQUEST["comment"]); 16 $cat = de_hyphenfile($_REQUEST["cat"]); 17 $myid = de_hyphen($_REQUEST["myid"]); 18 19 // if both field are ok 20 if (($mynewname != "") && ($comment != "")) { 21 $mydate = date("Y-m-d"); 22 // insert new comment 23 $query_add_comment = "INSERT INTO `commentaires` (`id`, `categorie`, `date`, `user`, `comment`) VALUES " . 24 "('', '$cat', '$mydate', '$mynewname', '$comment')"; 25 $id_add_comment = mysql_db_query($mydbase, $query_add_comment) or exit($lang_string_error_cantaddcomment); 26 $mynewid = mysql_insert_id(); 27 28 // getting existing list of comments for this picture 29 $query_add_pic = "SELECT `user_comment` FROM `cat_$cat` WHERE `id` = '$myid'"; 30 $id_add_pic = mysql_db_query($mydbase, $query_add_pic) or exit($lang_string_error_getcomment); 31 $r_add_pic = mysql_fetch_array($id_add_pic) or exit($lang_string_error_getcomment); 32 33 if ($r_add_pic[0] == "") { $list_comments = $mynewid; } 34 else { $list_comments = $r_add_pic[0].",".$mynewid; } 35 36 // updating current picture with the new comment 37 $query_upd_pic = "UPDATE `cat_$cat` SET `user_comment` = '$list_comments' WHERE `id` = '$myid'"; 38 $id_upd_pic = mysql_db_query($mydbase, $query_upd_pic) or exit($lang_string_error_cantupdatecommentslist); 39 40 // Storing current name for future use 41 setcookie ("commentname", "", time() - 3600, '/', '', 0); 42 setcookie ("commentname", $mynewname, time() + 8640000, '/', '', 0); 43 44 // redirect to comment viewing 45 unset($todo); 46 $url = "comment.php?cat=$cat&myid=$myid&lang=$lang&theme=$theme"; 47 print '<html><head><meta http-equiv="refresh" content="0;URL='.$url.'"></head></html>'; 48 // header("Location: comment.php?cat=$cat&myid=$myid&lang=$lang&theme=$theme"); 49 exit(''); 50 } 51 // Everything is not ok... 52 else { 53 print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"; 54 print "<html>"; 55 print "<head>"; 56 print "<title>SPiD :: Leave a comment</title>"; 57 print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$lang_charset\">"; 58 print "<link href=\"$spid_theme_css\" rel=\"stylesheet\" type=\"text/css\">"; 59 print "</head>"; 60 print "<body bgcolor=\"#071B30\">"; 61 print "<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">"; 62 print "<tr><td class=\"txt\" align=\"center\">"; 63 print "<b>Warning !</b><br>"; 64 print "$lang_string_error_commentname"; 65 print "<br><br><a href=\"add_comment.php?cat=$cat&myid=$myid&lang=$lang&theme=$theme\" class=\"link\">$lang_string_error_goback</a>"; 66 print "</td></tr></table>"; 67 exit(); 68 } 69 } 70 ?> 71 72 <!DOCTYPE html 73 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 74 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 75 <? 76 $cat = de_hyphenfile($_REQUEST["cat"]); 77 $myid = de_hyphen($_REQUEST["myid"]); 78 $lang = de_hyphen($_REQUEST["lang"]); 79 $theme = de_hyphen($_REQUEST["theme"]); 80 // category or id of picture isn't set... 81 if ((!isset($cat)) || (!isset($myid))) { 82 exit('Something wrong with the calling url<br>'); } 83 ?> 84 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<? echo $lang; ?>" lang="<? echo $lang; ?>"> 85 <meta http-equiv="Content-Type" content="text/html; charset=<? print $lang_charset; ?>" /> 86 <head> 87 <title>SPiD :: <? echo $lang_string_leavecomment; ?></title> 88 <link href="<? echo $spid_theme_css; ?>" rel="stylesheet" type="text/css" /> 89 <script language="Javascript" type="text/javascript"> 90 window.resizeTo(470,285); 91 </script> 92 93 <? include "spid.js"; ?> 94 </head> 95 96 <body> 97 <table width="100%" border="0" cellspacing="0" cellpadding="0"> 98 <tr> 99 <td class="titrecontact"><strong><? echo $lang_string_leavecomment; ?></strong></td> 100 </tr> 101 </table> 102 <br /> 103 <form name="add_comment" method="post" action="add_comment.php?todo=1&cat=<? echo $cat; ?>&myid=<? echo $myid; ?>&lang=<? echo $lang; ?>&theme=<? echo $theme; ?>"> 104 <table width="100%" border="0" cellspacing="0" cellpadding="0"> 105 <tr> 106 <td width="38%" class="txt"><? echo $lang_string_yourname; ?> :</td> 107 <? 108 print "<td width=\"62%\"><input name=\"mynewname\" type=\"text\" class=\"textinput\" size=\"25\" maxlength=\"150\" "; 109 if (isset($_COOKIE["commentname"])) { print "value=\"" . $_COOKIE["commentname"] . "\" "; } 110 print "/></td>"; 111 ?> 112 </tr> 113 <tr> 114 <td valign="top" class="txt"><? echo $lang_string_yourcomment; ?> :</td> 115 <td><textarea name="comment" cols="40" rows="6" class="textinput"></textarea></td> 116 </tr> 117 <tr> 118 <td width="120"><table width="100" border="0" cellspacing="0" cellpadding="0"> 119 <tr> 120 <td><div align="center"><a href="#" onclick="addsmiley(':)')"><img src="<? echo $spid_theme_smiley_smile; ?>" border="0" width="15" height="15" alt="smile" /></a></div></td> 121 <td><div align="center"><a href="#" onclick="addsmiley(';)')"><img src="<? echo $spid_theme_smiley_wink; ?>" border="0" width="15" height="15" alt="wink" /></a></div></td> 122 <td><div align="center"><a href="#" onclick="addsmiley(':(')"><img src="<? echo $spid_theme_smiley_mad; ?>" border="0" width="15" height="15" alt="frown" /></a></div></td> 123 <td><div align="center"><a href="#" onclick="addsmiley('%)')"><img src="<? echo $spid_theme_smiley_cool; ?>" border="0" width="15" height="15" alt="cool" /></a></div></td> 124 </tr> 125 <tr> 126 <td colspan="4" height="5"></td> 127 </tr> 128 <tr> 129 <td><div align="center"><a href="#" onclick="addsmiley('§)')"><img src="<? echo $spid_theme_smiley_rolleyes; ?>" border="0" width="15" height="15" alt="indeed..." /></a></div></td> 130 <td><div align="center"><a href="#" onclick="addsmiley(':D')"><img src="<? echo $spid_theme_smiley_biggrin; ?>" border="0" width="15" height="15" alt="grin" /></a></div></td> 131 <td><div align="center"><a href="#" onclick="addsmiley(':p')"><img src="<? echo $spid_theme_smiley_tongue; ?>" border="0" width="15" height="15" alt="tongue" /></a></div></td> 132 <td><div align="center"><a href="#" onclick="addsmiley(':o')"><img src="<? echo $spid_theme_smiley_redface; ?>" border="0" width="15" height="15" alt="shocked" /></a></div></td> 133 </tr> 134 </table> 135 </td> 136 <td><table width="300" border="0" cellspacing="0" cellpadding="0"> 137 <tr> 138 <td class="txt"><a href="#" onclick="addstyle('bold')" class="link"><? echo $lang_string_addbold; ?></a></td> 139 <td class="txt"><a href="#" onclick="addstyle('italic')" class="link"><? echo $lang_string_additalic; ?></a></td> 140 </tr> 141 <tr> 142 <td class="txt"><a href="#" onclick="addstyle('underline')" class="link"><? echo $lang_string_addunderline; ?></a></td> 143 <td class="txt"><a href="#" onclick="addstyle('break')" class="link"><? echo $lang_string_addbr; ?></a></td> 144 </tr> 145 </table></td> 146 </tr> 147 <tr> 148 <td colspan="2"><div align="center"> 149 <br /> 150 <input name="Reset" type="reset" class="button" value="<? echo $lang_string_reset; ?>" /> 151 <input name="Submit2" type="submit" class="button" value="<? echo $lang_string_submit; ?>" /> 152 </div></td> 153 </tr> 154 </table> 155 </form> 156 </body> 157 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |