• 12-12-2013, 22:56:39
    #1
    iyisite.NET
    Merhaba arkadaşlar auto portal scripti kullanıyorum ve önceden almadığım hatayı şuan almaya başladım. Haber eklemek istediğimde ekleyemiyorum.

    Aldığım hata aynen şöyle
    Alıntı
    Fatal error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ın muhalefete yönelik '
    ',resimyolu='haber/deneme-inceden.jpg',manset' at line 1 in /home/deneme/public_html/yonetim/plugin/habersave.php on line 54
  • 12-12-2013, 23:17:54
    #2
    Eklemek istediğiniz verinin içinde tırnak olduğu için hata alıyorsunuz.


    $mesaj = mysql_real_escape_string(stripslashes($mesaj));
    şeklinde temizledikten sonra eklerseniz bu şekilde hata almazsınız ve daha güvenli olur.
  • 12-12-2013, 23:34:57
    #3
    iyisite.NET
    mtn adlı üyeden alıntı: mesajı görüntüle
    Eklemek istediğiniz verinin içinde tırnak olduğu için hata alıyorsunuz.


    $mesaj = mysql_real_escape_string(stripslashes($mesaj));
    şeklinde temizledikten sonra eklerseniz bu şekilde hata almazsınız ve daha güvenli olur.
    Teşekkürler
    Bu kodu nerede kullanacağım hocam ?
  • 13-12-2013, 13:18:33
    #4
    Hocam merhabalar.

    habersave.php dosyasını paylaşır mısın?
  • 13-12-2013, 13:40:56
    #5
    iyisite.NET
    soulmy adlı üyeden alıntı: mesajı görüntüle
    Hocam merhabalar.

    habersave.php dosyasını paylaşır mısın?

    <?php
    
    
    
    function temizle($url)
    
    {
    
    $url = trim($url);
    
    $find = array('<b>', '</b>');
    
    $url = str_replace ($find, '', $url);
    
    $url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);
    
    $find = array(' ', '&amp;quot;', '&amp;amp;', '&amp;', '\r\n', '\n', '/', '\\', '+', '<', '>');
    
    $url = str_replace ($find, '-', $url);
    
    $find = array('.','..', '...');
    
    $url = str_replace ($find, '', $url);
    
    $find = array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê');
    
    $url = str_replace ($find, 'e', $url);
    
    $find = array('í', 'ý', 'ì', 'î', 'ï', 'I', 'Ý', 'Í', 'Ì', 'Î', 'Ï','İ','ı');
    
    $url = str_replace ($find, 'i', $url);
    
    $find = array('ó', 'ö', 'Ö', 'ò', 'ô', 'Ó', 'Ò', 'Ô');
    
    $url = str_replace ($find, 'o', $url);
    
    $find = array('á', 'ä', 'â', 'à', 'â', 'Ä', 'Â', 'Á', 'À', 'Â');
    
    $url = str_replace ($find, 'a', $url);
    
    $find = array('ú', 'ü', 'Ü', 'ù', 'û', 'Ú', 'Ù', 'Û');
    
    $url = str_replace ($find, 'u', $url);
    
    $find = array('ç', 'Ç');
    
    $url = str_replace ($find, 'c', $url);
    
    $find = array('þ', 'Þ','ş','Ş');
    
    $url = str_replace ($find, 's', $url);
    
    $find = array('ð', 'Ð','ğ','Ğ');
    
    $url = str_replace ($find, 'g', $url);
    
    $find = array('/[^A-Za-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');
    
    $repl = array('', '-', '');
    
    $url = preg_replace ($find, $repl, $url);
    
    $url = str_replace ('--', '-', $url);
    
    $url = strtolower($url);
    
    return $url;
    
    }
    
    
    
    if(isset($_POST['gonder'])){
    
    	
    
    $baslik = $_POST['baslik'];
    
    $icerik = $_POST['icerik'];
    
    $resimyolu = $_POST['resimyolu'];
    
    $manset = $_POST['manset'];
    
    $url=temizle($baslik);
    
    
    
    if($baslik==""||$icerik==""||$resimyolu==""){
    
    
    
    echo '<div class="error msg" style="width:300px;">Alanları boş geçemezsiniz!</div>'; }else{
    
    
    
    mysql_query("SET NAMES 'utf8'");
    
    mysql_query("SET CHARACTER SET utf8");
    
    mysql_query("SET COLLATION_CONNECTION = 'utf8_bin'");
    
    $mysql="UPDATE news SET baslik='$baslik',icerik='$icerik',resimyolu='$resimyolu',manset='$manset',sefurl='$url' where id='$id'";
    
    
    
    $sorgu12 = mysql_query($mysql) or trigger_error(mysql_error(),E_USER_ERROR);
    
    
    
     echo "	<div class='done msg' style='width:200px;'>
    
    		<b>Düzenleme Kaydedildi!</b>
    
    			</div>";
    
    } }
    
    ?>
  • 13-12-2013, 13:51:41
    #6
    Bu şekilde olması lazım.

    <?php
    
    
    
    function temizle($url)
    
    {
    
    $url = trim($url);
    
    $find = array('<b>', '</b>');
    
    $url = str_replace ($find, '', $url);
    
    $url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);
    
    $find = array(' ', '&amp;quot;', '&amp;amp;', '&amp;', '\r\n', '\n', '/', '\\', '+', '<', '>');
    
    $url = str_replace ($find, '-', $url);
    
    $find = array('.','..', '...');
    
    $url = str_replace ($find, '', $url);
    
    $find = array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê');
    
    $url = str_replace ($find, 'e', $url);
    
    $find = array('í', 'ý', 'ì', 'î', 'ï', 'I', 'Ý', 'Í', 'Ì', 'Î', 'Ï','İ','ı');
    
    $url = str_replace ($find, 'i', $url);
    
    $find = array('ó', 'ö', 'Ö', 'ò', 'ô', 'Ó', 'Ò', 'Ô');
    
    $url = str_replace ($find, 'o', $url);
    
    $find = array('á', 'ä', 'â', 'à', 'â', 'Ä', 'Â', 'Á', 'À', 'Â');
    
    $url = str_replace ($find, 'a', $url);
    
    $find = array('ú', 'ü', 'Ü', 'ù', 'û', 'Ú', 'Ù', 'Û');
    
    $url = str_replace ($find, 'u', $url);
    
    $find = array('ç', 'Ç');
    
    $url = str_replace ($find, 'c', $url);
    
    $find = array('þ', 'Þ','ş','Ş');
    
    $url = str_replace ($find, 's', $url);
    
    $find = array('ð', 'Ð','ğ','Ğ');
    
    $url = str_replace ($find, 'g', $url);
    
    $find = array('/[^A-Za-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');
    
    $repl = array('', '-', '');
    
    $url = preg_replace ($find, $repl, $url);
    
    $url = str_replace ('--', '-', $url);
    
    $url = strtolower($url);
    
    return $url;
    
    }
    
    
    
    if(isset($_POST['gonder'])){
    
    
    
    $baslik = $_POST['baslik'];
    
    $icerik = $_POST['icerik'];
    
    $resimyolu = $_POST['resimyolu'];
    
    $manset = $_POST['manset'];
    
    $url=temizle($baslik);
    
    
    
    if($baslik==""||$icerik==""||$resimyolu==""){
    
    
    
    echo '<div class="error msg" style="width:300px;">Alanları boş geçemezsiniz!</div>'; }else{
    
    
    
    mysql_query("SET NAMES 'utf8'");
    
    mysql_query("SET CHARACTER SET utf8");
    
    mysql_query("SET COLLATION_CONNECTION = 'utf8_bin'");
    
    $baslik = mysql_real_escape_string($baslik);
    $icerik = mysql_real_escape_string($icerik);
    $resimyolu = mysql_real_escape_string($resimyolu);
    $manset = mysql_real_escape_string($manset);
    $url = mysql_real_escape_string($url);
    $id = mysql_real_escape_string($id);
    
    
    $mysql="UPDATE news SET baslik='$baslik',icerik='$icerik',resimyolu='$resimyolu',manset='$manset',sefurl='$url' where id='$id'";
    
    
    
    $sorgu12 = mysql_query($mysql) or trigger_error(mysql_error(),E_USER_ERROR);
    
    
    
    echo "  <div class='done msg' style='width:200px;'>
    
    <b>Düzenleme Kaydedildi!</b>
    
     </div>";
    
    } }
    
    ?>
  • 14-12-2013, 00:28:12
    #7
    iyisite.NET
    Teşekkürler bu oldu lakin bir hata daha var, haber ekliyorum haber eklendi diyor ama haber yok.
  • 14-12-2013, 00:30:39
    #8
    Haber ekleme kodları görsek...
  • 14-12-2013, 00:48:43
    #9
    iyisite.NET
    soulmy adlı üyeden alıntı: mesajı görüntüle
    Haber ekleme kodları görsek...
    Onu yazarım da birde şuna ihtiyacım var.
    Alttaki koda limit eklemeliyim, video başlığı istediğim karakterde olsun istiyorum.

    			<div class="box">
    				<h2>Videolar</h2>
    				<ul class="line">
    <?php $as3d = mysql_query("select * from videash order by id desc limit 0,3"); if(mysql_num_rows($as3d)!="0"){ while($bc3d = mysql_fetch_array($as3d)){ ?>										
    				    <li>
    					<?php if($print['seourl']==".php"){ ?>
    				    	<a class="frm" href="video.php?url=<?php echo $bc3d['sefurl']; ?>"><img src="<?php echo $bc3d['resimyolu']; ?>" alt="" width="180" height="135" /></a>
    				    	<a href="video.php?url=<?php echo $bc3d['sefurl']; ?>"><?php echo $bc3d['baslik']; ?></a>
    					<?php }elseif($print['seourl']==".html"){ ?>
    				    	<a class="frm" href="video-<?php echo $bc3d['sefurl']; ?>.html"><img src="<?php echo $bc3d['resimyolu']; ?>" alt="" width="180" height="135" /></a>
    				    	<a href="video-<?php echo $bc3d['sefurl']; ?>.html"><?php echo $bc3d['baslik']; ?></a>
    					<?php } ?>			
    		    		</li>
    <?php } }else{ echo '<li>Henüz bir video eklenmemiş.</li>'; } ?>					
    				</ul>
    				<div class="cl">&nbsp;</div>
    			</div>