Jump to content

Monkuar

Members
  • Posts

    987
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Monkuar

  1. $letters = range('A', 'Z'); $menu=(empty($menu))?'':$menu; $menu.='<center><div class=pages>Starts With: '; $_GET['muffin']=(empty($_GET['muffin']))?'':$_GET['muffin']; foreach ($letters as $letter) { if ( isset( $_GET['muffin'] ) AND in_array($_GET['muffin'], $letters ) ){ $test = "hey"; } $menu .= '<a href="?a=(^_-)&muffin='. $letter .'">'. $letter .' '.$test.'</a>'." • "; } $menu.= '</div></center>'; if ( isset( $_GET['muffin'] ) AND in_array($_GET['muffin'], $letters ) ){ // CONNECT TO DATABASE AND QUERY $q_extra .= " AND m.name LIKE '".mysql_escape_string($_GET['muffin'])."%'"; // DO QUERY AND CHURN OUT RESULTS } I know this sounds childish but $test is being called for EACH forloop? when I only want it to be next to the letter that is matches.. so then I can use the bold tags around the '.$letter.' so then it will show the user if they clicked to sort by "A" or whatever, it would show that letter in a Bold color. Im getting 26 words of "HEY" when im only needing 1..
  2. I need to wrab <b> tags around the current Letter (If they clicked on it) $letters = range('A', 'Z'); $menu=(empty($menu))?'':$menu; $menu.='<center><div class=pages>Starts With: '; foreach ($letters as $letter) { $menu .= '<a href="?a=(^_-)&muffin='. $letter .'">'. $letter .'</a>'." • "; } $menu.= '</div></center>'; if ( isset( $_GET['muffin'] ) AND in_array($_GET['muffin'], $letters ) ){ // CONNECT TO DATABASE AND QUERY $q_extra .= " AND m.name LIKE '".mysql_escape_string($_GET['muffin'])."%'"; // DO QUERY AND CHURN OUT RESULTS } I tried if ($_GET['muffin'] == $letter){ $boldtag1 = '<b>'; $boldtag2= '</b>'; } I tried that inside my foreach and it's not working, it shows the bold stuff all over, not around the current selection ? Anyone can chime on this one for me? ty Current selection I mean around the '.$letter.' so it looks nice and bolded if clicked on
  3. im making a system where people can search by letter of my forum users here is my code: foreach(range('A','Z') as $i) $l.= $i; now i am echoing out $l wherever i want How do I make it so I i can add a hyperlink or a URL for each character? (inside the foreach) so I don't have to manually do it
  4. Yep! exactly, it updates the database row "p" where ID = 1 (or w/e user is updating it) if (isset($ibforums->input['down'])){ $DB->query("UPDATE ibf_members set p='WATTOADDHERE ' WHERE id={$ibforums->member['id']}"); header("Location: ?i={$ibforums->input['i']}"); } See it will update that value p to 0,1,2 or whatever, I have a down arrow and a UP arrow on each field section for them to click it. I would add a "up" input also, but just lost on how to update it based on what they pressed and what the other arrays are... it's so confusing KevinM1, I will read that link, thank yu
  5. On your last code was u missing a $? i added a $ $tmp = $arr[$x]; I have 3 sections, and each 1 has it's own name. Section 1 is 0 Section 2 is 1 Section 3 is 2 my code is $middle=array ( "0" => array ( "section" => $aboutme, ), "1" => array ("section" => $signature, ), "2" => array ("section" => $f, ), ); $order = array(0,1,2); print_r($middle); foreach ($order as $index) { $middlesection.= $middle[$index]['section']; } See how the array is 0,1,2 ? That is stored in a db field row for each users profile. I want them to beable to change the order of the sections to there choice. Kinda better explanation? not with ajax
  6. hmm, Thanks but I dont think it will work because i need to dynamically figure out the $anotherIndex array, which I cant.. I have a field in my DB, 0,1,2 and like if somone presses my "down arrow" it needs to move the 0 down 1, so it's 1,0,2. But then what if they press it again? It needs to move that 0 down 1 so it's 1,2,0 I just can't figure out how to dynamically do this?
  7. Is there anything in php that let's me SWAP 2 arrays? like let's say I have 3,2,1 in a array, is there a way I can swap the 2 and 1 if a statement is true?
  8. Okay, I have a P value field in my Database ROW. It contains 0,1,2 0 is my About Me, 1 is my Signature Section 2 is my Friends section: Check this screenshot: Now you see that little green arrow? When you click on it, I have the code for it here: if (isset($ibforums->input['down'])){ if ($ibforums->input['down'] == "0"){ $new = '1,0,2'; } $DB->query("UPDATE ibf_members set p='$new' WHERE id={$ibforums->member['id']}"); header("Location: ?i={$ibforums->input['i']}"); } As you can see, it updates it 1,0,2. (Default is 0,1,2) for variable $p. Here is my code. $p = explode(",", $member['p']); $middle=array ( "0" => array ( "section" => $aboutme, "b" => "banana", "c" => "apple" ), "1" => array ("section" => $signature, "b" => "banana", "c" => "apple" ), "2" => array ("section" => $f, "b" => "banana", "c" => "apple" ), ); $order = $p; print_r($middle); foreach ($order as $index) { $middlesection.= $middle[$index]['section']; } I echo out my $middlesection variable in my profile page, that's the screenshot that you see. My problem is, How can I check the input's when they click the green arrow button to know "not to go down anymore", I will be adding a up Arrow icon next to it... (I am very lost and little bit confused on how to check the input to make it all work) see like right now, on that screenshot it is: 1,0,2 (Signature,Aboutme,Friends) but if I click on that arrow again, how do I Dynamically make the 0 make sure it is the last one? but then see if I have to switch the 0 to 1,2,0 how would I check input on my 2 to know if it was the last one to move over to the second "," ?? It's just so confusing, (am I doing it wrong? it seems really confusing) But yeah... I appreciate your responses, hope you can guide,help me to get this done.
  9. $middle=array( "0" => $aboutme, "1" => $signature, "2" => $f, ); $order = array(1,2,0); print_r($middle); foreach ($order as $index) { $middlesection.= $middle[$index]; } LOL I FIGURED IT OUT!! AWESOME MAN LOVE IT THANKS!!!!! FOREACH IS JUST FREAKING EPCI!!
  10. $middle=array( "aboutme" => $aboutme, "signature" => $signature, "friends" => $f, ); foreach ($middle as $val =>$n) { $middlesection .= $middle[$val]; var_dump($middle[$val]); } Okay now How do I make this so my users can choose the ORDER of there profile sections? I: have a field in my db called "profile" varchar 255!I am so excited I am actually learning Foreach with arrays this is awesome! I am echoing out my $middlesection to display my 3sections: here is a screenshot: Now I just want my users to beable to change the order of the Array? how is this possible? I am so close, eventually I want them to beable to move the sections to the left or right (I would need a 3d array though) im not that smart yet :shrug: :shrug:
  11. list( $this->member['AVATAR_WIDTH'] , $this->member['AVATAR_HEIGHT'] ) = explode ("x", $this->member['avatar_size']); I get Notice: Undefined offset: 1 any idea? Is is the avatar_width or avatar_height? I also tried $this->member['AVATAR_HEIGHT'] = (empty($this->member['AVATAR_HEIGHT'])) ? '' : $this->member['AVATAR_HEIGHT']; $this->member['AVATAR_WIDTH'] = (empty($this->member['AVATAR_WIDTH'])) ? '' : $this->member['AVATAR_WIDTH']; $this->member['avatar_size'] = (empty($this->member['avatar_size'])) ? '' : $this->member['avatar_size']; still doesn't work or get rid of the error
  12. fixed this by simpling adding this: if (!isset($_COOKIE['hide_div']['0'])){ $_COOKIE['hide_div']['0'] = 0; } if (!isset($_COOKIE['hide_div']['2'])){ $_COOKIE['hide_div']['2'] = 0; } rofl i think I am thinking to hard?
  13. if (isset($_COOKIE['hide_div']['0']) && isset($_COOKIE['hide_div']['2'])){ $cookie1 = $_COOKIE['hide_div']['0']; $cookie2 = $_COOKIE['hide_div']['2']; } if ($cookie1 == $cat_id OR $cookie2 == $cat_id) { foreach ($this->forums as $forum_id => $forum_data) { if ($forum_data['category'] == $cat_id) { //----------------------------------- // We store the HTML in a temp var so // we can make sure we have cats for // this forum, or hidden forums with a // cat will show the cat strip - we don't // want that, no - we don't. //----------------------------------- $temp_html .= $this->process_forum($forum_id, $forum_data); } } if ($temp_html != "") { $this->output .= $this->html->CatHeader_Expandedhidden($cat_data); $this->output .= $this->html->end_this_cat(); } unset($temp_html); }else{ $cookie1 = ''; $cookie2 = ''; why in the world is it displaying Undefined variable: cookie1 and cookie2 as errors? When I declared both of them even AFTER my if statement, this is bogus dude, lol this isset stuff is really confusing or am i just not doing it right?
  14. wow var_dump is awesome, thanks 4 telling me that array 'id' => string '20' (length=2) 'topics' => string '1' (length=1) 'posts' => string '0' (length=1) 'last_post' => string '2 weeks 6 days ago' (length=19) 'last_poster_id' => string '1' (length=1) 'star' => string '' (length=0) 'last_poster_name' => string 'Newman' (length=6) 'name' => string 'Site Announcements' (length=18) 'description' => string '' (length=0) 'position' => string '1' (length=1) 'status' => string '1' (length=1) 'start_perms' => string '4' (length=1) 'reply_perms' => string '4' (length=1) 'read_perms' => string '*' (length=1) 'password' => string '' (length=0) 'category' => string '3' (length=1) 'last_title' => string 'New Site Design/Updates' (length=23) 'last_id' => string '281' (length=3) 'prune' => string '30' (length=2) 'preview_posts' => string '0' (length=1) 'allow_poll' => string '1' (length=1) 'allow_pollbump' => string '0' (length=1) 'parent_id' => string '-1' (length=2) 'subwrap' => string '0' (length=1) 'sub_can_post' => string '1' (length=1) 'quick_reply' => string '0' (length=1) 'has_mod_posts' => string '0' (length=1) 'topic_mm_id' => string '' (length=0) 'topic_thread' => string '1' (length=1) 'editable' => string 'global' (length=6) 'edit_time' => string '0' (length=1) 'cat_id' => string '3' (length=1) 'cat_position' => string '1' (length=1) 'cat_state' => string '1' (length=1) 'cat_name' => string 'SWR' (length=3) 'cat_desc' => string '' (length=0) 'image' => string '' (length=0) 'url' => string '' (length=0) 'mod_name' => null 'mod_id' => null 'is_group' => null 'group_id' => null 'group_name' => null 'mid' => null 'img_new_post' => string '<div class=forumoff></div>' (length=26) 'last_topic' => string '<a href='http://localhost/?t=281&x=1' title='Go To Last Page'>New Site Design/Updates</a>' (length=93) 'last_unread' => string '<a href='http://localhost/?showtopic=281&view=getlastpost' title='Go to the last post'><{LAST_POST}></a>' (length=108) 'last_poster' => string '<a href='http://localhost/?i=1'>Newman</a>' (length=42) 'moderator' => string '' (length=0) i guess sometimes it does not show subforums hence (forum has no subforums) which you are correct,h ow would I go about making those forums with no subforums isset? array 'id' => string '13' (length=2) 'topics' => string '21' (length=2) 'posts' => string '264' (length=3) 'last_post' => string '3 days 1 hour ago' (length=18) 'last_poster_id' => string '1' (length=1) 'star' => string '<img class='top3' src='style_images/1/icons/127.png'>' (length=53) 'last_poster_name' => string 'Newman' (length=6) 'name' => string 'Entertainment & Lifestyle' (length=29) 'description' => string '' (length=0) 'position' => string '2' (length=1) 'status' => string '1' (length=1) 'start_perms' => string '3,4,6,7' (length=7) 'reply_perms' => string '3,4,6,7' (length=7) 'read_perms' => string '*' (length=1) 'password' => string '' (length=0) 'category' => string '1' (length=1) 'last_title' => string 'Favorite Sport/Athlete?' (length=23) 'last_id' => string '114' (length=3) 'prune' => string '30' (length=2) 'preview_posts' => string '0' (length=1) 'allow_poll' => string '1' (length=1) 'allow_pollbump' => string '0' (length=1) 'parent_id' => string '-1' (length=2) 'subwrap' => string '1' (length=1) 'sub_can_post' => string '1' (length=1) 'quick_reply' => string '0' (length=1) 'has_mod_posts' => string '0' (length=1) 'topic_mm_id' => string '' (length=0) 'topic_thread' => string '1' (length=1) 'editable' => string 'global' (length=6) 'edit_time' => string '0' (length=1) 'cat_id' => string '1' (length=1) 'cat_position' => string '2' (length=1) 'cat_state' => string '1' (length=1) 'cat_name' => string 'Off Topic' (length=9) 'cat_desc' => string '' (length=0) 'image' => string '' (length=0) 'url' => string '' (length=0) 'mod_name' => null 'mod_id' => null 'is_group' => null 'group_id' => null 'group_name' => null 'mid' => null 'fid' => string '13' (length=2) 'subforums1' => string '<br> <img src=style_images/1/subforum.png> <span class=desc4>Subforums:</span>' (length=97) 'subforums' => string '<a href="?z=18">The Salon & Barbershop</a>, <a href="?z=14">Sports</a>, <a href="?z=15">Movies & Television</a>, <a href="?z=16">Nutrition & Exercise</a>, <a href="?z=17">Technology & Gaming</a>' (length=210) 'last_unread' => string '<a href='http://localhost/?showtopic=114&view=getlastpost' title='Go to the last post'><{LAST_POST}></a>' (length=108) 'last_topic' => string '<a href='http://localhost/?t=114&x=1' title='Go To Last Page'>Favorite Sport/Athlete?</a>' (length=93) 'last_poster' => string '<a href='http://localhost/?i=1'>Newman</a><img class='top3' src='style_images/1/icons/127.png'>' (length=95) 'img_new_post' => string '<div class=forumoff></div>' (length=26) that 1 shows subforums too i tried if (isset($forum_data['subforums'])){ $forum_data['subforums'] = implode(', ', $subforums); } no errors buit not working?
  15. i fixed subforums1 now for subforums Undefined variable: subforums if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ if (isset($info['subforums1']) && isset($info['subforums']) && isset($subforums) ) { $subforums = " {$info['subforums1']} {$info['subforums']}"; } } I tried to isset my $subforums variable but still it's calling it undefined? hmm im simply echoing out $subforums ? so weird rofl
  16. Okay i fixed it if (isset($info['subforums1'])){ $subforums = " {$info['subforums1']} {$info['subforums']}"; } dude this isset stuff is just literally retarded, there is NO means on why this should be used, is there any edited php librarys that have the isset stuff disabled? This is going to take forever to isset every stupid variable "just cuz" when everything work absolutely fine if it does not have a isset to it (for my coding style) i should have never used isset because this stuff is being called from a database should be no reason why it needs to be "defined" rofl, this is a joke
  17. function ForumRow($info) { global $ibforums; $color_one = 'class="rowpk"'; $color_two = ''; static $i = 0; $color = ($i % 2) ? $color_one : $color_two; $i++; if ($info['description']){ $info['description'] = "<br>{$info['description']}"; }else{ $info['description'] = ""; } if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ $subforums = " {$info['subforums1']} {$info['subforums']}"; } if (isset($info['moderator'])){ $moderator = $info['moderator']; } // <td style="border-left:none">{$info['img_new_post']}</td> return <<<EOF <tr $color> <td style=border-left:none><b><span class="forumhover"><a href="{$ibforums->base_url}z={$info['id']}" title='{$info['description']}'>{$info['name']}</a></span> </b> <span class='desc'> $subforums <br></span>$moderator</span></td> <td align='center' nowrap><span class=desc4>Posts:</span> {$info['posts']}<br> <span class=desc4>Topics:</span> {$info['topics']} </td> <td> » <b>{$info['last_topic']}</b></span> <br><span class="forumhover3">{$ibforums->lang['by']} {$info['last_poster']} <span class="desc4">{$info['last_post']}</span> </span> </td> </tr> EOF; } function ForumRow($info) { let me find $info return $this->html->ForumRow($forum_data); so it's coming from $forum_data, then right? and all the other $info's ($forum_data) do not use any type of isset (merely just stuff being called from a database from a loop, that is why in the hell does the subforum one get error'd out??)
  18. $forum_data['subforums1'] = '<br> <img src=style_images/1/subforum.png> <span class=desc4>Subforums:</span>'; it is there then my subforums are $subforums[] = "<a href=\"?z={$data['id']}\">{$data['name']}</a>"; $forum_data['subforums'] = implode(', ', $subforums); that is inside a Array. The problem is, all the other $info's ARE NOT DEFINED and they don't show any errors! How in the hell (and why) does my subforums need to be defined also? I search for $info['description'] and the only thing I can find to call that is the row name description getting pulled from a database query, there is no ISSET related to $info description or any of the other $info's so why in the worlds hell, is the subforum ones being error'd out, it makes absolutely no sense! (Same for all the other $info's are not defined either and i get no error's from them) it's MERELY Pulling stuff from a DATABASE, you don't need to define database values? something wrong with my php
  19. are you freaking kidding me or am i just gone dead? if (isset($_COOKIE['subforum'])) { $subforums = ""; }else{ $subforums = " {$info['subforums1']} {$info['subforums']}"; } I fixed the $cookie['subforum'] and added the isset, but now it's saying my subforums1 and subforums are UNDEFINED? Is this a joke? it's not a INPUT it's simply a variable from my DATABASE .... being called? this is my hole heredoc return <<<EOF <tr $color> <td style=border-left:none><b><span class="forumhover"><a href="{$ibforums->base_url}z={$info['id']}" title='{$info['description']}'>{$info['name']}</a></span> </b> <span class='desc'> $subforums <br></span>$moderator</span></td> <td align='center' nowrap><span class=desc4>Posts:</span> {$info['posts']}<br> <span class=desc4>Topics:</span> {$info['topics']} </td> <td> » <b>{$info['last_topic']}</b></span> <br><span class="forumhover3">{$ibforums->lang['by']} {$info['last_poster']} <span class="desc4">{$info['last_post']}</span> </span> </td> </tr> EOF; ONLY the SUBFORUMS are being UNDEFINED the other $info's like post's,last_posters,last_post ARE NOT Showing errors but the subforums one are? this is literally making me tear my hair out, this is outrageous! any idea why it would do this? pissing me off, I never had to isset those other $info's and it's not calling them as undefined error's but hell whenever I try to code my own mods/etc it always doesn't work the way I want, pathetic, i hate myself and I hate this isset STUFF, does it even effect performance that much? this is just getting ridiclious
  20. Bump anyone help? I tried isset($ibforums->input) = $std->parse_incoming(); but i get syntax error, unexpected '=' on that line i know this sounds really noob, but just help me lol
  21. In my index.php I use a global $_GET variable here: $ibforums->input = $std->parse_incoming(); parse_incoming function is: function parse_incoming() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_CLIENT_IP, $REQUEST_METHOD, $REMOTE_ADDR, $HTTP_PROXY_USER, $HTTP_X_FORWARDED_FOR; $return = array(); if( is_array($HTTP_GET_VARS) ) { while( list($k, $v) = each($HTTP_GET_VARS) ) { //-- mod_sec_update_131 begin if (strpos($k, "amp;") === 0) $k = substr($k, 4); //-- mod_sec_update_131 end if ( $k == 'INFO' ) { continue; } if( is_array($HTTP_GET_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) { $return[$k][ $this->clean_key($k2) ] = $this->clean_value($v2); } } else { $return[$k] = $this->clean_value($v); } } } // Overwrite GET data with post data if( is_array($HTTP_POST_VARS) ) { while( list($k, $v) = each($HTTP_POST_VARS) ) { if ( is_array($HTTP_POST_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) { $return[$k][ $this->clean_key($k2) ] = $this->clean_value($v2); } } else { $return[$k] = $this->clean_value($v); } } } //---------------------------------------- // Sort out the accessing IP // (Thanks to Cosmos and schickb) //---------------------------------------- $addrs = array(); foreach( array_reverse( explode( ',', $HTTP_X_FORWARDED_FOR ) ) as $x_f ) { $x_f = trim($x_f); if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $x_f ) ) { $addrs[] = $x_f; } } $addrs[] = $_SERVER['REMOTE_ADDR']; $addrs[] = $HTTP_PROXY_USER; $addrs[] = $REMOTE_ADDR; //header("Content-type: text/plain"); print_r($addrs); print $_SERVER['HTTP_X_FORWARDED_FOR']; exit(); $return['IP_ADDRESS'] = $this->select_var( $addrs ); // Make sure we take a valid IP address $return['IP_ADDRESS'] = preg_replace( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", "\\1.\\2.\\3.\\4", $return['IP_ADDRESS'] ); $return['request_method'] = ( $_SERVER['REQUEST_METHOD'] != "" ) ? strtolower($_SERVER['REQUEST_METHOD']) : strtolower($REQUEST_METHOD); return $return; } Now, I use my $ibforums->input throughout my forum system, and I use it in EVERY SINGLE file, I have around 50 Files and I get "unidetified variable" errors. is there a way I can just make sure my global $ibforums->input is ISSET so it it's a GLOBAL ISSET? So I don't have to go through each file that uses $ibforums->input and put a isset( ) around it? It would take over prob 10 days to go through each file and change all 300-500 errors, using the $ibforums->input, there has to be a way I can globally defined my $ibforums->input Variable with a isset.. Thank you
  22. I am going ahead and fixing all my variables that get that error with isset( around the variables this should fix it up right?
  23. Well then it's time to fix them, I guess I thought I was right? But atleast I know now right? I mean we all start somewhere? I am going to have to spend prob days going through each file and fixing each undefined $_GET and just pretty much add a isset to all the undefined's? Check out this article: http://stackoverflow.com/questions/1868874/does-php-run-faster-without-warnings You can save alot of ms's by just fixing your files, lol (found out this article after I posted here cause I was so curious) this sucks tho, i got literlaly hundrends ...... ON each file, i got like 50 files lol this gonna take forever..... Also, one of my errors are this line: $DB->obj['debug'] = ($INFO['sql_debug'] == 1) ? $_GET['debug'] : 0; It's a terny operator? I see nothing wrong with it?
  24. Let's say I have a forum with 300 active people posting 24/7 I have error reporting turned off. But if I turn it on, it shows 100-200 Undefined variable's error's on each forum page, even if it's off does it effect performance or does it matter if the php is writing to a error_log? If so how can I disable php writing to a error_log as I have no sense or no need for it. Thanks, and would the speed be noticable if I went ahead and fixed all the errors, if it would help? or no I code fine, it's just i dont use the isset..
  25. winner.. awesome
×
×
  • 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.