Jump to content

Birdman203

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Birdman203's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. well the script below shows me the mysql_query result is not correct or somethin error and points to line 52 [code] <?php $_mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'view'; switch($_mode) { case 'newtopic': $page = "Forums :: New Topic"; $tpl->assign('title', "$board_config[site_name] " . ":: $page"); $members->start_session($page); $f_id = $_GET['f']; $sql = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id = '$f_id'"; $query = mysql_query($sql); $num = mysql_num_rows($query); $row = mysql_fetch_array($query, MYSQL_ASSOC); if ( $num == "0" || empty($row['parent_id']) ) { $tpl->assign('message', 'There is no forum with that ID.'); } else { if ( $members->check_cat_per( $members->get_member_id(), 'forum_new_topic', $f_id ) == "1" ) { if ($_POST['submit']) { if ( empty($_POST['title']) || empty($_POST['message']) ) { $tpl->assign('message', 'You left the title and/or message blank.'); $tpl->assign('redirect', 'index.php?s=forums&mode=newtopic&f=' . $f_id); } else { $forum_id = $f_id; $poster = $members->get_profile( $members->get_member_id() ); $poster_id = $poster['member_id']; $time = strtotime("now"); $title = submit_textbox($_POST['title']); $message = submit_textbox($_POST['message']); $sql_auto = "SHOW TABLE STATUS " . POSTS_TABLE . ""; $query_auto = mysql_query($sql_auto); $auto_row = mysql_fetch_assoc($query_auto); $post_id = $auto_row['Auto_increment']; $sql_insert_topic = "INSERT INTO " . TOPICS_TABLE . " (forum_id, poster_id, title, first_poster_id, first_post_id, last_poster_id, last_post_id, last_post_time) VALUES ('$f_id', '$poster_id', '$title', '$poster_id', '$post_id', '$poster_id', '$post_id', '$time')"; $query_insert_topic = mysql_query($sql_insert_topic); $topic_id = mysql_insert_id(); $sql_insert_post = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, message, post_time, number_in_topic) VALUES ('$topic_id', '$f_id', '$poster_id', '$message', '$time', '1')"; $query_insert_post = mysql_query($sql_insert_post); $num_topics = $row['num_topics'] + 1; $sql_update_forums = "UPDATE " . FORUMS_TABLE . " SET num_topics = '$num_topics' WHERE forum_id = '$f_id'"; $sql_update_query = mysql_query($sql_update_forums); $tpl->assign('message', 'You have succesfully made a new topic.'); $tpl->assign('redirect', 'index.php?s=forums&mode=view_topic&id=' . $topic_id); } } else { $tpl->assign('form', '1'); $sql_parent = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id = '$row[parent_id]'"; $query_parent = mysql_query($sql_parent); $row_parent = mysql_fetch_array($query_parent); $forum_data = $row_parent; $forum_data['child'] = $row; $tpl->assign('forum_data', $forum_data); } } else { $tpl->assign('message', 'You do not have permission to post a topic in this forum.'); $tpl->assign('redirect', 'index.php?s=forums&mode=view_forum&id=' . $f_id); } } $tpl->display('forums-newtopic.tpl'); break; } ?> [/code] line 52 is [code] $auto_row = mysql_fetch_assoc($query_auto); [/code]
  2. [code] $count_session = count($_SESSION['topics']); $id = $_GET['id']; $array_session = array( 'id' => $id ); $array_session2[$count_session] = $array_session; $set_session = $_SESSION['topics'][$array_session2]; [/code] how come this doesnt work? or am i doin somethin wrong?
  3. How can I know when the user leaves the website or closes the browser?
  4. dont do mysql_select_db(); on your query do mysql_db_query("db", "select...");
  5. I have something like this: [code] <option value="1" style="padding-left: 20px; background: url(../img/flags/1.gif) no-repeat;" selected>United States</option><option value="2" style="padding-left: 20px; background: url(../img/flags/2.gif) no-repeat;" >Norway</option> [/code] And I need the value of it to be inserted as the ID in a table and the name of it thing which is United Stats and Norway in name. I need this, because I have about 180 countries and I need all of them to be in a SQL database.
  6. Can you tell me whats wrong with this? [code] <?php function quote($message) {     $quoteCount = preg_match_all("#\#(.*?)#si", $message, $quote2);     for ($i = 0; $i < $quoteCount; $i++) {     if (is_numeric($quote2[1][$i])) {     $quote = $quote2[1][$i];     $result = mysql_db_query("typekill_$config[short]", "select * from cp_fposts where topic_id = '$_GET[id]' order by id asc");     $n = 1;     $b = 0;     while ($row = mysql_fetch_array($result)) {     $array[$b] = array( 'id' => $qry[id], 'post_num' => $n, 'author' => $row[author], 'message' => $row[message] );     $n++;     $b++;     }     for ($d = 0; $d < count($array); $d++) {     if ($array[$d]['post_num'] == $quote) {     $author = mysql_db_query("typekill_global", "select * from cp_members where member_id = '$array[$d][author]'");     $qry = mysql_fetch_array($author);     $message = preg_replace("/\#{$quote}/si", '<table cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#A9A8AE\" width=\"85%\" style=\"margin: 4px auto 8px auto;\"><tr style=\"background-image: url(images/oddrowbg.gif);\"><th style=\"padding-left: 5px; text-align: left;\"><b>#{$quote} by <a href=members.php?mode=profile&id={$qry[member_id]}>{$qry[alias]}</a></b></th></tr><tr bgcolor=\"{$config.color}\"><td style=\"padding-left: 6px;\" valign=\"top\">{$array[$d][message]}</td></tr></table>', $message);     }     }     } } return($message); } ?> [/code]
  7. Delete the {} around $_SESSION['username']['user']
  8. OK, now I have another question. Didn't know if I should make a new topic or not. Lets say I have this array: [code] Array (2) 0 => Array (11)   id => "18",   post_num => "1",   message => "news post #7<br />\r\n<img src=http://g..." 1 => Array (11)   id => "19",   post_num => "2",   message => "gagaga" [/code] And now I need to get the "message" from it where the post_num is 1.
  9. Nice, thank you it works now.
  10. Ok so this is what I did to test it: [code] <?php require('required.inc.php'); $message = "[[member:Birdman]]<br>sada<br>[[member:ZOiD]]"; echo member($message); function member($message) { $prepareCount = preg_match_all("#\[\[member:(.*?)\]\]#si", $message, $prepare); for ($i = 0; $i < $prepareCount; $i++) { $alias = $prepare[1][$i]; $result = mysql_db_query("typekill_global", "select * from cp_members where alias = '$alias'"); $row = mysql_fetch_array($result); $message = preg_replace("/\[\[\member:(.*?)\]\]/si", "<img src=http://global.typekill.net/flags/{$row[country]}.gif> <a href=members.php?mode=profile&id={$row[member_id]}>{$row[alias]}</a>", $message); } return($message); } ?> [/code] And this is what I got: [code] <img src=http://global.typekill.net/flags/55.gif> <a href=members.php?mode=profile&id=1>Birdman</a><br> sada<br> <img src=http://global.typekill.net/flags/55.gif> <a href=members.php?mode=profile&id=1>Birdman</a> [/code] But when you do print_r($prepare); everything is in the array the right way and stuff so I don't know whats wrong.
  11. $prepareCount returns the number just like if you would do it with count. I did print_r($prepareCount); and it returned 2 not an array. $prepare is an array not $prepareCount. The problem is that $i++ isn't executing or somethin, because it always stays at 0. I inserted $i before <img and both were 0, but the 2nd 1 was supposed to be 1. That is why this is not workin and I do not know how to fix it that's what I'm asking for. If any of you know how to fix this.
  12. I did this here look through it and learn! [code] <?php require 'required.inc.php'; $news = $config[news]; $page = $_REQUEST['page']; $mul2 = bcmul($page, $news); $mul = bcsub($mul2, $news); if (isset($page)) { $result = mysql_db_query("typekill_$config[short]", "select * from cp_ftopics where cat_id = '$config[news_cat]' order by id desc limit $mul, $config[news]"); $smarty->assign("isset", "1"); } else { $result = mysql_db_query("typekill_$config[short]", "select * from cp_ftopics where cat_id = '$config[news_cat]' order by id desc limit 0, $config[news]") or die(mysql_error()); $smarty->assign("isset", "0"); } $count = mysql_num_rows($result); if ($count > $mul) { if (isset($page)) { $nextp = $page + 1; } else { $nextp = $page + 2; } $smarty->assign("nextp", $nextp); } if ($count < $mul) { $backp = $page - 1; $smarty->assign("backp", $backp); } ?> [/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.