<?php
$hostname = "localhost";
$database = "intranet";
$username = "root";
$password = "psiqur";
$login = mysql_connect ( $hostname, $username, $password ) or trigger_error ( mysql_error(),E_USER_ERROR );
mysql_select_db ( $database );
?>
<script type="text/javascript" src="fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'texto' ) ;
oFCKeditor.BasePath = '' ;
oFCKeditor.ReplaceTextarea() ;
oFCKConfig.EditorAreaCSS = './css/estilos.css' ;
}
</script>
<a href="editor.php?tipo=site_imagens&id=1&fazer=editar" class="azul"><b>[site imagens]</b></a><br><br>
<table cellpadding="0" cellspacing="0" border="0" width="820">
<?
$verf = $_GET['listar'];
if ($verf != ""){
$listar = $_GET['listar'];
}else{
$listar = $_POST['listar'];
}
if ($listar != ""){
// inicio listar
if ($listar == "site_imagens"){
$sql = mysql_query("SELECT * FROM site_imagens");
?>
<tr>
<td colspan="4" align="center" valign="middle"><br><a href="editor.php?tipo=site_imagens&fazer=inserir"><b>[Inserir Novo Registo]</b></a><br><br></td>
</tr>
<tr bgcolor="#B4CE07" align="center" class="branco">
<td></td>
<td></td>
</tr>
<?
while($row = mysql_fetch_array($sql)) {
$id = $row["id"];
$site_imagens = $row["site_imagens"];
?>
<tr>
<td height="50"><?=$site_imagens ?></td>
<td align="center" valign="middle"></td>
</tr>
<?
}
}
//fim listar
}else{
$verf1 = $_REQUEST['tipo'];
$tipo = $_REQUEST['tipo'];
$fazer = $_REQUEST['fazer'];
$id = $_REQUEST['id'];
$site_imagens = $_REQUEST['site_imagens'];
//inicio acções
if ($tipo == "site_imagens"){
if ($fazer == "inserir"){
if ($accao == "ok"){
$sql = mysql_query("INSERT INTO `site_imagens` (`site_imagens`) VALUES ('$site_imagens');");
echo ("<div align=center>Registo inserido com sucesso.</div>");
}else{
?>
<tr>
<td>
<form name="form" action="editor.php" method="POST">
<table align="center" width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="#EAEAEA">
<input name="tipo" value="site_imagens" type="hidden" />
<input name="fazer" value="inserir" type="hidden" />
<input name="accao" value="ok" type="hidden" />
<tr>
<td></td>
<td> </td>
</tr>
<tr>
<td></td>
<td><textarea id="textarea" name="site_imagens" rows="35" cols="120"><?=$site_imagens ?>
</textarea>
<input type="submit" name="Inserir" value="Inserir" /></td>
</tr>
</table>
</form>
</td>
</tr>
<?
}
}
if ($fazer == "editar"){
if ($accao == "ok"){
$sql = mysql_query("UPDATE site_imagens SET site_imagens = '$texto' WHERE id = '$id'");
echo ("<div align='center' valign='bottom' class='azul'>Registo editado com sucesso.</div>");
}else{
$sql = mysql_query("SELECT * FROM site_imagens WHERE id = $id LIMIT 1");
while($row = mysql_fetch_array($sql)) {
$id = $row["id"];
$site_imagens = $row["site_imagens"];
}
?>
<tr>
<td align="center" height="20"></td>
</tr>
<tr>
<td align="center" valign="middle"><div class="azul">site_imagens </div>
<form name="form" action="editor.php" method="POST">
<table align="top" width="810" cellpadding="0" cellspacing="0" border="0">
<input name="tipo" value="site_imagens" type="hidden" />
<input name="fazer" value="editar" type="hidden" />
<input name="accao" value="ok" type="hidden" />
<input name="id" value="<?=$id ?>" type="hidden" />
<tr>
<td>
</td>
<td align="center" valign="top"><textarea id="site_imagens" name="texto" rows="35" cols="120"><?=$site_imagens ?></textarea></td>
</tr>
<tr>
<td></td>
<td align="left" valign="top"><input type="submit" name="Editar" value="Editar" class="botao"/></td>
</tr>
</table>
</form>
</td>
</tr>
<?
}
}
if ($fazer == "apagar"){
$sql = mysql_query("DELETE FROM site_imagens WHERE id = $id LIMIT 1");
echo ("<div align=center>Registo apagado com sucesso.</div>");
}
//fim acções
}}
?>
</table>
Wed, 07/15/2009 - 12:22
#1

Re: FCKeditor does not work on my computer
If so, then the PHP interpreter doesn't parse code between <? ?> but only between <?php ?>.
I recommend changing <? to <?php instead of changing the setting.
Re: FCKeditor does not work on my computer
Re: FCKeditor does not work on my computer
error_reporting(E_ALL);ini_set('display_errors', 1);and check if there is something wrong.
Re: FCKeditor does not work on my computer
first of all, excuse my English i'm from Portugal.
i put the code error_reporting (E_ALL); ini_set ( 'display_errors', 1);
and reported several errors as Notice: Undefined index: listar in /home/divercom/public_html/dmaisnews/admin/editor.php on line 158
As I said before, I have no problem with this code online only to work in local server.
the error mentioned above is also reported under code with <? code ?>
i did an experience to put on line the two diferent code, one with <? code ?> and the other with <?php code ?> and only the <? code ?> works.
there is a slight difference in the change of code in the form that is when I change <?=$inicio ?> by <?php $inicio ?> does not working well
I think the problem is there
i put the form below
<?php } } if ($fazer == "editar"){ if ($accao == "ok"){ $sql = mysql_query("UPDATE inicio SET inicio = '$texto' WHERE id = '$id'"); echo ("<div align=center>Registo editado com sucesso.</div>"); }else{ $sql = mysql_query("SELECT * FROM inicio WHERE id = $id LIMIT 1"); while($row = mysql_fetch_array($sql)) { $id = $row["id"]; $inicio = $row["inicio"]; } ?> <tr> <td align="center" height="20"><span class="azul"></span></td> </tr> <tr> <td align="center" valign="middle" class="vermelho1">inicio</div> <form name="form" action="editor.php" method="POST"> <table align="center" width="810" cellpadding="0" cellspacing="0" border="0"> <input name="tipo" value="inicio" type="hidden" /> <input name="fazer" value="editar" type="hidden" /> <input name="accao" value="ok" type="hidden" /> <input name="id" value="<?php $id ?>" type="hidden" /> <tr> <td></td> <td align="center" valign="top"><textarea id="inicio" name="texto" rows="35" cols="120"><?php $inicio ?></textarea></td> </tr> <tr> <td></td> <td align="left" valign="top"><input type="submit" name="Editar" value="Editar" class="botao" /></td> </tr> </table> </form>Thanks!
Re: FCKeditor does not work on my computer
You have to put an echo in front, otherwise it will be siltenly ignored by PHP and not be echoed to the HTML.
Re: FCKeditor does not work on my computer
Re: FCKeditor does not work on my computer