W php nie jestem dobry, dlatego tez sciagnalem sobie gotowca na logowanie i rejestrowanie uzytkownikow.
Niestety nie dziala prawidlowo. Gdy sie rejestruje nowa osobe to skrypt nie wpisuje tych danych do bazy danych a co za tym idzie nie da sie zalogowac.
login.php
<?php require("./CustomSql.inc.php"); $db = new CustomSQL($DBName); $showtable = true; $errortag = false; $errortag = true; $errormsg = $error_usernameempty; } $errortag = true; $errormsg = $error_passwordempty; } $customerid = $db->logincheck($username,$password); if ($customerid==0) { $errortag = true; $errormsg = $error_wrongpassword; } if (!$errortag){ $CID = $customerid; $showtable = false; } } $showtable = false; } ?> <html> <head> <link rel="stylesheet" href="./style/style.css" type="text/css"> <script language="JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
}} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); // --> </script> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"> <?php include("top.php3"); ?> <table width="770" border="0" cellspacing="1" cellpadding="0" align="center" class="table_01"> <tr> <td class="table_02" width="160" valign="top"> <table width="160" border="0" cellspacing="0" cellpadding="4"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> </td> <td class="menu" bgcolor="#FFFFFF" valign="top" width="610"> <table border="0" cellspacing="0" cellpadding="4" width="610"> <tr> </tr> <?php if ($errortag){ ?> <tr> </tr> <?php } ?> <tr> <td> <?php if ($showtable){ ?> <table border=0 cellpadding=2 cellspacing=2> <tr><td><?php print "$front_password"; ?> : </td><td><input type="password" name="password" value=""> <font color="#FF0000">*</font></td></tr> </table> </form> <?php } else{ ?> <?php } ?> </td> </tr> <tr> <td align="right"> </td> </tr> </table> </td> </tr> </table> <?php include("bottom.php3"); ?> </body> </html>
register.php
<?php require("./CustomSql.inc.php"); $db = new CustomSQL($DBName); $showtable = true; $errortag = false; $errortag = true; $errormsg = $error_usernameempty; } $errortag = true; $errormsg = $error_passwordempty; } $errortag = true; $errormsg = $error_emailempty; } $usernamecheckresult = $db->checkusername($username); $errortag = true; $errormsg = $error_userexist; } if ($password!=$passretype){ $errortag = true; $errormsg = $error_passretypewrong; } if ($email!=$emailretype){ $errortag = true; $errormsg = $error_emailretypewrong; } $errortag = true; $errormsg = $error_email; } if (!$errortag){ $customerid = $db->adduser($username,$password,$email,$homepage,$icq,$aol,$yahoo,$msn,$location,$occupation,$interests,$biography); $showtable = false; } } ?> <html> <head> <?php ?> <meta http-equiv="refresh" content="0;URL=login.php"> <?php exit; } ?> <link rel="stylesheet" href="./style/style.css" type="text/css"> <script language="JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
}} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); // --> </script> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"> <?php include("top.php3"); ?> <table width="770" border="0" cellspacing="1" cellpadding="0" align="center" class="table_01"> <tr> <td class="table_02" width="160" valign="top"> <table width="160" border="0" cellspacing="0" cellpadding="4"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> </td> <td class="menu" bgcolor="#FFFFFF" valign="top" width="610"> <table border="0" cellspacing="0" cellpadding="4" width="610"> <tr> </tr> <?php if ($errortag){ ?> <tr> </tr> <?php } ?> <tr> <td> <?php if ($showtable){ ?> <table border=0 cellpadding=2 cellspacing=2> <tr><td><?php print "$front_password"; ?> : </td><td><input type="password" name="password" value=""> <font color="#FF0000">*</font></td></tr> <tr><td><?php print "$front_passwordagain"; ?> : </td><td><input type="password" name="passretype" value=""> <font color="#FF0000">*</font></td></tr> <tr><td><?php print "$front_emailagain"; ?> : </td><td><input type="text" name="emailretype" value=""> <font color="#FF0000">*</font></td></tr> <tr><td></td><td><input type="submit" name="adduser" value="<?php print "$front_regsubmit"; ?>"></td></tr> </table> </form> <?php } ?> </td> </tr> <tr> <td align="right"> </td> </tr> </table> </td> </tr> </table> <?php include("bottom.php3"); ?> </body> </html>
hmmm czy tu jest cos pokrecone?!
