Jump to content

Azaz

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by Azaz

  1. HI everyone, Here is my code: $myFile = "newuser.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 55); fclose($fh); $pices=explode(' ', $theData); And it opens up newuser.txt which is: "I love girls LOL 77" The "I Love GIRLS LOL" is the username of the user and the 77 is the id of the user! But when I echo it out like this: <a href=".?act=Profile&id='.$pices[1].'">'.$pices[0].'</a> It shows only the letter "i"? How do I make it show the full username even if it has spaces?
  2. Yea, I got that, thank you!! I am just curious on why he thinks the other way is faster and it'snot finding like it's finding the exact which i don't need in the first place,lol How old are you? 12yo? SELECT * FROM `table` WHERE `row` LIKE '%Silvin%' OR `row` LIKE '%wts%' and SELECT * FROM `table` WHERE MATCH `row` AGAINST( 'Silvin wts') Will produce the same result....except MATCH doesnt have to scan the database to find a like and it IS faster BOOYA! I wasn't asking for MATCH RESULTS BUDDY, I am asking for LIKE RESULTS. Do you really think people are perfect and say everything EXACTLY The same on forums? Even if i was 12, And learning php i'll be smarter then you when I hit your age so don't come to conclusions just yet .
  3. Thanks!! But my id has more then 1 character it currently only shows 1 digit from my 2digit id any cause why? My id is 73, it only shows 7 hmm?
  4. For example: I am using this code: $myFile = "newuser.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 5); fclose($fh); echo $theData; and it displays: Bob 2 Which I am reading from my newuser.txt file! Which corresponds to the username bob, and he has the ID of 2. Now I want to make that linkable like this: <a href=.?act=Profile&id=$IDFROMTEXTFILE(2)>$NAMEFROMTEXTFILE(BOB)</a> this is possible? If so, Thanks!
  5. Sweet, Solved. Gotta love people like you here, I hope to hear from you in the future,
  6. MYIASM, but i heard you can use COUNT("pid") or just count 1 row instead of using * still possible faster ? thanks[/code]
  7. SELECT count(*) as total FROM forum_replies My forum_replies has over 30,000 rows... how would mysql handle this on a forum on the main index, is there a better/simplified way ? I just need to grab posts not *... ?
  8. Ok thanks, and this query isn't working can u find out why? mysql_query("UPDATE friends SET accepted='1' WHERE friend_id='$id' AND id='{$_SESSION['user_id']}"); Redirect( "You have Successfully accepted this user", './?act=Friends&m=Pending' ); It's for my friend system for my forum I am creating... It doesn't pop any errors but I cannot see it change in my database table hmm... ROFL I FORGOT THE " ' " after } ZZ..my bad delete this post, lol ok thx 4 ur script zzzzzzzz
  9. if ( $r['warn'] >= 100 ) { $warn = '<img src=\'images/10.gif\'>'; $precent = "<font color=red>100</font>"; } else if ( $r['warn'] >= 90 ) { $warn = '<img src=\'images/9.gif\'>'; $precent = "90"; } else if ( $r['warn'] >= 80 ) { $warn = '<img src=\'images/8.gif\'>'; $precent = "80"; } else if ( $r['warn'] >= 70 ) { $warn = '<img src=\'images/7.gif\'>'; $precent = "70"; } else if ( $r['warn'] >= 60 ) { $warn = '<img src=\'images/6.gif\'>'; $precent = "60"; } else if ( $r['warn'] >= 50 ) { $warn = '<img src=\'images/5.gif\'>'; $precent = "50"; } else if ( $r['warn'] >= 40 ) { $warn = '<img src=\'images/4.gif\'>'; $precent = "40"; } else if ( $r['warn'] >= 30 ) { $warn = '<img src=\'images/3.gif\'>'; $precent = "30"; } else if ( $r['warn'] >= 20 ) { $warn = '<img src=\'images/2.gif\'>'; $precent = "20"; } else if ( $r['warn'] >= 10 ) { $warn = '<img src=\'images/1.gif\'>'; $precent = "10";} else if ( $r['warn'] <= 9 ){$warn = '<img src=\'images/0.gif\'>';$precent = "0";} I need to find a program that automatically squishes everything into 1 line of code, because I will not need to edit this code ever again, lol! Thanks! and it's taking to much space in my coding area
  10. Ok sweet Masterprice, I was thinking of that too! but now I have 1 other problem, What if I want to make it so they have to accept them to be a friend? Would I need a table called friend_reqs or is it simplilar? Thanks for your response tho if you could chime in here 1 more time i would love it.
  11. So I make a colum in my table called "friends" Is there a way to update using mysql that colum for each user, so let's say friend 1 adds friends 2 with the id of 25 so the query puts the id "25" into the friends column, then if friend 1 adds friend 5 with the id of 26 it puts "26" into the friends column and so on... So it would have like commas in the colum, 25,26,30,31,31 and all those represent the id's of the person who is wanting to add people to his friends list! If so how do I accomplish that, and then what If I want to use mysql to list all those id's and SELECT name,avatar,etc from userstable WHERE id = "25,26,3,31,31" Is this even possible or am i thinking to harD?
  12. EDIT: This query is run each time a user refreshes mysql_query("DELETE FROM ibf_sessions WHERE running_time < UNIX_TIMESTAMP(now())-{$GLOBALS['offline']}"); This is for the afk 5minutes, your gone! {$GLOBALS['offline']}") = 300.
  13. So like When somones enter my site it shows them as a guest, but then if they havn't clicked anywere for about 5minutes and then refresh or if somone else refresh it will delete from the active users list because it's been over 5 minutes, but then if that same person refreshes again my script wont catch them as a GUEST AGAIN!! It just shows no one online, none of my if's catch him and put him in the ibf_session table! //check for cookies //If no username, Is a Guest, Has COOKIE_ID and cookie USER_NAME and COOKIe PASSWORD if(!isset($_SESSION['user_name']) && !isset($_SESSION['is_guest']) && isset($_COOKIE['user_id']) && isset($_COOKIE['user_name']) && isset($_COOKIE['password'])){ $user_cond = "user_name='{$_COOKIE['user_name']}'"; $sql = "SELECT `id`,`user_name`,`approved` FROM users WHERE $user_cond AND `pwd` = '{$_COOKIE['password']}' AND `banned` = '0' "; $result = mysql_query($sql) or die (mysql_error()); $num = mysql_num_rows($result); // Match row found with more than 1 results - the user is authenticated. if ( $num > 0 ) { list($id,$full_name,$approved) = mysql_fetch_row($result); if(!$approved) { echo "YOU FREAKING HACKER"; exit(); } $_SESSION['user_id']= $id; $_SESSION['user_name'] = $full_name; $lol = session_id(); //$minute5 = 30 ? (time() - 30) : (time() - 3600); // mysql_query("DELETE FROM ibf_sessions WHERE running_time < {$minute5}"); mysql_query("INSERT INTO ibf_sessions (id, member_name, member_id, ip_address, running_time, location, member_group) ". "VALUES ('".$lol."', '{$_SESSION['user_name']}', '{$_SESSION['user_id']}', '{$_SERVER['REMOTE_ADDR']}', '".time()."', ". "'Index', '1')") or die(mysql_error()); unset($_SESSION['is_guest']); } } $lol = session_id(); //Thanks if (!$id) { //Create Guest Session ~ if (!isset($_SESSION['user_id']) && @(!$_SESSION['is_guest']) && !isset($_COOKIE['password'])) { //$minute5 = 39 ? (time() - 30) : (time() - 3600); //echo $minute5; // mysql_query("DELETE FROM ibf_sessions WHERE running_time < {$minute5}"); mysql_query("INSERT INTO ibf_sessions (id, member_name, member_id, ip_address, running_time, location, member_group) ". "VALUES ('".$lol."', 'Guest', '0', '{$_SERVER['REMOTE_ADDR']}', '".time()."', ". "'Index', '0')") or die(mysql_error()); $_SESSION['is_guest'] = 'yes'; } } if (isset($_SESSION['user_id']) && !isset($_SESSION['is_guest'])) { mysql_query("UPDATE ibf_sessions SET member_name='{$_SESSION['user_name']}',member_id='{$_SESSION['user_id']}',member_group='1', running_time='".time()."', in_forum='".$f."', in_topic='".$topicid."', location='".$act."' WHERE id='".$lol."'") or die(mysql_error()); } else { mysql_query("UPDATE ibf_sessions SET member_name='Guest',member_id='0',member_group='0', running_time='".time()."', in_forum='".$f."', in_topic='".$topicid."', location='".$act."' WHERE id='".$lol."'") or die(mysql_error()); } Thanks, it might be confusing but re read
  14. Well yea but what if I have 300,000 posts and selecting all those??? take forever?
  15. Yea but are you sure cause IW ould have to sum 3tables and sum the posts value for each one, are u sure
  16. I was wondering if this is faster or better performance. Each time a user submit's a post on my forum I will make it +1 the .txt file on my main server directory called test.txt, then I can just call that on my main forum index to show the amount of total posts our board has, instead of using mysql queries to sum all of it from the tables... good idea? or am i retarded?
  17. EDIT: Oh jeeze, maybe it's to late but is there anyway I can do the same thing with your script but use it to count fensifni I was thinking like this: preg_match_all('~[youtube](.+?)[/youtube]~', $_POST['Post'], $matches); That is out of the ordinary but I was wondering if it's possible, I have not tested do to the fact that I am very anxious in learning this first, thanks. Sorry for the double post.
  18. Gotta love this site and members like you! Thank you so much AlexWD! Worked perfectly, infact I am going to integrate that code into alot of other security features with my forum, thank you.
  19. I think I am sorry and missed you something but this will not work because it's just the parser, and my submit doesn't go through this when submitting so there will be no way to tell my user that he can't have that many... Can I still use ur first method and just count them? but I have no arrays it's a text field im submitting... this is the full class.... class BBCodeLibrary { var $default_smileys = Array( '' => 'smile.gif', ':-)' => 'smile.gif', '=)' => 'smile.gif', '=-)' => 'smile.gif', '' => 'frown.gif', ':-(' => 'frown.gif', '=(' => 'frown.gif', '=-(' => 'frown.gif', '' => 'bigsmile.gif', ':-D' => 'bigsmile.gif', '=D' => 'bigsmile.gif', '=-D' => 'bigsmile.gif', ''=> 'angry.gif', '>:-('=> 'angry.gif', '>=('=> 'angry.gif', '>=-('=> 'angry.gif', 'D:' => 'angry.gif', 'D-:' => 'angry.gif', 'D=' => 'angry.gif', 'D-=' => 'angry.gif', ''=> 'evil.gif', '>:-)'=> 'evil.gif', '>=)'=> 'evil.gif', '>=-)'=> 'evil.gif', '>'=> 'evil.gif', '>:-D'=> 'evil.gif', '>=D'=> 'evil.gif', '>=-D'=> 'evil.gif', '>'=> 'sneaky.gif', '>;-)'=> 'sneaky.gif', '>'=> 'sneaky.gif', '>;-D'=> 'sneaky.gif', 'O:)' => 'saint.gif', 'O:-)' => 'saint.gif', 'O=)' => 'saint.gif', 'O=-)' => 'saint.gif', '' => 'surprise.gif', ':-O' => 'surprise.gif', '=O' => 'surprise.gif', '=-O' => 'surprise.gif', ':?' => 'confuse.gif', ':-?' => 'confuse.gif', '=?' => 'confuse.gif', '=-?' => 'confuse.gif', ':s' => 'worry.gif', ':-S' => 'worry.gif', '=s' => 'worry.gif', '=-S' => 'worry.gif', ':|' => 'neutral.gif', ':-|' => 'neutral.gif', '=|' => 'neutral.gif', '=-|' => 'neutral.gif', ':I' => 'neutral.gif', ':-I' => 'neutral.gif', '=I' => 'neutral.gif', '=-I' => 'neutral.gif', ':/' => 'irritated.gif', ':-/' => 'irritated.gif', '=/' => 'irritated.gif', '=-/' => 'irritated.gif', ':\\' => 'irritated.gif', ':-\\' => 'irritated.gif', '=\\' => 'irritated.gif', '=-\\' => 'irritated.gif', '' => 'tongue.gif', ':-P' => 'tongue.gif', '=P' => 'tongue.gif', '=-P' => 'tongue.gif', 'X-P' => 'tongue.gif', '' => 'bigeyes.gif', '8-)' => 'bigeyes.gif', 'B)' => 'cool.gif', 'B-)' => 'cool.gif', '' => 'wink.gif', ';-)' => 'wink.gif', '' => 'bigwink.gif', ';-D' => 'bigwink.gif', ''=> 'anime.gif', '^^;' => 'sweatdrop.gif', '>_>'=> 'lookright.gif', '>.>' => 'lookright.gif', ''=> 'lookleft.gif', '<.<' => 'lookleft.gif', 'XD' => 'laugh.gif', 'X-D' => 'laugh.gif', '' => 'bigwink.gif', ';-D' => 'bigwink.gif', ':3' => 'smile3.gif', ':-3' => 'smile3.gif', '=3' => 'smile3.gif', '=-3' => 'smile3.gif', ';3' => 'wink3.gif', ';-3' => 'wink3.gif', '<g>' => 'teeth.gif', '<G>' => 'teeth.gif', 'o.O' => 'boggle.gif', 'O.o' => 'boggle.gif', ':blue:' => 'blue.gif', ':zzz:' => 'sleepy.gif', '<3' => 'heart.gif', ':star:' => 'star.gif', ':locked:' => 'dancinglock.gif', ':baby:' => 'baby.gif', ':hug:' => 'hug.gif', ':rofl:' => 'rofl.gif', ':sniper:' => 'sniper.gif', ':rifle:' => 'rifle.gif', ':banana:' => 'banana.gif', ':zzz:' => 'sleep4.gif', ':santa' => 'santa.gif', '' => 'cry3.gif', ':hello:' => 'hand.gif', ':love:' => 'heart2.gif', ':kiss:' => 'kuss.gif', ':blush:' => 'blush.gif', ':wallbash:' => 'wallbash.gif', ':thumbsup:' => 'thumbsup.gif', ':uglyhammer:' => 'uglyhammer.gif', ':fume:' => 'ranting.gif', ':argue:' => 'icon_argue.gif', ':uglystupid' => 'uglystupid1.gif', ':drool:' => 'drool.gif', ':angel:' => 'angel.gif', ':flamethrower:' => 'flamethrower.gif', ':hail:' => 'hail.gif', ':headscratch:' => 'headscratch.gif', ':run:'=> 'Bolt.gif', ':RUN:' => 'Bolt.gif', ':evil:' => 'devil.gif', ':cuss:' => 'cuss.gif', ':modwork:' => 'modwork.gif', ':help:' => 'help.gif', '' => 'ph34r.gif', ':mad:' => 'mad.gif', //@@ '' => 'mellow.gif', '' => 'wub.gif', '' => 'unsure.gif', '::' => '.gif', ':help:' => 'help.gif', '-->' => 'icon_pointr.gif', '<--' => 'icon_pointl.gif' ); $count = 0; $text = str_replace(array_keys($default_smileys), array_values($default_smileys), $text, $count); if($count > 10) { echo "to many smilies"; exit; // too many smilies } else { // less than 10 smilies } var $default_tag_rules = Array( 'b' => Array( 'simple_start' => "<b>", 'simple_end' => "</b>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), 'plain_start' => "<b>", 'plain_end' => "</b>", ), 'i' => Array( 'simple_start' => "<i>", 'simple_end' => "</i>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), 'plain_start' => "<i>", 'plain_end' => "</i>", ), 'u' => Array( 'simple_start' => "<u>", 'simple_end' => "</u>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), 'plain_start' => "<u>", 'plain_end' => "</u>", ), 'mp3' => Array( 'mode' => BBCODE_MODE_ENHANCED, 'template' => '<embed type="application/x-shockwave-flash" src="mp3.swf" flashvars="m={$_content/v}" width="200" height="12">', 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'youtube' => Array( 'mode' => BBCODE_MODE_ENHANCED, 'template' => '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/{param}"></param><embed src="http://www.youtube.com/v/{$_content/v}" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 's' => Array( 'simple_start' => "<strike>", 'simple_end' => "</strike>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), 'plain_start' => "<i>", 'plain_end' => "</i>", ), 'font' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'allow' => Array('_default' => '/^[a-zA-Z0-9._ -]+$/'), 'method' => 'DoFont', 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'color' => Array( 'mode' => BBCODE_MODE_ENHANCED, 'allow' => Array('_default' => '/^#?[a-zA-Z0-9._ -]+$/'), 'template' => '<span style="color:{$_default/tw}">{$_content/v}</span>', 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'size' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'allow' => Array('_default' => '/^[0-9.]+$/D'), 'method' => 'DoSize', 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'sup' => Array( 'simple_start' => "<sup>", 'simple_end' => "</sup>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'sub' => Array( 'simple_start' => "<sub>", 'simple_end' => "</sub>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'spoiler' => Array( 'simple_start' => "<span class=\"bbcode_spoiler\">", 'simple_end' => "</span>", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'acronym' => Array( 'mode' => BBCODE_MODE_ENHANCED, 'template' => '<span class="bbcode_acronym" title="{$_default}">{$_content/v}</span>', 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), ), 'url' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => 'DoURL', 'class' => 'link', 'allow_in' => Array('listitem', 'block', 'columns', 'inline'), 'content' => BBCODE_REQUIRED, 'plain_start' => "<a href=\"{\$link}\">", 'plain_end' => "</a>", 'plain_content' => Array('_content', '_default'), 'plain_link' => Array('_default', '_content'), ), 'email' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => 'DoEmail', 'class' => 'link', 'allow_in' => Array('listitem', 'block', 'columns', 'inline'), 'content' => BBCODE_REQUIRED, 'plain_start' => "<a href=\"mailto:{\$link}\">", 'plain_end' => "</a>", 'plain_content' => Array('_content', '_default'), 'plain_link' => Array('_default', '_content'), ), 'wiki' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => "DoWiki", 'class' => 'link', 'allow_in' => Array('listitem', 'block', 'columns', 'inline'), 'end_tag' => BBCODE_PROHIBIT, 'content' => BBCODE_PROHIBIT, 'plain_start' => "<b>[", 'plain_end' => "]</b>", 'plain_content' => Array('title', '_default'), 'plain_link' => Array('_default', '_content'), ), 'img' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => "DoImage", 'class' => 'image', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), 'end_tag' => BBCODE_REQUIRED, 'content' => BBCODE_REQUIRED, 'plain_start' => "[image]", 'plain_content' => Array(), ), 'rule' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => "DoRule", 'class' => 'block', 'allow_in' => Array('listitem', 'block', 'columns'), 'end_tag' => BBCODE_PROHIBIT, 'content' => BBCODE_PROHIBIT, 'before_tag' => "sns", 'after_tag' => "sns", 'plain_start' => "\n-----\n", 'plain_end' => "", 'plain_content' => Array(), ), 'br' => Array( 'mode' => BBCODE_MODE_SIMPLE, 'simple_start' => "<br />\n", 'simple_end' => "", 'class' => 'inline', 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'), 'end_tag' => BBCODE_PROHIBIT, 'content' => BBCODE_PROHIBIT, 'before_tag' => "s", 'after_tag' => "s", 'plain_start' => "\n", 'plain_end' => "", 'plain_content' => Array(), ), 'left' => Array( 'simple_start' => "\n<div class=\"bbcode_left\" style=\"text-align:left\">\n", 'simple_end' => "\n</div>\n", 'allow_in' => Array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ), 'right' => Array( 'simple_start' => "\n<div class=\"bbcode_right\" style=\"text-align:right\">\n", 'simple_end' => "\n</div>\n", 'allow_in' => Array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ), 'center' => Array( 'simple_start' => "\n<center>\n", 'simple_end' => "\n</center>\n", 'allow_in' => Array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ), 'indent' => Array( 'simple_start' => "\n<div class=\"bbcode_indent\" style=\"margin-left:4em\">\n", 'simple_end' => "\n</div>\n", 'allow_in' => Array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ), 'columns' => Array( 'simple_start' => "\n<table class=\"bbcode_columns\"><tbody><tr><td class=\"bbcode_column bbcode_firstcolumn\">\n", 'simple_end' => "\n</td></tr></tbody></table>\n", 'class' => 'columns', 'allow_in' => Array('listitem', 'block', 'columns'), 'end_tag' => BBCODE_REQUIRED, 'content' => BBCODE_REQUIRED, 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ), 'nextcol' => Array( 'simple_start' => "\n</td><td class=\"bbcode_column\">\n", 'class' => 'nextcol', 'allow_in' => Array('columns'), 'end_tag' => BBCODE_PROHIBIT, 'content' => BBCODE_PROHIBIT, 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "", ), 'code' => Array( 'mode' => BBCODE_MODE_ENHANCED, 'template' => "\n<div class=\"bbcode_code\">\n<div class=\"code2\">Code:</div>\n<div class=\"bbcode_code_body\" style=\"white-space:pre\">{\$_content/v}</div>\n</div>\n", 'class' => 'code2', 'allow_in' => Array('listitem', 'block', 'columns'), 'content' => BBCODE_VERBATIM, 'before_tag' => "sns", 'after_tag' => "sn", 'before_endtag' => "sn", 'after_endtag' => "sns", 'plain_start' => "\n<b>Code:</b>\n", 'plain_end' => "\n", ), 'quote' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => "DoQuote", 'allow_in' => Array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n<b>Quote:</b>\n", 'plain_end' => "\n", ), 'list' => Array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => 'DoList', 'class' => 'list', 'allow_in' => Array('listitem', 'block', 'columns'), 'before_tag' => "sns", 'after_tag' => "sns", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n", 'plain_end' => "\n", ), '*' => Array( 'simple_start' => "<li>", 'simple_end' => "</li>\n", 'class' => 'listitem', 'allow_in' => Array('list'), 'end_tag' => BBCODE_OPTIONAL, 'before_tag' => "s", 'after_tag' => "s", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n * ", 'plain_end' => "\n", ), ); function DoURL($bbcode, $action, $name, $default, $params, $content) { if ($action == BBCODE_CHECK) return true; $url = is_string($default) ? $default : $bbcode->UnHTMLEncode(strip_tags($content)); if ($bbcode->IsValidURL($url)) { if ($bbcode->url_targetable !== false && isset($params['target'])) $target = " target=\"" . htmlspecialchars($params['target']) . "\""; else $target = ""; if ($bbcode->url_target !== false) if (!($bbcode->url_targetable == 'override' && isset($params['target']))) $target = " target=\"" . htmlspecialchars($bbcode->url_target) . "\""; return '<a href="' . htmlspecialchars($url) . '" class="bbcode_url"\'target="blank"\'>' . $content . '</a>'; } else return htmlspecialchars($params['_tag']) . $content . htmlspecialchars($params['_endtag']); } function DoEmail($bbcode, $action, $name, $default, $params, $content) { if ($action == BBCODE_CHECK) return true; $email = is_string($default) ? $default : $bbcode->UnHTMLEncode(strip_tags($content)); if ($bbcode->IsValidEmail($email)) return '<a href="mailto:' . htmlspecialchars($email) . '" class="bbcode_email">' . $content . '</a>'; else return htmlspecialchars($params['_tag']) . $content . htmlspecialchars($params['_endtag']); } function DoSize($bbcode, $action, $name, $default, $params, $content) { switch ($default) { case '0': $size = '.5em'; break; case '1': $size = '.67em'; break; case '2': $size = '.83em'; break; default: case '3': $size = '1.0em'; break; case '4': $size = '1.17em'; break; case '5': $size = '1.5em'; break; case '6': $size = '2.0em'; break; case '7': $size = '2.5em'; break; } return "<span style=\"font-size:$size\">$content</span>"; } function DoFont($bbcode, $action, $name, $default, $params, $content) { $fonts = explode(",", $default); $result = ""; $special_fonts = Array( 'serif' => 'serif', 'sans-serif' => 'sans-serif', 'sans serif' => 'sans-serif', 'sansserif' => 'sans-serif', 'sans' => 'sans-serif', 'cursive' => 'cursive', 'fantasy' => 'fantasy', 'monospace' => 'monospace', 'mono' => 'monospace', ); foreach ($fonts as $font) { $font = trim($font); if (isset($special_fonts[$font])) { if (strlen($result) > 0) $result .= ","; $result .= $special_fonts[$font]; } else if (strlen($font) > 0) { if (strlen($result) > 0) $result .= ","; $result .= "'$font'"; } } return "<span style=\"font-family:$result\">$content</span>"; } function DoWiki($bbcode, $action, $name, $default, $params, $content) { $name = $bbcode->Wikify($default); if ($action == BBCODE_CHECK) return strlen($name) > 0; $title = trim(@$params['title']); if (strlen($title) <= 0) $title = trim($default); return "<a href=\"{$bbcode->wiki_url}$name\" class=\"bbcode_wiki\">" . htmlspecialchars($title) . "</a>"; } function DoImage($bbcode, $action, $name, $default, $params, $content) { if ($action == BBCODE_CHECK) return true; $content = trim($bbcode->UnHTMLEncode(strip_tags($content))); if (preg_match("/\\.(?:gif|jpeg|jpg|jpe|png)$/", $content)) { if (preg_match("/^[a-zA-Z0-9_][^:]+$/", $content)) { if (!preg_match("/(?:\\/\\.\\.\\/)|(?:^\\.\\.\\/)|(?:^\\/)/", $content)) { $info = @getimagesize("{$bbcode->local_img_dir}/{$content}"); if ($info[2] == IMAGETYPE_GIF || $info[2] == IMAGETYPE_JPEG || $info[2] == IMAGETYPE_PNG) { return "<img src=\"" . htmlspecialchars("{$bbcode->local_img_url}/{$content}") . "\" alt=\"" . htmlspecialchars(basename($content)) . "\" width=\"" . htmlspecialchars($info[0]) . "\" height=\"" . htmlspecialchars($info[1]) . "\" class=\"bbcode_img\" />"; } } } else if ($bbcode->IsValidURL($content, false)) { return "<img src=\"" . htmlspecialchars($content) . "\"/>"; } } return htmlspecialchars($params['_tag']) . htmlspecialchars($content) . htmlspecialchars($params['_endtag']); } function DoRule($bbcode, $action, $name, $default, $params, $content) { if ($action == BBCODE_CHECK) return true; else return $bbcode->rule_html; } function DoQuote($bbcode, $action, $name, $default, $params, $content) { if ($action == BBCODE_CHECK) return true; if (isset($params['name'])) { $title = htmlspecialchars(trim($params['name'])) . " wrote"; if (isset($params['date'])) $title .= " on " . htmlspecialchars(trim($params['date'])); $title .= ":"; if (isset($params['url'])) { $url = trim($params['url']); if ($bbcode->IsValidURL($url)) $title = "<a href=\"" . htmlspecialchars($params['url']) . "\">" . $title . "</a>"; } } else if (!is_string($default)) $title = "Quote:"; else $title = htmlspecialchars(trim($default)) . " wrote:"; return "<div class=\"quote1\">" . $title . "<bR>" . $content . "</div>"; } function DoList($bbcode, $action, $name, $default, $params, $content) { $list_styles = Array( '1' => 'decimal', '01' => 'decimal-leading-zero', 'i' => 'lower-roman', 'I' => 'upper-roman', 'a' => 'lower-alpha', 'A' => 'upper-alpha', ); $ci_list_styles = Array( 'circle' => 'circle', 'disc' => 'disc', 'square' => 'square', 'greek' => 'lower-greek', 'armenian' => 'armenian', 'georgian' => 'georgian', ); $ul_types = Array( 'circle' => 'circle', 'disc' => 'disc', 'square' => 'square', ); $default = trim($default); if ($action == BBCODE_CHECK) { if (!is_string($default) || strlen($default) == "") return true; else if (isset($list_styles[$default])) return true; else if (isset($ci_list_styles[strtolower($default)])) return true; else return false; } if (!is_string($default) || strlen($default) == "") { $elem = 'ul'; $type = ''; } else if ($default == '1') { $elem = 'ol'; $type = ''; } else if (isset($list_styles[$default])) { $elem = 'ol'; $type = $list_styles[$default]; } else { $default = strtolower($default); if (isset($ul_types[$default])) { $elem = 'ul'; $type = $ul_types[$default]; } else if (isset($ci_list_styles[$default])) { $elem = 'ol'; $type = $ci_list_styles[$default]; } } if (strlen($type)) return "\n<$elem class=\"bbcode_list\" style=\"list-style-type:$type\">\n$content</$elem>\n"; else return "\n<$elem class=\"bbcode_list\">\n$content</$elem>\n"; } } I still get Parse error: parse error, expecting `T_FUNCTION' in C:\wamp\www\nbbc.php on line 464 and That line is: $count = 0; Sorry for the trouble, but if you could find a way, it would be wonderful, thanks.
  20. Okay thanks, but my parser is in a seperate file and only parsers it, so i cannot error out anything in the parser file because it wont effect what is submitting, thank u 4 ur code. Damit, im getting a parse error, expecting `T_FUNCTION... this is line: $text = str_replace(array_keys($default_smileys), array_values($default_smileys), $text, $count); cant find the culprit hmmmmmmmmmmmmm This is whole parser: var $default_smileys = Array( '' => 'smile.gif', ':-)' => 'smile.gif', '=)' => 'smile.gif', '=-)' => 'smile.gif', '' => 'frown.gif', ':-(' => 'frown.gif', '=(' => 'frown.gif', '=-(' => 'frown.gif', '' => 'bigsmile.gif', ':-D' => 'bigsmile.gif', '=D' => 'bigsmile.gif', '=-D' => 'bigsmile.gif', ''=> 'angry.gif', '>:-('=> 'angry.gif', '>=('=> 'angry.gif', '>=-('=> 'angry.gif', 'D:' => 'angry.gif', 'D-:' => 'angry.gif', 'D=' => 'angry.gif', 'D-=' => 'angry.gif', ''=> 'evil.gif', '>:-)'=> 'evil.gif', '>=)'=> 'evil.gif', '>=-)'=> 'evil.gif', '>'=> 'evil.gif', '>:-D'=> 'evil.gif', '>=D'=> 'evil.gif', '>=-D'=> 'evil.gif', '>'=> 'sneaky.gif', '>;-)'=> 'sneaky.gif', '>'=> 'sneaky.gif', '>;-D'=> 'sneaky.gif', 'O:)' => 'saint.gif', 'O:-)' => 'saint.gif', 'O=)' => 'saint.gif', 'O=-)' => 'saint.gif', '' => 'surprise.gif', ':-O' => 'surprise.gif', '=O' => 'surprise.gif', '=-O' => 'surprise.gif', ':?' => 'confuse.gif', ':-?' => 'confuse.gif', '=?' => 'confuse.gif', '=-?' => 'confuse.gif', ':s' => 'worry.gif', ':-S' => 'worry.gif', '=s' => 'worry.gif', '=-S' => 'worry.gif', ':|' => 'neutral.gif', ':-|' => 'neutral.gif', '=|' => 'neutral.gif', '=-|' => 'neutral.gif', ':I' => 'neutral.gif', ':-I' => 'neutral.gif', '=I' => 'neutral.gif', '=-I' => 'neutral.gif', ':/' => 'irritated.gif', ':-/' => 'irritated.gif', '=/' => 'irritated.gif', '=-/' => 'irritated.gif', ':\\' => 'irritated.gif', ':-\\' => 'irritated.gif', '=\\' => 'irritated.gif', '=-\\' => 'irritated.gif', '' => 'tongue.gif', ':-P' => 'tongue.gif', '=P' => 'tongue.gif', '=-P' => 'tongue.gif', 'X-P' => 'tongue.gif', '' => 'bigeyes.gif', '8-)' => 'bigeyes.gif', 'B)' => 'cool.gif', 'B-)' => 'cool.gif', '' => 'wink.gif', ';-)' => 'wink.gif', '' => 'bigwink.gif', ';-D' => 'bigwink.gif', ''=> 'anime.gif', '^^;' => 'sweatdrop.gif', '>_>'=> 'lookright.gif', '>.>' => 'lookright.gif', ''=> 'lookleft.gif', '<.<' => 'lookleft.gif', 'XD' => 'laugh.gif', 'X-D' => 'laugh.gif', '' => 'bigwink.gif', ';-D' => 'bigwink.gif', ':3' => 'smile3.gif', ':-3' => 'smile3.gif', '=3' => 'smile3.gif', '=-3' => 'smile3.gif', ';3' => 'wink3.gif', ';-3' => 'wink3.gif', '<g>' => 'teeth.gif', '<G>' => 'teeth.gif', 'o.O' => 'boggle.gif', 'O.o' => 'boggle.gif', ':blue:' => 'blue.gif', ':zzz:' => 'sleepy.gif', '<3' => 'heart.gif', ':star:' => 'star.gif', ':locked:' => 'dancinglock.gif', ':baby:' => 'baby.gif', ':hug:' => 'hug.gif', ':rofl:' => 'rofl.gif', ':sniper:' => 'sniper.gif', ':rifle:' => 'rifle.gif', ':banana:' => 'banana.gif', ':zzz:' => 'sleep4.gif', ':santa' => 'santa.gif', '' => 'cry3.gif', ':hello:' => 'hand.gif', ':love:' => 'heart2.gif', ':kiss:' => 'kuss.gif', ':blush:' => 'blush.gif', ':wallbash:' => 'wallbash.gif', ':thumbsup:' => 'thumbsup.gif', ':uglyhammer:' => 'uglyhammer.gif', ':fume:' => 'ranting.gif', ':argue:' => 'icon_argue.gif', ':uglystupid' => 'uglystupid1.gif', ':drool:' => 'drool.gif', ':angel:' => 'angel.gif', ':flamethrower:' => 'flamethrower.gif', ':hail:' => 'hail.gif', ':headscratch:' => 'headscratch.gif', ':run:'=> 'Bolt.gif', ':RUN:' => 'Bolt.gif', ':evil:' => 'devil.gif', ':cuss:' => 'cuss.gif', ':modwork:' => 'modwork.gif', ':help:' => 'help.gif', '' => 'ph34r.gif', ':mad:' => 'mad.gif', //@@ '' => 'mellow.gif', '' => 'wub.gif', '' => 'unsure.gif', '::' => '.gif', ':help:' => 'help.gif', '-->' => 'icon_pointr.gif', '<--' => 'icon_pointl.gif', ); $text = str_replace(array_keys($default_smileys), array_values($default_smileys), $text, $count); if($count > 10) { echo "to many smilies"; exit; // too many smilies } else { // less than 10 smilies }
  21. Hi everyone. I have a submit form which will go through this: :uglyhammer: :uglyhammer: :uglyhammer: and if you know, when i submit that to my form, and then i use bbcode parser it will show the smiley that is related to it.. but i want to minimize my users to only allow up to 10 smileys for there signature. so I need a php code to check each :nudifsduif: text and count them and if it's over 10, i can echo out a error and exit;. Thanks...
  22. Ok well I submit my form and go back and all the fields are completely empty.... Like if I make this post then click back I can see everything I wrote, am I missing something? Is it even related to php or a html missing structure?
  23. Yea, I got that, thank you!! I am just curious on why he thinks the other way is faster and it'snot finding like it's finding the exact which i don't need in the first place,lol
  24. Your funny! But enough with the comedy man.......Your kidding about which is faster right? I dont need to match the right kind. I need to Like. clause.
×
×
  • 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.