line 95 is this bitWarning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web230/b2302/ipg.myaccount/test_server/admin/index.php:10) in /hermes/bosweb/web230/b2302/ipg.myaccount/test_server/admin/index.php on line 95
Code: Select all
header('Location: index.php');Code: Select all
<?php
// Set Global Vars
$HOST = "xxxxxxxxxx";
$USERNAME = "xxxxxxxxx";
$PASSWORD = "xxxxxxxxx";
$DATABASE = "group";
$TABLE = "Testimonials";
// Establish a connection
mysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());
mysql_select_db($DATABASE) or die(mysql_error());
//==================================================================
// Check if anything is posted
//==================================================================
if (isset($_POST['delete'])) {
$sql = ("delete from $TABLE where ");
for ($i = 0; $i < count($_POST['checkbox']); $i++) {
if ($i != 0) {
$sql.= "OR ";
}
$sql .= " id='" . $_POST['checkbox'][$i] . "'";
//==================================================================
// Select file to unlink based on id posted
//==================================================================
$sql_file_unlink = "select Download from $TABLE where id = {$_POST['checkbox'][$i]}";
$result_file_unlink = mysql_query($sql_file_unlink);
$row_file_link = mysql_fetch_assoc($result_file_unlink);
if($row_file_link) {
unlink('../testimonial_files/' . $row_file_link['Download']);
}
//==================================================================
}
$result = mysql_query($sql);
header('Location: index.php');
exit;
} else {
// select sql here
$sql = "select * from `$TABLE` order by `id`;";
$result = mysql_query($sql);
}
?>
<table align="center" width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="6" align="center"><strong>Testimonials</strong> </td>
</tr>
<tr>
<td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<table width="400" border="1" cellpadding="3" cellspacing="1">
<tr>
<td align="center"><strong>Select</strong></td>
<td align="center"><strong>ID</strong></td>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>Description</strong></td>
<td align="center"><strong>Download</strong></td>
<td align="center"><strong>Last Modified</strong></td>
</tr>
<?php $row = mysql_fetch_assoc($result); ?><?php do { ?>
<tr>
<td align="center">
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>">
</td>
<td align="center"><?php echo $row['id']; ?></td>
<td align="center"><?php echo $row['Name']; ?></td>
<td align="center"><?php echo $row['Message']; ?></td>
<td align="center"><a href="../testimonial_files/<?php echo $row['Download']; ?>">Download</a></td>
<td align="center"><?php echo date("j/n/y", strtotime($row["Modified"])) ?></td>
</tr>
<?php
} while ($row = mysql_fetch_assoc($result)); ?>
<tr>
<td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>