Jump to content

erfg1

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

erfg1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. How about instead, how do I change the div of the parent frame from the iframe? <script type="text/javascript"> $("#load2div").load("./zones/<?PHP echo $charinfo[9]; ?>.php?char=<?PHP echo $_GET["char"]; ?>&x=<?PHP echo rand; ?>"); </script> Wont do it alone obviously, it needs to be pointing to the parent file.
  2. Why does this not refresh when I click on the links? <script type="text/javascript"> function refreshDiv2() { $("#load2div").load("./zones/<?PHP echo $charinfo[9]; ?>.php?char=<?PHP echo $_GET["char"]; ?>&x=<?PHP echo rand; ?>"); } var refreshId = setTimeout(refreshDiv2, 800); </script> <div id="load2div"></div> Zone file: <?PHP session_start(); if ($_SESSION['zone'] == "Untitled-1") { ?> <img name="Untitled1" src="./zones/Untitled-1.jpg" width="675" height="494" border="0" id="Untitled1" usemap="#m_Untitled1" alt="" /><map name="m_Untitled1" id="m_Untitled1"> <area shape="rect" coords="562,222,675,494" href="w2.php?char=<?PHP echo $_GET["char"]; ?>&m=Lets check out the right area…&z=Untitled-right" alt="" target="hiddenframe"/> <area shape="rect" coords="0,302,138,494" href="w2.php?char=<?PHP echo $_GET["char"]; ?>&m=Lets check out this left area…&z=Untitled-left" alt="" target="hiddenframe"/> </map> <?PHP } else { echo "ERROR: Please refresh this page."; exit; } ?>
  3. Nothings working... not even 'ROW_BUG' => str_replace("\n", "<br>", $myrow2["bug"]),
  4. What? No, im wondering how to make it so the \n's become BR's and make the \'s go away. All at the same time. How would you make a str_replace in this area. $template->assign_block_vars('bug_info', array( 'ROW_ID' => $myrow2["id"], 'ROW_VERSION' => $myrow2["version"], 'ROW_USERNAME' => $myrow2["name"], 'ROW_BUG' => $myrow2[stripslashes("bug")], 'ROW_STATUS' => $myrow2["status"], 'ROW_COMMENTS' => $myrow2["comments"], 'ROW_MYNAME' => $user->data['username'], ));
  5. <?php define('IN_PHPBB', true); // we tell the page that it's going to be using phpBB, this is important. $phpbb_root_path = './forums/'; // See phpbb_root_path documentation $phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage. include($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects. // Start session management -- This will begin the session for the user browsing this page. $user->session_begin(); $auth->acl($user->data);// Language file (see documentation related to language files) $user->setup('mypage');/*** All of your coding will be here, setting up vars, database selects, inserts, etc...*/ page_header($user->lang['MY_PAGE_TITLE']); // Set the filename of the template you want to use for this file. $template->set_filenames(array( 'body' => 'mytemplate_body.html') // template file name -- See Templates Documentation ); $submit = (isset($_POST['post'])) ? true : false; //Submit values $submit_edit = (isset($_POST['post_edit'])); //Submit values $view = (isset($_GET['view'])); //View values $name = $user->data['username']; $name_edit = request_var('name_edit', '', true); $version = request_var('version', '', true); $bug = request_var('bug', '', true); $status = request_var('status', '', true); $id = request_var('id', '', true); $comments = request_var('comments', '', true); $edit = (isset($_GET['edit'])) ? intval($_GET['edit']) : 0; //Edit the bug $fixed = (isset($_GET['fixed'])) ? intval($_GET['fixed']) : 0; //Fixed the bug $delete = (isset($_GET['delete'])) ? intval($_GET['delete']) : 0;; //Remove the bug (spam? stupid? un-needed?) $fixed_var = "Fixed by"; // A typical usage for sending your variables to your template. $template->assign_vars(array( 'BUG' => $user->lang['BUG'], 'TEXT_VAR' => $user->lang['TEXT_VAR'], 'ANOTHER_TEXT_VAR' => $user->lang['ANOTHER_TEXT_VAR'], 'CM_VERSION' => $user->lang['CM_VERSION'], 'YOUR_NAME' => $user->lang['YOUR_NAME'], 'EXPLAIN_BUG' => $user->lang['EXPLAIN_BUG'], 'SUBMITED_BUG' => $user->lang['SUBMITED_BUG'], 'TITLE_VIEWING' => $user->lang['TITLE_VIEWING'], 'BUG_FIXED' => $user->lang['BUG_FIXED'], 'SUBMITED_EDIT' => $user->lang['SUBMITED_EDIT'], 'SUBMITED_AND_REMOVED' => $user->lang['SUBMITED_AND_REMOVED'], 'NOT_LOGGED_IN' => $user->lang['NOT_LOGGED_IN'], ));// Output the page if ($user->data['is_registered']){ $template->assign_vars(array( 'S_LOGIN' => true, )); } else { $template->assign_vars(array( 'S_NOT_LOGIN' => true, )); } if ($user->data['group_id'] == "7"){ //Clan Mod developing team is 7. Change this as needed. $template->assign_vars(array( 'S_ADMIN' => true, )); } /////////////////////////////////////////// // FIXED /////////////////////////////////////////// if (!$delete && !$submit_edit && $fixed && !$submit && !$view){ //We have fixed the bug. $sql3 = "UPDATE cm_bugreport SET status = '$fixed_var " . $user->data['username'] . "' WHERE id = '$fixed'"; $db->sql_query($sql3); $template->assign_vars(array( 'S_REPORTING' => false, 'S_DONE' => false, 'S_VIEWING' => false, 'S_BUG_FIXED' => true, 'S_IS_EDITING' => false, 'S_DONE_EDITING' => false, 'S_REMOVED' => false, )); } /////////////////////////////////////////// // DELETED /////////////////////////////////////////// if ($delete && !$submit_edit && !$fixed && !$submit && !$view){ //We must remove this bug. $sql6 = "DELETE FROM cm_bugreport WHERE id = '$delete'"; $db->sql_query($sql6); $template->assign_vars(array( 'S_REPORTING' => false, 'S_DONE' => false, 'S_VIEWING' => false, 'S_BUG_FIXED' => false, 'S_IS_EDITING' => false, 'S_DONE_EDITING' => false, 'S_REMOVED' => true, )); } /////////////////////////////////////////// // EDITING /////////////////////////////////////////// if (!$delete && !$submit_edit && $edit && !$fixed && !$submit && !$view){ //We have fixed the bug. $sql4 = "SELECT * FROM cm_bugreport WHERE id = '$edit'"; $result4 = $db->sql_query($sql4); while ($myrow4 = $db->sql_fetchrow($result4)){ $template->assign_vars(array( 'ROW_ID' => $myrow4["id"], 'ROW_VERSION' => $myrow4["version"], 'ROW_USERNAME' => $myrow4["name"], 'ROW_BUG' => $myrow4["bug"], 'ROW_STATUS' => $myrow4["status"], 'ROW_COMMENTS' => $myrow4["comments"], )); } $template->assign_vars(array( 'S_REPORTING' => false, 'S_DONE' => false, 'S_VIEWING' => false, 'S_BUG_FIXED' => false, 'S_IS_EDITING' => true, 'S_DONE_EDITING' => false, 'S_REMOVED' => false, )); } /////////////////////////////////////////// // DONE EDITING /////////////////////////////////////////// if (!$delete && $submit_edit && !$fixed && !$submit && !$view){ $sql5 = "UPDATE cm_bugreport SET version = '". mysql_real_escape_string("$version") ."', name = '". mysql_real_escape_string("$name_edit") ."', bug = '". mysql_real_escape_string("$bug") ."', status = '". mysql_real_escape_string("$status") ."', comments = '". mysql_real_escape_string("$comments") ."' WHERE id = '$id'"; $db->sql_query($sql5); $template->assign_vars(array( 'S_REPORTING' => false, 'S_DONE' => false, 'S_VIEWING' => false, 'S_BUG_FIXED' => false, 'S_IS_EDITING' => false, 'S_DONE_EDITING' => true, 'S_REMOVED' => false, )); } /////////////////////////////////////////// // SUBMITING /////////////////////////////////////////// if (!$delete && !$submit_edit && !$edit && !$fixed && $submit && !$view){ //We have submited our bug, and we are done. $sql = 'INSERT INTO cm_bugreport' . $db->sql_build_array('INSERT', array( 'name' => $name, 'version' => $version, 'bug' => mysql_real_escape_string("$bug"), 'status' => $status) ); $db->sql_query($sql); $template->assign_vars(array( 'S_REPORTING' => false, 'S_DONE' => true, 'S_VIEWING' => false, 'S_BUG_FIXED' => false, 'S_IS_EDITING' => false, 'S_DONE_EDITING' => false, 'S_REMOVED' => false, )); } /////////////////////////////////////////// // SUBMITTING /////////////////////////////////////////// else if (!$delete && !$submit_edit && !$edit && !$fixed && !$submit && !$view) { //Lets submit a bug! $template->assign_vars(array( 'S_REPORTING' => true, 'S_DONE' => false, 'S_VIEWING' => false, 'S_BUG_FIXED' => false, 'S_IS_EDITING' => false, 'S_DONE_EDITING' => false, 'S_REMOVED' => false, )); } /////////////////////////////////////////// // VIEWING /////////////////////////////////////////// else if (!$delete && !$submit_edit && !$edit && !$fixed && $view && !$submit) { //We are viewing the bugs that are already submited. $sql2 = 'SELECT * FROM cm_bugreport ORDER BY id DESC'; $result2 = $db->sql_query($sql2); $db->sql_freeresult($result2); $template->assign_vars(array( 'S_REPORTING' => false, 'S_DONE' => false, 'S_VIEWING' => true, 'S_BUG_FIXED' => false, 'S_IS_EDITING' => false, 'S_DONE_EDITING' => false, 'S_REMOVED' => false, )); while ($myrow2 = $db->sql_fetchrow($result2)){ $template->assign_block_vars('bug_info', array( 'ROW_ID' => $myrow2["id"], 'ROW_VERSION' => $myrow2["version"], 'ROW_USERNAME' => $myrow2["name"], 'ROW_BUG' => nl2br($myrow2["bug"]), 'ROW_STATUS' => $myrow2["status"], 'ROW_COMMENTS' => $myrow2["comments"], 'ROW_MYNAME' => $user->data['username'], )); } } // Finish the script, display the page page_footer(); ?>
  6. <?php //... 'ROW_BUG' => nl2br($myrow2['bug']), //... ?> Doesn't work. Maybe I should do a str_replace? If so, how should I go about doing it for this instance.
  7. Is there any way to change \n's to <br>'s though?
  8. If i'm doing something like $template->assign_block_vars('bug_info', array( 'ROW_ID' => $myrow2["id"], 'ROW_VERSION' => $myrow2["version"], 'ROW_USERNAME' => $myrow2["name"], 'ROW_BUG' => $myrow2["bug"], 'ROW_STATUS' => $myrow2["status"], 'ROW_COMMENTS' => $myrow2["comments"], 'ROW_MYNAME' => $user->data['username'], )); Would I do... $template->assign_block_vars('bug_info', array( 'ROW_ID' => $myrow2["id"], 'ROW_VERSION' => $myrow2["version"], 'ROW_USERNAME' => $myrow2["name"], 'ROW_BUG' => $myrow2[stripslashes("bug")], 'ROW_STATUS' => $myrow2["status"], 'ROW_COMMENTS' => $myrow2["comments"], 'ROW_MYNAME' => $user->data['username'], ));
  9. I'm using mysql_real_escape_string so that when people post a comment on my website, it won't mess up the message if you type in a ' or space down more than once. However, when it outputs it back onto the page, it doesn't correct it to show the new space downs and removes \'s. How do you replace \n's with <br>'s and completely remove \'s
  10. Is this right? $sql5 = "UPDATE cm_bugreport SET version = '". mysql_real_escape_string($version) .", name = '$name_edit', bug = '$bug', status = '$status', comments = '$comments' WHERE id = '$id'"; Cause im still getting errors back. EDIT: nvm, this is how it should be. $sql5 = "UPDATE cm_bugreport SET version = '". mysql_real_escape_string("$version") ."', name = '$name_edit', bug = '$bug', status = '$status', comments = '$comments' WHERE id = '$id'";
  11. I made a bug report script so people can report them, and an administrator could read them, and edit them. However, if someone reported something and put a special character like ' when i would go to edit and re-submit, it would say that its a syntax error. I've fixed this in my previous scripts however, i lost them, and can't recall how to do it. Basically I want to UPDATE. Basically editing another field, but not their original report containing a ' and wanting to re-submit without editing their report. $sql5 = "UPDATE cm_bugreport SET version = '$version', name = '$name_edit', bug = '$bug', status = '$status', comments = '$comments' WHERE id = '$id'"; $db->sql_query($sql5);
  12. Thank you very much hostfreak. That was exactly what I was looking for.
  13. When I made my form php powered, and you fill out a <TEXTAREA>, it does spaces, but the spaces dont show when displaying the mysql content onto a website. How would I make it so you can do <BR>'s instead of mysql's space downs. I assume it has something to do with str_replace.
  14. I think it just had a problem with carrying over the ID.
  15. [code]<?php define('IN_PHPBB',true); $phpbb_root_path = "./forums/"; // set path to phpBB files include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // // Start session management // $userdata = session_pagestart($user_ip, PAGE_LOGIN); // initiate session init_userprefs($userdata); // load user prefs // // End session management // $page_title = "RoAR clan :: ACP"; // session id check if (!empty($HTTP_POST_VARS['sid']) || !empty($_GET['sid'])) { $sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $_GET['sid']; } else { $sid = ''; } $link = mysql_connect(localhost, MY_USERNAME, MY_PASSWORD); $db = mysql_select_db(forum, $link); ?>[/code] [code]<?php   if ($userdata['session_logged_in'] && !isset($_GET['login']) && !isset($_GET['logout']) && !isset($_GET['announce']) && !isset($_GET['submitannounce']) && !isset($_GET['announce2']) && !isset($_GET['delete']) && !isset($_GET['editannouncement'])){   if ($userdata[group_id] = "2"){   //We are admin! WELCOME THEM BACK!   echo"Welcome back to the administrations control panel for the RoAR clans website $userdata[username]!";   //Announcements section   echo"<hr color=#990000><b><u><font color=red>ANNOUNCEMENTS SECTION</u></b><br>- <a href=acp.php?announce=true>Add an announcement</a><br>- <a href=acp.php?announce2=true>Remove/Edit an announcement</a><br>- <a href=index.php>View announcements</a>";   //Downloads section   echo"<hr color=#990000><b><u><font color=red>DOWNLOADS SECTION</u></b><br>- <a href=>Add a download</a><br>- <a href=>Remove/Edit a download</a><br>- <a href=downloads.php>View downloads</a>";   //Members section   echo"<hr color=#990000><b><u><font color=red>MEMBERS SECTION</u></b><br>- <a href=>Add a member</a><br>- <a href=>Remove/Edit a member</a><br>- <a href=members.php>View registered members</a><br>- <a href=>View membership applications</a>";   }   else{   //Not an admin? GET OUT!   echo'You are not an administrator of the RoAR clan! <b><font color="red">GET OUT OF THIS PAGE NOW!</b>';   } } else if (!$userdata['session_logged_in'] && !isset($_GET['login']) && !isset($_GET['logout'])){ //Not logged in? Please login! echo'You are currently not logged in! <b><font color="red">LOG IN NOW!</b>'; } //---------------------------- // ADD ANNOUNCEMENTS SECTION! //---------------------------- if ($userdata[group_id] = "2" && isset($_GET['announce']) && !isset($_GET['submitannounce']) && !isset($_GET['delete']) && !isset($_GET['editannouncement'])){ $today = date("Y-m-d"); echo"Welcome to the administration announcement addition part of the administrative control panel. Lets add a new announcement!<hr color=#990000>"; echo"<form action=\"acp.php?submitannounce=true\" method=\"post\"><table> <tr><td>Author:</td><td><input type=\"text\" size=\"30\" name=\"author\" value=\"$userdata[username]\"></td></tr> <tr><td>Date:</td><td><input type=\"text\" size=\"30\" name=\"date\" value=\"$today\"></td></tr> <tr><td>Title:</td><td><input type=\"text\" size=\"30\" name=\"title\"></td></tr> <tr><td>Content:</td><td><textarea size=\"30\" name=\"content\" rows=\"6\" cols=\"40\"></textarea></td></tr> <tr><td>- <a href=\"./acp.php\">Back</a></td><td><input type=\"submit\" value=\"Submit New Announcement\"></td></tr> </table></form>"; } if (isset($_GET['submitannounce'])){ if (!$_POST[content]){     echo "Missing CONTENT, please fill out the form again.<br>"; }     else{     $query = "INSERT INTO web_announcements (author, date, title, content) VALUES ('$_POST[author]', '$_POST[date]', '$_POST[title]', '$_POST[content]')";     $result = mysql_query($query, $link);     echo'Your new announcement was succesfully added!<br><br>- <a href="./acp.php">Back</a>'; } } //---------------------------- // REMOVE/EDIT ANNOUNCEMENTS SECTION! //---------------------------- //DELETE if (isset($_GET['delete']) && !empty($_GET['id'])) { $sql = mysql_query("DELETE FROM web_announcements WHERE id='$id'") or die(mysql_error()); if($sql) echo "The announcement has successfully been removed.<br><br>- <a href=./acp.php>Back</a>"; else echo "No row deleted.."; } else { echo "You are now ready to either remove or edit an announcement, please select your options below.<hr color=#990000>"; $query = mysql_query("SELECT * FROM web_announcements") or die(mysql_error()); while ($results = mysql_fetch_array($query)) { extract($results); echo"- $title (<a href=>EDIT</a>)/(<a href=$PHP_SELF?delete=1&amp;id=$id>DELETE</a>)<br>"; } } //VIEW if (isset($_GET['announce2'])){ echo"You are now ready to either remove or edit an announcement, please select your options below.<hr color=#990000>"; $query = "SELECT * FROM web_announcements"; $result = mysql_query($query);   while ($results = mysql_fetch_array($result)){   extract($results);   echo"- $title (<a href=$PHP_SELF?editannouncement&id=$id>EDIT</a>)/(<a href=$PHP_SELF?id=$id&delete>DELETE</a>)<br>"; } } //EDIT if (isset($_GET['editannouncement'])){ echo"You are now ready to edit an announcement.<hr color=#990000>"; $query = "SELECT * FROM web_announcements WHERE id=$id"; $result = mysql_query($sql, $link); extract($results); echo"<form action=\"acp.php?submiteditedannounce=true\" method=\"post\"><table> <input type=\"hidden\" name=\"id\" value=\"$id\"> <tr><td>Author:</td><td><input type=\"text\" size=\"30\" name=\"author\" value=\"$author\"></td></tr> <tr><td>Date:</td><td><input type=\"text\" size=\"30\" name=\"date\" value=\"$date\"></td></tr> <tr><td>Title:</td><td><input type=\"text\" size=\"30\" name=\"title\" value=\"$title\"></td></tr> <tr><td>Content:</td><td><textarea size=\"30\" name=\"content\" rows=\"6\" cols=\"40\">$content</textarea></td></tr> <tr><td>- <a href=\"./acp.php\">Back</a></td><td><input type=\"submit\" value=\"Submit Edited Announcement\"></td></tr> </table></form>"; } if (isset($_GET['submiteditedannounce'])){ $sql = "UPDATE web_announcements SET author='$_POST[author]', date='$_POST[date]', title='$_POST[title]', content='$_POST[content]' WHERE id=$id"; $result = mysql_query($sql, $link); }   ?>[/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.