PHP fehler^^
lima-city → Forum → Programmiersprachen → PHP, MySQL & .htaccess
abhilfe
beitrag
board
checken
count
detail
durchlauf
error
fehler
info
insert
member
none
quelltext
result
smilie
source
stat
update
zeile
-
Hi Ho^^
Also ich hab mal wieder nen fehler im code und wei? nich an was es liegt^^
Hier der fehler wo rauskommt:
Fatal error: Cannot use object of type User as array in C:\xampp\xampp\htdocs\forum\site\new-topic.php on line 203
Und hier die zeile 203 mit +-2 zeilen:
$output->add_template("new_topic", array("ac_toolbar", "user_name", "post_text", "post_topic_name", "icons", "smilies_legend", "all_number", "number_of_smilies", "poll", "file_upload", "preview", "sig_on"), array($output->create_template("action_code_bar"), $user_name, $post_text, $post_topic_name, $icons, $smilie, $all_smilies, $shown, $poll, $files, $prev, $login_member["mem_sig_status"] == "0" ? "" : "checked")); }
Beitrag ge?ndert am 1.08.2005 17:32 von sneppa -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage
-
Sehr wahrscheinlich liegt hier der Fehler:
array($output->create_template("action_code_bar"), $user_name, $post_text, $post_topic_name, $icons, $smilie, $all_smilies, $shown, $poll, $files, $prev, $login_member["mem_sig_status"] == "0" ? "" : "checked"));
Du kannst vermutlich nicht eine Klassenmethode (bzw. dessen R?ckgabewert) in diesem Array speichern.
Poste mal den Quelltext der Funktion create_template(); dann k?nnen wir Dir vielleicht mit einem anderen Code Abhilfe vom besagten Problem verschaffen!
mfG
cd -
Das ist eben schlecht^^ ich muss ein weg finden den code so belassen.. denn der is en teil von nem fertigforum wo en fehler drin ist^^ Aber ich will das eh irgendwie umscripten^^
Hier der gesammte quellcode:
<?php if (($login_member->autorization($f, $pw) && $login_member->details["mem_wright"] == "1") || (!$login_memer->loged && $config["mc_post_reg"] == 0)) { $sql->select("board_status", "boards", "board_id='".$f."'"); $board = $sql->result(); if ($board["board_status"] == "1") { if (isset($submit) && !isset($new_poll)) { $post_mem = $mem_login_name; if (isset($post_email)) $post_email ="1"; if (isset($post_sig)) $post_sig ="1"; if (isset($post_smilies)) $post_smilies ="1"; $pics_limit = update_posting($post_text,$post_smilies); if (substr_count($pics_limit,"<img src") >= $config["mc_num_pics"]) { $output->add_template("Info", array("info_title", "info_text", "link", "link_info"), array("{wl_information}", "{wl_too_many_pics} {wl_too_many_pics2} {mc_num_pics} {wl_too_many_pics3}", "site=new-topic&f=".$f, "{board_name}")); return; } $upload_suc = ""; if (isset($mem_file) && !empty($mem_file) && $config["mc_file_upload"] == "1" && $upload == "check") { $error = "{wl_no_valid_source}"; $uploadpath = $config["mc_absolute"]; $uploadpath .= "upload/mem_".$login_member->mem_id."/"; $source = $HTTP_POST_FILES['mem_file']['tmp_name']; $filename = basename($mem_file_name); $file_data = explode(".",$filename); if (($source != 'none') && ($source != '' ) && ($file_data[1] == "jpg" || $file_data[1] == "gif" || $file_data[1] == "zip")) { $error = "{wl_no_valid_size}"; if(filesize($source) < ($config["mc_file_size"] * 1000)){ $error = "{wl_no_valid_move}"; $handle = opendir($uploadpath); $uploadpath .= $filename; if (move_uploaded_file($source, $uploadpath)) $upload_suc = basename($uploadpath); else $upload_suc = false; } } if (!$upload_suc) { $output->add_template("Info", array("info_text", "info_title", "link", "link_info"), array("{wl_upload_miss} {wl_upload_info} ".$error, "{wl_information}", "site=new-topic&f=".$f, "{wl_mistake}")); return; } } else $upload_suc = $upload; $post_file = $upload_suc; // get ip $post_host = $REMOTE_ADDR; //get posting id $post_text = code_replace_URL($post_text); $post_views = "0"; $post_topic_parent = "0"; $post_topic_child = "0"; $post_topic_next_same = "0"; $post_time = time(); $post_time_reply = time(); $post_topic_name = mysql_escape_string(htmlentities($post_topic_name)); $post_mem = $login_member->mem_id; if (!$login_member->loged) { $sql->select("count(mem_id)", "members", "mem_login_name='".$poster_name."' OR mem_login_public='".$poster_name."'"); $count = $sql->result(); if ($count["count(mem_id)"] == 0) $post_mem = $poster_name; else $output->add_template("Info", array("info_title", "info_text", "link", "link_info"), array("{wl_information}", "{wl_name_already_exist}","", "{mc_forum_name}")); } $id = 0; if ($post_mem && $post_topic_name && $post_text) $id = $sql->insert("forum_topics_".$f, "post_mem='".$post_mem."', post_topic_name='".$post_topic_name."', post_text='".$post_text."', post_time='".time()."', post_time_reply='".time()."', post_icon='".$post_icon."', post_email='".$post_email."', post_sig='".$post_sig."', post_smilies='".$post_smilise."', post_host='".$post_host."', lst_mem='".$post_mem."', post_file='".$post_file."'"); else { $output->add_template("Info", array("info_text", "info_title", "link", "link_info"), array("{wl_no_post}", "{wl_information}", "site=new-topic&f=".$f, "{wl_mistake}")); return; } $sql->update("members", "mem_postings=mem_postings+1", "mem_id='".$login_member->details["mem_id"]."'"); $sql->update("stats", "num_tops=num_tops+1"); $sql->update("boards", "num_tops=num_tops+1, board_lstTopic='".$id."'", "board_id='".$f."'"); $sql->update("today_on", "posted='1'", "mem_id='".$login_member->details["mem_id"]."'"); if(isset($poll_option_times)){ for($x=0; $x != $poll_option_times;$x++){ $field = $$x; $sql->insert("poll", "forum_id='".$f."', post_id='".$id."', poll_field='".$field."', poll_name='".$poll_titel."', poll_votes='0', poll_status='1'"); } } $output->add_template("Info", array("info_title", "info_text", "link", "link_info"), array("{wl_system_works}", "{wl_thx_for_posting}", "site=forum&f=".$f, "{board_name}")); } else {// else submit $icons = ""; $handle = opendir("img/icons/"); $thatdir = array(); while ($file = readdir ($handle)) { if ($file != "." && $file != "..") array_push($thatdir,$file); } sort($thatdir); $i = 0; foreach ($thatdir as $file) { $i % $config["mc_icons_per_line"] == 0 ? $icons .= "<br>" : $icons .= ""; $icons .= $output->create_template("icon_field", array("checked", "file"), array($i == 1 ? "checked" : "", $file)); $i++; } unset($thatdir); closedir($handle); $sql->select("*", "smilies", "sm_status='1'"); $all_smilies = $sql->rows(); $shown = $all_smilies; if ($shown > ($config["mc_smilies_per_line"] * $config["mc_smilies_per_line"])) $shown = ($config["mc_smilies_per_line"] * $config["mc_smilies_per_line"]); $smilie = ""; $lauf = 0; $tr = false; while($smilies = $sql->result()) { $lauf++; if($lauf <= ($config["mc_smilies_per_line"] * $config["mc_smilies_per_line"])){ if (($lauf % $config["mc_smilies_per_line"]) == 0) $smilie .= $output->create_template("smilie_item_start", array("sm_code", "sm_file", "sm_desc"), array($smilies["sm_code"], $smilies["sm_file"], $smilies["sm_desc"])); else $smilie .= $output->create_template("smilie_item", array("sm_code", "sm_file", "sm_desc"), array($smilies["sm_code"], $smilies["sm_file"], $smilies["sm_desc"])); } else { $lauf--; break; } } while (($lauf % $config["mc_smilies_per_line"]) != 0){ $lauf++; $tr = true; $smilies .= $output->create_template("smilie_item_empty"); } if ($tr) $smilies .= "</tr>"; if ($config["mc_file_upload"] == "1") { if (!file_exists($config["mc_absolute"].'upload/mem_'.$login_member->mem_id.'/')) { if (!file_exists($config["mc_absolute"].'upload/')) if (!mkdir($config["mc_absolute"].'upload/',0777)) echo "Couldn't create dir"; if (!mkdir($config["mc_absolute"].'upload/mem_'.$login_member->mem_id.'/',0777)) echo "Couldn't create dir"; } $handle = @opendir($config["mc_absolute"].'upload/mem_'.$login_member->mem_id.'/'); $files = $output->create_template("pre_file_hang"); $durchlauf = 0; while ($file = @readdir($handle)) { if ($file != "." && $file != "..") { ++$durchlauf; $files .= $output->create_template("file_hang", "file", $file); } } if ($durchlauf < $config["mc_file_count"]) $files .= $output->create_template("post_file_upload_form_add"); $files .= $output->create_template("post_file_hang"); @closedir($handle); } $prev = ""; if (isset($preview)) { $post_mem = $login_member->mem_id; if (!$login_member->loged) { $sql->select("count(mem_id)", "members", "mem_login_name='".$poster_name."' OR mem_login_public='".$poster_name."'"); $count = $sql->result(); if ($count["count(mem_id)"] == 0) $post_mem = $poster_name; else $output->add_template("Info", array("info_title", "info_text", "link", "link_info"), array("{wl_information}", "{wl_name_already_exist}","", "{mc_forum_name}")); } else { $sql->select("mem_login_public", "members", "mem_id='".$post_mem."'"); $post_mem = $sql->result(); $post_mem = $post_mem["mem_login_public"]; } if ($config["mc_img_post"] == "0") $post_text = eregi_replace("\[img\]", "#img#", $post_text); $sm = isset($post_smilies) ? $post_smilies : 0; if ($config["mc_smilies_post"] == "0") $sm = "0"; $post_tmp = update_posting($post_text, $sm, $config["mc_html_post"], $config["mc_id_post"]); if ($config["mc_img_post"] == "0") $post_text = eregi_replace("\#img\#", "[IMG]", $post_text); if ($config["mc_img_post"] == "0") $post_tmp = eregi_replace("\#img\#", "[IMG]", $post_tmp); $prev = $output->create_template("reply_preview", array("poster", "post_text", "post_topic_name"), array($post_mem, $post_tmp, $post_topic_name)); } $poll = ""; if ($login_member->access["acc_poll"] == "1") { if (!isset($new_poll)) $poll = $output->create_template("add_poll"); else { for($x=0; $x != $imputs;$x++) $poll .= "<input type=\"text\" name=\"".$x."\" size=\"40\"><br>"; $poll = $output->create_template("add_poll_details", array("fields", "imputs"), array($poll, $imputs)); } } $sig_on = ""; if ($login_member->details["mem_sig_status"] == 1) $sig_on = "checked"; $user_name = $login_member->details["mem_login_public"]; if (!$login_member->loged) $user_name = $output->create_template("unregged_user_post"); $output->add_template("new_topic", array("ac_toolbar", "user_name", "post_text", "post_topic_name", "icons", "smilies_legend", "all_number", "number_of_smilies", "poll", "file_upload", "preview", "sig_on"), array($output->create_template("action_code_bar"), $user_name, $post_text, $post_topic_name, $icons, $smilie, $all_smilies, $shown, $poll, $files, $prev, $login_member["mem_sig_status"] == "0" ? "" : "checked")); } // end submit } else { // else board_status $output->add_template("Info", array("info_title", "info_text", "link", "link_info"), array("{wl_information}", "{wl_no_write_right}", "site=forum&f=".$f, "{board_name}")); } // end board_status } else { $sql->select("board_pw", "boards", "board_id='".$f."'"); $pw_array = $sql->result(); // else Autorization if ($pw_array["board_pw"] != "") { $msg = "{wl_bpw_need}"; if (isset($pw) && !empty($pw)) $msg = "{wl_bpw_false}"; $output->add_template("pw_control", array("msg", "query_string"), array($msg, $QUERY_STRING)); } else $output->add_template("Info", array("info_title", "info_text", "link", "link_info"), array("{wl_information}", "{wl_no_autorization}", "", "{mc_forum_name}")); } // end Autorization ?>
-
hab mal das array in klammern gesetzt und am Anfang <? und am Ende ?> entfernt
http://www.fabianh.de/code.txt -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage