beh9am 96 ارسال شده در بهمن 93 گزارش بازنشر ارسال شده در بهمن 93 سلام و خسته نباشیدمن یک مشکلی دارم یه فرم ارسال نظر دارم که وقتی نظر را ارسال میکنی در دیتابیس ذخیره نمیشهفرم نظرم اینه :<?phpif (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) exit('Access Denied');/*#############################################*/$c_status = $ite['comment'] ;if ( isset($_POST['c_act']) ) { return; $c_name = $_POST['c_name'] ; $c_email = $_POST['c_email'] ; $c_site = $_POST['c_site'] ; $c_body = $_POST['c_body'] ; $c_prv = isset($_POST['c_prv']) ? 1 : 0 ; if ( mysql_query( "INSERT INTO `ex_post_comment` VALUES ('', '$c_name', '$c_email' , '$c_site', '$c_body', now(), '$c_prv', '$c_status' , '$id', '".$C->MY_IP."' ) " ) ) if ( $c_status == 1 ) $body = '<center><b style="color:green">نظر شما با موفقيت به ثبت رسيد</b></center>'; else $body = '<center><b style="color:green">نظر شما با موفقيت به ثبت رسيد و پس از تاييد مدير سايت قابل مشاهده خواهد بود</b></center>'; else $body = '<center><b style="color:red">با عرض پوزش نظر شما به دليل برخي اشكالات ثبت نشد . لطفا دقايقي ديگر دوباره تلاش كنيد</b></center>'; include( "./themes/{$C->SITE_THEME}/center.php" );}$body = '' ;$c_resm = mysql_query( "SELECT * FROM `ex_post_comment` where pid = '{$id}' and status='1' and priv='0' ORDER BY id DESC limit 100" ) ;while ( $c_ite = @mysql_fetch_array( $c_resm ) ) { preg_match('/(.*)-(.*)-(.*) (.*).*).*)/si', $c_ite['date'] ,$find ) ; if ( $c_ite['email'] || $c_ite['site'] ) { $c_link = '<div class="bot">'; if ( $c_ite['email'] ) $c_link .= '<a href="mailto:'.$c_ite['email'].'">ايميل</a>'; if ( $c_ite['email'] && $c_ite['site'] ) $c_link .= ' || '; if ( $c_ite['site'] ) $c_link .= '<a href="'.$c_ite['site'].'" target="_blank">سايت</a>'; $c_link .= '</div>'; } else $c_link = ''; if ( $body == '' ) $body .= '<br><center>'; $body .= ' <div class="commentbox"> <div class="top"> <div class="name">نویسنده : <span class="author">'.$c_ite['name'].'</span></div> <div class="date" >'.jdate(" l j F Y ساعت H:i:s",mktime($find[4],$find[5],$find[6],$find[2],$find[3],$find[1])).'</div> <div style="clear:both" ></div> </div> <div class="text">'.str_replace("\r\n\r\n","<br>",$c_ite['body']).'</div> '.$c_link.' </div> <div style="height:10px"></div>';}if ( $body ) {$body .= '</center>';$title = "نظر ها";include( "./themes/{$C->SITE_THEME}/main.php" );}$title = 'ارسال نظر';$body = '';$body .= ' <a href="#" id="comment"></a> <form method="post" onsubmit="return IsValidForm(this);"> <input type="hidden" name="c_act" value="add"> <table class="formbox" dir="rtl" border="0" cellpadding="2" align="center"> <tr><td nowrap height="25"> نام شما :</td> <td width="380"><input type="text" name="c_name" id="c_name" class="f_input" /></td></tr> <tr><td nowrap height="25"> ايميل :</td> <td width="380"><input type="text" name="c_email" id="mail" class="f_input" /></td></tr> <tr><td nowrap height="25"> سايت / وبلاگ :</td> <td width="380"><input type="text" name="c_site" id="site" class="f_input" /></td></tr> <tr><td colspan="2" width="100%"><textarea class="textarea" name="c_body"></textarea></td> </tr><tr> <td colspan="2" width="100%"> <input id="c_prv" name="c_prv" type="checkbox" align="absmiddle"><label for="c_prv"> به صورت خصوصي ارسال شود</label></td> </tr> <tr><td colspan="2"><br><input class="button" name="submit" type="submit" id="comm-sub" value="ثبت نظر" /></td></tr> </table> </form>';include( "./themes/{$C->SITE_THEME}/main.php" );/*#############################################*/?>و جدول های دیتابیس هم اینه :DROP TABLE IF EXISTS `ex_post_comment`;CREATE TABLE `ex_post_comment` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `site` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `body` text COLLATE utf8_unicode_ci NOT NULL, `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `priv` int(1) NOT NULL DEFAULT '0', `status` int(1) NOT NULL DEFAULT '0', `pid` int(11) NOT NULL DEFAULT '1', `ip` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;وقتی فرم رو ارسال میکنی صفحه هیچ پیامی نمیده و نظر هم ثبت نمیشه در دیتابیسفقط نمیدونم مشکل کد php کجاست که ثبت نمیشهاتصال به دیتابیس و اینا هم به درستی انجام میشه لینک به ارسال
پست های پیشنهاد شده