KAYIT - GİRİŞ Sistemi ( Php )

Giriş - Kayıt Sistemi ( Php ) giris.php  PHP- Kodu:<html><head><title> Giriş </title></head> <bOdy> Kullanıcı Bilgilerinizi Girin : <form action = "auth.php" method = "post"> Kullanıcı Adı : <br> <input type = "text" name = "username"> <br><br> Şifre :<br><br> <input type = "text" name = "password"> <br><br> <input type = "submit" value = " Giriş "> </form> </bOdy></html>   auth.php<?php $username = $_POST[’username’]; $password = $_POST[’password’]; $self = $_SERVER [’PHP_SELF’]; $referer = $_SERVER [’HTTP_REFERER’]; if ( ( !$username ) or ( !$password ) ) {header("Location: $referer") ; exit () ; } $conn = @mysql_connect( "localhost", "USERNAME", "PASSWORD" ) or die ("couldnt connect to SQL ") ; $rs = @mysql_select_db("DATABASE" , $conn ) or die ( "Could not select Database" ) ; $sql="select * from my_database where user_name=\"$username\" and password = password( \"$password\" ) " ; $rs = mysql_query( $sql, $conn ) or die ( " Couldnt execute query" ) ; $num = mysql_numrows ( $rs ) ; if( $num != 0 ) { $msg = " $username - Giriş Başarılı !";} else { header( "location:$referer" ) ; exit() ; } ?> <html> <head><title> Giriş Tamamdır </title></head> <bOdy> <?php echo( $msg ) ; ?> <br><br></A> <br><br>    kayit.php$firstname = $_POST[’firstname’] ; $lastname = $_POST[’lastname’] ; $username = $_POST[’username’] ; $password = $_POST[’password’] ; if ( ( !$firstname ) or ( !$lastname ) or ( !$username ) or ( !$password ) ) { $form ="Gerekli Bilgileri Giriniz ..."; $form.="<form action=\"$self\""; $form.=" method=\"post\">Adı : "; $form.="<input type=\"text\" name=\"firstname\""; $form.=" value\"$firstname\"><br>Soyadı : "; $form.="<input type=\"text\" name=\"lastname\""; $form.=" value=\"$lastname\"><br>Kullanıcı Adı : "; $form.="<input type=\"text\" name=\"username\""; $form.=" value\"$username\"><br>Şifre : "; $form.="<input type type=\"text\" name=\"password\""; $form.=" value=\"$password\"><br>"; $form.="<input type=\"submit\" value=\"Onayla\">"; $form.="</form>"; echo( $form ) ; } else { $conn = @mysql_connect( "localhost", "USERNAME", "PASSWORD") or die ( "could not connect to mysql"); $db = @mysql_select_db( "DATABASE", $conn ) or die ("could not select database") ; $sql = "insert into my_database (first_name,last_name,User_name,password) values (\"$fistname\",\"$lastname\",\"$username\", password(\"$password\") )"; $result = @mysql_query( $sql, $conn ) or die("could not execute query") ; if( $result ) {echo( "New User $username added" ) ; } } ?>

Döküman Arama

Başlık :

Kapat