Results 1 to 1 of 1

Thread: Call of duty 2 reg and login system mysql.

  1. #1
    ... connecting
    Join Date
    Sep 2024
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Call of duty 2 reg and login system mysql.

    Hello. Does anyone have a way that is based on mysql and has registration - login? There are many cheaters on my server, so I would like help. Thanks to anyone who can help. I can't find any of these on the forum.

    in this system, there is only entry when joining. Registration is only on the website and I made it so that only I as admin can register the members. I created the Admin panel based on php.

    admin1.png

    admin2.png

    I can't put it in the gsc file, I would like to ask for help with this.
    this my sd.gsc file:

    https://mega.nz/file/dgQVwD7Q#Y_6PKiJYaQiZNanuffZlGsHU_nlONBPPvDnyFu9SK zw


    php file:
    Code:
    <?php
    $servername = "localhost";
    $username = "";
    $password = ""; 
    $dbname = ""; 
    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        die("Kapcsolódási hiba: " . $conn->connect_error);
    }
    $player_username = $_POST['username'];
    $player_password = $_POST['password'];
    $sql = "SELECT * FROM users WHERE username = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("s", $player_username);
    $stmt->execute();
    $result = $stmt->get_result();
    if ($result->num_rows > 0) {
        $user = $result->fetch_assoc();
        if (password_verify($player_password, $user['password'])) {
            echo "success";  
        } else {
            echo "invalid_password"; 
        }
    } else {
        echo "no_user";  
    }
    $conn->close();
    ?>
    login script:
    Code:
    login(player) {
        player iprintlnbold("Add meg a felhasználónevet:");
        player waitTill("say", username);
    
        player iprintlnbold("Add meg a jelszót:");
        player waitTill("say", password);
    
        request = "curl -X POST -d 'username=" + username + "&password=" + password + "' http://site.com/file.php";
        
        response = waitexec(request);
        
        if (response == "success") {
            player iprintlnbold("Bejelentkezés sikeres!");
        } else if (response == "invalid_password") {
            player iprintlnbold("Hibás jelszó.");
        } else if (response == "no_user") {
            player iprintlnbold("Felhasználó nem létezik.");
        } else {
            player iprintlnbold("Bejelentkezési hiba. Próbáld újra később.");
        }
    }
    
    init() {
        while(1) {
            level waittill("connected", player);
            player thread login();
        }
    }
    Last edited by Mofli; 29th September 2024 at 12:12.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •