goma smile Posted January 8, 2008 Report Share Posted January 8, 2008 Izveidojam mapi www folderii piemeeram "reg"Šajaa mapee izveidojam failu add.php un iekopējam šo skriptu: <? $nick = $_POST['nickname']; $pass = $_POST['password']; $pass2 = $_POST['pw_coniform']; $access = "z"; $flags = "a"; $nickname = "regnick"; $ip = $_SERVER['REMOTE_ADDR']; $id = "6"; if($pass == $pass2){ echo ""; }else{ die ("<script>alert('Paroles nesakrit!');window.back()</script>"); } if(empty($nick)){ die ("<script>alert('Ieraksti niku!'); window.back()</script>"); } if(empty($pass)){ die ("<script>alert('Ieraksti paroli!'); window.back()</script>"); } include('config.php'); $check = mysql_query("SELECT username FROM amx_amxadmins WHERE username='$nick'"); $exist = mysql_num_rows($check); if($exist > 0){ echo "<script>alert('Tads niks ir jau registrets!');window.back()</script>"; unset($nick); exit(); } $register = "INSERT INTO amx_amxadmins ( username, password, access, flags, nickname) VALUES('$nick', '$pass', '$access', '$flags', '$nickname')"; mysql_query($register) or die(mysql_error()); mysql_close(); echo "Registracija pabeikta!"; //header('location: index.php'); ?> Taalaak tajaa pšā mapē izveidojam failu config.php un iekopējam šādu kodu: <? $host = "localhost"; $db = "amxbansdatubāze"; $mysql_user = "lietotājs"; $mysql_pw = "parole"; mysql_connect ($host, $mysql_user, $mysql_pw)or die("neizdevas piekonekteeties: ".mysql_error()); mysql_select_db($db) or die(mysql_error()); ?> Ievadam savus datus ( datubāzi, lietotāju, paroli ) Vēl izveidojam index.php un iekopējam šādu kodu: <html> <head> <title>Nick Registration</title> </head> <body> <center> <form method="post" action="add.php"> <table border="1"> <tr><td>Niks</td><td><input type="text" name="nickname"></td></tr> <tr><td>Parole</td><td><input type="text" name="password"></td></tr> <tr><td>Apstiprini Paroli</td><td><input type="text" name="pw_coniform"></td></tr> <tr><td></td><td><input type="submit" value="Registret"></td></tr> </table> </form> </center> </body> </html> Tālāk jātrisia problēma ar ķeksīšiem server_admins lapā: Dodamies uz mapi www\amxbans\admin un atrodam failu server_admins.php atveram to un sameklējam rindiņu (149 rindiņa ) "checked" => 0 un nomainam uz: "checked" => 1 Aizveram un saglabājam Viss gatavs! Paarbaudam http://localhost/reg ©Lazda P.s - Ar šo skriptu var uztaisiit sms niku reģistrāciju!! Vai ir iespejams izdarit ta ka registresanos apvienot ar sms un ka var izdarit ka lai registretu teu ir jaievada vel kods un tikai tad vares registreties ? Link to comment Share on other sites More sharing options...
mounkuls Posted January 8, 2008 Report Share Posted January 8, 2008 (edited) Salauzīs šito ļoti ātri. Kā ir domāta tā "reģistrēšanās apvienojot ar sms"? Nevarēju saprast ko ar to domāji. Kodu ģenerē ar rand() un ievieto pirms lauka kurā to jāievada. $access = "z";$flags = "a"; $nickname = "regnick"; $ip = $_SERVER['REMOTE_ADDR']; $id = "6"; Un kas tie tādi? Cik nojaušu config.php ir tikai tas ko iepostēji? P.s - Ar šo skriptu var uztaisiit sms niku reģistrāciju!! Uztaisīt var visu ko ja prot. Edited January 8, 2008 by mounkuls Link to comment Share on other sites More sharing options...
goma smile Posted January 8, 2008 Author Report Share Posted January 8, 2008 ja ar niku registracija a var izdarit ta ka ta bus iespejama tikai tad ja zinas kodu ? kurs piemeram ir 444122 tad viss ok ,a ja ievada 3233332 tad nejiet ? Link to comment Share on other sites More sharing options...
mounkuls Posted January 8, 2008 Report Share Posted January 8, 2008 (edited) Protams ka var. $kods=(int)$_GET['kods']; if($kods!=444122) header("Location:wrong.php"); iespraud pirms padod formu. Sataisi wrong.php failu kurā nolamās ka nav tiesību. Edited January 8, 2008 by mounkuls Link to comment Share on other sites More sharing options...
goma smile Posted January 9, 2008 Author Report Share Posted January 9, 2008 (edited) ka es nesapratu ? ka un kura faila tiesi ? Edited January 9, 2008 by goma smile Link to comment Share on other sites More sharing options...
mounkuls Posted January 9, 2008 Report Share Posted January 9, 2008 (edited) Kā domā veikt to pārbaudi uz paroli? Nu kādā veidā lietotājam jāiziet autorizācija? To $kods=(int)$_GET['kods']; jau es tikai tā uzrakstiju lai skaidrāks ko jādara. Fiška viekārša: ja parole nepareiza, header("Location:wrong.php"); Tas wrong.php pašam jāuztaisa, tur sūti tos, kam nav tiesību uz to formu, kur tajā wrong.php redirektē uz māju(tava hosta index lapa) vai kvartālu(http://google.com) tālāk :) Tātad to IF ieliec pirms padod jūzerim formu uz to savu add.php Edited January 9, 2008 by mounkuls Link to comment Share on other sites More sharing options...
mixis Posted January 9, 2008 Report Share Posted January 9, 2008 Atkal bērnudārzs grib izveidot kaut ko, par ko pašam nav ne mazākās sajēgas! Link to comment Share on other sites More sharing options...
goma smile Posted January 9, 2008 Author Report Share Posted January 9, 2008 :D jus uzbaucieni mani uzjautina 100 punkti tu nesi vecaks pa mani ja butu tad runatu kautcik gudrak :P Link to comment Share on other sites More sharing options...
mixis Posted January 9, 2008 Report Share Posted January 9, 2008 Nu moška saderm? :) te vismaz 2 koda guru zina cik es esmu vecs un ko protu ;) tā kā man nebūs grūti pierādīt ko māku un cik vecs esmu. Man vienkārši besī, ka cilvēki nejēdz pat pašus pamatus un uzdod nez kādus jautājumus. Kamēr viņiem kodu neielej mutē tikmēr mierā neliekas. Link to comment Share on other sites More sharing options...
andrisp Posted January 10, 2008 Report Share Posted January 10, 2008 Piekrītu mixim, nedaudz nomācoši... Link to comment Share on other sites More sharing options...
Kavacky Posted January 10, 2008 Report Share Posted January 10, 2008 Risinājums: ban nafig. Link to comment Share on other sites More sharing options...
Val Posted January 10, 2008 Report Share Posted January 10, 2008 kur ir tā saistība ar SMS? Link to comment Share on other sites More sharing options...
goma smile Posted January 10, 2008 Author Report Share Posted January 10, 2008 es vienkarsi gribeju lai kads palidz a jus te dirsat Link to comment Share on other sites More sharing options...
Kavacky Posted January 10, 2008 Report Share Posted January 10, 2008 Ko mēs varam palīdzēt, ja tu nekā nejēdz? Link to comment Share on other sites More sharing options...
goma smile Posted January 11, 2008 Author Report Share Posted January 11, 2008 ka var uzlikt kad tas skrips stradas tikai ar kodu Link to comment Share on other sites More sharing options...
Recommended Posts