djdellux Posted November 21, 2008 Share Posted November 21, 2008 <?php $db = $_SERVER['DOCUMENT_ROOT']."/../data/log.db"; $usercodeQuery = "SELECT DISTINCT userCode FROM log ORDER by userCode"; $handle = sqlite_open($db); $usercodeResult = sqlite_query($handle, $usercodeQuery); ?> <html> <head> <title>Loggin DB</title> </head> <body> <h1 align=center><b>--LOGGIN DATABASE SEARCH--</b></h1> <h1 align=left>Please enter search feilds:</h1> <body bgcolor="000000" text="FFFFFF"> <form method="get" action="loggin1.php"> Page: <select name="Page"> <option value="approve.php" >Approve</option> <option value="custquery" >CustQuery</option> <option value="slpnlogin">SlpnLogin</option> <option value="slpnlogin">custmain</option> <option value="slpnlogin">SupLogin</option> </select> User Code: <select name="userCode"> <?php while($usercodeRow = sqlite_fetch_array($usercodeResult)){ echo '<option >'.$usercodeRow['userCode'].'</option>' ; } ?> </select> Start Date: <input type="text" name="time"> End Date: <input type="text" name="time1"> <p><input name="submitted" type="submit" value="send"/></p></form> <?php $db = $_SERVER['DOCUMENT_ROOT']."/../data/log.db"; //connect to sql $handle = sqlite_open($db); $query = "SELECT * FROM log WHERE"; if(isset($_GET['submitted']) && $_GET["submitted"] == "send")// line check { if ($_GET["Page"] !="") { $query.=" page=\"" .$_GET["Page"]."\""; } if ($_GET["userCode"] !="") { $query.=" and userCode=\"".$_GET["userCode"]."\""; } if(isset($_GET["time"])) { $stime = strtotime($_GET["time"]); $query.=" and time >='" .$stime."'"; } if(isset($_GET["time1"])) { $etime = strtotime($_GET["time1"]); $query.=" and time <='" .$etime."'"; } } echo $query;// show the result of the search $result = sqlite_query($handle, $query); $row = sqlite_fetch_array( $result ); echo "<style type='text/css'> table { border-width: 1px; border-spacing:0px ; border-style: double; border-color: black; border-collapse: separate; background-color: #0000FF; } table th { border-width: 1px; padding: 0px; border-style: solid; border-color: black; background-color: #0000FF; } table td { border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #0000FF; } </style> <table class='db'; cellspacing=\"0px\">"; while($row = sqlite_fetch_array($result)){ echo " <tr>\n"; echo " <td> $row[id]</td><td> $row </td> <td> $row[desc] </td><td> $row[userCode] </td><td> $row[codeType] </td><td>". date( "Y-m-d", $row['time'])."</td><td> $row[ipaddr]</td>\n"; echo " </tr>\n"; } echo "</table>"; ?> </html> What do u guys/girls think and how could i improve if at all thanks Quote Link to comment https://forums.phpfreaks.com/topic/133683-please-critic-this-for-me/ Share on other sites More sharing options...
Maq Posted November 21, 2008 Share Posted November 21, 2008 What is it supposed to do? Details please... Quote Link to comment https://forums.phpfreaks.com/topic/133683-please-critic-this-for-me/#findComment-695608 Share on other sites More sharing options...
djdellux Posted November 21, 2008 Author Share Posted November 21, 2008 its a loggin db search tool. it will just pull info off the db according to user inputs... need more??? Quote Link to comment https://forums.phpfreaks.com/topic/133683-please-critic-this-for-me/#findComment-695611 Share on other sites More sharing options...
djdellux Posted November 21, 2008 Author Share Posted November 21, 2008 this is my first contribution to the wonderfull world of coding special thanks to premiso and maq for their help Quote Link to comment https://forums.phpfreaks.com/topic/133683-please-critic-this-for-me/#findComment-695621 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.