As Mauzen said:
Check if their name exists in the Database, if not kick them. Their name = Registered on the web site.
There are other things besides PHP, so I don't know why you singled that one out but I will use that.
For a very basic registration on the web site side:
PHP код:
<?php
mysql_connect("localhost", "root", "", "db");
mysql_select_db("db");
?>
<html>
<head>
<title>Registration for Server</title>
</head>
<body>
<?php
if (isset($_POST['submit'])) {
if (!$_POST['Name'] || !$_POST['Pass']) {
echo "<h1><center><font color='red'>You need to fill in both fields!</font></center></h1>";
} else {
$name = mysql_escape_string($_POST['Name']);
$pass = mysql_escape_string($_POST['Pass']);
$Query = mysql_query("SELECT username FROM users WHERE username = '".$name."'");
if(mysql_num_rows($Query) == 0) { //Their account is not already made, so insert it into the DB
echo "<h1><center><font color='green'>Account Created Successfully!</font></center></h1>";
$Query = mysql_query("INSERT INTO users (id, username, password) VALUES ('', '".$name."', '".$pass."')")
} else { //Account already exists
echo "<h1><center><font color='red'>This account exists already!</font></center></h1>";
}
}
}
?>
Enter below the required information:<br />
<form action="" method="post">
In-Game Name: <input type="text" name="Name" size="30" /><br />
In-Game Pass: <input type="password" name="Pass" size="30" /><br />
Submit Info: <input type="submit" name="submit" value="Submit" /><br />
<b>Names must be 20 Characters long!</b>
</form>
</body>
</html>
Now this is just an example, don't go using this cause its only there to show you. Obviously this would be your site as not many people would be excited to use a white blank registration page.
Now back on PAWN side:
You need to check the account name in the database and if there's a match then they can login.
pawn Код:
public OnGameModeInit
() { mysql_connect
("localhost",
"root",
"",
"db",
1);
return 1;
}public OnPlayerConnect
(playerid
) { //Registration and Loggin In new Query
[80];
format(Query,
80,
"SELECT username FROM users WHERE username = '%s'", Name
(playerid
));
mysql_query
(Query
);
mysql_store_result
();
if (mysql_num_rows
() == 1) { //They are already registered, so they can login SendClientMessage
(playerid, COLOR_WHITE,
"Your account exists. Please enter your password to proceed.");
} else { //They are not, so kick them. SendClientMessage
(playerid, COLOR_WHITE,
"You need to register your account on our website first: http://yoursite.domain");
Kick
(playerid
);
} return 1;
}
Once again, this is an example only and to show you how to do it.
Learn upon this and make yours work.