title: How to create a php page with login using cookies?
body: <p>I want to create an admin page with login and if the user is logged and he is admin in my database the content must appear, if is not an admin the content will appear but without some privileges. And if the user and password did not match with any user and password form database a message error must appear.</p>
  
  <p>This is my HTML code:</p>
  
  <pre><code>&lt;form action="admin.php" method="post"&gt;
  &lt;table&gt;
      &lt;tr&gt;&lt;td&gt;
          &lt;label&gt;User:&amp;nbsp&amp;nbsp&amp;nbsp&lt;/label&gt; &lt;/td&gt; &lt;td&gt;&lt;input type="text" class="text" name="user"/&gt; &lt;span&gt;&lt;/span&gt;
      &lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;
          &lt;label&gt;Password:&lt;/label&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="password" class="text" name="pass"/&gt; &lt;span&gt;&lt;/span&gt;
      &lt;/td&gt;&lt;/tr&gt;
      &lt;tr &gt;&lt;td colspan="2"&gt;
      &lt;p align=center&gt;&lt;input type="submit" class="submit" value="Log In" /&gt; &lt;/p&gt;
      &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>This is my PHP code:</p>
  
  <pre><code>&lt;?php
  require_once('config.php');
          $user = $_POST['user'] ;
          $pass = $_POST['pass'] ;
          $sql='SELECT * FROM users';
          $result = mysql_query($sql);
          $row = mysql_fetch_array($result);
  ?&gt;
  </code></pre>
  
  <p>My table is:</p>
  
  <pre><code> |ID_user| user |password|is_admin|
   |   1   |admin | admin  |    1   |
  </code></pre>
  
  <p>Thank you!</p>