Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. I'd say it's more vague or maybe incomplete than misleading... From the manual: I think it should actually show examples rather than giving a vague reference, especially since it says it matches according to 'similar' rules and not 'exact' rules.
  2. glob does support character classes, so you can skip doing a *.php and preg_matching all the files: $list = glob("[0-9]*.php"); echo "<pre>"; print_r($list); echo "</pre>";
  3. Last time I checked, "hacking" is illegal in the USA. Exactly what rules are in place by whom is not really relevant; we're talking about whether I should respect other people's rules or just do as I please, based on my own standards.
  4. It's still the same principle. You not letting me on your site to begin with is just another rule. I could decide that I don't like that rule and do as I please.
  5. Sure, I will extend the analogy to your friend insisting you have a bag over your head, but you can't just throw in "...and you can't leave" because nobody is forcing you to cater to people in china. I never said I agreed with china's internet policies. But that's their rules, and if I go to their house, then I should expect to follow their rules. Would you like it if I went to your website and cracked it, because I don't like the fact that you expect me to enter in my ss number or cc number or even go through xyz process? Or would you expect me to follow your rules and register/login and follow the scripts you have in place, if I want to visit your site? I bet you'd be pretty peeved if I circumvented your scripts, and would respond accordingly, because I broke your 'house' rules. It's the same principle.
  6. I know china is labeled as pretty secretive and controlling, but that's not really the point I was making. Trying to get around imposed restrictions raises questions of legitimacy, because you feel their rules somehow shouldn't apply to you, and you are looking to circumvent the restrictions through channels other than what the chinese govt. deems proper in their eyes. You can call them secretive, controlling, prudish, insert anything you choose, and you can claim you site is the most legitimate in the world, but at the end of the day, that's your opinion. And even if a lot of other people share that opinion, it doesn't somehow make it right to decide china's rules don't apply to you. It's like going to your friend's house and he tells you you can't come in unless you take your shoes off and you decide to walk in with your shoes on because you don't feel you should have to. Or maybe you have a 'legit' reason like your socks are stinky dirty and you don't want to rub your funk on his carpet. Well that's your opinion and you are nonetheless not respecting his rules. The proper thing to do would be to ask your friend if you can keep your shoes on for whatever reason. And I have a sneaking suspicion that "I don't know who to ask or appeal to" is probably not a legitimate excuse to the chinese govt.
  7. I don't have any idea who to contact for that. I was just making the general statement that if you have a legitimate website for teachers in china, you could possibly appeal to someone or other. But, the fact that you're instead trying to "get around" the firewall kind of speaks volumes about your legitimacy, IMO. Could be wrong.
  8. http://www.phpfreaks.com/tutorial/php-loops
  9. If you have a site for helping their education system, why not go find out why you got blocked and/or appeal?
  10. And then they come crying to us again when they don't want people to find out that they received help so they want us to delete their topics. QFT And it's really really funny when they add on for good measure: "...do it or I'll take legal action against you."
  11. Some clients go for the coders who charge like $1 an hour or like $100 for complete site projects. All I'm going to say to that is at best, you get what you pay for, at worst, you got scammed. Usually some tightwad or some kid wanting to make the next l33t text mmo goes for this sort of deal. Other clients don't want the headache associated with picking aforementioned coders, but they don't necessarily want to be buying the proverbial sports car, either. They just want it to "get the job done, security is not a concern, blahblahblah is not necessary, etc...", so they are willing to pay more, but not top dollar. Small businesses/self-employed people generally fall into this category. Also, the tightwads who have been previously burned from the $1/hr crowd will reluctantly line up for this deal if they are really backed into a corner. Still other clients understand the whole concept of you get what you pay for. They expect the best, because they expect to be the best. They will pay top dollar, and demand top coding and performance with little or no hassle or time. Generally only larger businesses opt for this, though it's fairly common to make a living off these fees from word-of-mouth business alone. How much you personally should charge really depends on what kind of coder you want to be. Are you a "make a quick buck off some fool" type of person? Are you a "I get the job done, it works, that's all that counts" guy? Are you a "I get the job done, and it's the current standard" type of guy? And, how much time you're willing to put into it in general, goes a long way. Also (as mentioned by others), your current skill level plays a big part in it. You may have the heart of a pro, but if you don't have the knowledge, you are going to be constantly biting off more than you can chew and you will get nothing but trouble out of it. But you don't really care about all that, do you? You just want to hear some solid numbers. Well it's not that simple, for all the reasons I mentioned, and more. I know decent coders who charge $10 an hour due to their desire to "keep it simple" and only do it on the side. I know a few bad coders who charge $50 an hour and constantly get in way over their head. I know a few good coders who charge $25-50 an hour who I consider to be professionals. I also know a lot of people who I consider to be professionals, who offer a lot of free help in places like phpfreaks.com. I personally do not consider myself to be a top dog coder, but tbh all day long I see people coming and going around here that claim to deliver but fail, and then come crying for us to help them swallow what they bit off, and I'm just like wtf if I knew who you were working for I'd go to them and steal your project, lol. Point is, it's not black and white.
  12. would actually be \w not \d. Or [a-zA-Z0-9] if you want to be more specific. \d only matches numbers.
  13. You can't just echo $var_one and expect it to automatically search for it in your flatfile. Variables only hold data. You can have that data be code and then eval it if you really want to, but then you'd have to have one for every single variable in there. you can write some code to load them into an array (or individual vars) so they would all be loaded up. Or you can make a function that searches through the file and grabs the value and returns it, each time it is called. Or you can make a class that does the same thing.
  14. Dunno if it's the root problem but very first thing I see wrong is you're doing $n == 1 and $n == 0 instead of one =.
  15. unless I'm cross-eyed, your code looks fine. Check to make sure that your column is correctly named (including the right case; like, make sure it's 'title' and not 'Title' because it's case-sensitive).
  16. $data[$n] = 'http://example.com/news/article/2009/'.$n.'/'; fyi that's not an associative array. Associative arrays are where the keys are strings. Numbered keys are numeric arrays.
  17. If it works for one client, it will work for others. Just a matter of whether it lands in the spam folder or not. Nothin' you can really do about that, except make sure you are sending emails in proper format and hope for the best.
  18. How did you open this file? Did you do it through your browser (like, view source)? If it's executing properly, and you can see the code from your browser, then it's not php. As revraz mentioned, you can set your server to treat any file extension as anything you want. But if you set a .html file to parse php, it still gets parsed on the server, just like a normal php file. Only the results would be sent to your browser.
  19. Ah damn effigy, forgot about preg_split. Touché. I'd go for effigy's, as it is more elegant. In retrospect, there's a couple of things in my regex has a couple of unnecessary things in it. First one technically works, but I would actually have changed it to: preg_match("~(\w+)\s(\w+)\(([^\)]+)\)~",$string,$matches); (\w+) matches the first word 'Nick'. \w matches an alphanumeric character (lower and uppercase letters, numbers and underscores). + is a quantifier. It tells it to match one or more of those characters. It will stop at the space because space is not an alphanumeric character. The parenthesis means to capture the match and put it into $matches. \s is shorthand for space character (and tabs and spans). Used to look for a space between first name and last name. We don't want to actually capture it; just match it, so the next capture knows where to start. Could have instead physically put a spacebar tap in there, but I think using \s is more visible. Just remember that in general, \s matches not only space, but tabs and other 'whitespace' things. (\w+) matches the second word 'Leigh'. Same as the first one. It starts after the \s and stops when it hits the ( because ( is not an alphanumeric character. \(([^\)]+)\) The text to match is (1). Since parenthesis are special characters for regex, we have to escape it in order for the engine to know to look for a parenthesis instead of treat it as the special character. so \( matches the first ( in (1). The next ( is the opening capture parenthesis for what we want to capture inside the (..); the '1'. [^\)] means to match anything that is not a closing parenthesis ')' (remember, have to escape it). + matches one or more of that. ) is the closing parenthesis for the capture, and \) is the closing parenthesis to literally match.
  20. $string = "Nick Leigh(1)"; preg_match("~(\w+?)\b\s(\w+?)\(([^\)]+)\)~",$string,$matches); print_r($matches);
  21. In other words, we're here to teach you how to fish, not do your fishing for you. If you would like someone to write your script for you, I suggest you hire someone, because that's the sort of thing people get paid for doing.
  22. I think he's having trouble understanding why someone won't just write his script for him.
  23. Browser looks like a target marketer's wet dream.
  24. well your solution permits strings like "a8" or "8a" which is just as arbitrary as my solution. Guess the bottom line is the OP needs to specify :/
  25. well if he doesn't want the _ then I would suggest ~^[a-z0-9]*[0-9][a-z0-9]*$~1 Your regex is a whole lot of overkill
×
×
  • 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.