• 26-08-2010, 09:34:22
    #1
    Üyeliği durduruldu
    arkadaşlar formdan veri tabanına veri yolluyorum ama Türkçe karakterleri farklı yolluyor ? ve belirsiz karaktaerler gibi.
    gönderdiğm sayfanın kodları aşağıdaki gibi
    <?php require_once('Connections/baglanti.php'); ?><?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
    
    // ** Logout the current user. **
    $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
    if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
      $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
      //to fully log out a visitor we need to clear the session varialbles
      $_SESSION['MM_Username'] = NULL;
      $_SESSION['MM_UserGroup'] = NULL;
      $_SESSION['PrevUrl'] = NULL;
      unset($_SESSION['MM_Username']);
      unset($_SESSION['MM_UserGroup']);
      unset($_SESSION['PrevUrl']);
    	
      $logoutGoTo = "login.php";
      if ($logoutGoTo) {
        header("Location: $logoutGoTo");
        exit;
      }
    }
    ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO dersler (baslik, kategori, icerik, kl, il) VALUES (%s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['text1'], "text"),
                           GetSQLValueString($_POST['textfield'], "text"),
                           GetSQLValueString($_POST['textfield2'], "text"),
                           GetSQLValueString($_POST['textfield'], "text"),
                           GetSQLValueString($_POST['text2'], "text"));
    
      mysql_select_db($database_baglanti, $baglanti);
      $Result1 = mysql_query($insertSQL, $baglanti) or die(mysql_error());
    
      $insertGoTo = "basaili.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
    		<title>Admin Paneli </title>
           
            <!-- CSS Reset -->
    		<link rel="stylesheet" type="text/css" href="reset.css" tppabs="http://www.xooom.pl/work/magicadmin/css/reset.css" media="screen" />
           
            <!-- Fluid 960 Grid System - CSS framework -->
    		<link rel="stylesheet" type="text/css" href="grid.css" tppabs="http://www.xooom.pl/work/magicadmin/css/grid.css" media="screen" />
    		
            <!-- IE Hacks for the Fluid 960 Grid System -->
            <!--[if IE 6]><link rel="stylesheet" type="text/css" href="ie6.css" tppabs="http://www.xooom.pl/work/magicadmin/css/ie6.css" media="screen" /><![endif]-->
    		<!--[if IE 7]><link rel="stylesheet" type="text/css" href="ie.css" tppabs="http://www.xooom.pl/work/magicadmin/css/ie.css" media="screen" /><![endif]-->
            
            <!-- Main stylesheet -->
            <link rel="stylesheet" type="text/css" href="styles.css" tppabs="http://www.xooom.pl/work/magicadmin/css/styles.css" media="screen" />
            
            <!-- WYSIWYG editor stylesheet -->
            <link rel="stylesheet" type="text/css" href="jquery.wysiwyg.css" tppabs="http://www.xooom.pl/work/magicadmin/css/jquery.wysiwyg.css" media="screen" />
            
            <!-- Table sorter stylesheet -->
            <link rel="stylesheet" type="text/css" href="tablesorter.css" tppabs="http://www.xooom.pl/work/magicadmin/css/tablesorter.css" media="screen" />
            
            <!-- Thickbox stylesheet -->
            <link rel="stylesheet" type="text/css" href="thickbox.css" tppabs="http://www.xooom.pl/work/magicadmin/css/thickbox.css" media="screen" />
            
            <!-- Themes. Below are several color themes. Uncomment the line of your choice to switch to different color. All styles commented out means blue theme. -->
            <link rel="stylesheet" type="text/css" href="theme-blue.css" tppabs="http://www.xooom.pl/work/magicadmin/css/theme-blue.css" media="screen" />
            <!--<link rel="stylesheet" type="text/css" href="css/theme-red.css" media="screen" />-->
            <!--<link rel="stylesheet" type="text/css" href="css/theme-yellow.css" media="screen" />-->
            <!--<link rel="stylesheet" type="text/css" href="css/theme-green.css" media="screen" />-->
            <!--<link rel="stylesheet" type="text/css" href="css/theme-graphite.css" media="screen" />-->
            
    		<!-- JQuery engine script-->
    		<script type="text/javascript" src="jquery-1.3.2.min.js" tppabs="http://www.xooom.pl/work/magicadmin/js/jquery-1.3.2.min.js"></script>
            
    		<!-- JQuery WYSIWYG plugin script -->
    		<script type="text/javascript" src="jquery.wysiwyg.js" tppabs="http://www.xooom.pl/work/magicadmin/js/jquery.wysiwyg.js"></script>
            
            <!-- JQuery tablesorter plugin script-->
    		<script type="text/javascript" src="jquery.tablesorter.min.js" tppabs="http://www.xooom.pl/work/magicadmin/js/jquery.tablesorter.min.js"></script>
            
    		<!-- JQuery pager plugin script for tablesorter tables -->
    		<script type="text/javascript" src="jquery.tablesorter.pager.js" tppabs="http://www.xooom.pl/work/magicadmin/js/jquery.tablesorter.pager.js"></script>
            
    		<!-- JQuery password strength plugin script -->
    		<script type="text/javascript" src="jquery.pstrength-min.1.2.js" tppabs="http://www.xooom.pl/work/magicadmin/js/jquery.pstrength-min.1.2.js"></script>
            
    		<!-- JQuery thickbox plugin script -->
    		<script type="text/javascript" src="thickbox.js" tppabs="http://www.xooom.pl/work/magicadmin/js/thickbox.js"></script>
            
            <!-- Initiate WYIWYG text area -->
    		<script type="text/javascript">
    			$(function()
    			{
    			$('#wysiwyg').wysiwyg(
    			{
    			controls : {
    			separator01 : { visible : true },
    			separator03 : { visible : true },
    			separator04 : { visible : true },
    			separator00 : { visible : true },
    			separator07 : { visible : false },
    			separator02 : { visible : false },
    			separator08 : { visible : false },
    			insertOrderedList : { visible : true },
    			insertUnorderedList : { visible : true },
    			undo: { visible : true },
    			redo: { visible : true },
    			justifyLeft: { visible : true },
    			justifyCenter: { visible : true },
    			justifyRight: { visible : true },
    			justifyFull: { visible : true },
    			subscript: { visible : true },
    			superscript: { visible : true },
    			underline: { visible : true },
                increaseFontSize : { visible : false },
                decreaseFontSize : { visible : false }
    			}
    			} );
    			});
            </script>
            
            <!-- Initiate tablesorter script -->
            <script type="text/javascript">
    			$(document).ready(function() { 
    				$("#myTable") 
    				.tablesorter({
    					// zebra coloring
    					widgets: ['zebra'],
    					// pass the headers argument and assing a object 
    					headers: { 
    						// assign the sixth column (we start counting zero) 
    						6: { 
    							// disable it by setting the property sorter to false 
    							sorter: false 
    						} 
    					}
    				}) 
    			.tablesorterPager({container: $("#pager")}); 
    		}); 
    		</script>
            
            <!-- Initiate password strength script -->
    		<script type="text/javascript">
    			$(function() {
    			$('.password').pstrength();
    			});
            </script>
    	</head>
    	<body>
        	<!-- Header -->
            <div id="header">
                <!-- Header. Status part -->
                <div id="header-status">
                  <div class="container_12">
                      <div class="grid_8">
    					&nbsp;
                        </div>
    <div class="grid_4">
                            <a href="<?php echo $logoutAction ?>" id="logout">Çıkış</a>                    </div>
    </div>
                    <div style="clear:both;"></div>
                </div> <!-- End #header-status -->
                
                <!-- Header. Main part -->
                <div id="header-main">
                    <div class="container_12">
                        <div class="grid_12">
                            <div id="logo">
                                <ul id="nav">
                                    <li id="current"><a href="index.php">Hızlı sayfa </a></li>
                                    <li><a href="makaleler.php">Makaleler</a></li>
                                    <li><a href="dosyalar.php">Dosyalar</a></li>
                                    <li><a href="profil.php">Profilim</a></li>
                                    <li><a href="ayarlar.php">Ayarlar</a></li>
                                </ul>
                            </div><!-- End. #Logo -->
                        </div><!-- End. .grid_12-->
                        <div style="clear: both;"></div>
                    </div><!-- End. .container_12 -->
                </div> <!-- End #header-main -->
                <div style="clear: both;"></div>
                <!-- Sub navigation -->
                <div id="subnav">
                    <div class="container_12">
                        <div class="grid_12">
                            <ul>
                                <li></li>
                                <li></li>
                                <li></li>
                                <li></li>
                                <li></li>
                            </ul>
                            
                        </div><!-- End. .grid_12-->
                    </div><!-- End. .container_12 -->
                    <div style="clear: both;"></div>
                </div> <!-- End #subnav -->
            </div> <!-- End #header -->
            
    		<div class="container_12">
            
    
                
                <!-- Dashboard icons -->
                <div class="grid_7">
                  <div style="clear: both"></div>
        </div>
    <!-- End .grid_7 -->
                
                <!-- Account overview -->
                <div class="grid_5">
                    <div class="module">
                      <h2>Makale ekle </h2>
                            
                      <div class="module-body">
                            
    <p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript">
            function text2yaz(val) {
                document.form1.text2.value = cevir(val);
            }
            function cevir(val) {
                var tempstr = ""
                var i;
                for (i = 0; i <= val.length - 1; i++) {
                    tempstr = tempstr + harfcevir(val.substr(i, 1));
                }
                return tempstr;
            }
            function harfcevir(h) {
                if (h == "ç") return "c";
                if (h == "ı") return "i";
                if (h == "ğ") return "g";
                if (h == "ö") return "o";
                if (h == "ş") return "s";
                if (h == "ü") return "u";
                if (h == " ") return "-";
                return h;
            }
        </script>
    </head>
    <body>
    <form method="POST" action="<?php echo $editFormAction; ?>" name="form1">
        <p>&nbsp;</p>
        <table width="459" border="1">
          <tr>
            <td width="111">Başlık</td>
            <td width="332"><input name="text1" size="40" value="" onkeyup="text2yaz(this.value)" /></td>
          </tr>
          <tr>
            <td>Sef link </td>
            <td><input name="text2" size="40" value="" /></td>
          </tr>
          <tr>
            <td>Kategori:</td>
            <td><label>
              <input name="textfield" type="text" size="40" />
            </label></td>
          </tr>
          <tr>
            <td>İçerik</td>
            <td><label>
              <textarea name="textfield2" cols="40"></textarea>
            </label></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><label>
              <input type="submit" name="Submit" value="Kaydet" />
            </label></td>
          </tr>
        </table>
      <p><br />
        </p>
      <input type="hidden" name="MM_insert" value="form1">
    </form>
    </body>
    </html>
    </p>
    </div>
                    </div>
                    <div style="clear:both;"></div>
                </div> <!-- End .grid_5 -->
                
                <div style="clear:both;">
                  <p>&nbsp;</p>
                  <p><br />
                  </p>
  • 26-08-2010, 10:16:54
    #2
    bir konuda da başka bir kodlama paylaşmıştın ve ondada getsqlvaluestring fonksiyonu vardı her dosyaya koymak yerine bir dosyaya koyup include etsen daha iyi olur

    bu arada sorunun mysql deki tablonun karakter eşlem ayarlarıyla ilgili olabilir,tabloyu utf8 e çevirin öyle değilse,yada php uzantılı dosyalarınızı Notepad++ programıyla açıp Utf-8 olarak kaydedin
  • 26-08-2010, 17:45:23
    #3
    Üyeliği durduruldu
    Deimosx adlı üyeden alıntı: mesajı görüntüle
    bir konuda da başka bir kodlama paylaşmıştın ve ondada getsqlvaluestring fonksiyonu vardı her dosyaya koymak yerine bir dosyaya koyup include etsen daha iyi olur

    bu arada sorunun mysql deki tablonun karakter eşlem ayarlarıyla ilgili olabilir,tabloyu utf8 e çevirin öyle değilse,yada php uzantılı dosyalarınızı Notepad++ programıyla açıp Utf-8 olarak kaydedin
    kaç defa denedim yemiyor çÄ�çüÅ�i,-Å�Ä�üİÅ� böyle görünüyor