• 27-04-2010, 21:10:34
    #64
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @hhy89, verdiğin birinci kodda $hhy=str_replace("$yusuf","",$dosya); satırındaki yusuf değişkenini tırnak içine almayacaksın. Alırsan $yusuf yazılır, değişkenin değeri değil...
  • 27-04-2010, 21:11:50
    #65
    Üyeliği durduruldu
    by_grafitus adlı üyeden alıntı: mesajı görüntüle
    @hhy89, verdiğin birinci kodda $hhy=str_replace("$yusuf","",$dosya); satırındaki yusuf değişkenini tırnak içine almayacaksın. Alırsan $yusuf yazılır, değişkenin değeri değil...
    değişken tek tırnak içinde ise senin dediğin olur çift tırnakta yine değişken degeri yazılır
  • 27-04-2010, 23:49:48
    #66
    devturkeli adlı üyeden alıntı: mesajı görüntüle
    değişken tek tırnak içinde ise senin dediğin olur çift tırnakta yine değişken degeri yazılır
    Ahh, evet. Ancak yine de doğru bir kullanımmış gibi gelmiyor bana...
  • 28-04-2010, 00:58:43
    #67
    Üyeliği durduruldu
    by_grafitus adlı üyeden alıntı: mesajı görüntüle
    Ahh, evet. Ancak yine de doğru bir kullanımmış gibi gelmiyor bana...
    evet standartlara uygun bir kullanım değildir çift tırnak içinde değişken kullanmak.
  • 26-05-2010, 23:10:48
    #68
    Üyeliği durduruldu
    Function KufurTemizle($yorum){
    $gelenkufur = array('kufur1','kufur2','kufur3','kufur4','kufur n');
    $degisen = array('***','***','***','***','***');
    $yenideger = str_replace($gelenkufur,$degisen,$yorum);
    return $yenideger;
    }
    Php ile küfürlü cümleleri engelleyebilirsiniz. engellemek istediğiniz cümleleri

    $gelenkufur değişkenine ekleyin

    yerine gelecek olan ifadeleride $degisen değişkenine ekleyin.

    her eklediğiniz için $degisen değişkenine *** ya da çevireceğin karakteri ekleyiniz.
  • 05-06-2010, 00:45:41
    #69
    Noktalama hatalarını bir nebzede düzeltebilen nacizade bir fonksiyon:
    function noktalama($metin)
    {
    	// Mustafa Dokumacı tarafından yazılmıştır...
    	return stripslashes(preg_replace(array(
    		'~([^\s.,;:!?]{2,})\s+([.,;:!?])~u',
    		'~([^\s.,;:!?]{2,})([.,;:!?]+)([^\s.0-9"\'„”’›»])~u',
    		'~(\s)+[.,;:!?]+\s+~u',
    		'~\.{4,}~u',
    		'~\.{3,}\s*$~u',
    		'~^\s+~um',
    		'~\s+$~um',
    		'~\r+~u',
    		'~\n{2,}~u',
    		'~\s{2,}~u',
    		'~((ht|f)tps?: //|[-a-z0-9]{2,}\. )([-a-z0-9/]{2,}\. )+[-a-z0-9]{2,4}~uie',
    		'~(^|\s)([-a-z0-9]{2,}\. )+(com|de|net|co\.[a-z]{2}|org|info|it|biz|nl|cc|tv|com\.[a-z]{2}|ch|br|dk|us|ca|ws|be|cz|no|at|fr|pl|ru|net\.[a-z]{2})(/[-a-z0-9.]+)*([\s.0-9"\'„”’›»]|$)~uie',
    		'~(^|[^0-9.?!]{2,}[.?!]\s)(["\'“‘‹«]?\s?)([^\s])~ue'
    	), array(
    		'$1$2',
    		'$1$2 $3',
    		'$1',
    		'...',
    		'.',
    		'',
    		'',
    		"\n",
    		"\n",
    		' ',
    		'strtr("$0", array(": "=>":", ". "=>"."))',
    		'strtr("$0", array(": "=>":", ". "=>"."))',
    		"'$1$2' . mb_strtoupper('$3')"
    	), $metin));
    }
    Düzeltebildiği hatalar:
    1. Noktalama işaretlerinin bir önceki kelimeye bitişik yazılmaması.
    2. Noktalama işaretlerinden sonra bir boşluk bırakılmaması.
    3. Üç nokta yerine 4, 5 ya da daha fazla nokta konulması.
    4. Metnin en sonunda üç nokta kullanılması.
    5. Metnin içinde herhangi bir yerde birden fazla boşluk bırakılması.
    6. Paragraflar arası boşluk bırakmak için boş satırlar bırakılması.
    7. Noktadan sonra cümleye küçük harfle başlanması.
  • 07-06-2010, 01:44:29
    #70
    username (kullanıcı adı)'nda rakam (sayısal) olmasını istemiyorsanız kontrol fonksiyonu

    Buradaki Arkadaşın isteiği üzerine Yapılmıştır..
    https://www.r10.net/php/650370-if-kon...inda-soru.html

    <?
    //Post'dan Gelen Değer
    $Username = "Bytrislasis";
    
    function kontrol ($str){
    Preg_Match("/(\d+)/",TRIM($str),$isim);
    Echo (is_numeric($isim[0]) == TRUE) || (EMPTY($str)) 
    ? "Kullanıcı Adınız Rakamlardan Oluşamaz<br>Boş Bırakılamaz" 
    : "Kullanıcı Adınız : ".$str;
                        }
    //Örnek Kullanım
    kontrol($Username);
    ?>
  • 26-06-2010, 18:52:45
    #71
    class SessionStorageApc
    {
    	/**
    	* Constructor
    	*
    	* @access protected
    	* @param array $options optional parameters
    	*/
    	function __construct()
    	{
    		session_set_save_handler(
    			array($this, 'open'),
    			array($this, 'close'),
    			array($this, 'read'),
    			array($this, 'write'),
    			array($this, 'destroy'),
    			array($this, 'gc')
    		);
    	}
    
    	/**
    	 * Open the SessionHandler backend.
    	 *
    	 * @access public
    	 * @param string $save_path     The path to the session object.
    	 * @param string $session_name  The name of the session.
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function open($save_path, $session_name)
    	{
    		return true;
    	}
    
    	/**
    	 * Close the SessionHandler backend.
    	 *
    	 * @access public
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function close()
    	{
    		return true;
    	}
    
     	/**
     	 * Read the data for a particular session identifier from the
     	 * SessionHandler backend.
     	 *
     	 * @access public
     	 * @param string $id  The session identifier.
     	 * @return string  The session data.
     	 */
    	function read($id)
    	{
    		//$sess_id = 'sess_'.$id;
    		return (string) apc_fetch('sess_'.$id);
    	}
    
    	/**
    	 * Write session data to the SessionHandler backend.
    	 *
    	 * @access public
    	 * @param string $id            The session identifier.
    	 * @param string $session_data  The session data.
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function write($id, $session_data)
    	{
    		//$sess_id = 'sess_'.$id;
    		return apc_store('sess_'.$id, $session_data, ini_get("session.gc_maxlifetime"));
    	}
    
    	/**
    	  * Destroy the data for a particular session identifier in the
    	  * SessionHandler backend.
    	  *
    	  * @access public
    	  * @param string $id  The session identifier.
    	  * @return boolean  True on success, false otherwise.
    	  */
    	function destroy($id)
    	{
    		//$sess_id = 'sess_'.$id;
    		return apc_delete('sess_'.$id);
    	}
    
    	/**
    	 * Garbage collect stale sessions from the SessionHandler backend.
    	 *
    	 * @access public
    	 * @param integer $maxlifetime  The maximum age of a session.
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function gc($maxlifetime)
    	{
    		return true;
    	}
    
    }
    joomla kütüphanesinden editlenmiştir. Kullanmak için php APC eklentisi kurulu olmalıdır.

    kullanımı çok basittir
    new SessionStorageApc;
    session_start();
  • 30-06-2010, 10:02:13
    #72
    python adlı üyeden alıntı: mesajı görüntüle
    class SessionStorageApc
    {
    	/**
    	* Constructor
    	*
    	* @access protected
    	* @param array $options optional parameters
    	*/
    	function __construct()
    	{
    		session_set_save_handler(
    			array($this, 'open'),
    			array($this, 'close'),
    			array($this, 'read'),
    			array($this, 'write'),
    			array($this, 'destroy'),
    			array($this, 'gc')
    		);
    	}
    
    	/**
    	 * Open the SessionHandler backend.
    	 *
    	 * @access public
    	 * @param string $save_path     The path to the session object.
    	 * @param string $session_name  The name of the session.
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function open($save_path, $session_name)
    	{
    		return true;
    	}
    
    	/**
    	 * Close the SessionHandler backend.
    	 *
    	 * @access public
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function close()
    	{
    		return true;
    	}
    
     	/**
     	 * Read the data for a particular session identifier from the
     	 * SessionHandler backend.
     	 *
     	 * @access public
     	 * @param string $id  The session identifier.
     	 * @return string  The session data.
     	 */
    	function read($id)
    	{
    		//$sess_id = 'sess_'.$id;
    		return (string) apc_fetch('sess_'.$id);
    	}
    
    	/**
    	 * Write session data to the SessionHandler backend.
    	 *
    	 * @access public
    	 * @param string $id            The session identifier.
    	 * @param string $session_data  The session data.
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function write($id, $session_data)
    	{
    		//$sess_id = 'sess_'.$id;
    		return apc_store('sess_'.$id, $session_data, ini_get("session.gc_maxlifetime"));
    	}
    
    	/**
    	  * Destroy the data for a particular session identifier in the
    	  * SessionHandler backend.
    	  *
    	  * @access public
    	  * @param string $id  The session identifier.
    	  * @return boolean  True on success, false otherwise.
    	  */
    	function destroy($id)
    	{
    		//$sess_id = 'sess_'.$id;
    		return apc_delete('sess_'.$id);
    	}
    
    	/**
    	 * Garbage collect stale sessions from the SessionHandler backend.
    	 *
    	 * @access public
    	 * @param integer $maxlifetime  The maximum age of a session.
    	 * @return boolean  True on success, false otherwise.
    	 */
    	function gc($maxlifetime)
    	{
    		return true;
    	}
    
    }
    joomla kütüphanesinden editlenmiştir. Kullanmak için php APC eklentisi kurulu olmalıdır.

    kullanımı çok basittir
    new SessionStorageApc;
    session_start();
    tam olarak ne işe yarıyor ?