Jump to content

DragonFire-N[R]

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

About DragonFire-N[R]

  • Birthday 11/18/1990

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling

DragonFire-N[R]'s Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've been trying to think of the best way to build a PHP based chat room. Obviously a push method would work the greatest but I have been unable to find any such techniques using PHP so this is the only alternative I can think of. When a user logs in to the chat, a file is created in a secure directory on the server for the user. This file will store messages to be sent to the user. Each time someone sends a message to the chat, the message is inserted into every user's file. Then, using AJAX, the user in chat will "reload" the chat every few seconds, which will simply access a PHP script that reads the file, sends it to the user, then truncates the file contents to zero. My concern is obviously the high frequency of server loads to access the chat file, but this is why I would try to minimize the server's effort for retrieving chat content and focus the efforts more on sending messages since this action is done less often. I'm looking for suggestions on what would be best to keep the system efficient... maybe some ideas of headers to send which may help with optimization. Thank you for your time.
  2. Alright, so I recently toyed around with Facebook's chat feature, and to my complete amazement, messages are sent instantly from one person to another. I would have expected a delay, thinking maybe the chat loaded every five seconds to see if a new message appeared, but this was certainly not the case. I had two computers on right next to each other and I sent a message, and the other computer received it instantly. I even tested it over different networks and it was still instant. I have never seen anything like it where data could be received as quickly as this. Typically what I would expect is the page to check for new messages every few seconds and display them if they exist. I honestly have no idea how to do this instantaneous programming so any insight would be very much helpful!
  3. I'm bumping this because I'm still unsure of how to do this and would link a solution.
  4. How would I go about automatically adding <a> tags to people's posts when they type in a URL?
  5. I've been trying to build my own WYSIWYG editor, but the browser's built in "execcommand" functions are really weak and vary too much among browsers. With this I am trying to build my own "execcommand" function which will surround highlighted text with my own tags. Basically I am in need of code that will effectively surround highlighted text with a certain HTML tag. I'm pretty sure this is the best approach to building my own WYSIWYG editor, but if anyone has any better ideas I'm more than willing to hear them . Sadly there aren't many good tutorials on this so it is difficult to know of many tactics. Thank you in advance
  6. http://us.php.net/manual/en/types.comparisons.php Perhaps this can explain why PHP does what it does
  7. I believe you are confusing the purpose of magic_quotes_gpc and magic_quotes_runtime. magic_quotes_runtime will add quotes to information obtained from any external source, such as a database or text file. magic_quotes_gpc simply adds quotes to data variables such as $_GET, $_POST, and $_COOKIE. More appropriately, you should simply use the set_magic_quotes_runtime() function at the beginning of your code to disable this feature so that information obtained from your database does not contain quotes. However, since you are experiencing issues with this function, it seems clear that the magic_quotes_runtime is already disabled and that you need not worry about removing slashes from information obtained from a MySQL database but as I already mentioned, if you feel the need to check that this function is enabled, use get_magic_quotes_runtime() rather than get_magic_quotes_gpc() For more information about magic quotes, visit this link: http://us3.php.net/manual/en/security.magicquotes.php
  8. 1.) It seems most of those libraries require some sort of extension, and unfortunately there is no way to install any additional PHP functions on a shared hosting package . It seems I can use GZIP, so could you perhaps provide a simple example on how I would add files to an archive? 2.) That doesn't quite help me though. I'm looking to reduce server lag by having the records update hourly as opposed to instantly, like the IPB features which update topic/profile views hourly to reduce memory allocation. Currently I just run an update query every time a user downloads a file, which isn't very efficient.
  9. Are there PHP functions available that allow me to compress multiple files into an archive? I have a site that gives users a lot of files to download, and it would be easier if the users could select which files to include in an archive rather than downloading each file individually, so I'm wondering how I could do that. Also, secondly, on IPB there is a feature that keeps track of topic views and profile views, but it doesn't update immediately, instead it updates every hour to reduce server activity. I need to know how to do this for my site to keep track of downloads for each file because the files are downloaded frequently and it may be too much stress on the server to keep the count up-to-date constantly. Thank you all in advance
  10. I'm not entirely sure about this since I haven't done much with secure connections, but I believe when a user goes through a PHP document with a secure connection, a server variable $_SERVER['HTTPS'] exists (I also forget what information the variable contains but for this situation that isn't important). You can do something like this: if ( ! $_SERVER['HTTPS'] ) { header( 'Location: https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ); exit; }
  11. Ah, now I see what I was doing wrong and why it didn't work Thanks a million
  12. Hello, I have tried many expressions but I am unable to find one that works. Could someone please post an expression that matches alpha characters and spaces only? I've tried this: if ( preg_match( '#[a-z\s]#is', $string ) ) but it doesn't work like I had hoped. I haven't found anything $string could be that would make preg_match return false. Also, if someone could also include a preg_replace expression that would eliminate all characters from a string except alpha characters and spaces that would be great Thanks in advance!
  13. Thank you PC Nerd for your feedback. When you say "have a cron run the script once every 10 minutes," what exactly do you mean? Is it possible to configure the shared server to execute a PHP script regularly without requiring someone to access the file via HTTP? I appreciate the info from everyone and I will be using all of the ideas
  14. lol, I'm not; I'm trying to create a newsletter but once so many people subscribe to it, it'll start stressing the server having to send all of those e-mails individually and I'm looking for a more efficient method Thanks for the idea though, I may use that. Would it be possible to send Bcc using the PHP mail() function?
  15. lol, yeah, something like that. Is there not a more efficient method for sending many e-mails other than calling the mail() function every time it goes through a cycle?
×
×
  • 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.