I uploaded my php application using Filezilla and when I checked it online, all of the images are missing and total site get break. I don't understand this because everything works fine offline but when I check through after publishing it online, all the images disapear. I also checked all my links and they're fine.
Here is my code
<html>
<head>
<title> Vatsal Technosoft Messanger </title>
<script type="text/javascript" src="../JavaScript/frmvalidation.js"></script>
<link href="../Stylesheet/style.css" media="all" type="text/css" rel="stylesheet" />
</head>
<body>
<?php include 'connect.php' ?>
<?php include 'functions.php' ?>
<?php include 'header.php' ?>
<div id="outer" style="margin-top:0px;">
<div class="container" style="color:#00C; z-index:1;">
<div class="subcontainer" >
<?php
if(loggedin())
{
?>
<a href='' onclick='addcontact();' id='noti' style='text- decoration:none;margin-bottom:0px;'>
<?php
$my_id = $_SESSION['user_id'];
$notifrnd = mysql_query("SELECT * FROM `frnd_req` WHERE `to` = '$my_id' ");
if(mysql_num_rows($notifrnd))
{
while($arr = mysql_fetch_array($notifrnd))
{
$fid = $arr[1];
$firstname = getfirstname($fid , 'firstname');
$lastname = getlastname($fid , 'lastname');
}
echo "<font style='color:#FFFF00; font-size:11px; margin-left:15px; margin-top:3px; margin-bottom:5px; float:left; font-weight:bold;'>You have Friend request</font>";
}
}
?>
</a>
<?php
?>
<iframe name ='uses' src='../indexus.php' width='185' height='140' style='max-width:185px; background-color:#ccc;'>
</iframe>
<?php
if(adminlogedin())
{
$admin_id = $_SESSION['admin_id'];
eader('location:admindex.php');
}
?>
</div>
</div>
<div class="footer">
<div class="online">
<?php
if(loggedin())
{
echo "<img src='../Images/ym1.png'>";
}
else
{
echo "<img src='../Images/ym2.png'>";
}
?>
</div>
<div class="footertext">
<?php
if(loggedin())
{
$my_id = $_SESSION['user_id'];
$firstname = getfirstname($my_id , 'firstname');
$lastname = getlastname($my_id , 'lastname');
echo " $firstname $lastname ";
}
else
{
}
?>
</div>
</div>
</div>
</body>
</html>
Related
I would like to put a background on my guestbook messages and the font color should be white. How can I change the echo:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(!isset($_SESSION))
{
session_start();
}
include ('dbconnection.php');
include 'checklogin.php';
include 'head_nav.html';
?>
<!DOCTYPE html5>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="descripion" content="Die offizielle Seite von BestFoto">
<meta name="keywords" content="Foto, Fotografie, BestFoto, Business, Architektur, Fashion, Natur">
<meta name="copyright" content="Copyright 2017 by Sharam Etemadi">
<meta name="author" content="Sharam Etemadi">
<title>BestFoto – Kontakt</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="main-content-container">
<div class="content-header-container">
<header class="content-header">
<h1>Kontakt</h1>
</header>
</div><!-- content-header -->
<div class="content-container">
<section class="content">
<p>
Hier könnt ihr Verbesserungsvorschläge oder sonstiges einreichen.
</p>
</section>
</div><!-- content-container -->
</div><!-- main-content-container -->
<form action="" method="post">
<p>Betreff:</p>
<input type="text" name="betreff" placeholder="Betreff?"><br>
<p>Nachricht:</p>
<textarea name="nachricht" placeholder="Ihre Nachricht!"></textarea><br>
<input type="submit" name="submit" value="Absenden!"><br>
</form>
<?php
array_walk ( $_POST, 'cleanmsg' );
array_walk ( $_GET, 'cleanmsg' );
array_walk ( $_REQUEST, 'cleanmsg' );
function cleanmsg(&$value, $key)
{
// keine HTML-Tags erlaubt, außer p und br
$value = strip_tags($value, '<p><br /><b><strong>');
// HTML-Tags maskieren
$value = htmlspecialchars($value, ENT_QUOTES);
// Leerzeichen am Anfang und Ende beseitigen
$value = trim($value);
}
if(isset($_POST['submit'])):
$betreff = $_POST['betreff'];
$nachricht = $_POST['nachricht'];
$userid = $_SESSION['user'];
$StrSQL = "INSERT INTO kontakt (userid_fk,betreff,nachricht,datum)
VALUES (?,?,?,NOW())";
$absenden = $db->prepare($StrSQL);
$absenden->bind_param('iss', $userid, $betreff, $nachricht);
$absenden->execute();
endif;
$StrSQL2 = "SELECT users.benutzername as bn,
kontakt.betreff, kontakt.nachricht, kontakt.datum
FROM users RIGHT JOIN kontakt
ON users.userid = kontakt.userid_fk ORDER BY datum DESC";
$abfrage = $db->query($StrSQL2);
echo 'Es wurden '.$abfrage->num_rows.' Nachrichten gefunden!<br>';
?>
<?php while ($ausgabe = $abfrage->fetch_object()) { ?>
<div class="test">
<b>user:</b><?=!is_null($ausgabe->bn) ? htmlspecialchars($ausgabe->bn) : 'Guest'?>
<br>
<b>Date:</b><?=$ausgabe->date?>
<br>
<b>subject:</b><?=htmlspecialchars($ausgabe->subject)?>
<br>
<b>message:</b>
<br>
<?=htmlspecialchars($ausgabe->message)?>
<br>
<hr>
</div>
<? } ?>
<?php
// rest of the PHP code
$result_total = mysqli_query($db,'SELECT COUNT(*) as `total` FROM kontakt');
$row_total = mysqli_fetch_assoc($result_total);
$gesamte_anzahl = $row_total['total'];
$ergebnisse_pro_seite = 10;
$gesamt_seiten = ceil($gesamte_anzahl/$ergebnisse_pro_seite);
if (empty($_GET['seite_nr'])) {
$seite = 1;
} else {
$seite = $_GET['seite_nr'];
if ($seite > $gesamt_seiten) {
$seite = 1;
}
}
$limit = ($seite*$ergebnisse_pro_seite)-$ergebnisse_pro_seite;
$result = mysqli_query($db,'SELECT `nachricht` FROM `kontakt` LIMIT '.$limit.', '.$ergebnisse_pro_seite);
while ($row = mysqli_fetch_assoc($result)) {
// Ausgabe deiner Daten
}
for ($i=1; $i<=$gesamt_seiten; ++$i) {
if ($seite == $i) {
echo ''.$i.'';
} else {
echo ''.$i.'';
}
}
include 'footer.html';
?>
</div><!-- container -->
</body>
</html>
now with a div class, so I can write this in my css?
Edit: I have inserted the whole code for you, maybe who can overlook which error is present? After I have inserted the accepted answer, I get a white screen and nothing is displayed anymore. Unfortunately I also don't get an error
Do yourself a favor and ditch those echo garbage. Make the HTML first class citizen and then mix PHP into it:
<?php
// php code
?>
<?php while ($ausgabe = $abfrage->fetch_object()) { ?>
<div class="test">
<b>user:</b><?=!is_null($ausgabe->bn) ? htmlspecialchars($ausgabe->bn) : 'Guest'?>
<br>
<b>Date:</b><?=$ausgabe->date?>
<br>
<b>subject:</b><?=htmlspecialchars($ausgabe->subject)?>
<br>
<b>message:</b>
<br>
<?=htmlspecialchars($ausgabe->message)?>
<br>
<hr>
</div>
<? } ?>
<?php
// rest of the PHP code
I have an backend website setup that displays all the users on my site in an organised table, I should be able to edit and delete the users from the php page. However I cannot get the delete function to work, here is the code.
Data_Display.php
<?php
include('session.php');
?>
<?php include ("db.php"); ?>
<?php
$sql = "SELECT * FROM username ORDER BY UserNameID DESC";
$query = mysql_query($sql) or die(mysql_error());
if (isset($_GET['UserNameID'])) {
$id = mysql_real_escape_string($_GET['UserNameID']);
$sql_delete = "DELETE FROM users WHERE id = '{$UserNameID}'";
mysql_query($sql_delete) or die(mysql_error());
header("location: data_display.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/ico" href="favicon.ico">
<title>Network TV - All Records</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body >
<div class="container">
<div class="content">
<h1>Network TV Users and User control panel</h1>
<br>
<div class="toolbar">
Add New Person
Home
</div>
<br>
</div>
</div>
<div class="container">
<div class="content">
<?php if (mysql_num_rows($query)) { ?>
<?php while ($rows = mysql_fetch_assoc($query)) { ?>
<div class="separator"></div>
<h2><b>User reference:</b> <?php echo $rows['UserNameID']; ?></h2>
<h2><b>Name:</b><?php echo $rows['name']; ?></h2>
<h2><b>Email address:</b> <?php echo $rows['email']; ?></h2>
<h2><b>Gender:</b> <?php echo $rows['sex']; ?></h2>
<h2><b>Profile Picture:</b> <?php echo $rows['imagelink']; ?></h2>
<div class="toolbar">
Edit
Delete
</div>
<?php } /* End Loop */ ?>
<div class="separator"></div>
<?php } else { ?>
<div class="separator"></div>
<h2>There are no records to display</h2>
<div class="separator"></div>
<?php } /* End Rows Checking */?>
</div>
</div>
<div class="container">
<br>
<br>
<br>
<br>
<br>
</div>
<script>
function confirmDelete ( message, url )
{
var confirmation = confirm ( message );
if ( confirmation == true ) {
window.location = url;
} else {
return false;
}
}
</script>
</body>
</html>
Session.php
<?php
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$connection = mysql_connect("localhost", "root", "Oliver");
// Selecting Database
$db = mysql_select_db("users", $connection);
if(!isset($_SESSION)){session_start();}
// Storing Session
$user_check=$_SESSION['login_user'];
// SQL Query To Fetch Complete Information Of User
$ses_sql=mysql_query("select username from username where username='$user_check'", $connection);
$row = mysql_fetch_assoc($ses_sql);
$login_session =$row['username'];
if(!isset($login_session)){
mysql_close($connection); // Closing Connection
header('Location: home.php'); // Redirecting To Home Page
}
?>
db.php
<?php
$connection = mysql_connect('localhost', 'root', 'Oliver');
mysql_select_db('users', $connection) or die(mysql_error());
?>
Information
When I click the delete button in data_display.php, I do receive the javascript alert to confirm that I do want to delete the user from the database, but nothing actually happens.
if (isset($_GET['recordId'])) {
$id = mysql_real_escape_string($_GET['recordId']);
$sql_delete = "DELETE FROM users WHERE id = '{$id}'";
mysql_query($sql_delete) or die(mysql_error());
header("location: data_display.php");
exit();
}
You are sending recordId as parameter.
So I'm getting an error:
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\CWoW\add.php on line 97 in my code.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="default.css">
<link rel="stylesheet" href="cms.css">
<title>ACP</title>
</head>
<body>
<?php
if(isset($_POST['add']))
{
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '';
$mysqli = new mysqli('localhost','root','','meh') or die("Error " . mysqli_error($mysqli));
if(empty($_POST['title'])) {
echo 'The title must not be empty!<br/>';
} else if(empty($_POST['message'])) {
echo 'The message field must not be empty!<br/>';
} else if(empty($_POST['author'])) {
echo 'A poster name is required!<br/>';
} else {
if(! get_magic_quotes_gpc() )
{
$title = addslashes ($_POST['title']);
$message = addslashes ($_POST['message']);
$author = addslashes ($_POST['author']);
}
else
{
$title = $_POST['title'];
$message = $_POST['message'];
$author = $_POST['author'];
}
if ($query = $mysqli->query("INSERT INTO etl_articles (title, message, author) VALUES ('{$title}', '{$message}', '{$author}');")) {
echo "The post has successfully been added! <a href='add.php'>Click Here</a> to go back.";
} else {
echo 'Failed to add the post!';
$query->close;
}
}
}
else
{
?>
<div id="logo_div">
<a id="logo_anch" href="#" title="Project Hysteria">Project Hysteria</a>
</div>
<ul id="top_menu">
<li>Home</li>
</ul>
<div id="main">
<aside id="right">
<div id="main_sep"></div>
<div id="content_ajax">
<form method="post" action="<?php $_PHP_SELF ?>" class="custom2">
<article>
<div class="top"><input name="title" type="text" placeholder="» Title" /></div>
<section class="body">
<div class="clear"></div>
<div class="news_bottom">
<textarea name="message" placeholder="» Message"></textarea><br><br>
<select name="author">
<option value="Admin">Admin</option>
<option value="Moderator">Global Moderator</option>
<option value="Developer">Developer</option>
</select><br><br>
<input name="add" type="submit" value="Submit News" />
</div>
<div class="comments" id="comments_17"></div>
</section>
</article>
</div>
</aside>
<div class="clear"></div>
</div>
</form>
<footer>
<p>© Copyright 2013 Caustic WoW</p>
<p id="design"> <a target="_new" href=""></a></p>
</footer>
</section>
</body>
</html>
I can't seem to find the problem really.
If any of you guys can help me that would be great.
You have a syntax error in your code : there is an opening brace { after else statement but the closing } is missing.
Replace
else
{
?>
with
else;
?>
or
else{}
?>
I started these code fragments in a tutorial and then I mixed them with others tutorials I found in the Internet, but now I have a problem to make the "edit" and "delete" Options. Could anyone help me? Here is my code fragments.
admin(folder: add.php, index.php, logout.php)
asset(folder: style.css)
includes(folder: article.php, connection.php)
article.php
index.php
index.php
<?php
include_once('includes/connection.php');
include_once('includes/article.php');
$article = new Article;
$articles = $article->fetch_all();
?>
<html>
<head>
<title>CMS</title>
<link href='assets/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
CMS
<ol>
<?php foreach ($articles as $article) { ?>
<li>
<a href="article.php?id=<?php echo $article['article_id']; ?>">
<img src="news_images/<?php echo $article['article_photo']; ?>.jpg" width="300" height="150" alt="Ver mas" class="article_photo" />
</a>
<br />
<a href="article.php?id=<?php echo $article['article_id']; ?>">
<h2><?php echo $article['article_title'];?>
</a>
-<small><small>
posted <?php echo date('l jS', $article['article_timestamp']); ?>
</small></small>
</h2>
<?php //echo $article['article_content'];?>
<a href="article.php?id=<?php echo $article['article_id']; ?>">
<b>Read More</b>
</a>
<hr>
</li>
<?php }?>
</ol>
<br />
<small><a href="admin" >admin</a></small>
</div>
</body>
</html>
article.php
<?php
include_once('includes/connection.php');
include_once('includes/article.php');
$article = new Article;
if (isset($_GET['id'])) {
$id = $_GET['id'];
$data = $article->fetch_data($id);
?>
<html>
<head>
<title>CMS</title>
<link href='assets/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<!-- FB like button -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- FB fINISH -->
<div class="container">
CMS
<img src="news_images/<?php echo $data['article_photo']; ?>.jpg" width="600" height="300" alt="Ver mas" class="article_photo" />
<h2>
<?php echo $data['article_title']; ?>
<small><small><small> - posted <?php echo date('l jS', $data['article_timestamp']); ?></small></small></small>
</h2>
<div class="fb-like" data-href="http://www.wr-audio.com/article.php?id=<?php echo $data['article_id']; ?>" data-send="true" data-width="450" data-show-faces="false" data-font="arial"></div>
<p>
<?php echo $data['article_content']; ?>
</p>
<div class="fb-comments" data-href="http://www.wr-audio.com/article.php?id=<?php echo $data['article_id']; ?>" data-width="470" data-num-posts="10"></div>
<br />
← Back
</div>
</body>
</html>
<?php
} else {
header('Location: index.php');
exit();
}
?>
includes/connection.php
<?php
try {
$pdo = new PDO('mysql:host=example.com;dbname=myDatabase', 'username', 'password');
} catch (PDOException $e) {
exit('Database error.');
}
?>
includes/article.php
<?php
class Article {
public function fetch_all() {
global $pdo;
$query = $pdo->prepare("SELECT * FROM articles ORDER BY article_timestamp DESC");
$query->execute();
return $query->fetchAll();
}
public function fetch_data($article_id) {
global $pdo;
$query = $pdo->prepare("SELECT * FROM articles WHERE article_id = ?");
$query->bindValue(1, $article_id);
$query->execute();
return $query->fetch();
}
}
?>
I'm going to be honest, it's very difficult to understand what you're asking. The way I read the question is that you want to create edit and delete buttons that, when clicked, will call some script to update the database?
Well, there are two options:
AJAX using jQuery / PHP
Non AJAX PHP script
I'm going to give an example of how #2 will work, you can google for #1 based on the code below.
You're going to put the buttons in a form (let's do delete):
HTML:
<form method="POST" action="">
<input type="hidden" name="article_id" value="<?php echo $article['article_id']; ?>" />
<input type="submit" value="Delete article" name="delete_article" />
</form>
PHP: - Shown using prepared statements
if(isset($_POST['delete_article'])){
if(isset($_POST['article_id'])){
$sql = "DELETE FROM table_name
WHERE article_id=?";
if($stmt = $mysqli->prepare($sql)){
$stmt->bind_param("i", $_POST['article_id']);
$stmt->execute();
$stmt->close();
}
}
}
I'm using a CKEditor along with a CKFinder. Both work fine. When I browse (or copy directly) an image (or flash) to CKEditor, it's displayed within it and inserted into the MySql database.
Aafter inserting it into MySql database, I'm trying to display it in an HTML table where it isn't displayed and the alternate text is displayed.
The image path after browsing an image through the CKFinder is something like the following.
<img alt="" src="/ckfinder/userfiles/images/1243_SS_2502.jpg" style="width: 490px; height: 618px;" />
The contents inserted into the database is as follows.
<img alt="\"\"" data-cke-saved-src="\"
src="\"/ckfinder/userfiles/images/1243_SS_2502.jpg\"" st yle=&
quot;\"width:" 490px;="" height:="" 618px;\"= quot;">
Tried with htmlentities() still it doesn't work. While dealing the same with JSP using JSTL/EL, I had to do the following.
<c:out value="${str}" default="No content found." escapeXml="false"/>
escapeXml="false", where str written in EL was a java.lang.String holding the Oracle clob data after conversion.
What is the way to get around the situation in PHP? Both CKEditor and CKFinder work fine for me.
$ckeditor = new CKEditor();
$ckeditor->basePath = 'ckeditor/';
$ckeditor->config['filebrowserBrowseUrl'] = 'ckfinder/ckfinder.html';
$ckeditor->config['filebrowserImageBrowseUrl'] = 'ckfinder/ckfinder.html?type=Images';
$ckeditor->config['filebrowserFlashBrowseUrl'] = 'ckfinder/ckfinder.html?type=Flash';
$ckeditor->config['filebrowserUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
$ckeditor->config['filebrowserImageUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
$ckeditor->config['filebrowserFlashUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';
$ckeditor->editor('description', $ed_about_us);
Edit:
<?php include_once("Lock.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wagafashion</title>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
<link rel="stylesheet" href="css/template.css" type="text/css"/>
<!--<script type="text/javascript" language="javascript" src="ckeditor/ckeditor.js"></script>-->
<script src="js/jquery-1.6.min.js" type="text/javascript"></script>
<script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script><script>
jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#dataForm").validationEngine();
});
</script>
<script language="javascript" type="text/javascript">
function deleteSingle(id)
{
var delId=confirm("About us with the id "+id+" is about to be deleted permanently.\n\nAttention : This action will never be undone!\n\nAre you sure...???");
return(delId==true?true:false);
}
</script>
</head>
<body>
<?php
include_once("Connection.php");
include_once("ckeditor/ckeditor.php");
$con=new Connection();
$con->get_connection();
$ed_about_us="";
$flag=-1;
$msg="";
if(isset($_POST['btnSubmit']))
{
$act=trim($_POST['param_action']);
$about_us=$_POST['cms_description'];
if($act=="add")
{
$res=$con->get_data("select count(*) as cnt from cms");
$cnt_cmt=mysql_result($res, 'cnt');
if($cnt_cmt==0)
{
$flag=$con->iud("insert into cms (about_us)values('".mysql_real_escape_string(urlencode($about_us))."')");
}
else
{
$flag=$con->iud("update cms set about_us='".mysql_real_escape_string(urlencode($about_us))."'");
}
if($flag==1)
{
$msg="Insertion done successfully.";
}
else if($flag==0)
{
$msg="Insertion failed - reason : ".mysql_errno()." : ".mysql_error();
}
}
else if($act=="edit")
{
$cms_id=$_POST['cms_id'];
$flag=$con->iud("update cms set about_us='".mysql_real_escape_string(urlencode($about_us))."' where id=".$cms_id."");
if($flag==1)
{
$msg="About us has been updated successfully.";
}
else if($flag==0)
{
$msg="Updation failed - reason : ".mysql_errno()." : ".mysql_error();
}
}
}
else if(isset($_GET['ed_id']))
{
$ed_res=$con->get_data("select about_us from cms where id=".$_GET['ed_id']."");
while($row=mysql_fetch_assoc($ed_res))
{
$ed_about_us=$row['about_us'];
}
}
else if(isset($_GET['del_id']))
{
$flag=$con->iud("update cms set about_us='' where id=".$_GET['del_id']);
if($flag==1)
{
$msg="About us been deleted successfully.";
}
else if($flag==0)
{
$msg="Can not delete - reason : ".mysql_errno()." : ".mysql_error();
}
}
else if(isset($_POST['btnDelete']))
{
$set_del=$_POST['setDel'];
$flag=$con->iud("update cms set about_us='' where id in($set_del)");
$size=sizeof(split(",", $set_del));
if($flag==1)
{
if($size==1)
{
$msg="1 row deleted.";
}
else
{
$msg=$size." rows deleted.";
}
}
else if($flag==0)
{
$msg="Can not perform deletion - reason : ".mysql_errno()." : ".mysql_error();
}
}
?>
<?php include("tamplate/Template1.php");?>
<h2>About Us</h2>
<?php include("tamplate/NewTemplate.php");?>
<?php
if($flag==1)
{
echo "<p>";
?>
<!--[if !IE]>start system messages<![endif]-->
<ul class="system_messages">
<li class="green"><span class="ico"></span><strong class="system_title"><?php echo $msg; ?></strong></li>
</ul>
<!--[if !IE]>end system messages<![endif]-->
<?php
echo "</p>";
}
else if($flag==0)
{
echo "<p>";
?>
<!--[if !IE]>start system messages<![endif]-->
<ul class="system_messages">
<li class="red"><span class="ico"></span><strong class="system_title"><?php echo $msg; ?></strong></li>
</ul>
<!--[if !IE]>end system messages<![endif]-->
<?php
echo "</p>";
}
?>
<img alt=\"\" src="/ckfinder/userfiles/images/1243_SS_2502.jpg" style=\"width: 490px; height: 618px;\" />
<!--[if !IE]>start forms<![endif]-->
<form action="<?php $_SERVER['PHP_SELF']; ?>" id="dataForm" name="dataForm" method="post" class="search_form general_form">
<!--[if !IE]>start fieldset<![endif]-->
<fieldset>
<!--[if !IE]>start forms<![endif]-->
<div class="forms">
<!--[if !IE]>start row<![endif]-->
<div class="row">
<?php
$ckeditor = new CKEditor();
$ckeditor->basePath = 'ckeditor/';
$ckeditor->config['filebrowserBrowseUrl'] = 'ckfinder/ckfinder.html';
$ckeditor->config['filebrowserImageBrowseUrl'] = 'ckfinder/ckfinder.html?type=Images';
$ckeditor->config['filebrowserFlashBrowseUrl'] = 'ckfinder/ckfinder.html?type=Flash';
$ckeditor->config['filebrowserUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
$ckeditor->config['filebrowserImageUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
$ckeditor->config['filebrowserFlashUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';
$ckeditor->editor('cms_description', urldecode($ed_about_us));
?>
<!--[if !IE]>start row<![endif]-->
<div class="row">
<div class="buttons">
<span class="button send_form_btn"><span><span>Submit</span></span><input type="submit" value="Submit" id="btnSubmit" name="btnSubmit" onclick="return validate();"></span>
</div>
</div>
<!--[if !IE]>end row<![endif]-->
</div>
</fieldset>
<!--[if !IE]>end fieldset<![endif]-->
<input type="hidden" id="param_action" name="param_action" value="
<?php
if(isset($_GET['ed_id']))
{
echo "edit";
}
else
{
echo "add";
}
?>
" />
<input type="hidden" id="cms_id" name="cms_id" value="<?php echo isset($_GET['ed_id'])?$_GET['ed_id']:"";?>" />
</form>
<?php include("tamplate/Template2.php");?>
<h2>About Us</h2>
<?php include("tamplate/NewTemplate1.php");?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" id="mainForm" name="mainForm" method="post">
<?php include("tamplate/ExtraTemplate.php");?>
<table cellpadding="0" cellspacing="0" width="100%">
<tbody>
<th style="width: 10px;">Check</th>
<th style="width: 450px;">About Us</th>
<th style="width: 10px;">Actions</th>
<?php
$get_data=$con->get_data("select id, about_us from cms order by id");
$cnt=1;$flag='';
while($data_row=mysql_fetch_assoc($get_data))
{
extract($data_row);
$cnt%2==0?$flag="second":$flag="first";
++$cnt;
echo "<tr class='$flag'>";
echo "<td><input type='checkbox' name='chk' value='$id'></td>";
echo "<td>".urldecode($about_us)."</td>";
echo "<td><div class='actions'><ul><li><a href='".$_SERVER['PHP_SELF']."?ed_id=$id' class='action2'></a></li>";
echo "<li><a href='".$_SERVER['PHP_SELF']."?del_id=$id&table_name=cms&pri=id' onclick='return deleteSingle($id);' class='action4'></a></li></ul></div></td>";
echo "</tr>";
}
?>
</tbody>
</table>
<input type='hidden' id='setDel' name='setDel'/>
<?php include("tamplate/Template3.php");?>
</form>
<?php include("tamplate/Template4.php");?>
</body>
</html>
Did you try to use html_entity_decode() to display the contents ? It will decode the encoded html for better output. Reference here
Edit
Change your query to the following
insert into cms (about_us) values ('".mysql_real_escape_string(urlecode(stripslashes($about_us)))."')
When you get it from database it use
urldecode($value)
Where $value is the block you got from database.