Bonsoir , j'ai un petit soucis avec mon petit login.
Enfaite j'aimerais que quand dans ma DB que si la dans la colonne banned il y'a "YES" alors il va mettre une message box .
Mais que si il y'a rien ou NO , alors il continue son chemin , voici mon code PHP et voici mon code C#
Et voici le PHP je me suis trompé c'est sur x)
Merci à vous !
Enfaite j'aimerais que quand dans ma DB que si la dans la colonne banned il y'a "YES" alors il va mettre une message box .
Mais que si il y'a rien ou NO , alors il continue son chemin , voici mon code PHP et voici mon code C#
Code:
private void secondOriginButton1_Click(object sender, EventArgs e)
{
try
{
using (WebClient wc = new WebClient())
{
wc.Credentials = new NetworkCredential("XXXXXXXX", "XXXXXXX"); // We give the HTaccess logins
string rLogin = wc.DownloadString("https://asinith.us/Login/login.php?username=" + textBox1.Text + "&password=" + textBox2.Text + "&hwid=" + Value()) + "&banned="; // Check in DB if username & password & hwid & banned matches
if (rLogin == "0")
{
MessageBox.Show("Your login information might be invalid :/.", "Invalid user.", MessageBoxButtons.OK, MessageBoxIcon.Error); // If login is wrong then display that.
}
else if (rLogin == "1")
{
MessageBox.Show("Hi " + textBox1.Text + " you're connected ! ", "Connected", MessageBoxButtons.OK, MessageBoxIcon.Information); // If login is good then display that + Open new form and close old one.
this.Hide();
Form2 F2 = new Form2();
F2.Show();
}
else if (rLogin == "2") // Banned = Yes in DB then toggle banned message.
{
MessageBox.Show("You have been permanently banned from FrenchCore.CC", "Banned.", MessageBoxButtons.OK, MessageBoxIcon.Error); // If user is banned then display that.
}
}
}
catch (Exception ex)
{
MessageBox.Show("Sorry! There is a problem with our server please check it out at https://status.frenchcore.cc/", "Server error.", MessageBoxButtons.OK, MessageBoxIcon.Error); // If there is an exception display that message
}
}
Et voici le PHP je me suis trompé c'est sur x)
PHP:
<?php
// 0 = Erreur de connexion
// 1 = Connexion réussite
// 2 = BANNIS
include("config.php");
$username = $_GET['username'];
$pass = $_GET['password'];
$hwid = $_GET['hwid'];
$banned = $_GET['banned'];
$private_key = 'XXXXXXX';
function f_crypt($private_key, $str_to_crypt) {
$private_key = md5($private_key);
$letter = -1;
$new_str = '';
$strlen = strlen($str_to_crypt);
for ($i = 0; $i < $strlen; $i++) {
$letter++;
if ($letter > 31) {
$letter = 0;
}
$neword = ord($str_to_crypt{$i}) + ord($private_key{$letter});
if ($neword > 255) {
$neword -= 256;
}
$new_str .= chr($neword);
}
return base64_encode($new_str);
}
$password = f_crypt($private_key, $pass);
$req = $bdd->prepare('SELECT id FROM users WHERE username = :username AND password = :password AND hwid = :hwid AND banned = :banned');
$req->execute(array(
'username' => $username,
'hwid' => $hwid,
'password' => $password,
'banned' => $banned));
$resultat = $req->fetch();
if (!$resultat)
{
echo '0';
}
else
{
echo '1';
}
else
if ($banned == 'YES')
{
echo '2';
}
?>
Merci à vous !