Advertisement
Guest User

Untitled

a guest
Jan 4th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.52 KB | None | 0 0
  1. <?php
  2.     //require_once('auth.php');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6.   <head>
  7.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8.     <title>Catalog</title>
  9.     <link rel="stylesheet" href="footer.css" />
  10.   </head>
  11. <body>
  12.   <div class="wrapper">
  13.     <? // am inlocuit aici user-ul din session pt ca n-am restul paginilor si nu pot seta sesiunea
  14.       //$current_user = $_SESSION['SESS_FIRST_NAME'];
  15.       //$current_user_id = $_SESSION['SESS_MEMBER_ID'];
  16.  
  17.       $current_user = "Mihai";
  18.       $current_user_id = 1;
  19.     ?>
  20.     <h1>Bine ai venit, <?php echo $current_user ?></h1>
  21.     <a href="logout.php">Logout</a>
  22.     <a href="chpass.php">Schimba parola</a>
  23. <?
  24.     require_once('config.php');
  25.     //Connect to mysql server
  26.     error_reporting (E_ALL ^ E_NOTICE);
  27.     $link = mysql_connect($DB_HOST, $DB_USER, $DB_PASSWORD);
  28.     if(!$link) {
  29.             die('Failed to connect to server: ' . mysql_error());
  30.     }
  31.  
  32.     //Select database
  33.     $db = mysql_select_db($DB_DATABASE);
  34.     if(!$db) {
  35.             die("Unable to select database");
  36.     }
  37.  
  38.     echo '<br><br>';
  39.  
  40.     $query=mysql_query("select * from elev where nume='".$current_user."'");
  41.     $result=mysql_fetch_array($query);
  42. ?>
  43.     <h1>Informatii elev</h1>
  44.     <table border="1">
  45.       <tr>
  46.         <td>Nume si prenume</td>
  47.         <td><? echo $result['nume']; ?></td>
  48.       </tr>
  49.       <tr>
  50.         <td>Clasa</td>
  51.         <td><? echo $result['clasa']; ?></td>
  52.       </tr>
  53.       <tr>
  54.         <td>CNP</td>
  55.         <td><? echo $result['cnp'] ?></td>
  56.       </tr>
  57.     </table>
  58. <?
  59.     $query2 = mysql_query("SELECT * from materie");
  60.     $a = array();
  61.     $i = 0;
  62.     while ($result2 = mysql_fetch_array($query2)) {
  63.       $a[$i] = $result2['nume'];
  64.       $i ++;
  65.     }
  66. ?>
  67.     <br><br>
  68.     <h1>Note</h1>
  69.     <table border="1"><b><tr>
  70.       <? for($x = 0;$x < $i; $x ++) { ?>
  71.         <tr>
  72.           <th><? echo $a[$x]; ?></th>
  73.           <? $matid = $x + 1;
  74.             $sql = mysql_query("select nota from note where materie_id='".$matid."' and elev_id='".$current_user_id."'");
  75.             while ($result = mysql_fetch_array($sql)) {
  76.               echo "<td>".$result['nota']."</td>";
  77.             }
  78.           ?>
  79.         </tr>
  80.       <?  } ?>
  81.       </tr>
  82.     </table>
  83.     <br><br>
  84.     <h1>Absente</h1>
  85.     <table border="1">
  86.       <tr>
  87.  
  88.       </tr>
  89.     </table>
  90.   </body>
  91. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement