By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

what s wrong with my code

P: 22
Whats wrong with my code , i cant access to next page.
Looks like the text field cant be read by login.php
Thanks
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>Untitled Document</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <style type="text/css">
  7. <!--
  8. .style1 {color: #0000FF}
  9. .style2 {color: #392CB8}
  10. .style3 {
  11.     font-family: Geneva, Arial, Helvetica, sans-serif;
  12.     font-weight: bold;
  13. }
  14. .style6 {
  15.     font-size: 12px;
  16.     font-style: italic;
  17. }
  18. .style9 {font-size: 12px}
  19. .style10 {color: #0000FF; font-size: 12px; }
  20. .style11 {
  21.     font-size: 12;
  22.     font-weight: bold;
  23.     color: #FFFFFF;
  24. }
  25. .style12 {color: #FFFFFF}
  26. -->
  27. </style>
  28. </head>
  29.  
  30. <body>
  31. <table width="797" border="0" cellpadding="0" cellspacing="0">
  32.   <!--DWLayoutTable-->
  33.   <tr>
  34.     <td height="150" colspan="2" valign="top" bordercolor="#392CB8" bgcolor="#392CB8"><div align="center" class="style2"><img src="images/banner.jpg" width="797" height="150" align="top"></div></td>
  35.   </tr>
  36.   <tr>
  37.     <td width="180" height="50" valign="top" bgcolor="#392CB8"><table width="200" border="1" align="center" bordercolor="#392CB8" bgcolor="#392CB8">
  38.       <!--DWLayoutTable-->
  39.       <tr>
  40.         <td><!--DWLayoutEmptyCell-->&nbsp;</td>
  41.       </tr>
  42.     </table></td>
  43.     <td width="617" valign="top" bgcolor="#392CB8"><table width="300" border="1" align="center" bordercolor="#392CB8" bgcolor="#392CB8">
  44.         <tr>
  45.           <td width="61"><span class="style12"><a href="coba.php">[Home]</a></span></td>
  46.           <td width="8">&nbsp;</td>
  47.           <td width="112"><span class="style12">[Information]</span></td>
  48.           <td width="8">&nbsp;</td>
  49.           <td width="50"><div align="right" class="style12">[User]</div></td>
  50.           <td width="21">&nbsp;</td>
  51.           <td width="15"><span class="style12">[Administrator]</span></td>
  52.         </tr>
  53.     </table></td>
  54.   </tr>
  55. </table>
  56. <table width="803" height="587" border="0" cellpadding="0" cellspacing="0">
  57.   <!--DWLayoutTable-->
  58.   <tr>
  59.     <td width="189" height="132" align="center" valign="middle" bordercolor="#392CB8" bgcolor="#392CB8" class="style1"><div align="right"></div>      <div align="right">
  60.         <p align="center"><img src="images/gp.jpg" width="99" height="94"></p>
  61.       </div></td>
  62.     <td colspan="9" rowspan="3" valign="top"><form name="form1" method="post" action="">
  63.     </form>
  64.       <p>&nbsp;</p>
  65.     <p>&nbsp;</p>
  66.     <p>&nbsp;</p>
  67.     <p>&nbsp;</p>
  68.     <form action="login.php" method="post" name="form2">
  69.       <table width="254" border="1" align="center" id="table1">
  70.         <tr>
  71.           <td colspan="2"><div align="center">Please Login </div></td>
  72.           </tr>
  73.         <tr>
  74.           <td width="94">User Name </td>
  75.           <td width="144"><input name="txtuser" type="text" id="txtuser"></td>
  76.         </tr>
  77.         <tr>
  78.           <td>Password</td>
  79.           <td><input name="txtpass" type="password" id="txtpass"></td>
  80.         </tr>
  81.         <tr>
  82.           <td colspan="2">&nbsp;</td>
  83.           </tr>
  84.         <tr>
  85.           <td colspan="2"><div align="center">
  86.             <input name="login" type="submit" id="login" value="LOGIN">
  87.             <input type="reset" name="Submit2" value="RESET">
  88.           </div></td>
  89.           </tr>
  90.       </table>
  91.     </form>    <p>&nbsp;</p></td>
  92.     <td width="1"></td>
  93.   </tr>
  94.          <tr>
  95.              <td height="343" valign="middle" bgcolor="#392CB8"><p align="center" class="style11">&nbsp;</p>      
  96.                <p align="center">&nbsp;</p>      <p>&nbsp;</p>      <p>&nbsp;</p></td>
  97.              <td></td>
  98.     </tr>              
  99.     <tr>
  100.       <td rowspan="5" valign="top" bgcolor="#392CB8"><p>&nbsp;</p>
  101.         <p>&nbsp;</p>
  102.         <p><span class="style1">
  103.         </span></p>
  104.         <p>&nbsp;</p>
  105.         <p>&nbsp;</p>
  106.         <p>&nbsp;</p>        <p><span class="style1">
  107.       </span></p></td>
  108.       <td height="143"></td>
  109.     </tr>
  110.  
  111.   <tr>
  112.     <td height="32" colspan="8" valign="top"><div align="left"><span class="style1">
  113.     </span></div></td>
  114.     <td width="16"></td>
  115.     <td></td>
  116.   </tr>
  117.   <tr>
  118.     <td width="62" height="19">&nbsp;</td>
  119.     <td width="9">&nbsp;</td>
  120.     <td colspan="4" valign="top"><div align="left" class="style1 style3"><em> POWER BY OPEN SOURCE : </em></div></td>
  121.     <td width="4"></td>
  122.     <td width="30"></td>
  123.     <td></td>
  124.     <td></td>
  125.   </tr>
  126.   <tr>
  127.     <td height="55">&nbsp;</td>
  128.     <td colspan="2" valign="top"><div align="center"><img src="images/php5.jpg" width="70" height="47"></div></td>
  129.     <td width="149" valign="top"><div align="center"><img src="images/mysql.gif" width="112" height="40"></div></td>
  130.     <td width="119" valign="top"><div align="center"><img src="images/wamp5.jpg" width="68" height="44" align="middle"></div></td>
  131.     <td width="121" valign="top"><div align="center"><img src="images/apache.jpg" width="60" height="47"></div></td>
  132.   <td></td>
  133.     <td></td>
  134.     <td></td>
  135.     <td></td>
  136.   </tr>
  137.   <tr>
  138.     <td height="26">&nbsp;</td>
  139.     <td colspan="6" valign="top"><div align="center" class="style6">CREATED BY CGK-INNOVATION 2007 </div></td>
  140.     <td></td>
  141.     <td></td>
  142.     <td></td>
  143.   </tr>
  144.   <tr>
  145.     <td height="0"></td>
  146.     <td></td>
  147.     <td></td>
  148.     <td width="103"></td>
  149.     <td></td>
  150.     <td></td>
  151.     <td></td>
  152.     <td></td>
  153.     <td></td>
  154.     <td></td>
  155.     <td></td>
  156.   </tr>
  157. </table>
  158. </body>
  159. </html>
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. session_register("username");
  4. ?>
  5. <table width="149" border="0" cellpadding="0" cellspacing="0">
  6.   <!--DWLayoutDefaultTable-->
  7.   <tr>
  8.     <td width="9" height="57">&nbsp;</td>
  9.     <td width="140" valign="top"><a href="index.htm">back to main page</a> </td>
  10.   </tr>
  11. </table>
  12. <?php
  13. if ((!$txtuser) or(!$txtpass)){
  14. echo"<br>";
  15. echo "User Name:$txtuser";
  16. echo "<br>";
  17. echo "Wrong Password ";
  18. }else
  19. {
  20. include "koneksi.php";
  21. $txtpass=md5($password);
  22. $query_login=mysql_query("select * from tbluser where username='$txtuser' and password='$txtpass'",$koneksi) or die (mysql_error());
  23. while($row=mysql_fetch_array($query_login))
  24. {
  25. if($txtpass=="$row[password]" && $txtuser=="$row[username]")
  26. {
  27. header("location:./login/user.php");
  28. }
  29. else
  30. header("location:./index.php?error=1");
  31. }}
  32. ?>
Feb 11 '07 #1
Share this Question
Share on Google+
6 Replies


ronverdonk
Expert 2.5K+
P: 4,258
You posted your values to login.php. So the question is: where did you assign the values to these variables from the $_POST array in LOGIN.PHP?
Expand|Select|Wrap|Line Numbers
  1. if ((!$txtuser) or(!$txtpass)){
  2.  
Ronald :cool:
Feb 11 '07 #2

P: 99
The globals will be off and that's a good thing. To get posted and url parameter values use $_POST and $_GET.
Feb 11 '07 #3

ronverdonk
Expert 2.5K+
P: 4,258
The globals will be off and that's a good thing.
What do I do with this statement or what message are you conveying? Please explain.

Ronald :cool:
Feb 11 '07 #4

P: 99
if the globals in the php ini are on you can retrieve post and get variables like they were self defined variables hence the txtuser and textpass variables.

now hosting compagnies are beginning to use that setting in the off state because they are switching to php 4.2. I think this is what is happening with amrhis hosting.

It happened to a site of mine i made a few years ago too a month ago. if you are used to work with the globals setting on it breaks all code that is based on http actions.

register_globals is the setting i'm talking about
Feb 11 '07 #5

ronverdonk
Expert 2.5K+
P: 4,258
Thank you for your explanation.

You are right that a lot of programmers still don't know that globals are set off by most server providers nowadays. And that, for that reason, a lot of 'old' applications run into problems.

Ronald :cool:
Feb 11 '07 #6

P: 22
Thanks guys for your help..........!
it works now.
Feb 12 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.