MārisL Posted August 28, 2007 Report Share Posted August 28, 2007 (edited) <?php function showheader ($title) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <TITLE> <?php echo $title ?> </TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <CENTER> <?php } function showfooter () { ?> </CENTER> </BODY> </HTML> <?php } mysql_connect("localhost", "root", "parole"); mysql_select_db("datubaze"); if ($Password == $Password2) { $user = mysql_query("SELECT * FROM personalize WHERE (Name='$Name')"); if (mysql_num_rows($user) > 0) { showheader("User Name Taken !"); ?> We are sorry to inform you that the User Name <B><?php echo $Name ?></B> Is already Taken. <?php showfooter(); } else { $user = mysql_query("INSERT INTO personalize VALUES ('$Name','$Password','$News1','$News2','$Weather')"); setcookie("site_user", $Name, time() + 31536000, "/"); setcookie("site_pass", $Password, time() + 31536000, "/"); showheader("Registration Success!"); ?> You have registered.<BR> User Name: <?php echo $Name ?> <BR> Password: <?php echo $Password ?> <?php showfooter(); } } else { showheader("Registration Error!"); ?> Your Two Passwords Did Not Match <?php showfooter(); } ?> Kas šajā kodā ir nepareizs, ka izlec errors? 2.) Un kādā veidā db var izveidot šo: This is the query that inserts the values into the database. setcookie("site_user", $Name, time() + 31536000, "/"); setcookie("site_pass", $Password, time() + 31536000, "/"); iznākums: http://81.198.234.32/register Edited August 28, 2007 by MārisL Link to comment Share on other sites More sharing options...
black Posted August 28, 2007 Report Share Posted August 28, 2007 Vispār vajadzēja prasīt, kas tajā kodā ir pareizs :) Tabula 'personalize' eksistē? Link to comment Share on other sites More sharing options...
NiTrino Posted August 28, 2007 Report Share Posted August 28, 2007 (edited) 1) kāds errors izlec? 2) no kurienes ienāk $Password, $Name un $Password2? 3) kur ir mysql_real_escape_string() ? 4) priekš kam html definīcijas jābāž funkcijās showheader() un showfooter ()? 5) priekš kam tev kukī reģistrācijā? Edited August 28, 2007 by NiTrino Link to comment Share on other sites More sharing options...
MārisL Posted August 28, 2007 Author Report Share Posted August 28, 2007 pamācība taisīta pēc http://www.thescripts.com/serversidescript...stem/page3.html Es vnk gribu izveidot reģistrēšanos, bet nesanāk :@ Link to comment Share on other sites More sharing options...
Grey_Wolf Posted August 28, 2007 Report Share Posted August 28, 2007 1. Taadus koda blakjus --> paste.php.lv 2. Kaa jau mineja prieksh kam jaukt HTML ar PHP? 2.) Un kādā veidā db var izveidot šo:This is the query that inserts the values into the database. setcookie("site_user", $Name, time() + 31536000, "/"); setcookie("site_pass", $Password, time() + 31536000, "/"); 3. kaads sakars setcookie() ar DB? 4. Visi te ir gaisregji --> Vismaz buutu paraadijis to gabalu kas paredzeets DB izveidei... // tas ir *.SQL vai PHP kods... Link to comment Share on other sites More sharing options...
MārisL Posted August 28, 2007 Author Report Share Posted August 28, 2007 tāda koda nav! Viss sastāv no viena faila, kas mani lika ļoti aizdomāties, jo nesen atradu skriptu, kur ir vismaz 4 faili (login.php, logout.php, u.c.) VIss kods man jau ir ierakstīts. Pamācības links ar pievienots. Link to comment Share on other sites More sharing options...
black Posted August 28, 2007 Report Share Posted August 28, 2007 Tajā pamācībā nebija par to, kā izveidot tabulu? Link to comment Share on other sites More sharing options...
MārisL Posted August 28, 2007 Author Report Share Posted August 28, 2007 Nē. Paskaties pats to pamācību. Urla augstāk Link to comment Share on other sites More sharing options...
black Posted August 28, 2007 Report Share Posted August 28, 2007 Tagad padomāsim... "SELECT * FROM personalize" izmanto kaut kādu tabulu, vai ne? Pamācībā tādas izveidošana nav pieminēta, pie tam pamācība nestrādā. Ko no tā varam secināt? Link to comment Share on other sites More sharing options...
MārisL Posted August 28, 2007 Author Report Share Posted August 28, 2007 No tā, ka es jau atradu citu tutoriālu :D Paldies par to pašu. php man ir kā veļasmašīna - ļoti sarežģīta sistēma Link to comment Share on other sites More sharing options...
black Posted August 28, 2007 Report Share Posted August 28, 2007 Saprati, kāpēc negāja šis? Link to comment Share on other sites More sharing options...
MārisL Posted August 28, 2007 Author Report Share Posted August 28, 2007 nebija tabula un īsti uzrādīts ko katrā vietā jāraksta. Esmu atradis citu tut, kur viss sīki aprakstīts. Link to comment Share on other sites More sharing options...
Recommended Posts