Jump to content

Tenaciousmug

Members
  • Posts

    159
  • Joined

  • Last visited

About Tenaciousmug

  • Birthday April 26

Contact Methods

  • AIM
    Dyloki
  • MSN
    tenaciousmug@live.com
  • Skype
    h_schillig

Profile Information

  • Gender
    Female

Tenaciousmug's Achievements

Regular Member

Regular Member (3/5)

1

Reputation

  1. Thank you for the response. (: I did this query in CodeIgniter and got everything working along with post count and such too
  2. Uhm thanks for the suggestion on switching my left joins. I have done that, but that didn't help me at all with my last question... Wasn't very helpful towards my goal, but thanks anyway.
  3. Thank you! I wasn't aware that you could do that. That works like a charm, but now my DISTINCT isn't exactly working the way I want it to. If the board has two posts in it, it pulls that thread twice even with the DISTINCT on the id... So I'm confused. This is my SQL statement now: SELECT DISTINCT t.id, t.title, t.sticky, t.locked, u.username AS author, pu.username AS lposter FROM forum_topic t JOIN user u ON u.user_id = t.author_id LEFT JOIN forum_post p ON p.topic_id = t.id LEFT JOIN user pu ON pu.user_id = p.author_id WHERE t.cat_id =2 ORDER BY p.date DESC Now this is what is returning: id title sticky locked author lposter 5 Another Topic 0 0 peanut peanut 3 Another Topic 0 0 peanut draco 3 Another Topic 0 0 peanut peanut 2 Testing123 0 0 peanut peanut However, topic 3 is only suppose to be pulling once as Draco is the last poster... But it's pulling all the posts from it. So I basically need to LIMIT 1 on the pu.username.. Is there a way of doing that??
  4. Ok I'm trying to create a stored function to grab a username based on the user id that is given. My syntax is as follows: CREATE FUNCTION get_username(user_id BIGINT(20)) RETURNS VARCHAR(35) BEGIN DECLARE user_name VARCHAR(35); SELECT username INTO user_name FROM user WHERE user_id = user_id; RETURN(user_name); END; However, it is saying this error: I'm not sure what's wrong with the word DECLARE since it's nesting inside a BEGIN and END statement.. Also, I don't know if anyone knows any other efficient way of doing this so I don't have to create a stored function. I know you can join a user table from a forum post table to grab the username instead, but the thing is I need to grab both the topic username and last post username... but you can only join the user table using either the topic author or the post author... but I need BOTH usernames so I don't have to run two SQL statements. Here is my SQL statement for that thus far: SELECT DISTINCT t.id, t.title, t.sticky, t.locked, u.username FROM forum_topic t JOIN user u ON u.user_id = t.author_id LEFT JOIN forum_post p ON p.topic_id = t.id WHERE t.cat_id = 2 ORDER BY p.date DESC But I also want to grab another username that p.author_id is in AND t.author_id.. I just don't know how to?? Any help on this would be much appreciate. Thank you!
  5. Okay, when this shoutbox runs on my page and I'm going into my inventory and use an item or something and put it in my virtual shop, it puts TWO in or if I stay there for 5 minutes, LOADS of the same item in the shop... It just keeps redoing my action everytime it reloads the shoutbox.. Here is my code for the shoutbox ON my layout: <div id="chat"> <? $checkonline = time() - 1800; $online1 = mysql_query("SELECT * FROM login WHERE lastactive >= $checkonline"); $online2 = mysql_num_rows($online1); ?> <p style="text-align:center;"><b><? echo $online2; ?></b> Users Online</p> <? if($clearance >= 4) { echo '<br /><p style="text-align:center;"><a href="adminsb.php">SB Admin</a></p>'; } if($sbdisablebattle == 'yes' || $sbdisablebreed == 'yes') { echo '<br /><p style="text-align:center;">Shoutbox disabled whilst breeding or battling.</p>'; } else { echo '<form name="myForm" action="postbox.php" method="post"> <textarea id="message" name="message" wrap="physical" rows="5" onkeydown="textCounter(document.myForm.message,document.myForm.remLen1,79)" onkeyup="textCounter(document.myForm.message,document.myForm.remLen1,79)"></textarea> <br /> <div class="clearfix" style="width:100%;"> <input readonly type="text" name="remLen1" maxlength="3" value="79" style="color:#474747;width:15px;background:none;border:none;float:left;font-size:9px;margin-right:2px;"> <span style="font-size:9px;margin-right:6px;float:left;">Characters Left</span> </div> <div class="clearfix" style="width:100%;margin-top:-15px;"> <input name="location" id="location" type="hidden" value="'.$url.'" /> <input type="Submit" name="Submit" value="POST" class="button" style="float:right;" /> </div> </form>'; } if($usrdet[sbauto] == 'no') { echo '<br /><p style="text-align:center;"><a href="settings.php?auto=yes">Turn ON Auto SB</a></p>'; } else { echo '<br /><p style="text-align:center;"><a href="settings.php?auto=no">Turn OFF Auto SB</a></p>'; } if($usrdet[sbauto] == 'no') { $sb = mysql_query("SELECT * FROM sb WHERE blocked = 'no' ORDER BY id DESC LIMIT 15"); while ($sbresults = mysql_fetch_array( $sb )) { echo '<div class="shoutbox_post fixed_width" style="background-color: '.$sbresults[colour].';">'; echo '<div class="shout_header"><p><img src="#" /><b><a href="http://www.dstable.com/profile.php?name='.$sbresults[user].'">'.$sbresults[user].'</b></a></p></div>'; if($clearance >= 7) { echo '<sub><a href="admindelsb.php?id='.$sbresults[id].'&act=block&user='.$sbresults[user].'">Block</a> - <a href="admindelsb.php?id='.$sbresults[id].'&act=del&user='.$sbresults[user].'">Delete</a></sub>'; } echo '<div class="shout_body">'.$sbresults[message].'</div>'; echo '</div>'; } } else { echo ' <script> $(document).ready(function() { $("#responsecontainer").load("shout6.php"); var refreshId = setInterval(function() { $("#responsecontainer").load(\'shout6.php?randval=\'+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> <div id="responsecontainer"> </div> '; } ?> </div> Then here is the shout6.php page it loads: <? $conn = mysql_pconnect('localhost', 'username', 'password') or die ( header ( 'Location: noconnect.php' ) ); mysql_select_db('jdstable_dstable', $conn); $sb = mysql_query("SELECT * FROM sb WHERE blocked = 'no' ORDER BY id DESC LIMIT 15"); while ($sbresults = mysql_fetch_array( $sb )) { echo '<div class="shoutbox_post fixed_width" style="background-color: '.$sbresults[colour].';">'; echo '<div class="shout_header clearfix"><p><img src="#" /><b><a href="http://www.dstable.com/profile.php?name='.$sbresults[user].'" style="float:left;">'.$sbresults[user].'</a></b>'; echo '<span style="float:left;margin-left:5px;">'; if($sbresults[user] == 'Jooshy') {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_program.gif">';} if($sbresults[user] == 'Tim') {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_program.gif">';} if($sbresults[user] == 'DracoTarcheInazuma') {echo '<img src="http://www.dstable.com/images/icon_staff.gif" width="14" height="14">';} if($sbresults[user] == 'Nortiker') {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_art.gif">';} if($sbresults[user] == 'Annasaur' || $sbresults[user] == 'Knight') {echo '<img src="http://www.dstable.com/images/icon_art.gif">';} if($sbresults[user] == 'Fenikkusu') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';} if($sbresults[user] == 'Mage') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';} if($sbresults[user] == 'Prinx') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';} if($sbresults[user] == 'Yakumo') {echo '<img src="http://www.dstable.com/images/icon_mod2.gif">';} if($sbresults[user] == 'Thaddeusgrey') {echo '<img src="http://www.dstable.com/images/icon_art.gif">';} if($sbresults[user] == 'lilpeanut') {echo '<img src="http://www.dstable.com/images/icon_program.gif">';} echo '</span></p></div>'; if($clearance >= 7) { echo '<sub><a href="admindelsb.php?id='.$sbresults[id].'&act=block&user='.$sbresults[user].'">Block</a> - <a href="admindelsb.php?id='.$sbresults[id].'&act=del&user='.$sbresults[user].'">Delete</a></sub>'; } echo '<div class="shout_body">'.$sbresults[message].'</div>'; echo '</div>'; } ?> Does anyone have any idea why it would be resubmitting the actions over and over again that I'm doing as long as I stay on that page? It just keeps refreshing the page every 3-5 seconds since that is when the shoutbox refreshes?
  6. I did. I tried putting the [fontc=blah] first, but then it replaces the one that has [fontc=#000000s=1] to <font color="#000000s=1"> ... :/
  7. What do you mean?? Turning what off and on again?
  8. Okay I'm doing a typical BBCode to HTML converter except that it is converting BBCode from Neopets.. which is different from original BBCode. ANYWAY, I have a problem. I'll just post the parts that are messing up. function bb2html($string) { $match = array ( '#\[\/font\]#se', '#\[fontc\=(.*?)s\=(.*?)f\=(.*?)\]#se', '#\[fontc\=(.*?)f\=(.*?)s\=(.*?)\]#se', '#\[fonts\=(.*?)c\=(.*?)f\=(.*?)\]#se', '#\[fonts\=(.*?)f\=(.*?)c\=(.*?)\]#se', '#\[fontf\=(.*?)c\=(.*?)s\=(.*?)\]#se', '#\[fontf\=(.*?)s\=(.*?)c\=(.*?)\]#se', '#\[fontc\=(.*?)f\=(.*?)\]#se', '#\[fontc\=(.*?)s\=(.*?)\]#se', '#\[fonts\=(.*?)f\=(.*?)\]#se', '#\[fonts\=(.*?)c\=(.*?)\]#se', '#\[fonts\=(.*?)\]#se', '#\[fontf\=(.*?)\]#se', '#\[fontc\=(.*?)\]#se', ); $replace = array ( "'</font>'", "'<font color=\'\\1\' size=\'\\2\' face=\'\\3\'>'", "'<font color=\'\\1\' face=\'\\2\' size=\'\\3\'>'", "'<font size=\'\\1\' color=\'\\2\' face=\'\\3\'>'", "'<font size=\'\\1\' face=\'\\2\' color=\'\\3\'>'", "'<font face=\'\\1\' color=\'\\2\' size=\'\\3\'>'", "'<font face=\'\\1\' size=\'\\2\' color=\'\\3\'>'", "'<font color=\'\\1\' face=\'\\2\'>'", '<font color=\"\\1\" size=\"\\2\'>"', "'<font size=\'\\1\' face=\'\\2\'>'", "'<font size=\'\\1\' color=\'\\2\'>'", "'<font size=\'\\1\'>'", "'<font face=\'\\1\'>'", "'<font color=\'\\1\'>'", ); return preg_replace($match, $replace, $content); } $top_line = ' [center][fontc=#f1c232][sup]?[/sup]???[br]?[/font][fontc=#000000s=1]neoHTML[/font][fontc=#f1c232f=courier]?[br]['; $bottom_line = ']?I used to be Rich[sub]?[/sub]?[br]?[br]?[/font]Orange Draik-_-[fontc=#f1c232]??[/font][br][/center] '; $new_top_line = substr($top_line, 0, -1); $new_bottom_line = substr($bottom_line, 1); echo bb2html($new_top_line.$new_bottom_line); Okay, it's converting everything fine besides when it starts to get to the [fontc=#f1c232] in the very beginning. Since the [fontc=#000000s=1] would be listed first.. in the array.. it replaces those first. SO when it sees the [fontc=#f1c232], it replaces it with the first one that lists [fontc='something'... and doesn't put the ending > bracket on it... because it's expecting the s=1 and f=courier or something... How do I make it so that if it's ONLY [fontc=#198202], it uses the one that is meant for that and not the very first one? Because it's not putting the ending bracket on it..
  9. Hmm okay, thanks everyone. Let me ask my client that I'm doing this project for. All of the coordinates are out of range then.. Hopefully I just have to convert them to something use a mathematical equation or something!
  10. $(document).ready(function() { var lng = get_url_parameter('long'); var lat = get_url_parameter('lat'); if(lng==null && lat==null) { var mapOptions = { zoom: 8, center: new google.maps.LatLng(-34.397, 150.644), mapTypeId: google.maps.MapTypeId.ROADMAP }; } else { var mapOptions = { zoom: 8, center: new google.maps.LatLng(lat, lng), mapTypeId: google.maps.MapTypeId.ROADMAP }; } var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); }); Now when the long and lat parameters in the URL are null, the map loads fine with the preset coordinates. But when the long and lat parameters are passed. For example, this is what I'm passing to the URL right now : long=2277103.99355757&lat=421953.402769517 It's grabbing the parameters as I did the whole alert(lat); and it alerts the appropriate value. However, it won't load the map. It's just a grey block. Anyone know the issue here??
  11. Wow you're a genius PFMaBiSmAd!!! I never knew that was an issue in Javascript. Now I know all lowercase with underscores for function names. Thank you so much!!!!
  12. Okay I know this error is common. And it's mainly always a syntax problem, but I can not for the life of me figure out what is wrong with my code. I tried putting the getUrlParameter function inside the document.ready() function.. I also tried both of them outside of it.. every possibility you can imagine, I tried. So it has to be something else. I've been staring at it for the past hour or so... Maybe a second pair of eyes can help me out here. <script type="text/javascript"> function getURLParameter(name) { /*var parameter = decodeURI( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] ); if (parameter == null) { return null; } else { return parameter; }*/ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) { return null; } else { return results[1]; } } $(document).ready(function() { var lng = getUrlParameter('long'); var lat = getUrlParameter('lat'); if(lng==null && lat==null) { var mapOptions = { zoom: 8, center: new google.maps.LatLng(-34.397, 150.644), mapTypeId: google.maps.MapTypeId.ROADMAP }; } else { var mapOptions = { zoom: 8, center: new google.maps.LatLng(lat, lng), mapTypeId: google.maps.MapTypeId.ROADMAP }; } var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); }); </script> Thank you!
  13. Figured it out. If anyone is curious, here is the solution: //removes bbcode public function strip_bbcode($string) { // All the default bbcode arrays. $bbcode = array( //Text Apperence '#\[b\](.*?)\[/b\]#si' => '\\1', '#\[i\](.*?)\[/i\]#si' => '\\1', '#\[u\](.*?)\[/u\]#si' => '\\1', '#\[s\](.*?)\[/s\]#si' => '\\1', '#\[center\](.*?)\[/center\]#si' => '\\1', '#\[right\](.*?)\[/right\]#si' => '\\1', '#\[left\](.*?)\[/left\]#si' => '\\1', //Font Color & Size '#\[color=(.*?)\](.*?)\[/color\]#si' => '\\2', '#\[small\](.*?)\[/small\]#si' => '\\1', '#\[normal\](.*?)\[/normal\]#si' => '\\1', '#\[big\](.*?)\[/big\]#si' => '\\1', '#\[large\](.*?)\[/large\]#si' => '\\1', //Text Effects '#\[bl\](.*?)\[/bl\]#si' => '\\1', '#\[marquee\](.*?)\[/marquee\]#si' => '\\1', //Other '#\[url=(.*?)\](.*?)\[/url]#si' => '\\2', '#\[quote\](.*?)\[/quote\]#si' => '\\1', '#\[img\](.*?)\[/img\]#si' => '\\1' ); $output = preg_replace(array_keys($bbcode), array_values($bbcode), $string); return $output; }
  14. I'm trying to code a function that strips all BBCodes.. but I'm having trouble with the color since it has =whatever they type... This is how it looks: public function strip_bbcode($string) { // All the default bbcode arrays. $bbcode = array( //Text Apperence ' [center]' => '', '[/center] ' => '', '[b]' => '', '[/b]' => '', '[i]' => '', '[/i]' => '', '[u]' => '', '[/u]' => '', '[s]' => '', '[/s]' => '', ' [right]' => '', '[/right] ' => '', ' [left]' => '', '[/left] ' => '', '[small]' => '', '[/small]' => '', '[normal]' => '', '[/normal]' => '', '[big]' => '', '[/big]' => '', '[large]' => '', '[/large]' => '', '[color=(.*?)]' => '', '[url=(.*?)\](.*?)\[/url]#si' => '\\2', '[img]' => '', '[/img]' => '' ); $output = str_replace(array_keys($bbcode), array_values($bbcode), $string); return $output; } Anyone have any idea on how to do the color and the url?? I just basically want to replace it with emptiness.
  15. It still reads the deposit because it is making that the default submit button.. it's not even recognizing hitting the second one unless you click it.. which most people will hit enter, so I need this to work. Thanks though!
×
×
  • 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.