Hi
Ich habe ein Problem
Wenn ich mich einloggen möchte ne bei meiner DB für den SA-MP Server
Ich habe ja schon auf dem SA-MP server ein Account jedoch findet er meinen Nicht,
Könnte evtl einer mal darauf schauen ob ich alles Richtig gemacht habe?
Ich möchte gerne auch wissen wieso er die Users Tabelle nicht finden kann
p.s. Ich weis das es ein UCP ist aber mit diesen Tabellen web_users und web_news
Dennoch muss es ja irgendwie gehen das an meine DB anzupassen nur wie das wäre nett wenn mir einer Helfen könnte
Ich möchte euch bitten das ihr mir sagt was ihr braucht
hier schonmal die Login.php
hier die Testseite
UCP
<center><?php
if(!IsLogged()) {
if(isset($_POST['loggomb'])) {
Login($_POST['name'], $_POST['pass']);
}
else {
echo '
<form action="index.php?p=login" method="post">
<input type="text" name="name" placeholder="Benutzername "erforderlich"/> <br>
<input type="password" name="pass" placeholder="Passwort" Erforderlich/> <br>
<input type="submit" name="loggomb" />
</form>';
}
}
else header('Location: index.php');
?></center>
Alles anzeigen
hier die Reg.php
<center><?php
if(!IsLogged()) {
if(isset($_POST['reggomb'])) {
Register($_POST['name'], $_POST['pass'], $_POST['email']);
}
else {
echo '
<form action="index.php?p=reg" method="post">
<input type="text" name="name" placeholder="Name" required/> <br>
<input type="email" name="email" placeholder="E-Mail" required/> <br>
<input type="password" name="pass" placeholder="Kennwort" required/><br>
<input type="submit" name="reggomb"/>
</form>';
}
}
else header('Location: index.php');
?></center>
Alles anzeigen
heir die Index.php
<?php
require_once "inc/func.php";
?>
<html>
<head>
<meta charset="UTF-8" />
<title>UCP by Atomic RP - <?php echo $_SERVER['SERVER_NAME']; ?></title>
<link href="default.css" rel="stylesheet" />
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="logo">
<h1><a href="#">UCP by Atomic RP</a></h1>
</div>
<?php
$num = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE 1"));
echo "<h3 class='title' style='font-weight: normal;'>";
echo ( $num == 0 ? "$num Mitglied seit" : "<a href='?p=users'>$num Mitglied seit</a>" );
echo "</h3>";
?>
</div>
<div id="menu">
<ul>
<li><a href="?p=home" <?php echo (!isset($_GET['p']) || $_GET['p'] == "home" ? 'class="active"' : '');?>>Home</a></li>
<li><a href="?p=team" <?php echo (isset($_GET['p']) && $_GET['p'] == "team" ? 'class="active"' : '');?>>Team</a></li>
<li><a href="?p=server" <?php echo (isset($_GET['p']) && $_GET['p'] == "server" ? 'class="active"' : '');?>>Server-Status</a></li>
<?php
if(IsAdmin(2) || IsAdmin(3)) {
echo ( isset($_GET['p']) && $_GET['p'] == "admin" ? '<li><a href="?p=admin" class="active">Admin Panel</a></li>':'<li><a href="?p=admin">Admin Panel</a></li>');
}
if(IsLogged()) {
echo ( isset($_GET['p']) && $_GET['p'] == "profile" ? '<li><a href="?p=profile" class="active">Profil</a></li>' : '<li><a href="?p=profile">Profil</a></li>');
echo '<li><a href="?p=logout">Kijelentkezés</a></li>';
}
else {
echo ( isset($_GET['p']) && $_GET['p'] == "login" ? '<li><a href="?p=login" class="active">Anmelden</a></li>' : '<li><a href="?p=login">Anmelden</a></li>' );
echo ( isset($_GET['p']) && $_GET['p'] == "reg" ? '<li><a href="?p=reg" class="active">Registrieren</a></li>' : '<li><a href="?p=reg">Registrieren</a></li>' );
}
?>
</ul>
</div>
<div id="page">
<div id="content">
<?php
if( !empty($_GET['p']) && isset($_GET['p']) )
{
if(file_exists("pages/$_GET[p].php"))
{
require("pages/$_GET[p].php");
}
else
{
require("pages/error.php");
}
}
else
{
require("pages/home.php");
}
?>
</div>
</div>
<div class="clr"></div>
<hr class="sz" />
<div id="footer" style="text-align: center;">
<p class="left">© 2014 -Atomic RP<br>YOKO CO.KG : <?php echo $_SERVER['REMOTE_ADDR']; ?></p>
<p class="right"><br><?php echo $_SERVER['SERVER_NAME'];?></p>
</div>
</div>
</body>
</html>
Alles anzeigen
und die Connections
hier die settings.php
#
<?php
$sql = array (
"host" => "127.0.0.1",
"user" => "samp03",
"pass" => "privat",
"db" => "samp03" );
$samp = array (
"ip" => "178.33.79.60",
"port" => "7300");
?>
Alles anzeigen
Die Functions.php
<?php
require_once "Settings.php";
require_once "SampQuery.class.php";
$db_con = mysql_connect($sql["host"], $sql["user"], $sql["pass"]);
$db_db = mysql_select_db($sql["db"]);
if($db_con && $db_db) {} else { die ("Konnte nicht mit dem Mysql Server verbinden': ".mysql_error().""); }
$query = new SampQuery($samp['ip'], $samp['port']);
session_start();
ob_start();
/*
# Vendégek
if( !IsLogged() ) {
$time = time();
$res = mysql_query("SELECT * FROM web_guest_online WHERE IP = '$_SERVER[REMOTE_ADDR]'");
$guest = mysql_fetch_assoc($res);
$guestnum = mysql_num_rows($res);
if( $guestnum == 0 ) {
mysql_query("INSERT INTO web_guest_online(IP, TIME) VALUES('$_SERVER[REMOTE_ADDR]', '$time')");
}
else {
mysql_query("UPDATE web_guest_online SET TIME = '$time' WHERE IP = $guest[IP]");
}
}
$res = mysql_query("SELECT * FROM web_guest_online");
$guest = mysql_fetch_assoc($res);
$elhagyta = time() - $guest['TIME'];
if( $elhagyta > 120 || IsLogged() ) {
mysql_query("DELETE FROM web_guest_online WHERE IP = '$guest[IP]' LIMIT 1");
}
$guest_irhato = mysql_num_rows(mysql_query("SELECT * FROM web_guest_online"));
# Felhasználók
if( IsLogged() ) {
$time = time();
$res = mysql_query("SELECT * FROM web_user_online WHERE IP = '$_SERVER[REMOTE_ADDR]'");
$member = mysql_fetch_assoc($res);
$membernum = mysql_num_rows($res);
if( $membernum == 0 ) {
mysql_query("INSERT INTO web_user_online(NAME, IP, TIME) VALUES('$_SESSION[NAME]', '$_SERVER[REMOTE_ADDR]', '$time')");
}
else {
mysql_query("UPDATE web_user_online SET TIME = '$time' WHERE NAME = '$_SESSION[NAME]'");
}
}
$res2 = mysql_query("SELECT * FROM web_user_online");
$member = mysql_fetch_assoc($res2);
$elhagyta2 = time() - $member['TIME'];
if( $elhagyta2 > 120 ) {
mysql_query("DELETE FROM web_guest_online WHERE IP = '$member[IP]'");
}
$member_irhato = mysql_num_rows(mysql_query("SELECT * FROM web_user_online"));
*/
if(IsLogged()) {
$time = time();
mysql_query("UPDATE users SET LASTLOGGED = '$time' WHERE NAME = '$_SESSION[NAME]'");
}
function GetData($data) {
mysql_query("SET NAMES UTF8");
$res = mysql_query("SELECT * FROM users WHERE NAME = '$_SESSION[NAME]' ");
$tomb = mysql_fetch_array($res);
return $tomb[$data];
}
function GetDataEx($data) {
mysql_query("SET NAMES UTF8");
$res = mysql_query("SELECT * FROM users WHERE NAME = '$_GET[nev]' ");
$tomb = mysql_fetch_array($res);
return $tomb[$data];
}
function IsLogged() {
if(isset($_SESSION['NAME']) && !empty($_SESSION['NAME'])) {
if(GetData("BANNED") == "0") {
return 1;
}
else {
return 0;
}
}
else { return 0; }
}
function IsAdmin($level) {
if(isset($_SESSION['NAME']) && GetData("GROUP") == $level){
if(GetData("BANNED") == "1") { return 0; }
else return 1;
}
else return 0;
}
function Register($user2, $pass2, $mail2) {
mysql_query("SET NAMES UTF8");
$user = mysql_real_escape_string($user2);
$pass = sha1(mysql_real_escape_string($pass2));
$mail = mysql_real_escape_string($mail2);
$time = time();
$vane = mysql_num_rows(mysql_query("SELECT * FROM users WHERE NAME = '$user'"));
if($vane == 0 && !empty($user2) && !empty($pass2) && !empty($mail2) ) {
mysql_query("INSERT INTO `samp03`.`users` (`SQLid`, `NAME`, `KEY`, `keyConfirmKey`, `Level`, `AdminLevel`, `DonateRank`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Age`, `Origin`, `Muted`,`Respect`) VALUES (NULL, '$user', '$pass', '$_SERVER[REMOTE_ADDR]', '0', '0', '0', '0', 0, '$mail', '$time', '$time', 0);");
//mail($mail, "Üdvözöllek!", "Szia $user!\nEzt a mailt azért kapod mert regisztráltál a szerverre!\n\nNév: $user\nÜdvözlettel: Valaki"); # Ha támogatja az email küldést a szolgáltatód akkor vedd ki a //-t
echo 'Erfolgreiche Registrierung! Sie können jetzt anmelden!';
}
else {
echo 'Einige sind leer oder existiert schon links, dem Benutzer!';
}
}
function Login($user2, $pass2) {
mysql_query("SET NAMES UTF8");
$user = mysql_real_escape_string($user2);
$pass = sha1(mysql_real_escape_string($pass2));
$res = mysql_query("SELECT * FROM users WHERE NAME = '$user'");
if( mysql_num_rows($res) == 0 ) {
echo 'A felhasználónév nem létezik!';
}
else {
while( $row = mysql_fetch_array($res) ) {
if($row['BANNED'] == 0) {
if( $pass == $row['PASS'] ) {
$_SESSION['NAME'] = $user;
$time = time();
mysql_query("UPDATE users SET IP = '$_SERVER[REMOTE_ADDR]' WHERE NAME = '$user'");
mysql_query("UPDATE users SET LASTONLINE = '$time' WHERE NAME = '$user'");
header('location: index.php');
}
else {
echo 'Der Benutzername / Passwort ist nicht korrekt!';
}
}
else {
echo 'Haben Sie von der Website verbannt!';
}
}
}
}
function Logout() {
session_unset();
header('Location: index.php');
}
function ListUsers() {
mysql_query("SET NAMES UTF8");
echo "<table class='users'><tr><th>Name</th><th>eingetragen</th></tr>";
$res = mysql_query("SELECT * FROM `users` WHERE 1");
while( $row = mysql_fetch_array($res) ) {
$time = date("Y.m.d - H:m:s", $row['REGDATE']);
echo "<tr>";
echo "<td>$row[NAME]</td> <td>$time";
echo "</tr>";
}
echo "</table>";
}
function HirTitle($text) {
echo '<h3 class="titlebg">'.$text.'</h3>';
echo '<div class="hirbg">';
}
function HirFooter() {
echo '</div>';
}
function HirAdd($title, $content) {
mysql_query(" SET NAMES UTF8 ");
mysql_query("INSERT INTO web_news (ID, TITLE, CONTENT, ADDED, DATE) VALUES (NULL, '$title', '$content', '$_SESSION[NAME]', '".time()."') ");
}
function ListNews() {
mysql_query(" SET NAMES UTF8 ");
$res = mysql_query("SELECT * FROM web_news ORDER BY ID DESC");
if(mysql_num_rows($res) > 0) {
while( $row = mysql_fetch_array($res) ) {
$ekkor = date("Y.m.d - H:m:s", $row['DATE']);
HirTitle("$row[TITLE]");
echo nl2br("$row[CONTENT]<br><br><hr class='sz' />Írta: $row[ADDED]<br>Ekkor: $ekkor");
HirFooter();
}
}
else {
echo '<h3>Nem található hír!</h3>';
}
}
function AdminListNews() {
echo '<table class="admin"> <tr><td><b>Cím</b></td> <td><b>Törlés</b></td></tr>';
mysql_query(" SET NAMES UTF8 ");
$res = mysql_query(" SELECT * FROM web_news ORDER BY ID DESC");
while ( $row = mysql_fetch_array($res) ) {
echo "<tr> <td>$row[TITLE]</td> <th><a href='index.php?p=admin&delid=$row[ID]'>Törlés</a></th> </tr>";
}
echo '</table>';
}
function UnBan($id) {
mysql_query("UPDATE users SET BANNED = 0 WHERE ID = $id");
header('location: index.php?p=admin&i=bans&msg=Unban megadva!');
}
function Ban($id) {
mysql_query("UPDATE users SET BANNED = 1 WHERE ID = $id");
header('location: index.php?p=admin&i=bans&msg=Felhasználó kitiltva!');
}
function Team($level, $string) {
echo "<h2>$string</h2><br />";
$res = mysql_query("SELECT * FROM `users` WHERE 1 = $level");
if( mysql_num_rows($res) == 0 ) {
echo "$string.";
}
else {
echo '<table>';
while( $t = mysql_fetch_array($res) ) {
echo '<tr>';
echo "<td>$t[NAME]</td>";
echo '</tr>';
}
echo '</table>';
}
}
function MakeAdmin($name2, $level) {
$name = mysql_real_escape_string($name2);
mysql_query("UPDATE `users` SET `GROUP` = '$level' WHERE `NAME` LIKE '$name'");
header('location: index.php?p=admin&i=makeadmin&msg=Sikeresen beállítottad a játékos adminszintjét!');
}
?>
Alles anzeigen
Das UCP war in einer Anderen Sprache und musste ich soweit auf deutsch Übersetzen,
Ich hoffe es wird kein Problem sein mir zuhelfen vielleicht auch über Teamviewer