![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
zq29
-
Posts
2,752 -
Joined
-
Last visited
-
Days Won
1
Posts posted by zq29
-
-
Have you tried adding the output parameter to the exec() function to see if it is spitting out any error messages?
-
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.
-
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? -
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] -
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.
-
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.
-
[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. -
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"
-
Might have something to do with starting topics like this, maybe? Exactly what value does this topic bring to the community?
-
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.
-
I think you can with PHP 5
-
I'm assuming you're using Windows, here is an option...
[code]<?php
$drives = shell_exec("fsutil fsinfo drives");
?>[/code] -
chmod()
-
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... -
Looking back on my solution, it's not a very good one, as unix time stamps only start from 01/01/1970 and Negative timestamps are only available on PHP5 and on some *NIX based OS
-
Ahhh, you took that from one of my replies earlier today! There are 31,556,926 seconds in a year - A Unix timestamp is the amount of seconds since the unix epoc (1st of January 1970 ish I think).
-
I think he's trying to use a variable variable. Here's an example of how you might go about this:
[code]<?php
$qty0 = 4;
$qty1 = 8;
$qty2 = 16;
for($i=0; $i<=2; $i++) {
$q = "qty".$i;
echo $$q;
}
?>[/code] -
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. -
Wouldn't it be easier to position all of the elements with CSS and have the text auto-wrap around them?
-
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] -
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. -
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. -
I don't think you will be able to do this without sending an email to the address and checking for bouncebacks.
-
Many virus scanning packages offer a CLI, you could run your command with PHPs exec() function and check its output to see if the file is infected.
Mysterious count down
in Miscellaneous
Posted