Hi all,
I’m sorry to bother you, my host decided to migrate my website to another server a week early without telling me, this blocked me from FTP, then they blocked my work’s IP which we all use my website from, then finally after all that I get it working again with one exception:
I have a database on my website which users can search for records. The results are presented on the results.php page. For some reason this page produces a HTTP 500 in IE and in Chrome it produces a blank page. The search.php page works. An admin.php page works so I can connect to the database through the db_con.php file that they both reference…
[php]<?php include('db_con.php'); ?>[/php]
It’s only results.php that won’t load. In the admin file I mentioned, I can retrieve data from the database (it’s a control panel I can use to modify the database’s contents). So I have no idea why results.php is refusing to output it’s basic HTML or redirect back to search.php to show an error if nothing’s found.
Can you see if there’s anything obviously wrong here?
[php]<?php include("password_protect.php"); ?>
<?php include_once('db_con.php'); if(isset($_POST['save']) and $_POST['save'] != '') { $search = $_POST['search_name']; $search = cleanQuery($search); if($search == ''){ header("Location: search.php?error=2"); exit; } if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $search)){
header("Location: search.php?error=1");
exit;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Search Results</title>
<link rel="stylesheet" href="css/search.css" />
<link rel="stylesheet" href="css/results.css" />
<!-- <script type="text/javascript" src="scripts/jquery.js"></script> -->
<script type="text/javascript">
$(document).ready(function(){
$(".copy").click(function()
{
var text =$(this).html();
copy_to_clipboard(text);
$(".copy").css("background-color","");
//$(".copy").css("color","");
$(this).css("background-color","yellow");
//$(this).css("color","#ffffff");
//~ SelectText(this);
//set path
//~ ZeroClipboard.setMoviePath('ZeroClipboard.swf');
//~ //create client
//~ var clip = new ZeroClipboard.Client();
//~ //event
//~ clip.addEventListener('mousedown',function() {
//~ clip.setText(text);
//~ });
//~ clip.addEventListener('complete',function(client,text) {
//~ alert('copied: ' + text);
//~ });
//~ //glue it to the button
//~ clip.glue('copy');
});
});
function copy_to_clipboard(text)
{
if(window.clipboardData)
{
window.clipboardData.setData('text',text);
}
else
{
var clipboarddiv=document.getElementById('divclipboardswf');
if(clipboarddiv==null)
{
clipboarddiv=document.createElement('div');
clipboarddiv.setAttribute("name", "divclipboardswf");
clipboarddiv.setAttribute("id", "divclipboardswf");
document.body.appendChild(clipboarddiv);
}
clipboarddiv.innerHTML='<embed src="clipboard.swf" FlashVars="clipboard='+
encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
}
//~ alert('The text is copied to your clipboard...');
return false;
}
function SelectText(element)
{
var text = document.getElementById(element);
if ($.browser.msie) {
var range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if ($.browser.mozilla || $.browser.opera) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
} else if ($.browser.safari) {
var selection = window.getSelection();
selection.setBaseAndExtent(text, 0, text, 1);
}
}
</script>
</head>
<body>
<?php
$query = mysql_query("SELECT * FROM Ms WHERE Name LIKE '%{$search}%'") or die(mysql_error());
$num_rows = mysql_num_rows($query);
if($num_rows!=0)
{
while($rows = mysql_fetch_assoc($query))
{
$MtID = $rows['MtID'];
$Name = $rows['Name'];
$Phone = $rows['Phone'];
$SecondaryPhone = $rows['SecondaryPhone'];
$Email = $rows['Email'];
$SecondaryEmail = $rows['SecondaryEmail'];
$Privacy = $rows['Privacy'];
if($Privacy == 'To:' or $Privacy == 'to:')
{
$Privacy = '<span class="to">';
}
if($Privacy == 'Bcc:' or $Privacy == 'bcc:')
{
$Privacy = '<span class="bcc">';
}
?>
|
|||||||||||||||||
} |