Spectre
Members-
Content Count
1,034 -
Joined
-
Last visited
Everything posted by Spectre
-
It's not possible to call a function directly from a link, per se (as has been noted, PHP is server side), but you can construct a link to use GET variables to instruct the script to execute a certain function. For example: if( isset($_GET['function']) ) { switch( $_GET['function'] ) { case 'dosomething': dosomething(); break; case 'dosomethingelse': dosomethingelse(); break; }} And then link to script.php?function=dosomething Hope that helps. Oh, and Tyssen, using the link you originally supplied would cause nameOfYourFunction() to be executed whenever the script is, not just when the user clicks the link. Anything between <?php ?> (and, depending on server configurationm, <? ?>) is going to be processed as soon as the PHP engine encounters it within the script, so at the client's end, the link would end up pointing to whatever output nameOfYourFunction() returned (if any).
-
Include File.php?id=something using the include() function
Spectre replied to Amezis's topic in Programming
Just to avoid future problems, I would recommend changing: $id = $_REQUEST['id']; To somethingl ike: $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : isset($view_var) ? $view_var : 0;. Changing to just '$id = $view_var;' means it won't work if someone actually accesses view.php directly. Whether or not that's going to happen in your particular circumstance I don't know, but I like to try to avoid potential problems wherever possible. -
Is Google Cheating With Adsense? Does Google Cheats with Adsense...
Spectre replied to visitor's topic in Business Forum
I don't think Google goes around banning people simply for the sake of it, nor do I think that they kick out genuinely good publishers. If you are earning decent money via AdSense, then it is in Google's best interests to keep you on as a publisher - they obviously earn x amount for every click made, of which a percentage is paid to you, so if you are sticking to the rules and bringing in generous traffic, they aren't going to terminate your account just so they can keep the few dollars you've earned. I think the majority of people that get banned and then complain about it either did infact do something wrong, whether or not it was intentional. Of course, there are exceptions, and some would probably have been banned unfairly - but Google is out to make money, and they don't do that by removing publishers from their program who perform well. -
Hmm, because of the obvious potential for abuse, I'm not going to help you with such a project. However, I will offer this small piece of advice - look up RFC 821, aka. the Simple Mail Transfer Protocol specification, and put the time and effort into learning how to control this protocol (it is, as the name implies, reasonably simple).
-
That should work fine - maybe there's another section of code causing the block you mentioned to not work properly? I wouldn't recommend such a method for what you're trying to do. In my opinion, it would be better to use something like: if( $_SERVER['PHP_SELF'] == '/index.php' && count($_GET) < 1 ) { // Is the root} else { // Not the root} Or: $url = parse_url($_SERVER['REQUEST_URI']);if( ( $url['path'] == '/' || $url['path'] == '/index.php' ) && !isset($url['query']) ) { // Is the root} else { // Not the root} If that makes sense. That's my two dollars worth, anyway.
-
Oh, and a quick search on Snopes (as Cerb mentioned) brought up this article, which notes that: And:
-
It's not about whether some people think it might be a joke or not - it is known to be a joke, and this has been clearly establish since not long after it first started in 2000. Although I personally don't find it funny in the least, there isn't really someone behind the site stuffing kittens into bottles and trying to retard their natural growth or anything of the sort. Getting worked up and angry over it would be understandable where it real, but as it is not, doing so does little more than to help the 'joke' spread. Let's think about it from another angle for a minute. The site has existed since December 2000. The server hosting it is located in America, and the domain is registered to someone claiming to live in New York. As actually running such an operation would obviously violate the laws surrounding cruelty towards animals which exist in the United States (and most other countries), it would have been legally forced to close down a long time ago had the person actually been causing such cruel and severe damage to infant felines. Oh, and no, that's not how I know the site is a joke - it's just something more to think about.
-
Ok then. Now that we've got the pointless arguing about nothing aside, can we return to discussion of the original topic?
-
Although a distasteful one, it is just a joke. It's been around for quite a long time - I remember it floating about the Internet prior to 2001, with similar results (people getting worked up about it).
-
Question~about Mysql ALTER TABLE `xxx` ORDER BY `no`;
Spectre replied to kakingho's topic in Programming
PHP communicates directly with MySQL, and provided the user you are accessing the database with has the correct privelages, any command can be executed. Which would lead me to think you're doing something wrong somewhere else in the code. -
Opaque Birthday Is Today/tomarrow thanks M^E
Spectre replied to Saint_Michael's topic in General Discussion
Heh. Happy birthday, 'old timer'. For the record, he's well under 30. -
Hmm, running a public server on dial-up? That's dedication. Anyway, well done for figuring out how to work the world's most popular web server. Just make sure you don't open yourself up to any potentially dangerous security problems.
-
Copyright and intellectual property law is applicable almost everywhere. It may not be enforced, but that doesn't mean it's legal. Here is a reasonably good resource on copyright law in your particular part of the world - I think you should probably read it. Anyway, this is getting a little off topic. There is indeed a lot of very good open source software floating around, although it obviously doesn't meet the same standard as the commercial market in all areas, in terms of functionality and reliability. Not all open source software is published under the same license - although the Free Software Foundation recommends the GNU GPL for free, open-source software, there are other licenses available for authors to license their work under whilst keeping it open source and free, so it's worth getting familiar with the particular license a package is distributed under before going ahead and making modifications or redistributing it.
-
Question~about Mysql ALTER TABLE `xxx` ORDER BY `no`;
Spectre replied to kakingho's topic in Programming
Certainly true, although I would still recommend using single quotes where possible and simply escaping any other single quotation marks which are required to appear in the query: 'SELECT * FROM tablename WHERE name=\'you\''; Using double quotes slows the operation down. Although it probably wouldn't affect small sites or scripts that aren't used a great deal, those which operate constantly will start to notice it. Although it's sometimes easier and more practical to use double quotes, in my opinion, it's usually a better idea and general good coding practice to use single quotes and simply escape any instances required to appear in the string, as well as adding variables outside of it (eg. 'SELECT * FROM table WHERE field =\'' . $variable . '\' LIMIT 3'). -
Question~about Mysql ALTER TABLE `xxx` ORDER BY `no`;
Spectre replied to kakingho's topic in Programming
Oh, it may also be worth noting that when sending queries to MySQL via PHP, they do not need to be terminated in themselves via a semicolon, as it is done automatically. So mysql_query('blah'); would have exactly the same result as mysql_query('blah;'); -
Question~about Mysql ALTER TABLE `xxx` ORDER BY `no`;
Spectre replied to kakingho's topic in Programming
A semicolon can be placed within quotes and PHP will treat it simply as a string. As no9t9 noted, the query should be in quotes between the brackets of the mysql_query() function. mysql_query('ALTER TABLE `xxx` ORDER BY `no`;'); -
Yahoo! Publisher Network Yahoos reply to Adsense
Spectre replied to freesoul's topic in Search Engines
The YPN has been around for a while now, and I believe there are other threads floating around on the topic. Just for the record, the Yahoo! Publisher Network is located here. -
Microsoft Plans Free Anti-Spyware Program
Spectre replied to iGuest's topic in Security issues & Exploits
Oh yay, another chance to jump on the 'Microsoft Sucks LOL' bandwagon.Notice how old this thread is? You should probably try and find more recently active threads to participate in. Anyway, I have never used Microsoft's anti-spyware solution(s?), so I can't really comment on it with any authority - but I would imagine that since they created Windows, they would know more about the operating system than any other software development company, and therefore could target areas of weakness which other developers do not yet know about.And the man's name is not 'Billy'. I'm not a huge fan of Microsoft or their policies either, but it irritates me when people thinks it makes them special to throw petty insults at the company or the co-founder. -
This is getting quite ridiculous. People seem to be mixing up a violation of workplace requirements with the removal of human rights, which is ludicruous. I don't want to stir up any small flame wars, but s243a, you are incorrect. I can understand that people would want to take sides with the woman who lost her job in this case, but without knowing all the information surrounding it, I think she may be in the wrong.A contract - which can be any recording of agreement to a set of terms and conditions - is legally binding, and the person who signs their name to the contract is going to be held accountable for any violations of those terms. With the exception of anything explicitly unlawful, there is no restriction as to what a contract can contain, and it is up to the person to thoroughly read and check a contract before signing their name to it - because they will be bound by every single word contained therein.Although I am no expert in law, it is my understanding that there are laws surrounding employment that prevent employers from discrimating against potential employees for certain things - pregnancy or having children being one of them (this, of course, could vary from country to country, but I would assume it is consistant at least throughout Western society). However, that has absolutely nothing to do with this case. The woman is not being fired because she fell pregnant - but rather because she did so outside of marriage, something that Catholicism in general looks down upon. And whilst she is perfectly free to do that, one of the conditions of employment at the school is that teachers are "required to convey the teachings of the Catholic faith" and act as a "role model" for the students. Therefore, I would think that, although I personally disagree with the school, the woman is in fact the one in the wrong.I am not nor have I ever been a Catholic, and I strongly oppose some of their principles and beliefs. I just want to make that clear, so you don't think my opinion is biased based on my beliefs. I do sympathize with the woman, and think it is ridiculous to have such rules in the first place - but as they were clearly there before she was, and she agreed to take up her position in the school and demonstrate the beliefs of their religion to the students under her anyway, she has little choice but to accept it and seek employment elsewhere. I do not think this case would hold up in court.
-
Verifying Email Addresses Using a simple PHP script
Spectre replied to rvalkass's topic in General Discussion
It depends on the TLD. The minimum .com length is currently three characters - although every single possible three character .com domain name has long been registered, and the only way to get one is by snatching it after it expires. In the past, the minimum length has been two and even one for this TLD, but only for a short time (x.com, cj.com and aa.com are examples of domain names registered before the minimum length was increased). With the exception of .info, which has a minimum four character length, the other generic TLDs are the same, and most ccTLDs are as well. You should be able to find more information at IANA, InterNIC and ICANN. Anyway, this is getting a little off topic... -
Of course it is. But she still stepped outside of her legally binding agreement and terms of employment at the school. Although I don't think it makes any sense having the rule in the first place, that's just what her religion insists on enforcing, and it's not like she 'accidently' broke her agreement. Or rather, the religion under which the school follows. Sorry for the double post (most likely not her religion).
-
Saint_Michael, settle down. I'm not a religious person either, but I don't hate all religions. I can respect that some people may wish to believe in or worship certain figures or ideas which I do not agree with. I'm sure many people would take great offense to your words. Remember, you are a moderator and your job is to keep the peace and guide the forum's users. Anyway, I stand sort of in the middle on this particular issue. If the teacher had not agreed or obide by the rules of the school and the religion under which it teaches, then I would certainly support her choice to take legal action against the school - however, as she apparently did agree to provide a religious role model to students and keep to the ideas and morals which that religion supports, I don't think she is in any position to try and sue them. It is indeed harder to prove that a male has engaged in pre-marital sexual activity, but I don't think it's so much that she participated in an act the school views with scorn that is the problem - I think it's that she is now pregnant, basically 'flaunting' it to her students and showing disregard for the laws of their religion in front of them that is more the issue.
-
Verifying Email Addresses Using a simple PHP script
Spectre replied to rvalkass's topic in General Discussion
Just to provide a (hopefully) clearer description, the pattern: [_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)* Basically translates to: [any letter, number, underscore, or dash] repeated one or more times (a dot [any letter, number, underscore, or dash] repeated one or more times) appearing zero or more times @ [any number, letter, or dash] repeated one ore more times (a dot [any letter, number, or a dash] repeated one or more times) appearing zero or times. Also, you may want to quote sources or give due credit when using code obtained from other parties. -
What's wrong with attempting to increase the publicity and general user acceptance of Internet Explorer? Personally, I don't like it or use it as a web browser, but if people can 'spread FireFox' freely, they should be able to do the same to Internet Explorer or any other software application without being riddiculed. Just because you and I don't like the current major version, doesn't mean no-one else is allowed to. Anyway, this site does seem to be a joke, intended more to make fun of Microsoft's browser than 'spread' it. But I still think that if you make fun of or belittle someone simply because they use Internet Explorer (or because they don't use FireFox), then you are foolish and close-minded beyond words. Excuse me while I brace myself for the torrent of abuse I am bound to receive from a bunch of 13 year olds for saying that.
-
I posted something on this quite a long time ago. I don't know if it's still floating around or not. But if anyone ever claims they are a moderator/administrator etc. and need their account permissions back, ignore them. Because they are lying.And in the unlikely event that OpaQue was locked out of his account, he would be able to take the appropriate measures to get it back.