İyinet'e Hoşgeldiniz!

Türkiye'nin En Eski Webmaster Forum'una Hemen Kayıt Olun!

Kayıt Ol!

Üyeliği Aktif Edene 25 Tl :)

GameStaL

0
İyinet Üyesi
Katılım
26 Nisan 2010
Mesajlar
142
Reaction score
1
üyelik panelinde yeni üye oldunduğunda böyle bir hata veriyor.. Sebebi hakkında yardımcı olur musunuz ? sorunu giderene iş sonu ziraatten 25 Tl. havale yada Eft

Üyeliğin olduğu sayfa burasıdır.. http://www.vipsro.com/register
Hata : (linkten üye olmayı denerseniz aynı hatayı alırsınız...

could not find driver
Fatal error: Call to a member function prepare() on a non-object in C:\AppServ\www\class.silkroad.php on line 79

ilgili index kodları bu
PHP:
<?php
/*
 @Silkroad Scripts
 @Author	: Llairenm Ilai - Brasil
 @Version	: 1.5
 -- ---------------------------------------------------
 You must have a version of PHP with support for PDO(PHP Data Objects)
 and have the drive PDO odbc installed.
*/

class silkroad{
	// ODBC SQL Driver
	private $odbc_driver = 'SQL Server Native Client 10.0';
	
	private $SQL_host = 'WIN-C8FSCXM6RHH\SQLEXPRESS'; // PC-NAME\SQLEXPRESS
	private $SQL_user = 'xxxxx'; // SQL User
	private $SQL_pass = 'xxxxxxxx'; // SQL Password
	private $SQL_db_account = "xxxx"; // Name DB Account
	private $SQL_db_shard = "xxxxxxxxx"; //  Name DB Shard
	
	public $conn;
	
	function odbcConnect($database){
		try{
			$this->conn = new PDO("odbc:Driver={".$this->odbc_driver."};Server=".$this->SQL_host.";Database=".$database.";", $this->SQL_user, $this->SQL_pass);
		}catch(PDOException $e){
			echo $e->getMessage();
		}
	}
	
	function checkStr($string){
		if(preg_match("/[a-zA-Z0-9_-]/", $string)): return true;
		else: return false; endif;
	}
	
	function msg($text, $script = ""){
		$msg = '<script type="text/javascript">';
		$msg.= 'alert("' . $text . '");' . $script;
		$msg.= '</script>';
		
		echo $msg;
	}
	
	function createAccount(){
		if(isset($_POST['silkroad_register']) && !empty($_POST['silkroad_register'])):
			$userid		= trim($_POST['userid']);
			$password	= trim($_POST['password']);
			$confpassw	= trim($_POST['confpassw']);
			$email		= trim($_POST['email']);
			$+++		= trim($_POST['+++']);
			
			switch($+++):
				case 0: $+++2 = 'M'; break;
				case 1: $+++2 = 'F'; break;
			endswitch;
			
			$msg = array();
			
			if(strlen($userid) < 3): $msg[] = "Username too short!"; endif;
			if(strlen($password) < 6): $msg[] = "Password must be between 6 and 32 characters."; endif;
			if(strlen($confpassw) < 6): $msg[] = "Confirmation Password must be between 6 and 32 characters."; endif;
			if($password != $confpassw): $msg[] = "Passwords are not the same!"; endif;
			if(!preg_match("/^[a-z0-9_-]+(\.[a-z0-9_-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email)): $msg[] = "Invalid email address."; endif;
			
			if($this->checkStr($userid) === false): $msg[] = "Username contains forbidden symbols"; endif;
			if($this->checkStr($password) === false): $msg[] = "Password contains forbidden symbols"; endif;
			if($this->checkStr($confpassw) === false): $msg[] = "Confirmation Password contains forbidden symbols"; endif;
			
			if(count($msg) > 0):
				for($i = 0; $i < count($msg); $i++):
					$error.= '- '. $msg[$i].'\n';
				endfor;
				
				$this->msg($error, 'history.back();');
			else:
				// Open Connection
				$this->odbcConnect($this->SQL_db_account);
				
				$accountExists = $this->conn->prepare("SELECT StrUserID FROM [dbo].[TB_User] WHERE StrUserID = :userid");
				$accountExists->execute(array(":userid" => $userid));
				
				if($accountExists->fetch(PDO::FETCH_NUM) > 0): $this->msg("Account with such username already exists!",'history.back();');
				else:
					$md5_password = md5($password);
					$insert = $this->conn->prepare("INSERT INTO [dbo].[TB_User](StrUserID,
																				password,
																				Name,
																				Email,
																				+++,
																				regtime,
																				reg_ip,
																				sec_primary,
																				sec_content)
																		 VALUES(:userid,
																				:password,
																				:name,
																				:email,
																				:+++,
																				GETDATE(),
																				:ip,
																				'3',
																				'3')");
					$insert->bindValue(":userid", $userid, PDO::PARAM_STR);
					$insert->bindValue(":password", $md5_password, PDO::PARAM_STR);
					$insert->bindValue(":name", 'No Name', PDO::PARAM_STR);
					$insert->bindValue(":email", $email, PDO::PARAM_STR);
					$insert->bindValue(":+++", $+++2, PDO::PARAM_STR);
					$insert->bindValue(":ip", $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
					$insert->execute();
					
					if($insert->rowCount() > 0):
						$this->msg("Account successfully created!");
					else:
						$this->msg("Error creating account!",'history.back();');
					endif;
				endif;
			endif;
		endif;
	}
	
	function playerRank($top = 100){
		$this->odbcConnect($this->SQL_db_shard);
		
		$players = $this->conn->query("SELECT TOP ".$top." c.CharName16, c.MaxLevel, g.Name
									   FROM [dbo].[_Char] as c
									   LEFT JOIN [dbo].[_Guild] as g
									   ON c.GuildID = g.ID
									   ORDER BY c.MaxLevel DESC, c.CurLevel DESC, InventorySize DESC");
		
		$i = 1;
		while($pRows = $players->fetch(PDO::FETCH_ASSOC)):
			echo '<tr>
					<td style="text-align:center;">'.$i.'º</td>
					<td>'.$pRows['CharName16'].'</td>
					<td>'.$pRows['NickName16'].'</td>
					<td style="text-align:center;">'.$pRows['MaxLevel'].'</td>
					<td>'.$pRows['Name'].'</td>
				  </tr>';
			$i++;
		endwhile;
	}
	
	function guildRank($top = 100){
		$this->odbcConnect($this->SQL_db_shard);

		$guilds = $this->conn->query("SELECT g.ID, g.Name, g.Lvl, g.GatheredSP
									  FROM [dbo].[_Guild] as g
									  LEFT JOIN [dbo].[_AlliedClans] as a
									  ON g.ID = a.ID");
		
		while($gRows = $guilds->fetch(PDO::FETCH_ASSOC)):
			$guildArr[] = array('Lvl' => $gRows['Lvl'],
								'Members' => $this->countGuildMembers($gRows['ID']),
								'GatheredSP' => $gRows['GatheredSP'],
								'Name' => $gRows['Name'],
								'Ally' => $this->guildAllies($gRows['ID'])
								);
		endwhile;
		
		rsort($guildArr);
		
		for($i = 0; $i <= ($top-1); $i++):
			echo '<tr>
					<td style="text-align:center;">'.($i+1).'º</td>
					<td>'.$guildArr[$i]['Name'].'</td>
					<td style="text-align:center;">'.$guildArr[$i]['Lvl'].'</td>
					<td style="text-align:center;">'.$guildArr[$i]['Members'].'</td>
					<td style="text-align:center;">'.$guildArr[$i]['Ally'].'</td>
				  </tr>';
		endfor;
	}
	
	function countGuildMembers($guildID){
		$this->odbcConnect($this->SQL_db_shard);
		
		if(!is_null($guildID)):
			$guilds = $this->conn->prepare("SELECT COUNT(*) FROM [dbo].[_GuildMember] WHERE GuildID = :guildid");
			$guilds->bindValue(":guildid", $guildID, PDO::PARAM_INT);
			$guilds->execute();
			return $guilds->fetchColumn(0);
		endif;
	}
	
	function guildAllies($guildID){
		$this->odbcConnect($this->SQL_db_shard);

		if(!is_null($guildID)):
			try{
				$allies = $this->conn->query("SELECT Ally1, Ally2, Ally3, Ally4, Ally5, Ally6, Ally7, Ally8
											  FROM [dbo].[_AlliedClans]
											  WHERE ID = " . $guildID);

				$alliesRows = $allies->fetch(PDO::FETCH_NUM);
				if(!is_bool($alliesRows)):
					for($i = 0; $i <= (count($alliesRows)-1); $i++):
						if(!is_null($alliesRows[$i])):
							$guilds = $this->conn->query("SELECT Name FROM [dbo].[_Guild] WHERE ID = " . $alliesRows[$i]);
							$guildsRows[] = $guilds->fetch(PDO::FETCH_NUM);
						endif;
					endfor;
					
					foreach($guildsRows as $key => $val):
						foreach($val as $value): $ally[] = $value; endforeach;
					endforeach;
					
					return '<a href="javascript:void(0)" onclick="alert(\'Allies »\n' . implode("\\n", $ally) . '\');">Allied Clans</a>';	
				endif;
			}catch(PDOException $e){
				echo $e->getMessage();
			}
		endif;
	}
}
?>
 

Türkiye’nin ilk webmaster forum sitesi iyinet.com'da forum üyeleri tarafından yapılan tüm paylaşımlardan; Türk Ceza Kanunu’nun 20. Maddesinin, 5651 Sayılı Kanununun 4. maddesinin 2. fıkrasına göre, paylaşım yapan üyeler sorumludur.

Backlink ve Tanıtım Yazısı için iletişime geçmek için Skype Adresimiz: .cid.1580508955483fe5

Üst