הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   שאלה | PHP - הרשמה (https://hosts.co.il/forums/showthread.php?t=49499)

Elad-A 13-07-07 14:23

תנסה את זה:

PHP קוד:

<?php

$link
=mysql_connect("localhost""root""") or die(mysql_Error());  
mysql_select_db("db",$link) or die(mysql_error()); 

if(
$_SERVER['REQUEST_METHOD'] == 'POST')
{
    if(isset(
$_POST['username']) && isset($_POST['password']) && isset($_POST['pconf']))
    {
        
        
$user mysql_real_escape_string(htmlspecialchars($_POST['username']));
        
$pass $_POST['password'];
        
$query mysql_query("SELECT * FROM users WHERE username = '$user' ");

        if(
mysql_num_rows($query) > 0)
        {
            die(
"שגיאה: שם המשתמש שבחרת תפוס.");
        }

        if(
$_POST['password'] != $_POST['pconf'])
        {
            die(
"שגיאה: הסיסמאות שהזנת לא תואמות.");
        }

        
mysql_query("INSERT INTO users (id , username , password) VALUES ('' , '$user' , '$pass') ") OR die ("ERROR!");
    }
    else
    {
        die(
"שגיאה: אנא הזן את כל הפרטים הנחוצים.");
    }
}

?>

*לא בדקתי את הקוד.


כל הזמנים הם GMT +2. הזמן כעת הוא 19:12.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ