Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Try adding a Content-type header with a charset to the email. E.g. like this: <?php $to = "[email protected]"; $subject = "Invitation"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $headers = "From: $email\r\nContent-type: text/plain; charset=utf-8"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "your email was sent"; } else {print "En error has occurred, try again , "; } ?>
  2. In terms of security it can help foil session fixation attacks. If you obtain someone's session ID you can effectively log in as them. If the session ID changes frequently, the chance of a compromised session ID still being active decreases. Doing it right after login would be pointless. You should do it every X requests. I suppose that depends on what you want to use the function for. Did you read what it does?
  3. This post is primarily targeted at people who have posted asking for help as these seem to be the people who most frequently ask these questions. All PMs/emails to staff members regarding deletion requests will henceforth be ignored as they are answered in this thread. Q: Will you delete my post/topic? No. Q: Why won't you delete my post/topic? Imagine if everybody requested their posts to be deleted. If everybody did this there would be no community left, which means you couldn't get the help you required. Secondly, at about 700 posts per day, we would be very busy deleting posts if that was the case. Time is not really an issue, however. There are other reasons why we deny your deletion request. You've come to this forum asking for free help. You don't pay anyone any money, neither PHP Freaks nor the volunteer who is spending his/her spare time on helping you. We think that when you are getting such an awesome service for free, it is only fair that the help you have received is publicly archived for anyone to use. We also think that is a reasonable and very small price to pay. There is also another reason. As already mentioned, people have been helping you for free. By deleting your topic we are also deleting their work. That would be unfair. Q: But I didn't even get sufficient help, so why can't you just delete it? We are not interested in forming a committee with the purpose of finding out whether someone received adequate help or not each time someone asks. Q: But what if my client finds it? So what if your client finds out? If the topic reveals that you are incompetent at doing the work your client pays you to do, then you should not have taken the job in the first place. At least be adult enough to admit you have received help instead of relying on lies and deception. Q: But what if my teacher finds it? If your teacher finds it and you were supposed to do it yourself, it's your own fault for cheating. Q: Aren't you guys human? While the real identity of all staff members hasn't been verified, we are pretty certain that all our staff members belong to the homo sapiens species (except for CV..whatever (s)he/it is, it's not human...). Really though, trying to shift the blame is pretty pointless. Before you registered, you agreed to our Terms of Service stating that you will grant us an irrevocable license to use content you post using our systems. For added convenience we added a big red notice on all post forms informing you that we will not delete the things you post. You posted knowing these terms. Q: But my post makes me look immature/foolish/stupid/unintelligent. Won't you delete it? "Think before you speak" is a good rule to remember that applies both in real life and on the internet. Q: Won't you make an exception just this time? Sure! Like we'll make an exception for everybody else who asks... No. Q: So what should I do? If you're unwilling to accept that your topics here will be archived publicly, you should hire a consultant to help you in private. This rule blows! Maybe it does, but we did not force you to visit this web site. Basically, think of your posts as emails. You cannot alter emails once they have been sent either. Nor can you take them back (delete them). Think of your post like a speech transmitted live on television. You cannot change what you say there either. Consider what you write before you hit the "post" button. Your post is probably not so important that it cannot wait one minute while you do that.
  4. Yeah, well, we're not going to help you with bypassing security on other people's websites.
  5. array_reverse
  6. 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
  7. 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']; }
  8. You can check the number of words using str_word_count.
  9. Where did you get that API URL?
  10. We would encourage everybody to introduce themselves here so we might get to know you and "old" members are very welcome to introduce themselves as well.
  11. I've got a VPS. A dedicated server would be overkill for my needs.
  12. That's quite a surprise to me. As I said, it is something I would expect from any web host. Then again, I've never purchased shared hosting.
  13. I would expect all webhosts to have that.
  14. That doesn't necessarily mean you cannot write a TDD primer.
  15. What do you mean with "doing .htaccess on a folder"? .htaccess files just contain Apache configuration directives. Not only does it have nothing to do with PHP whatsoever, but it can all be looked up in the Apache documentation.
  16. Here is yet another alternative: http://devzone.zend.com/article/4571-Fetching-multiple-random-rows-from-a-database
  17. A sub query returns a result, like all queries do, and you can use that result as a variable in your query. That's it, essentially.
  18. http://web.archive.org/web/20080209154336/http://www.phpit.net/article/simple-mvc-php5/
  19. A login script is essentially so simple that it's not even worth dedicating a tutorial for that. Stuff involved is essentially form processing, database access and sessions/cookies. We have a tutorial for sessions and cookies and we have one for database access and another one focusing on joins and unions. Then you have form processing, but that's fairly straightforward. You simply read from the $_GET or $_POST superglobal. You might also be interested in this blog post that talks about breaking a script/application down into logical elements the same way I just did.
  20. You mean like this? http://www.phpfreaks.com/tutorial/debugging-a-beginners-guide
  21. Please do not post links to download copyrighted material that you do not have the right to redistribute yourself.
  22. I'll sticky this for further reference and in case other people might know books that people might find useful.
  23. I can't remember when I've last used FTP. I always use SSH, SCP and SVN.
  24. I've read some of SitePoint's Simply JavaScript. At the time I read it I found it pretty good.
  25. [quote author=lukkyjay link=topic=119433.msg728404#msg728404 date=1193718287] I'm just now starting to learn php for a project on my own site.  I don't understand how a WYSIWYG would work with php, but that would be awesome if it were actually possible.  Can you get specific about the best WYSIWYG for a beginner? [/quote] WYSIWYG is for HTML only. Best is a matter of personal preference and hence the reason why this and [url=http://www.phpfreaks.com/forums/index.php/topic,54859.0.html]this[/url] topic are created.
×
×
  • 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.