tak jak w temacie, a oto kod:
  1. <?php
  2. require("./CustomSql.inc.php");
  3. $db = new CustomSQL($DBName);
  4. $showtable = true;
  5. $errortag = false;
  6. if (!empty($userlogin)) {
  7.  
  8. if (empty($username)){
  9. $errortag = true;
  10. $errormsg = $error_usernameempty;
  11. }
  12.  
  13. if (empty($password)){
  14. $errortag = true;
  15. $errormsg = $error_passwordempty;
  16. }
  17.  
  18. $customerid = $db->logincheck($username,$password);
  19. if ($customerid==0) {
  20. $errortag = true;
  21. $errormsg = $error_wrongpassword;
  22. }
  23.  
  24. if (!$errortag){
  25. $_SESSION["CID"] = $customerid;
  26. $CID = $customerid;
  27. $showtable = false;
  28. }
  29.  
  30. }
  31.  
  32. if (session_is_registered("CID")){
  33. $showtable = false;
  34. }
  35.  
  36.  
  37. ?>
  38. <html>
  39. <head>
  40. <title><?php print "$front_login"; ?></title>
  41. <meta http-equiv="Content-Type" content="text/html; charset=<?php print "$front_charset"; ?>">
  42. <link rel="stylesheet" href="./style/style.css" type="text/css">
  43. <script language="JavaScript">
  44. <!--
  45. function MM_reloadPage(init) { //reloads the window if Nav4 resized
  46. if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  47. document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
     }}
  48. else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  49. }
  50. MM_reloadPage(true);
  51. // -->
  52. </script>
  53. </head>
  54.  
  55. <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
  56.  
  57. <table width="770" border="0" cellspacing="1" cellpadding="0" align="center" class="table_01">
  58. <tr> 
  59. <td class="table_02" width="160" valign="top"> 
  60. <table width="160" border="0" cellspacing="0" cellpadding="4">
  61. <tr> 
  62. <td> </td>
  63. </tr>
  64. <tr> 
  65. <td valign="top"></td>
  66. </tr>
  67. </table>
  68. </td>
  69. <td class="menu" bgcolor="#FFFFFF" valign="top" width="610"> 
  70.  <table border="0" cellspacing="0" cellpadding="4" width="610">
  71. <tr> 
  72. <td bgcolor="#F2F2F2" class="menu_in">::<?php print "$front_login"; ?>   <font color="#FF0000">*</font> <?php print "$front_requiredinfo"; ?></td>
  73. </tr>
  74. <?php
  75. if ($errortag){
  76. ?>
  77. <tr> 
  78. <td><font color="#FF0000"><?php print "$errormsg"; ?></font></td>
  79. </tr>
  80. <?php
  81. }
  82. ?>
  83. <tr> 
  84. <td>
  85. <?php
  86. if ($showtable){
  87. ?>
  88. <form action="<?php print "$PHP_SELF"; ?>" method="POST">
  89. <table border=0 cellpadding=2 cellspacing=2>
  90. <tr><td width="120"><?php print "$front_username"; ?> : </td><td><input type="text" name="username" value="<?php print "$username"; ?>"> <font color="#FF0000">*</font></td></tr>
  91. <tr><td><?php print "$front_password"; ?> : </td><td><input type="password" name="password" value=""> <font color="#FF0000">*</font></td></tr>
  92. <tr><td><a href="register.php"><?php print "$front_registration"; ?></a>   <a href="forgetpass.php"><?php print "$front_forgetpass"; ?></a></td><td><input type="submit" name="userlogin" value="<?php print "$front_login"; ?>"></td></tr>
  93. </table>
  94. </form>
  95. <?php
  96. }
  97. else{
  98. ?>
  99. <a href="modiinfo.php"><?php print "$front_modiinfo"; ?></a>   <a href="modipass.php"><?php print "$front_modipass"; ?></a>
  100. <?php
  101. }
  102. ?>
  103.  
  104.  
  105. </td>
  106. </tr>
  107. <tr> 
  108. <td>
  109.  
  110. </td>
  111. </tr>
  112. </table>
  113. </td>
  114. </tr>
  115. </table>
  116.  
  117.  
  118. </body>
  119. </html>