Faks Posted March 21, 2011 Author Report Share Posted March 21, 2011 (edited) nu tāk nu tad par tiem gļukiem :D ir sekojoš ja tas ir pirmais komentārs sadāļa un mēģiņa viņu edītot tad viņs atsakās to veikt ari neizelk ārā pašu kometāra tekstu ! ir sekojoš ja darbobjas edit tad uzrodas 3 formas,1 nedarbojas ieliek blnaku,outra ieliek informāciju darbojas,treša ieliek blanku ! ir sekojoš ja darbojas komentāra teksta izvilkšana tad rodas cits gļuks katra no 3 forma ir cita komentāra teksts bet 2 forma vienalga darbojas neskatoties uz neko Nu nezinu kungi ja kāds varētu palīdzēt izlabot visus gļukus kuru uzradās tad tas būtu lieliski ! šeit būs pats kods krietini nācās paņemties lai appiet citius gļukus bet tas tā :) ! $comment = mysql_query("SELECT hosting_comment_id,hosting_comment_news_id,hosting_comment_text,hosting_comment_nick,hosting_comment_date FROM hosting_comment WHERE hosting_comment_news_id = '$id' "."limit $offset, $comment_limit") or die(mysql_error()); if (mysql_num_rows($comment) != 0) { while ($row_news_comment = mysql_fetch_array($comment)) { echo "$row_news_comment[hosting_comment_nick] $row_news_comment[hosting_comment_date] "; if ($_SESSION['permission'] >= 2) { echo "<a href='/?section=nwcomment&id=".$id."&comment=edit&id_edit=".$row_news_comment['hosting_comment_id']."'>Edit Comment</a>"." "."<a href='/?section=nwcomment&id=".$id."&comment=delete&id_delete=".$row_news_comment['hosting_comment_id']."'>Delete Comment</a>"; if ($_GET['comment'] == 'edit') { $comment_id_edit = (INT)$_GET['id_edit']; $comment_text = $row_news_comment['hosting_comment_text']; $edit_comment_text = $_POST['hosting_comment_text']; if(isset($_POST['hosting_comment_text'])) { mysql_query("UPDATE hosting_comment SET hosting_comment_text = '".$edit_comment_text."' WHERE hosting_comment_id = '".$comment_id_edit."' ") or die (mysql_error()); } if (isset($_POST['Submit'])) { echo "<meta http-equiv='REFRESH' content='0;url=/?section=nwcomment&id=".$id."'>"; } echo ("<form action='/?section=nwcomment&id=".$id."&comment=edit&id_edit=".$comment_id_edit."'' id='edit_comment' name='edit_comment' method='post'> <p> <textarea name='hosting_comment_text' cols='50' rows='10' id='textarea' value='$edit_comment_text' >$edit_comment_text</textarea> <p> <input type='submit' name='Submit' id='button' value='{$lang['BODY_NEWS_COMMENT_SUBMIT']}' /> <input type='reset' name='Reset' id='button' value='{$lang['BODY_NEWS_COMMENT_RESET']}' /> </p> </form>"); } if ($_GET['comment'] == 'delete') { $comment_id_delete = (INT)$_GET['id_delete']; mysql_query("DELETE FROM hosting_comment WHERE hosting_comment_id = '".$comment_id_delete."' ") or die (mysql_error()); echo "<meta http-equiv='REFRESH' content='0;url=/?section=nwcomment&id=".$id."'>"; } } echo "<br> $row_news_comment[hosting_comment_text] <br>"; } Edited March 21, 2011 by Faks Link to comment Share on other sites More sharing options...
Faks Posted March 24, 2011 Author Report Share Posted March 24, 2011 bump ! Link to comment Share on other sites More sharing options...
mad182 Posted March 24, 2011 Report Share Posted March 24, 2011 Nu ja tu to formu drukā iekš cikla, nepārbaudot vai vispār tiek prasīts konkrētais koments, tad loģiksi, ka parādīsies tik daudz formas, cik ir komentāru. Kverijā tu mierīgi vari lietot *, nevis rakstīt xvinjuzina cik kolonnu nosaukumus, jo tā pat izskatās, ka tu prasi viņas visas :) Link to comment Share on other sites More sharing options...
Faks Posted March 24, 2011 Author Report Share Posted March 24, 2011 (edited) Nu ja tu to formu drukā iekš cikla, nepārbaudot vai vispār tiek prasīts konkrētais koments, tad loģiksi, ka parādīsies tik daudz formas, cik ir komentāru. Kverijā tu mierīgi vari lietot *, nevis rakstīt xvinjuzina cik kolonnu nosaukumus, jo tā pat izskatās, ka tu prasi viņas visas :) iskatas ka es neko nerubu vairs :D maybe ir kāds sample lai cilvēks var kļūt apgaismots :D vai kādu tutoriāli :D Edited March 24, 2011 by Faks Link to comment Share on other sites More sharing options...
daGrevis Posted March 24, 2011 Report Share Posted March 24, 2011 SELECT row1, row2, row3 FROM whatever Būs tas pats, kas... SELECT * FROM whatever ...ja attiecīgajā tabulā nebūs citas rindas. Link to comment Share on other sites More sharing options...
Faks Posted March 24, 2011 Author Report Share Posted March 24, 2011 (edited) konceptuāli man ir viena problēma komentāri visi jaunumu,bloga,foruma ir vienā tabulā ceru ka tas netraucēs :D $select_comment_edit = mysql_query("SELECT hosting_comment_text,hosting_comment_id FROM hosting_comment WHERE hosting_comment_id = '".$comment_id_edit."' ") or die (mysql_error()); $comment_edit = mysql_fetch_array($select_comment_edit); respetivi tu runa par kveriju kurs izvelk vienu (tātād bez while) tikai tēmu kura tiek pieprasīta ar id :) (pamēģināšu ceru ka izdosies ! ) izmēģināju secinājums kļūda ir kaut kur koda faktiski pārbaudot atradu vienu bet kaut ko neredzu vai palaižu garām . Reku ir kods kurš rada gļuku kā noprotu problēma ir ar tokenu kurš bloķē update formu ja ir idejas kā to izlabot būšu starā ! <?php if (isset($_POST['token']) && $_POST['token'] == $_SESSION['token']) { $comment_text = mysql_real_escape_string($_POST['comment_text']); $comment_text = htmlentities($_POST['comment_text']); $comment_text = trim($_POST['comment_text']); $comment_text = stripslashes($_POST['comment_text']); $id = (int)$_GET['id']; unset($_POST['token']); $insert_comment = "INSERT INTO hosting_comment (hosting_comment_nick,hosting_comment_date,hosting_comment_text,hosting_comment_news_id) VALUES ('".$_SESSION['nick']."','".$last_time_seen."','".$comment_text."','".$id."') "; mysql_query($insert_comment); echo "<meta http-equiv='REFRESH' content='0'/>"; } $token = sha1(uniqid(rand(), true)); $_SESSION['token'] = $token; echo ("<h4>{$lang['BODY_NEWS_COMMENT_COMMENT_ADD']}</h4> <form id='form1' name='form1' method='post'> <p> <textarea name='comment_text' cols='50' rows='10' id='textarea'>{$lang['BODY_NEWS_COMMENT_HINT']} </textarea> <input type='hidden' name='token' value='{$token}'/> <p> <input type='submit' name='Submit' id='button' value='{$lang['BODY_NEWS_COMMENT_SUBMIT']}' /> <input type='reset' name='Reset' id='button' value='{$lang['BODY_NEWS_COMMENT_RESET']}' /> </p> </form>"); ?> Edited March 25, 2011 by Faks Link to comment Share on other sites More sharing options...
Faks Posted March 25, 2011 Author Report Share Posted March 25, 2011 mega BUMP kurš ir pietiekoši gudrs lai izpalīdzētu man ? vai vismaz izksaidrotu kā risināt ? Link to comment Share on other sites More sharing options...
briedis Posted March 25, 2011 Report Share Posted March 25, 2011 Paskaties uz šīm rindiņām, ir ok? :) $comment_text = mysql_real_escape_string($_POST['comment_text']); $comment_text = htmlentities($_POST['comment_text']); $comment_text = trim($_POST['comment_text']); $comment_text = stripslashes($_POST['comment_text']); Vai tomēr kaut kas te nav? Link to comment Share on other sites More sharing options...
Faks Posted March 25, 2011 Author Report Share Posted March 25, 2011 (edited) Paskaties uz šīm rindiņām, ir ok? :) $comment_text = mysql_real_escape_string($_POST['comment_text']); $comment_text = htmlentities($_POST['comment_text']); $comment_text = trim($_POST['comment_text']); $comment_text = stripslashes($_POST['comment_text']); Vai tomēr kaut kas te nav? vaitik ne stripslashes viņs nonem pēdiņas ja es kļudos tad nau ne jausmas :D Edited March 25, 2011 by Faks Link to comment Share on other sites More sharing options...
daGrevis Posted March 25, 2011 Report Share Posted March 25, 2011 $comment_text = $_POST['comment_text']; $comment_text = mysql_real_escape_string($comment_text); $comment_text = htmlentities($comment_text); $comment_text = trim($comment_text); $comment_text = stripslashes($comment_text); Link to comment Share on other sites More sharing options...
Faks Posted March 25, 2011 Author Report Share Posted March 25, 2011 (edited) $comment_text = $_POST['comment_text']; $comment_text = mysql_real_escape_string($comment_text); $comment_text = htmlentities($comment_text); $comment_text = trim($comment_text); $comment_text = stripslashes($comment_text); cilveki tas nau saistits ar update formas darbibu bet ideja skaidra nodot vertibu $_post uz mainigo un tad filtret nau nekas bistams ja pat vinas nau bet ka saprotu labak ka ir tādā veida nerada iespēju manupulēt ar formu :) bet tas neatrisina galveno problēmu ! Edited March 25, 2011 by Faks Link to comment Share on other sites More sharing options...
daGrevis Posted March 25, 2011 Report Share Posted March 25, 2011 Neko nesapratu, bet darot tā, kā Tu darīji... Tu $comment_text saturu darot katru nākamo darbību zaudē, jo nepadot to kā nākamās darbības argumentu, bet izmanto tā viena elementu no POST masīva... Link to comment Share on other sites More sharing options...
Recommended Posts