Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enter code here
- First page:
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
- <title>Clients</title>
- <link rel="stylesheet" type="text/css" href="./css/clients.css">
- <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
- <!--[if gt IE 8]><!--><!-- <html lang="en">--><!--<![endif]-->
- <!--[if lt IE 9]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->
- <!--[if !IE | (gt IE 8)]><!-->
- <script type="text/javascript" src="js/client.js"> </script>
- </head>
- <body>
- <div id="container">
- <div id="sidebar1">
- <!-- <h3>Commercial Refrigeration</h3>-->
- <!-- end #sidebar1 --></div>
- <div id="mainContent">
- <!--<h2>Clients</h2>-->
- <form action="clientchk.php" onsubmit="return validate_form(this)" method="post" >
- <table class="td">
- <tr>
- <td> <!--<input type="hidden" name="todo" value="post">-->
- </td>
- <td class="td">Clients</td></tr>
- <tr>
- <td class="td"> Client »
- </td><td><input type="text" size="35" name="client" /></td></tr>
- <tr><td class="td"> Date »</td><td ><input type="text" size="55" name="date" /></td></tr><tr><td class="td"> Details »</td><td ><input type="text" size="55" name="details" /></td></tr>
- <tr><td class="td"> Invoice no. »</td><td><input type="text" name="invoice" /></td></tr>
- <tr><td class="td"> Signer »</td><td><input type="text" name="signer" /></td></tr>
- <tr><td class="td"> Billing Total »</td><td><input type="text" name="billing total" value="$" /></td></tr>
- <tr><td class="td"> Month To Date »</td><td><input type="text" name="month to date" value="$" /></td></tr>
- <tr><td class="td"> Year To Date »</td><td><input type="text" name="year to date" value="$" /></td></tr>
- <tr><td class="td"> Parts »</td><td><input type="text" name="parts" value="$" /></td></tr>
- <tr><td class="td"> Parts Year to Date » </td><td><input type="text" name="parts year to date" value="$" /></td></tr>
- <tr><td colspan="2"><input type="submit" /></td></tr>
- </table>
- </form>
- <p class="p"><a href="dbchk.php">Check DB</a></p>
- <!-- end #mainContent --></div>
- <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
- <!-- end #container --></div>
- </body>
- </html>
- //////////////////////////////////////////////////////////
- dbchk.php
- <?php
- error_reporting(E_ALL | E_ERROR | E_PARSE | E_CORE_ERROR);
- $servername = "localhost";
- $username = "root";
- $password = "rich";
- $dbname = "clients";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $result = mysqli_query($con,"SELECT * FROM client");
- //{die("Connection failed: " . mysqli_connect_error);}
- $fields_num = mysqli_num_fields($result);
- echo "<h2>Records</h2>";
- echo "<table border='1' cellpadding='3'><tr>";// printing table headers
- for($i=0; $i<$fields_num; $i++)
- {$field = mysqli_fetch_field($result);
- echo "<td>{$field->name}</td>";
- }
- echo "</tr>n";// printing table rows
- {echo "<tr>"; // $row is array...//foreach( .. ) //puts every element
- // of $row to $cell variable
- foreach($row as $cell)
- echo "<td>$cell</td>";
- echo "</tr>n";}
- echo "</table>n";
- mysqli_free_result($result);?>
- <a class="return" href="clients.html">Return to Clients</a>
- </body></html>
- //////////////////////////////////////////////////////
- clientchk.php
- <?php
- //if($rec=mysqli_fetch_array(mysqli_query("SELECT * FROM client WHERE client='$client' AND date = '$date'"))){
- ///if(($rec['client']==$client)&&($rec['date']==$date)){
- // include "include/newsession.php";
- //{ if(empty($client) || empty($message))
- //echo "<font face='Verdana' size='2' color='white'><br>You must make an entry.";
- //echo "The client field cannot be blank!<br>" ;
- //}
- //if(!empty($client) || ($message))
- //echo "Data Entered";
- //$tm=date("Y-m-d H:i:s");//deleted time '$tm',
- mysqli_query("INSERT INTO client VALUES('$id', '$client','$ts', '$details', '$invoice', '$signer', '$billing_total',
- '$month_to_date', '$year_to_date', '$parts','$parts_year_to_date')");
- { // Now password is matching but userid is case sensitive so you can give message but that will help hackers to guess and try.
- echo "<font face='Verdana' size='4' color='black'><br>Data Entry Succeeded.<br><center></center>";
- session_unset();
- }
- //$result = mysqli_query($query) or die('Query failed: ' . mysqli_error());
- // Free resultset
- mysqli_free_result($result);
- // Closing connection
- mysqli_close($link);
- ?>
- <a class="a" href="clients.html">Return to Client</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement