Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
Yeah, well, we're not going to help you with bypassing security on other people's websites.
-
array_reverse
-
Really? It works fine for me. <?php function getAlexaRank ($url) { $xml = simplexml_load_file("http://data.alexa.com/data?cli=10&dat=s&url=$url"); return (int) $xml->SD->POPULARITY['TEXT']; } echo getAlexaRank('google.com'); // 1 echo getAlexaRank('phpfreaks.com'); // 11283
-
Oh sorry. I was viewing it in Chrome and I forgot that it doesn't work very well with XML files; it showed up blank to me. Anyways, the problem is that it's not returning the string in the attribute, but it's returning a SimpleXMLElement object. Simply casting it explicitly to an int will fix it: function getAlexaRank ($url) { $xml = simplexml_load_file("http://data.alexa.com/data?cli=10&dat=s&url=$url"); return (int) $xml->SD->POPULARITY['TEXT']; }
-
You can check the number of words using str_word_count.
-
Where did you get that API URL?
-
No, it is not installed. Having shell access, and having the PHP ssh2 extension installed is not the same thing.
-
Create another function. Possibly an anonymous function or using create_function if you're using <PHP 5.3.
-
Well, if the function doesn't exist then obviously the extension is not installed. How did you verify that it's installed? Check the output of phpinfo(). It'll give you info about your PHP environment. Also try to run <?php var_dump(extension_loaded('ssh2')); If that doesn't output true then it is not installed. See get_loaded_extensions as well.
-
If logins using the same credentials come from a large number of different IP addresses, it could be a strong indicator that multiple people are logging in. You'll have to consider that 1.2.3.4 and 1.2.3.3 could very well be the same person, but 1.2.3.4 and 2.2.3.4 could certainly not (a relative difference of respectively 1 and 16777216). Another thing you could do is to restrict one login per IP address at a time. You could also check against the user agent string. Many different UA strings from many different IP addresses would also be an indicator. You cold automatically flag suspicious accounts and manually investigate them.
-
Seriously, make an effort yourself. If you want people to do things for you then post in the freelancing section.
-
I've got a better idea. How about you read his suggestion and try to incorporate it into your code yourself? Learning how to program is something that is difficult and takes time (if anyone told you otherwise they don't know what they're talking about, or they're lying). It comes from experience. However, experience does not come from copying other people's solutions that you don't understand. Slow down and instead try to figure it out yourself instead of immediately asking for help
-
Why would you set a session variable and then unset it again in the same request? That kind of defeats the purpose of using sessions.
-
Then you probably need to work harder on fixing it... dude.
-
Indeed it does. Please refrain from hijacking other people's posts with useless crap, everybody. kevinkhan, if you still need help, you are very welcome to open a new topic.
-
Yeah, but it also makes it difficult (read: impossible) for people browsing without Javascript turned on, or people who use UAs that do not support Javascript at all (screen readers, lynx, etc.).
-
No, you cannot do that. As I said, imagejpeg outputs the image when called with a null filename. Try opening an image in notepad (or another plain text editor); that's the kind of stuff it'll output. It doesn't return a path or anything along those lines. The only thing it will ever return is boolean indicating either failure or success. You can use the second parameter to have it save the image to a file instead. In that way you can do what you're trying to do.
-
That's not how it works. $img = imagecreatefromjpeg('images/gallery/test/Dock.jpg'); header('Content-type: image/jpeg'); imagejpeg($img, null, 75); imagedestroy(); imagejpeg() outputs the image.
-
I don't believe I ever said so. I said that when he implemented salting it could complicate things.
-
Yes it is: if ($pass != $info['password']) { die('Incorrect password, please try again.'); } I don't recall having spoken about efficiency. Shorter code isn't necessarily neither better nor faster. Which is all I ever said. Everything else is stuff you made up.
-
I suppose you can restrict the number of requests from an IP address within the last X units of time. The only fool proof way of preventing people from downloading your website is to not publish it at all, however.