Jump to content

zq29

Staff Alumni
  • Posts

    2,752
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by zq29

  1. You might find it useful to have a read of the [url=http://uk2.php.net/manual/en/ref.imap.php]IMAP, POP3 and NNTP Functions [/url] section in the manual. SMTP is used for outgoing mail by the way.
  2. I'm not 100% sure on this, but I do have some thoughts:

    1) If you have [url=http://uk2.php.net/manual/en/ref.mbstring.php]mbstring[/url] running with PHP, can you force it to 8-bit mode?
    2) Would the [url=http://uk2.php.net/manual/en/language.operators.bitwise.php]Bitwise Operators[/url] be of any use you you here?
  3. You can get a count like this, then just pop that value back into the right table.
    [code=php:0]$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `posts` WHERE `member_id`='$mid'"),0);[/code]
    Or you can just run a query every time the user makes a post.
    [code=php:0]mysql_query("UPDATE `members` SET `posts`=`posts`+1 WHERE `id`='$mid'") or die(mysql_error());[/code]
  4. There is no reason why your files and file references should get mixed up, as always, make sure you validate and escape [i]all[/i] user input to prevent any errors within the query.
  5. Check out the documentation over at the PayPal Developer site, I can't remeber the exact URL but I think it's something like http://developer.paypal.com or something. You are looking for information on PayPals IPN (Instant Payment Notification) system.
  6. [quote]$search[0]; does not print anything, and neither does $search[0][0];[/quote]
    That is because you have no numerical keys for that array. $search['pirates'] holds the value "1". The "++" on the end of your variables (or array keys) is just incrementing it's value by one.
  7. Just a minor suggestion on my behalf. Sure, go ahead and place the language in the title of your topic - BUT, please do avoid using generic titles as demonstrated in steelmanronald06's examples. Use something that is related to your problem, i.e. "[C++] Help with overload operators" is more likely to get looked at than something like "[C++] I need help!!!!!1one"
  8. As far as I know, the title isn't passed by the browser. You'd have to use the referer URL and scrape the page to pull out its title. You could use a combo of file() and eregi() for your scraping, if you're not too great with regular expressions, pop over to our Regex forum or give [url=http://www.regular-expressions.info]this site[/url] a look.
  9. Sorry, went off to do a bit of research. I'm not 100% sure on this, but I don't think it matters...

    Seconds in a normal year: 3600 * 24 * 365 = 31,536,000
    Seconds in a leap year: 3600 * 24 * 366 = 31,622,400
    Seconds used in my function: 31,556,926 (Reported by Google - "seconds in a year")

    Maybe googles answer is some kind of average that accounts for the difference caused by leap years? I really don't know to be honest.

    Also, I've realised that my function won't work on all systems - negative timestamps are only supported in PHP5 and on *NIX based operating systems...
  10. I'm not entirely sure if you can use square brackets like you have within your session array. You could try one of the following:
    [code]<?php
    $_SESSION["quantity$i"];
    $_SESSION["quantity".$i];
    $_SESSION["quantity{$i}"];
    ?>[/code]
    [b]EDIT:[/b] Or, yes, use wildteen88s method if you have a multi-dimensional array, I [i]may[/i] have misunderstood what you were trying to achieve.
  11. I might have gone at this the long way around, but hey, it works...
    [code]<?php
    function age($dob) {
    $date = strtotime($dob);
    $today = strtotime(date("d/m/Y"));
    echo floor(($today - $date) / 31556926);
    }

    age("16/12/1985"); //Displays 20
    ?>[/code]
  12. Can you not CHMOD the directory to 0777, create the file, then drop it back down to 0755? Pain in the arse I know, but I've found that's the only way around issues like this. I've had to do this when peoples servers have been configured in an odd way where PHP runs under a user with odd access-rights...

    The amount of time that your files will be set to 0777 would be pretty minimal, a second or so at the absolute most I think.
  13. There's an easier method of checking the file type, although it is a bit slack. The MIME type of a file is passed in the $_FILES array with $_FILES['file']['type'] - Although this shouldn't really be trusted as this information is decided by the browser and can be spoofed. Another easier method, although not bulletproof, is to just check the extension and match it against a list of allowed extensions...
    [code=php:0]$ext = substr($_FILES['file']['name'],strrpos($_FILES['file']['name'],"."));[/code]
    I normally find both of these solutions adequate.
×
×
  • 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.