I’ve wandered far away from God,
Now I’m coming home;
The paths of sin too long I’ve trod,
Lord, I’m coming home.
Coming home, coming home,
Nevermore to roam,
Open wide Thine arms of love,
Lord, I’m coming home.
June 20, 2009
from God.com
March 25, 2009
Upload & Save file in DB
// add to form <tr> <input type="hidden" name="MAX_FILE_SIZE" value="100000000" /> <td width="200"> <div align="right"><font face="Times New Roman, Times, serif"><strong>Choose a file to upload: </strong></font></div></td> <td colspan=2><input name="uploadedfile" type="file" /><br /> </td> </tr>
//add to insert.php $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { //echo "The file ". basename( $_FILES['uploadedfile']['name']). //" has been uploaded"; } else{ //echo "There was an error uploading the file, please try again!"; }
'".$_FILES['uploadedfile']['name']."')";
//db_config <?php $con = mysql_connect("localhost","root","shad4me"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("automation", $con); $target_path = 'uploads/';
March 14, 2009
Delete Confirmation
echo "<input type='submit' onclick=\"if(confirm('Are you sure you want to delete this?')) document.form.submit(); else return false;\" value='Delete'>";
Back
to be added to: edit successful, deleted successfully, record added</strong></a>
<br/> <a href="feedback_tool.php"><strong><font size="3" face="Arial, Helvetica, sans-serif">Back</font></strong></a>
March 11, 2009
Action not allowed…
<?php include('login_checker.php');?> <?php include('header.php'); include('db_config.php');
//condition-so page can't be access directly if((!isset($_POST)) OR (!count($_POST))) { die("Action not Allowed"); }
$sql="INSERT INTO daily_report (
product,
date_added,
sw_build,
fw_level,
ina_fw,
hw_level,
connection_type,
tester,
os,
issues_concerns,
comments,
awit,
piloa,
igniter,
mac_print,
mac_scan)
VALUES (
'$_POST[product]',
'".date('Y-m-d H:i:S')."',
'$_POST[sw_build]',
'$_POST[fw_level]',
'$_POST[ina_fw]',
'$_POST[hw_level]',
'$_POST[connection_type]',
'$_POST[tester]',
'$_POST[os]',
'$_POST[issues_concerns]',
'$_POST[comments]',
'$_POST[awit]',
'$_POST[piloa]',
'$_POST[igniter]',
'$_POST[mac_print]',
'$_POST[mac_scan]')";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
echo "<BR>";
echo "<span style='font-family: Arial; font-size: 14px;' ><b>- 1 Record Added - </b></span>";
echo "<BR>";
mysql_close($con)
?>
<?php include('footer.php'); ?>Save as Excel file
<?php include('login_checker.php'); //Name this file as view_excel.php header("Pragma: public"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: pre-check=0, post-check=0, max-age=0"); header("Pragma: no-cache"); header("Expires: 0"); header("Content-Transfer-Encoding: none"); header("Content-Type: application/vnd.ms-excel;"); header("Content-type: application/x-msexcel"); header("Content-Disposition: attachment; filename=automation_".date('Ymd').".xls");
//from view.php include ('db_config.php'); if (isset($_GET['field'])){ $sql="SELECT * FROM daily_report WHERE 1 ORDER BY ".$_GET['field']." ".$_GET['order']; if(isset($_GET['iscompletewin'])){ $sql="SELECT * FROM daily_report WHERE awit=100 AND piloa=100 AND igniter=100 ORDER BY ".$_GET['field']." ".$_GET['order']; } if(isset($_GET['iscompletemac'])){ $sql="SELECT * FROM daily_report WHERE mac_print=100 AND mac_scan=100 ORDER BY ".$_GET['field']." ".$_GET['order']; } }else{ $sql="SELECT * FROM daily_report"; } $result = mysql_query($sql); echo "<html><body>"; echo "<table border='1' style='font-family: Arial; font-size: 11px;' width='100%'> <tr> <th>Product</th> <th>Date</th> <th>SW Build</th> <th>FW Level</th> <th>INA FW</th> <th>HW Level</th> <th>Connection Type</th> <th>Tester</th> <th>OS</th> <th>Issues/Concerns</th> <th>Comments</th> <th>AWiT</th> <th>PILOA</th> <th>Ignit3r</th> <th>MAC Print</th> <th>MAC Scan</th> <th> </th> <th> </th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['product'] . " </td>"; echo "<td>" . $row['date_added'] . " </td>"; echo "<td>" . $row['sw_build'] . " </td>"; echo "<td>" . $row['fw_level'] . " </td>"; echo "<td>" . $row['ina_fw'] . " </td>"; echo "<td>" . $row['hw_level'] . " </td>"; echo "<td>" . $row['connection_type'] . " </td>"; echo "<td>" . $row['tester'] . " </td>"; echo "<td>" . $row['os'] . " </td>"; echo "<td>" . $row['issues_concerns'] . " </td>"; echo "<td>" . $row['comments'] . " </td>"; echo "<td>" . $row['awit'] . " </td>"; echo "<td>" . $row['piloa'] . " </td>"; echo "<td>" . $row['igniter'] . " </td>"; echo "<td>" . $row['mac_print'] . " </td>"; echo "<td>" . $row['mac_scan'] . " </td>"; echo "<td>"; if($_SESSION['can_edit']=='yes') { echo "<a href='edit.php?target_id=".$row['id']."'>Edit</a>"; } else { echo "Edit"; } echo "</td>"; echo "<td>"; if($_SESSION['can_delete']=='yes') { echo "<form action='delete.php' method='post'>"; echo "<input name='target_id' type='hidden' value='".$row['id']."'>"; echo "<input type='submit' value='Delete'>"; echo "</form>"; } else { echo "Delete"; } echo "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </body> </html>
March 5, 2009
Delete
<?php include('login_checker.php'); include ('header.php'); include ('db_config.php'); ?> <?php $sql = "DELETE FROM daily_report WHERE id='".$_GET['target_id']."'"; $result=mysql_query($sql); //var_dump($row); // if successfully deleted if($result){ echo "Deleted Successfully"; echo "<BR>"; } else { echo "ERROR"; } // close connection mysql_close(); ?>
echo "<td><a href='delete.php?target_id=".$row['id']."'>Delete</a></td>";
Update-Edit
<?php include('login_checker.php'); include('header.php'); include('db_config.php'); $sql="UPDATE daily_report SET product='$_POST[product]', sw_build='$_POST[sw_build]', fw_level='$_POST[fw_level]', ina_fw='$_POST[ina_fw]', hw_level='$_POST[hw_level]', connection_type='$_POST[connection_type]', tester='$_POST[tester]', os='$_POST[os]', issues_concerns='$_POST[issues_concerns]', comments='$_POST[comments]', awit='$_POST[awit]', piloa='$_POST[piloa]', igniter='$_POST[igniter]', mac_print='$_POST[mac_print]', mac_scan='$_POST[mac_scan]' WHERE id='$_POST[target_id]' "; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Successful..."; mysql_close($con) // Add / Show List ?>
Edit
<?php include('login_checker.php'); include ('db_config.php'); ?> < html> < body> < form action="update.php" method="post"> < ?php echo date('m-d-Y'); ?> < ?php $sql = "SELECT * FROM daily_report WHERE id='".$_GET['target_id']."'"; $result=mysql_query($sql); $row = mysql_fetch_assoc($result); //var_dump($row); ?> <table border=2> <tr> <td colspan=2> Windows Automation Testing </td> </tr> <tr> <td> Product </td> <td> <input type='text' value='<?php echo $row['product']; ?>' name='product' /> <input type='hidden' value='<?php echo $row['id']; ?>' name='target_id' /> </td> </tr> <tr> <td> SW Build </td> <td> <input type='text' value='<?php echo $row['sw_build']; ?>' name='sw_build' /> </td> </tr> <tr> <td> FW Level </td> <td> <input type='text' value='<?php echo $row['fw_level']; ?>' name='fw_level' /> </td> </tr> <tr> <td> INA FW </td> <td> <input type='text' value='<?php echo $row['ina_fw']; ?>' name='ina_fw' /> </td> </tr> <tr> <td> HW Level </td> <td> <input type='text' value='<?php echo $row['hw_level']; ?>' name='hw_level' /> </td> </tr> <tr> <td> Connection Type </td> <td> <input type='text' value='<?php echo $row['connection_type']; ?>' name='connection_type' /> </td> </tr> <tr> <td> Tester </td> <td> <input type='text' value='<?php echo $row['tester']; ?>' name='tester' /> </td> </tr> <tr> <td> OS </td> <td> <input type='text' value='<?php echo $row['os']; ?>' name='os' /> </td> </tr> <tr> <td> Issues/Concerns </td> <td> <textarea name="issues_concerns" ><?php echo $row['issues_concerns']; ?></textarea> </td> </tr> <tr> <td> Comments </td> <td> <textarea name="comments" ><?php echo $row['comments']; ?></textarea> </td> </tr> <tr> <td colspan=2> Test Progress </td> </tr> <tr> <td colspan=2> Windows </td> </tr> <tr> <td> AWiT </td> <td> <input type='text' value='<?php echo $row['awit']; ?>' name='awit' /> </td> </tr> <tr> <td> PILOA </td> <td> <input type='text' value='<?php echo $row['piloa']; ?>' name='piloa' /> </td> </tr> <tr> <td> Ignit3r </td> <td> <input type='text' value='<?php echo $row['igniter']; ?>' name='igniter' /> </td> </tr> <tr> <td colspan=2> MAC </td> </tr> <tr> <td> MAC Print </td> <td> <input type='text' value='<?php echo $row['mac_print']; ?>' name='mac_print' /> </td> </tr> <tr> <td> MAC Scan </td> <td> <input type='text' value='<?php echo $row['mac_scan']; ?>' name='mac_scan' /> </td> </tr> <tr> <td> <input type="submit" value="save"/> </td> <td> <a href="view.php">Cancel</a> </td> </tr> < /table> < /form> < /body> < /html>
echo "<td><a href='edit.php?target_id=".$row['id']."'>Edit</a></td>";
March 4, 2009
Header
<?php if (isset($_SESSION['username'])) { ?> <p>Logged as <?php echo $_SESSION['username']; ?> | <a href="change_password.php">Change Password</a> | <a href="test.php">Add</a> | <a href="view.php">View All</a> | <a href="logout.php">Logout</a> </p> <?php } ?>