חבר על
|
[בעיה]בקשר לעורך tiynmce וphp...
שלום לכולם,
אני מנסה לבנות מערכת ניהול.
אני משתמש בעורך tiynmce ,אני מנסה לקבל מ tiynmce נתונים ,להכניס אותם למסד ולאחר הלחיצה על סמביט להפנות את המשתמש לעמוד הניהול ,ולהציג את התוצאה בדף הראשי(index.php)
השגיאה היא שזה מפנה אותי ל index.php ושרק אחרי ריענון של הדף הוא מתעדכן בתוכן החדש (לפני ריענון זה כותב מה שלחצתי בסאבמיט הקודם)
זה קוד ה-index.php :
PHP קוד:
<?php
$mysql_link=mysql_connect('localhost','root','')///////////connect mysql
or die("ERROR: cannot connect to MySQL server.");//////////connect mysql
echo "";//////////connect mysql
//////////connect mysql
if (mysql_select_db('mydb',$mysql_link) //////////connect mysql
//////////connect mysql
) //////////connect mysql
echo ""; //////////connect mysql
else
echo "Could not select the DB.";
$query = "SELECT * FROM admin";
$result = mysql_query($query) or die("Query failed: ".mysql_error());
if (isset($_POST['elm1'])){ //admin
$elm1 = ($_POST['elm1']);
mysql_query("UPDATE `admin` SET `index`='$elm1' ");
}
while ($row = mysql_fetch_array($result))
{
echo $row['index'];
}
?>
זה קוד ה- admin.php:
PHP קוד:
<?php
ob_start();
require "function.php";
echo connection_db();
function login_user() //fuonction start
{
if (isset($_POST['login'])){ //login
$name = htmlspecialchars($_POST['user']);
$pass = htmlspecialchars($_POST['pass']);
$query = mysql_query("SELECT * FROM `login` where `pass` = '$pass' && `user` = 'ronolo'");
$row = mysql_num_rows($query);
if ($row > 0) {
login_succes();
}
else {
menu_one(); //function.php
login_notsucces();
}} else {
menu_one(); //function.php
login_notisset();
}
} //fuonction end
login_user();
function login_succes() //fuonction start
{
$name = htmlspecialchars($_POST['user']);
session_start();
$_SESSION['youlogin'] = "$name";
$sosdog1 = $_SESSION['youlogin'];
echo <<<st
<html>
<head>
<!-- TinyMCE -->
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1_add_before : "save,newdocument,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,|,code",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
content_css : "example_full.css",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_link_list.js",
external_image_list_url : "example_image_list.js",
flash_external_list_url : "example_flash_list.js",
media_external_list_url : "example_media_list.js",
template_external_list_url : "example_template_list.js",
file_browser_callback : "fileBrowserCallBack",
theme_advanced_resize_horizontal : false,
theme_advanced_resizing : true,
nonbreaking_force_tab : true,
apply_source_formatting : true,
template_replace_values : {
username : "Jack Black",
staffid : "991234"
}
});
function fileBrowserCallBack(field_name, url, type, win) {
// This is where you insert your custom filebrowser logic
alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type);
// Insert new URL, this would normaly be done in a popup
win.document.forms[0].elements[field_name].value = "someurl.htm";
}
</script>
<!-- /TinyMCE -->
</head>
<body bgcolor="#33CCFF">
<table border=1 background="login.jpg" align=center>
<tr>
<td align=center>
$sosdog1 :ברוך הבא אתה מחובר כ
<br><br>
<a href='login.php'><B> התנתק
<B/></a>
</td>
</tr>
</table>
<form method="post" action="index.php">
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 100%">
<span class="example1">Test header 1</span><br />
<span class="example2">Test header 2</span><br />
<span class="example3">Test header 3</span><br />
Some <b>element</b>, this is to be editor 1. <br /> This editor instance has a 100% width to it.
<p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p>
<img src="logo.jpg">
</textarea>
<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html>
st;
} //fuonction end
function login_notisset() //fuonction start
{
echo <<<st
<body bgcolor=#33CCFF>
<table border=1 align=center>
<tr>
<td align=center width=265>
<form method="post">
<br>
<center><h4>התחברות מנהלים</h4></center>
<input type="text" name="user"> :שם משתמש
<br><input type="password" name="pass"> :סיסמא
<center><input type="submit" name="login" value="התחבר"><br></center><br>
כדי להירשם לחץ<a href="register.php"><font color=red> כאן</font></a>
<form/></td>
</tr>
</table>
st;
}
ob_end_flush();
?>
מה שלא ניסיתי זה פשוט לא הצליח.|עצוב|
תודה לכל העוזרים.
Last edited by Ron | CSite.co.il; 10-08-07 at 10:43..
|