|  | 
	                
  
    | 
	 
        ช่วบด้วยเรื่อง win7 กับ app serv ที่เอา php มาแล้วรันไม่ได้ครับ     |  
    |  |  
 
              
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | error นี้ไม่เกี่ยวกับ version ครับ ปัญหาคือหา function ไม่เจอครับ อาจจะลืม include เข้ามาครับ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-11-30 12:41:38 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | อ่อ แก้ไขได้ระดับนึงแล้วครับ แต่เจอแบบนี้อีก -*- 
 Code
 
 Fatal error: Cannot redeclare connect_db() (previously declared in C:\AppServ\www\108items\lib\utility.php:3) in C:\AppServ\www\108items\lib\utility.php on line 11 
 ไม่ทราบว่ามันเปนไรละเนี่ย
 
 ถ้าไม่ได้หรือมันยุ่งยากเกินช่วยบอกหน่อยนะคับ จะได้ไม่ต้องตามแก้
 
 กลับไปทำในเครื่องเพื่อนเลยจะดีกว่า -*-
 
 utility.php
 
 Code (PHP)
 
 <?
function connect_db() {
	$host     = "localhost";
	$username = "root";
	$password = "root";
	$db       = "108item";
	
	@mysql_connect($host, $username, $password) or die("MySQL Connection Failed");
	@mysql_select_db($db) or die("MySQL Select Database Failed");
	mysql_query("SET NAMES utf8") or die(mysql_error());
}
function random_password() {
	$text = "abcdefghijklmnopqrstuvwxyz0123456789";
	
	return substr(str_shuffle($text), 0, 7);
}
function send_mail($from, $to, $subject, $body, $cc = "", $bcc = "", $attach = "") {
	//	To
	$sto = $to;
		
	//	Subject
	$ssubject = "=?UTF-8?B?" . base64_encode($subject) . "?="; 
	
	//	Body & Header
		//	Body, Type
	if ($attach == "" || $attach["size"] == 0) {
		$sbody   = stripslashes($body);
		$sheader = "MIME-Version: 1.0\n"
				   . "Content-type: text/html; charset=utf-8\n";
	}
	else {
		$type  = $attach["type"];
		$name  = $attach["name"];
		$size  = $attach["size"];
		$tname = $attach["tmp_name"];
	
		$file = fopen($tname, "r");
		$data = fread($file, $size);
		$data = chunk_split(base64_encode($data . "\n"));
		fclose($file);
		
		$boundary = uniqid("");
		$sbody    = "--$boundary\n"
					. "Content-type: text/html; charset=utf-8;\n"
					. "Content-transfer-encoding: 16bit\n\n"
					. stripslashes($body) . "\n"
				  . "--$boundary\n"
					. "Content-type: $type; name=$name\n"
					. "Content-transfer-encoding: base64\n\n"
					. $data
					. "--$boundary--";
		$sheader  = "MIME-Version: 1.0\n"
				    . "Content-type: multipart/mixed; boundary=\"$boundary\"\n";
	}
		//	From, CC, BCC
	$sheader .= "From: $from";
	if ($cc != "") {
		$sheader .= "\nCc: $cc";
	}
	
	if ($bcc != "") {
		$sheader .= "\nBcc: $bcc";
	}
	return mail($sto, $ssubject, $sbody, $sheader);
}
function check_login($name, $dest) {
	if (!isset($_SESSION[$name])) {
		header("location:$dest");
		return;
	}
}
?>
 |  
              | 
 ประวัติการแก้ไข
 2010-11-30 13:02:17
 2010-11-30 13:03:29
 2010-11-30 13:08:57
 2010-11-30 13:09:43
 2010-11-30 13:10:20
 2010-11-30 13:15:49
 2010-11-30 13:16:43
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-11-30 13:00:24 | By :
                            ladywizard |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | น่าจะ include ซ้ำน่ะครับ ให้ใช้ require_once("") แทนครับ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-11-30 14:00:11 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |