اذهب إلى المحتوى

السؤال

نشر

 


 



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>register</title>
</head>
<body>
    <div class="box">
        <form method="post" >
            <h3>register</h3>
            <input type="text" name="name" id=""  placeholder = "  enter your name">
            <input type="email" name="email" id="" placeholder = "  enter your email">
            <input type="password" name="password" id="" placeholder = "  enter your password">
            <input type="password" name="password_re" id="" placeholder = "  enter your password again">
            <input type="submit" name="btn" value = "register" id="btn">
            <p> Already Have An Account ?  <a href="login.php">login</a> </p>
        </form>
    </div>
    
</body>
</html>

<!-- include style rel -->

<?php include 'conf.php' ; ?>

<!-- include ended -->

<?php

if(isset($_POST['btn'])){

    $name = mysqli_real_escape_sting($conn , $_POST['name']) ; 
    $email = mysqli_real_escape_sting($conn , $_POST['email']) ; 
    $password = mysqli_real_escape_sting($conn , $_POST['password']) ; 
    $pass = mysqli_real_escape_sting($conn , $_POST['password_re']) ; 

    if($password == $pass){
        $select = mysqli_query($conn , "SELECT * FROM `u` WHERE email = '$email '") or die ("select failed");

        if(mysqli_num_rows($select) > 0 ){
            echo '<span class = `msg`>this user already exist</span>';

        }else{

            $insert = mysqli_query($conn , "INSERT INTO u (name, email ,password ) VALUES ('$name', '$email', '$password')")or die("insert failed");

        }

    }else{
        echo '<span class = `msg`>password not matched</span>';

    }





}

?>

output : 

 

Fatal error: Uncaught Error: Call to undefined function mysqli_real_escape_sting() in C:\xampp\htdocs\server\ahmed\register.php:37 Stack trace: #0 {main} thrown inC:\xampp\htdocs\server\ahmed\register.phpon line37

Recommended Posts

  • 2
نشر (معدل)

الخطأ هنا اخى 

mysqli_real_escape_sting() // string not sting


mysqli_real_escape_string() // correct

 

الكود الصحيح 

$name = mysqli_real_escape_string($conn , $_POST['name']) ; 
$email = mysqli_real_escape_string($conn , $_POST['email']) ; 
$password = mysqli_real_escape_string($conn , $_POST['password']) ; 
$pass = mysqli_real_escape_string($conn , $_POST['password_re']) ; 

 

تم التعديل في بواسطة محمد عاطف11

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...