Skocz do zawartości

Dołącz do społeczności!

👋 Witaj na MPCForum!

Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

  • ✅ Pełny dostęp do działów i ukrytych treści
  • ✅ Możliwość pisania i odpowiadania w tematach
  • ✅ System prywatnych wiadomości
  • ✅ Zbieranie reputacji i rozwijanie swojego profilu
  • ✅ Członkostwo w jednej z największych społeczności graczy

👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

Zarejestruj się teraz

[Pomoc] - Logowanie ?X=Default

Rekomendowane odpowiedzi

Opublikowano

Witam

chciałem zrobić stronę do metin2 opierajac się na innym szablonie

ale mam problem z logowaniem gdyż za nic nie mogę tego zrobić

nie wiem co zrobić aby można było logowac na dane z account

Dam te 2 pliki i proszę o pomoc ;)

index.php

 

<?php
ob_start();
function escape($str){ 
$search=array("\\","\0","\n","\r","\x1a","'",'"'); 
$replace=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); 
return str_replace($search,$replace,$str); 
}
function unescape($str) { 
$replace=array("\\","\0","\n","\r","\x1a","'",'"');  
$search=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); 
return str_replace($search,$replace,$str);  
}
function preps($text){   
$text = str_replace("<", "", $text);  
$text = str_replace(">", "", $text); 
$text = preg_replace("/\<([^\*]+)\>/", " ", $text);  
preg_match("/\[url:\]([^\*]+)\[\/url\]/", $text, $matches); 
if(is_array($matches)) 
	foreach($matches as $match) 
	$text = str_replace("[url:]".$match."[/url]","<a href='".$match."' target='_blank'>".$match."</a>",$text);
return $text; 
}
function real_string($text){ 
return $text = trim(escape(nl2br(preps(trim($text))))); 
}
function real_string2($text){ 
return $text = trim((nl2br((trim($text))))); 
}
function query($sql){ mysql_query($sql); }
function one($sql){ $one = mysql_fetch_array(mysql_query($sql)); return $one[0]; }
function row($sql){ return mysql_fetch_object(mysql_query($sql)); }
function all($sql){ $query = mysql_query($sql); $i =0; 	$array = ""; while ($row = mysql_fetch_object($query)){ $array[$i++] = $row; } return $array; }

function show($what){ echo "<pre>"; print_r($what); die; }
//function getClass($name){ require_once('functions/'.$name.'Mgr.php');  eval('$class  = new '.$name.'Mgr;'); return $class; }
function reload($where){ header("Location: ?x=$where"); }
function getPlayer($id){ $player = row("select user, email, login from users where user = $id"); return $player; }

require_once('var/config.php');
session_start();

if(!empty($_SESSION['user'])  && is_numeric($_SESSION['user'])){ $player = getPlayer($_SESSION['user']);}
if(empty($player)){	$player->role = -1; }

if(!empty($_SESSION['user'])  && is_numeric($_SESSION['user'])){ $player = getPlayer($_SESSION['user']);}
if(empty($player)){	$player->role = -1; }

$header = 'templates/master/header.php';
$menu = 'templates/master/menu.php';
$menu2 = 'templates/master/menu2.php';
$informacje = 'templates/master/informacje.php';
$page =  'templates/master/'.$_GET['x'].'.php';
$logowanie2 =  'templates/master/logowanie2.php';
$logowanie =  'templates/master/logowanie.php';
$footer = 'templates/master/footer.php';

$master_act = array("default","login","register");
$user_act = array("logout","account","messages","forum","thread","section");
$admin_act = array("logout","admin");


if(empty($_GET['x'])){ $_GET['x']= 'default'; }

if(in_Array($_GET['x'],$admin_act) && ($player->role == 1) ){
$header = 'templates/admin/header.php';
$footer = 'templates/admin/footer.php';
$page =  'templates/admin/'.$_GET['x'].'.php'; 
} elseif(in_Array($_GET['x'],$user_act) && ($player->role >= 0) ){
$header = 'templates/user/header.php';
$menu = 'templates/user/menu.php';
$menu2 = 'templates/user/menu2.php';
$informacje = 'templates/user/informacje.php';
$page =  'templates/user/'.$_GET['x'].'.php';
$logowanie2 =  'templates/user/logowanie2.php';
$logowanie =  'templates/user/logowanie.php';
$footer = 'templates/master/footer.php';  
} elseif(in_Array($_GET['x'],$master_act)){
$header = 'templates/master/header.php';
$menu = 'templates/master/menu.php';
$menu2 = 'templates/master/menu2.php';
$informacje = 'templates/master/informacje.php';
$page =  'templates/master/'.$_GET['x'].'.php';
$logowanie2 =  'templates/master/logowanie2.php';
$logowanie =  'templates/master/logowanie.php';
$footer = 'templates/master/footer.php'; 
} else { 
$header = 'templates/master/header.php';
$menu = 'templates/master/menu.php';
$menu2 = 'templates/master/menu2.php';
$informacje = 'templates/master/informacje.php';
$page =  'templates/master/default.php';
$logowanie2 =  'templates/master/logowanie2.php';
$logowanie =  'templates/master/logowanie.php';
$footer = 'templates/master/footer.php';

}	
require_once($header);
require_once($menu);
require_once($menu2);
require_once($informacje);
require_once($page);
require_once($logowanie2);
require_once($logowanie);
require_once($footer);

mysql_close();
ob_end_flush();
?>

 

 

logowanie2.php

 

	<div class="right">

		<div class="mng2">Logowanie</div>
		<center>
			<form action='?x=<?php echo $_GET['x'] ?>' method='post'>
			<p>Login:<input name="login" type="text" value='<?php echo  $_POST['login'] ?>' size=15/> </p>
			<p>Hasło:<input name="pass" type="password" value='<?php echo  $_POST['pass'] ?>' size=15 /> </p>
			<p><input type="submit" value=" OK " /></p>			
		</form>
		<br>
<?php
function login($login, $pass){
	$msg = '';
	$login = real_string($login);
	$pass = md5(real_string($pass));

	$user = row("select user from users where login = '".$login."' and pass = '".$pass."' limit 1");

	if(!empty($user) && is_numeric($user->user) && ($user->user > 0)){
			$_SESSION = array();
			$_SESSION['user'] = $user->user;
			$msg = 'zalogowano ';
			header('Location: ?x=account');
	} else { 
		$msg = 'Wprowadzono błędne dane ';
	}

	return $msg;
}

if(!empty($_POST)){
if (!empty($_POST['login']) && !empty($_POST['pass'])){

	$msg = login($_POST['login'],$_POST['pass']);
} else {
	$msg = 'Wypełnij wszystkie pola poprawnie';
}
echo $msg;
}
?>
		</center>

 

Szukam grafików, questerów Metin2, koderów www, skrypterów, programistów visual c++, c++.
Techników od bazy danych, systemów linuksowych( głównie FreeBSD).

[email protected] - > Pisać - > Rozpatrzę propozycje :)

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.