Jump to content

EchoFool

Members
  • Posts

    1,074
  • Joined

  • Last visited

Everything posted by EchoFool

  1. I use the SQLskip function for both getting from the database and inserting just to be on the v.safe side - i don't think it would effect the breaklines in anyway though
  2. My input is : MY SQLSkip function: //SQL protection function SQLskip($Var){ return mysql_real_escape_string(stripslashes($Var)); }
  3. Hey, When a user posts a message the next page shows it as a preview before confirming.... but for some reason the nl2br function doesn't work... This is what i have: <?php function local($BB){ //bb code fucntion $BBCode = array( "&" => "&", "[title]" => '<center><span class="header">', "[/title]" => '</span></center>', "[p]" => '<p align"left">', "[/p]" => '</p><br><br>', "[i]" => '<i>', "[/i]" => '</i>', "[b]" => '<b>', "[/b]" => '</b>' ); $Message = str_replace(array_keys($BBCode), array_values($BBCode), $BB); return $Message; } $Message = SQLskip($_POST['letter']); ?> <span class="Negative"><blink>NOTE:</blink> This is just a preview!</span><br><br> <div id="messagebox"><br><br> <?php echo nl2br(local($Message));?> <br><br> </div> But the page shows : test\r\n\r\ntest Any idea why? Thanks
  4. Hey, Say i had two strings assigned to different variables like $var = 'Hello there, how are you ?'; $var2 = 'Hello there, how are you today?'; I want to get a function automatically highlight whats different between the two by - say for example highlighting the added words in a red font. So like the result would show (after comparison) Hello there, how are you today? Is there a built in function for such a thing or is this a make your own function moment?
  5. Hi Mchl Thanks for that - i tried it but i get: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' Never had that before - v.odd error =/ any ideas why ?
  6. Thought that might be the way to do - i was hopeing a single query could. But i will use your suggestion. Thanks
  7. Hey, I have a query which is meant to delete all rows which are less than the last 31 ids with this WHERE clause. As i only display the most latest 31 rows the rows that are any older might aswell be deleted but it won't work for me. The error i get is: You can't specify target table 'messages' for update in FROM clause DELETE FROM messages WHERE id < (SELECT MAX(id) FROM messages) - 31 Hope you can help!
  8. Hmm how would php return a value to tell the script not to call to update chat as thats stretching my ability a bit xD?
  9. Thank you for the kind reply, If i may squeeze one final question in, I am using a function call every half a second to load the chat with: So my question is, is this the best way to load the chat ? Or is there a better method, equally should i store logs in a database or a text file, which is more efficient if were talking about lots of users using the script?
  10. Okay that did the trick how ever it does not clear the text in the input box when submit occurs - is there a way to clear afterwards?
  11. Hey, I need help, i trying to get my chat logs to get the the lastest 30 logs so i put ORDER BY Field DESC LIMIT 30 How ever this causes the newest log(highest) to be first. But as its a chat room (think IRC) i want the latest message to be at the bottom and older messages above it but still only load the LIMIT of 30. Any ideas on how to do this ?
  12. Hey I have some ajax on my site which posts messages to a PHP script but it still refreshes the page when they do so which is frustratin and i don't want it doing that. My code: function sendMessage() { $.ajax({ type: "POST", url: "chatpost.php", async: false, data: "message="+$("#myMessage").val(), success: function(msg){ refreshChat(); } }); } function refreshChat() { $.ajax({ type: "POST", url: "chat.php", success: function(msg){ $("#chatArea").html(msg); } }); } Form: <form onSubmit="sendMessage()" method="POST"> <input type="texT" id="myMessage" class="blank" style="width:74%;"> <input type="button" class="blank" value="Send Message" onclick="sendMessage();"> </form> Any ideas on how to prevent the refresh ?
  13. Oh i see - of course You mean this: SELECT Count(ReferredBy) AS Total,ReferredBy FROM tablename GROUP BY Count(ReferredBy) ORDER BY Total DESC
  14. What you mean by want back to ReferredBy column itself?
  15. So like : SELECT Count(ReferredBy) AS Total FROM tablename GROUP BY Count(ReferredBy) ORDER BY Total DESC Or is there a better way?
  16. Hey, If a database of users have a field named "ReferredBy" with the user id of the person that they were referred by... im trying to get a query that can then collect the top 20 users who have referred the most people. So i tried Count(ReferredBy) As TotalReferred But then realised without the WHERE clause stateing exactly which ID to count i can't make a simple list like: (DESC order basically). How would i make a query to do that with a count and without actually referencing a precise ID?
  17. Thanks will read into it.
  18. Not sure if this is the correct place to ask as im not sure what catergory it belongs in, I have done a latest performance scan on my site with a score of 93 out of 100. MY down side is this critical error: Does any one understand this and what i have to do to correct it ?
  19. Oh thanks One final question, when i send an email to a user it says "Mailed-by: server.domain.com" But other emails from other companies do not seem to, why is this ?
  20. How come when i recieve emails from things like facebook in Gmail then it says "From : Facebook" Rather than a website email ? The Reply to is "donotreply@domain.com" which isn't a real email address at my server cos people are not suppose to reply. Edit the /r/n worked perfectly Thanks
  21. Yeah tried that it just shows them aswell...
  22. That is further up the script. I do recieve the email but it comes out showing the "<br>" rather than acting as HTML. @Karl the method you used isn't what im trying to do sorry, im trying to allow the email to use HTML so itll convert "<br>" into new lines.
  23. When a user registers i send them an activation email but my mail function doesn't work properly even though i got it from the php website. The headers is my problem they won't work so <br> just comes through as text rather than actually using it as html. My script: <?php $subject = "Welcome"; $headers = 'From: Company Name'; $headers .= 'Reply-To: '.$Domain; $headers .= 'MIME-Version: 1.0'; $headers .= 'Content-type: text/html; charset=iso-8859-1'; $message = 'Thank you for registering! <br><br> To activate your account, please visit this link:'; $message = $message. "<br><br> ".$Link; $message = $message. '<br><br> Your username is: '.$Username.' <br>You password is: '.$Password2.' !'; mail($Email, $subject, $message, $headers); ?> What am i doing wrong with my headers?
×
×
  • 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.