Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- class dbConnect
- {
- private $host;
- private $username;
- private $password;
- private $db_name;
- private $db_link;
- private $db_select;
- public function setDB()
- {
- $this->host = "localhost";
- $this->username = "root";
- $this->password = "";
- $this->db_name = "overviewer";
- }
- public function connect()
- {
- $this->db_link = mysql_connect($this->host, $this->username, $this->password) or die(mysql_error());
- }
- public function selectTable()
- {
- $this->db_select = mysql_select_db($this->db_name)or die(mysql_error());
- }
- }
- $obj = new dbConnect();
- $obj->setDB();
- $obj->connect();
- $obj->selectTable();
- echo '<h3 style="margin-bottom:5px;">Mitarbeiter, welche an diesem Projekt gearbeitet haben:</h3>';
- $query = "SELECT * FROM user";
- $result = mysql_query($query);
- echo '<table border="1" cellspacing="0" cellpadding="3" width="100%">';
- echo '<tr style="background-color:#58ACFA;">
- <td><b>Benutzername</b></td>
- <td><b>Name</b></td>
- <td><b>Vorname</b></td>
- <td><b>Rechte</b></td>
- <td></td>
- </tr>';
- while($row = mysql_fetch_array($result))
- {
- $u_id = $row['u_id'];
- $s_id = $row['s_id'];
- $u_uname = $row['u_uname'];
- $u_name = $row['u_name'];
- $u_fname = $row['u_fname'];
- $u_right = $row['u_right'];
- $s_start_arr[$count] = $row['s_start'];
- $s_end_arr[$count] = $row['s_end'];
- $count++;
- ?>
- <tr>
- <td><?php echo $u_uname; ?></td>
- <td><?php echo $u_name; ?></td>
- <td><?php echo $u_fname; ?></td>
- <td><?php
- if($u_right == 3 )
- {
- echo "Administrator";
- }
- elseif($u_right == 2)
- {
- echo "Teamleader";
- }
- elseif($u_right == 1)
- {
- echo "Mitarbeiter";
- }
- else
- {
- echo "Nicht spezifiziert";
- }
- ?></td>
- <td>
- <a href="index.php?site=project&view_project&user_project_view=<?php echo $u_id; ?>"><img src="images/icons/view.png" width="16px"alt="edit" border="0" ></a>
- </td>
- </tr>
- <?php
- }
- //Der geschätze Gesamtumsatz wird berechnet
- $query_sum = "SELECT p_hourly_rate FROM project WHERE p_id = '".$_GET['view_project']."'";
- $result_sum = mysql_query($query_sum);
- $count = mysql_num_rows($result_sum);
- while($row_sum = mysql_fetch_array($result_sum))
- {
- $p_hourly_rate = $row_sum['p_hourly_rate'];
- }
- if(!empty($s_start_arr))
- {
- $s_res_hours = (array_sum($s_end_arr) - array_sum($s_start_arr)) / 3600;
- }
- $p_total = $p_hourly_rate * $s_res_hours;
- echo '</table>';
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement