Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
A property is not an address, so you shouldn't use inheritance. Inheritance denotes an "is-a" relationship between the child and parent class. What you have is an "has-a" relationship which is made using aggregation or composition. http://en.wikipedia.org/wiki/Object_composition
-
[php] How to check if the input variable is integer?
Daniel0 replied to michalchojno's topic in PHP Coding Help
The regular expressions says: Start of string (^) followed by a character in the range 1-9 ([1-9]) followed by a character in the range 0-9 zero or more times ([0-9]*) followed by end of string ($). Google: "regex" And see: http://www.phpfreaks.com/tutorial/regular-expressions-part1---basic-syntax By the way, preg is faster than ereg. -
How are you going to check if the local Apache is running when that's the server you're the script through?
-
Well, then maybe show the code using that method so we can tell you what you're doing wrong.
-
Just check out the manual: http://framework.zend.com/manual/en/zend.session.html It's got plenty of examples.
-
http://www.google.com/search?q=captcha+tutorial+php http://recaptcha.net/plugins/php/
-
http://www.phpfreaks.com/tutorial/working-with-checkboxes-and-a-database
-
http://php.net/manual/en/mysqli-stmt.bind-result.php
-
How about Zend_Session? You won't get a definite answer to which is "the best" because that's subjective.
-
Universities would be the kind of institutions that need these kinds of massive computational power. Funny that you would use a 32-bit platform on setups that are designed to handle huge amounts of data though.
-
In your case, only the user huw would have access to that .ssh directory. Either make a new key for Apache/PHP or move the key to where it is writable. I wouldn't recommend using the root user though. You should use an unprivileged user unless the command you wish to run absolutely needs root.
-
Like this: ssh user@machine -i /path/to/private/key 'command to run on machine as user'
-
Yes, I am sure: daniel@daniel0:~$ hostname daniel0.net daniel@daniel0:~$ ssh phpfreaks.com 'hostname' phpfreaks.serverpowered.com Are you sure you've got the keys properly setup? Note that it will try with the private key for the user that PHP is run as (which means the user the web server is run as if you run it through a web server). You might want to explicitly set the identity file when calling ssh.
-
No it shouldn't. This should, however: shell_exec("ssh root@myserver 'uname -a'");
-
split the number 100 into arrays of numbers that add up to 100
Daniel0 replied to tallberg's topic in PHP Coding Help
Actually it is. If you generate an array of arrays of natural numbers whose sum is 100, when randomly selecting one of these arrays, the probability of selecting 99+1 is equal to the probability of 100*1. It's unlikely that you select either of those particular ones out of the many that exist, but they are equally probable. Edit: Nevermind. I was still thinking about his initial way of solving the problem. -
It's for search indexing. It's not a database.
-
split the number 100 into arrays of numbers that add up to 100
Daniel0 replied to tallberg's topic in PHP Coding Help
Yeah you already said that, but how and why? Say I give you the array you're looking for? How do you intend to use it? -
Unable to access the search daemon
Daniel0 replied to Coreye's topic in PHPFreaks.com Website Feedback
Yeah, and this time I remembered to save the updated iptables rules, so if the server reboots again it should work from the start. -
Unable to access the search daemon
Daniel0 replied to Coreye's topic in PHPFreaks.com Website Feedback
Ha... so I've been working on this for a while now, trying to figure out what is wrong. Removing everything, compiling it again. Upgrading. All sorts of stuff. Eventually I find out that iptables is blocking the port that the Sphinx search daemon is listening to. How annoying. Anyway, search should be working again. -
split the number 100 into arrays of numbers that add up to 100
Daniel0 replied to tallberg's topic in PHP Coding Help
Maybe you should elaborate on that. It sounds like there are better ways to do what you're trying to do. -
Then pass that individual element instead of the entire array...
-
You can also just do something like: $start = microtime(true); sleep(2); $end = microtime(true) - $start Same thing really. That parameter was added in PHP5.
-
[SOLVED] Encypt/Decrypt via mcrypt problem...
Daniel0 replied to Cory94bailly's topic in PHP Coding Help
Yeah, as I said, it only seems to happen if the key is "key". -
[SOLVED] Encypt/Decrypt via mcrypt problem...
Daniel0 replied to Cory94bailly's topic in PHP Coding Help
Hmm... Check this out: $key = 'key'; $message = 'test'; $encrypted = mc_encrypt($message, $key); $decrypted = mc_decrypt($encrypted, $key); if ($decrypted == $message) { echo 'Works'; } else { echo 'Broken'; } That will output "Broken", but if you do $key = 'abc'; it will output "Works". I cannot give an explanation to that.