Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=308093.0
  2. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=308101.0
  3. trq

    Jail a user?

    Sorry if this sounds harsh, but if you really need to ask these questions there is no way you should be doing this. It WILL blow up in your face. Anyway, you just need to make sure that all directories are only accessible by there owner. This generally means 700. Some directories however will need to be accessible by certain groups so you might need to use 770. Really, for this sort of thing, creating home directory jails is the best option. If this isn't an option, you'll be up for allot more work and the system will be allot less secure, though people who know what they are doing can usually break out of a jail depending on what tools are available to them. Are the users themselves going to have system accounts?
  4. if ($result = mysql_query("SELECT email FROM users")) { if (mysql_num_rows($result)) { $users = array(); while ($row = mysql_fetch_assoc($result)) { $users[] = $row['email']; } } }
  5. Just bcc them in. A simple example. <?php // this would come from your database. $users = array('foo@foo.com','bar@bar.com','boo@boo.com'); $to = 'you@youremailaddress.com'; $subject = 'subject'; $message = 'this is an example'; $headers = 'From: you@yourwebsite.com' . "\r\n" . 'Reply-To: you@yourwebsite.com' . "\r\n" . 'Bcc: ' . implode(', ', $users) . "\r\n"; 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> This will send the email to you, but bcc in all your users from your database.
  6. No, http is the webs protocol, not part of a domain name. www is generally a subdomain on that server specifically used for serving web content. Your hostname entry should look more like..... $dbhost = "mydatabase.com"; Be aware though that using a hostname is going to be slower than an ip. If you know the domain you can find the ip easily enough by pinging it (I don't/won't use Cpanel).
  7. Yes, you need to replace the localhost domain with either the ip address or domain name of your mysql server database.
  8. Thats helpful. Try debugging it. if ($result = mysql_query("SELECT COUNT(id) AS cnt FROM inbox WHERE read = '0'")) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo $row['cnt']; } else { // no records found. } } else { trigger_error(mysql_error()); }
  9. Just gotta remember that arrays start at 0. So if you have an array with 10 indexes within it, the highest index number will be 9 not 10.
  10. trq

    MySql Triggers

    What is the exact error and code?
  11. I don't see any issue. What exactly is the problem? Just make sure your development environment as closely as possible mirrors your production environment and there won't be any issues.
  12. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=308068.0
  13. You woulds be much better off using the api that youtube provide. http://code.google.com/apis/youtube/overview.html
  14. Your while goes one increment too many. Should be..... while( $counter < count($_FILES['photo_filename']['tmp_name']))
  15. So many things wrong with this code. Firstly, executing mysql_query() within mysql_num_rows() like that is ridiculous. it gives you absolutely no opportunity to check your query for success before attempting to use its result. Speaking of which, your query is failing because its syntax is incorrect. You might try..... SELECT id FROM inbox WHERE read = '0' So, that would be.... if ($result = mysql_query("SELECT id FROM inbox WHERE read = '0'")) { echo mysql_num_rows($result); } Now, considering you only want a count and not the actual data, this would be even better. if ($result = mysql_query("SELECT COUNT(id) AS cnt FROM inbox WHERE read = '0'")) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo $row['cnt']; } }
  16. Also, why does Email extend Database? The two seem unrelated and your passing a Database object into Email anyway?
  17. The error is pretty self explanitory. NumRows is not a property of your $q object (whatever that is). What is returned by db->select() ? That is the object we need to see.
  18. Locked. There isn't a specific question, your asking for opinion. obviously know one has anything nice to say.
  19. trq

    Jail a user?

    I thought you said in your first post that this wasn't an option. So, in my very first reply I gave you an alternative.
  20. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=308032.0
  21. One has more verbose error reporting is all. Neither would work, but only one seems to be displaying the warning.
×
×
  • 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.