Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.36 KB | None | 0 0
  1. <?php session_start();
  2.  
  3. if(!session_is_registered(myusername)){
  4. header("location:main_login.php");
  5. }
  6. require_once('calendar/classes/tc_calendar.php');
  7. header ( "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
  8. header ("Pragma: no-cache");
  9.  
  10. ?>
  11. <html>
  12. <head>
  13. <script language="javascript" src="calendar/calendar.js"></script>
  14. <link href="calendar/calendar.css" rel="stylesheet" type="text/css">
  15.  
  16. <style type="text/css">
  17. body
  18. {
  19. background-color:#d0e4fe;
  20. }
  21. h1
  22. {
  23. color:orange;
  24. text-align:center;
  25. }
  26. p
  27. {
  28. font-family:"Times New Roman";
  29. font-size:20px;
  30. }
  31. form
  32. {
  33. width: 400px; text-align:center; border: 0px solid #5a698b
  34. }
  35.  
  36. </style>
  37. </head>
  38. <body>
  39. <div align="center">
  40. <?php
  41.  
  42.  
  43. $hostname = "localhost";
  44. $dbuser = "thestory_carl";
  45. $dbpassword = "carl";
  46. $dbname = "thestory_mancstore";
  47.  
  48.      mysql_connect($hostname, $dbuser, $dbpassword)
  49.      or die("Unable to connect to the server!");
  50.  
  51.      mysql_select_db($dbname)
  52.      or die("Unable to connect to the database");
  53.         $fields_array=array(); $num_fields=0; $num_row=0;
  54.  
  55.         $sql="select fname,sname,customerid from customer ";
  56.  
  57.             $result=mysql_query($sql);
  58.             $num_row=mysql_numrows($result);
  59.  
  60.             if($num_row >0)
  61.             {
  62.                     //Get number of fields in query
  63.                     $num_fields=mysql_num_fields($result);
  64.  
  65.          
  66.  
  67.            # get column metadata
  68.            $i = 0;
  69.  
  70.              //Set table width 15% for each column
  71.             $width=10 * $num_fields;
  72.  
  73.             print('<br><table width='.$width.'% align="center"><tr>');
  74.             print('<tr><th colspan='.$num_fields.'></th></tr>');
  75.  
  76.              while ($i < $num_fields)
  77.              {
  78.  
  79.               //Get fields (columns) names
  80.             $meta = mysql_fetch_field($result);
  81.  
  82.             $fields_array[]=$meta->name;
  83.  
  84.            //Display column headers in upper case
  85.        print('<th><b>'.strtoupper($fields_array[$i]).'</b></th>');
  86.  
  87.                     $i=$i+1;
  88.                     }
  89.  
  90.             print('</tr>');
  91.  
  92.  
  93.                    //Get values for each row and column
  94.                 while($row=mysql_fetch_row($result))
  95.                 {
  96.                  print('<tr>');
  97.  
  98.                         for($i=0; $i<$num_fields; $i++)
  99.                         {
  100.                         //Display values for each row and column
  101.                         print('<td align = center>'.$row[$i].'</td>');
  102.  
  103.                         }
  104.  
  105.                 print('</tr>');
  106.                 }
  107.  
  108.     }
  109.  
  110.  
  111. ?>
  112.  
  113.  
  114. <h1><b>Add Item</b></h1>
  115. <form id="form1" name="form1" method="post" action="insertnewitem.php">
  116.  
  117. <div id="inputs">
  118. <?php
  119. $host="localhost"; // Host name
  120. $username="thestory_carl"; // Mysql username
  121. $password="carl"; // Mysql password
  122. $db_name="thestory_mancstore"; // Database name
  123. $tbl_name="users"; // Table name
  124.  
  125. $link = mysql_connect($host, $username, $password);
  126. mysql_select_db($db_name);
  127.  
  128. $query = "SELECT customerid FROM customer";
  129. $result = mysql_query($query);
  130. print "Customer ID: <SELECT name=item>";
  131. while ($line = mysql_fetch_array($result))
  132. {
  133. foreach ($line as $value)
  134. {
  135. print "<OPTION value='$value'";
  136. }
  137. print ">$value</OPTION>";
  138. }
  139. mysql_close($link);
  140. print "</SELECT>";
  141.  
  142.  
  143. ?>
  144. </div>
  145.  
  146. Type: <input type="text" name="type" /><br>
  147. <table border="0" cellspacing="0" cellpadding="2">
  148. <tr>
  149. <td>Collection Date:</td>
  150. <td><?php
  151. $myCalendar = new tc_calendar("date5", true, false);
  152. $myCalendar->setIcon("calendar/images/iconCalendar.gif");
  153. $myCalendar->setPath("calendar/");
  154. $myCalendar->setYearInterval(2000, 2015);
  155. $myCalendar->dateAllow('2008-05-13', '2015-03-01');
  156. $myCalendar->setDateFormat('j F Y');
  157. $myCalendar->writeScript();
  158. ?>
  159. </td>
  160. </tr>
  161. </table>
  162.  
  163. <table border="0" cellspacing="0" cellpadding="2">
  164. <tr>
  165. <td>Release Date:</td>
  166. <td><?php
  167. $myCalendar = new tc_calendar("date6", true, false);
  168. $myCalendar->setIcon("calendar/images/iconCalendar.gif");
  169. $myCalendar->setPath("calendar/");
  170. $myCalendar->setYearInterval(2000, 2015);
  171. $myCalendar->dateAllow('2008-05-13', '2015-03-01');
  172. $myCalendar->setDateFormat('j F Y');
  173. $myCalendar->writeScript();
  174. ?></td>
  175. </tr>
  176. </table>
  177.  
  178.  
  179. <p>
  180. <input type="submit" name="Submit" value="Submit" />
  181. </p> <br>
  182.  
  183. <br>
  184. </form>
  185. <form action="snapshot.php" method="post">
  186.  
  187. <input type="submit" value = "Back"/><br><br>
  188. </form>
  189.  
  190. </body>
  191. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement