-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
We actually at one point in time in the past did have a separate "Author" group, where you pretty much just had to be a registered member and ask for it. That was available for like a year and in all that time only like 3 people joined, didn't post anything on the main site, and eventually removed themselves from the Author group. So we just ditched that group. But right now, what you said... that is more or less how the current restrictions effectively are. When a member has been around a while, has x+ posts, and gives decent advice, not being a complete asshat in the community...someone in Guru+ can nominate that member to become a Guru and other Guru+ can vote yay or nay and if the yay's win, they become a Guru, which gives them access to make blogs/tutorials. So...so far IMO there isn't much reason to just give open access to regular members; trying that in the past did not generate the interest we had hoped for, and putting restrictions on it like that..we already do that. IOW my personal vote is to keep it as-is.
-
FYI any guru+ member already has the ability to add a blog or tutorial to main site right now.
-
sowna, judging by the code you posted, it looks like you are working with an html document, perhaps retrieved from a file_get_contents or cURL call, and you are trying to extract the user id from links on the page. When trying to parse html, it is safer to use a DOM Parser than regex. example: // example content to parse. You didn't post that part of your script, but you probably got this from a file_get_contents call or something. $content = <<<EOF <html> <head></head> <body> <a href="site/user/36" title="Vinodkumar">Vinodkumar 36</a> <a href="site/user/37" title="Vinodkumar">Vinodkumar 37</a> <a href="site/user/38" title="Vinodkumar">Vinodkumar 38</a> <a href="site/user/39" title="Vinodkumar">Vinodkumar 39</a> <a href="somepage.php">some page</a> </body> </html> EOF; // create a new DOM object $doc = new DOMDocument(); // load the html content to be parsed $doc->loadHTML($content); // get all the anchor tags $links = $doc->getElementsByTagName('a'); // for each anchor tag... foreach ($links as $link) { // get the href attribute $href = $link->getAttribute('href'); // if href is the right link ... if ( stripos($href,'/user/')!==false ) // user id is the last / delimited value in $href, grab it and put into array of found user ids $user_ids[] = array_pop(explode('/',$href)); } // end foreach anchor tag // example showing output of found user ids echo "<pre>"; print_r($user_ids); echo "</pre>"; output: Array ( [0] => 36 [1] => 37 [2] => 38 [3] => 39 )
-
He can't get the value from the server superglobal...that only contains info about the request url. He is trying to extract a url from a string of html code. My question is, what has he tried? I ask because we are here to help people in their efforts, because our goal is to teach people how to do stuff, not just do their work for them.
-
what have you tried?
-
So today's father's day google logo animation features a letter-child "e" giving its letter-father "l" a cup of coffee via remote control. So, which letter is the mom? If we are to go by color, then all of "Goog" is the mom. Notice that the "g" in "Goog" is conspicuously missing the bottom half of its font stroke, making it look like the "g" is standing on 2 legs...as if "mom" is standing on two legs, bent over in front of "dad", offering up her father's day gift as well. Hey, check out the oo's on that milf...giggity giggity
-
well to be fair, back then, literally every byte counted...
-
I've only poked at perl like once or twice, but doesn't perl do that sort of thing?
-
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
.josh replied to Shockdot's topic in Regex Help
yes, show the code where you receive the posted info, and where you are matching it. Also, put this somewhere: echo "<pre>"; print_r($_POST); echo "</pre>"; and post what is echoed out. -
There isn't case-sensitive and case-insensitive comparison operators of other types, so why would there be here? Well yes, that is half my point. For that half, I agree, the point is that when it comes to current operators, case-sensitivity isn't really relevant. But for proposed operators for things like "begins with.." and "ends with.." case-sensitivity is a common issue and therefore becomes relevant. IOW sure, you can just have $= be case-sensitive but there will be enough situations and people wanting it to sometimes be insensitive that people will want a way to specify, which means a separate operator will have to be made. But since all the other operators don't consider case, having two separate operators for these proposed things would disjoint them from the spirit of other operators. So therefore my argument is that in order to accommodate case, it wouldn't make sense to have operators like this, it's better to stick with functions. In other words, operators are "lower level functions" where things like case should not be considered. There are no conditions involved. Core functions are "higher level functions" where things like that are considered (passing as arguments). There are conditions involved, that allow for variance based on circumstance. Since "begins with..." and "ends with.." will often want to consider case, they should not be expressed as operators, because situations will often demand for variance in behavior. Or another way to put it, in principle, it is essentially the same argument people make for bitching about loosely typed languages.
-
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
.josh replied to Shockdot's topic in Regex Help
This would be odd. Doesn't magic_quotes only affect userland data? In which cases would this happen? Curious for my own debugging Well, yes. But the OP did not specify where the data is coming from. It could be for matching against posted data. Like I said, random shot in the dark. -
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
.josh replied to Shockdot's topic in Regex Help
random shot in the dark: perhaps you are testing with ' and I wonder if your server automatically escapes those to make the value \' and since \ doesn't match, the regex is failing... -
Interesting idea...not sure how I feel about that. Right now you can easily do stuff like that with for instance strpos or using regex. Not sure how useful those operators would be though. How would case-sensitivity (vs. non) be handled? That's common enough that it would have to be considered, and IMO it would be kinda lame to have two separate operators for that.. would be better as a function. On that note...perhaps cleaning up the functions in regards to stuff like case comparison.. for instance, there's no reason why there needs to be a separate strpos vs. strpos, or even strrpos and strripos .. all 4 of those could be combined to a single function.
-
Google Analytics is a popular tracking system. Alternatively, if you are looking to host your own solution, Piwik is pretty comprehensive.
-
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
.josh replied to Shockdot's topic in Regex Help
if ( preg_match('~^[-a-z0-9_:%$.,!]+$~i',$string) ) { // valid } else { // invalid } -
All by itself, I'm not seeing anything wrong with the code you've posted, you'll have to post more. 1) I'm not 100% but I don't think browsers default to a radio button being selected, so if it is "defaulting" to "Male" then I'm pretty sure either that's what you selected or you have other code (not posted) that's setting $gender. I don't see it defaulting to "Male" in the latest FF, Chrome and IE anyways... 2) Dunno what to tell you on this count since near as I can tell, you didn't post relevant code for that 3) Again, you didn't post relevant code for that (the query string and query insert code)
-
Really? That simple? Debbie I've noticed that things tend to get "buggy" sometimes when php tags are embedded inside html tags like that; it's pretty hard to accurately parse (I've seen this in other IDEs too, and if you look at your posted code, you can see even smf's syntax highlighter is buggin') I messed that up. Does this look better... <input id="female" type="radio" name="gender" value="F" <?php echo ((isset($gender) && $gender == "F") ? 'checked="checked"' : ''); ?> /> <label for="female">Female</label> <input id="male" type="radio" name="gender" value="M" <?php echo ((isset($gender) && $gender == "M") ? 'checked="checked"' : ''); ?> /> <label for="male">Male</label> Debbie looks okay to me
-
only thing i think is technically wrong is I think in your label tag, I think the for attribute is supposed to point to an element id not, name.
-
looks okay to me.. I guess netbeans is buggin'
-
I also agree with ManiacDan: that statement is more for like if you were wanting to setup some kind of communication system with someone, you would be adding an extra layer (php) into the mix, thus opening up more possibilities for potential attacks. It's the same working principle that the more hoops you have to jump through, more points you have to go through to get from sender to receiver, the more opportunity to find and exploit a hole. So that statement isn't really applicable for wanting to hash a password to be stored. ...
-
could also take a look at hash() it doesn't offer bcrypt but it does offer a lot of other algorithms (you can use hash_algos to see a list of available)
-
In this case, without seeing what you are assigning, yes, it is a matter of preference, a matter of code readability, but you just need to really pay attention to order of operations when it comes to ternaries, throwing in multiple assignment operators like that...you can very easily make your code behave unexpectedly.
-
it is the pattern delimiter. You used # in yours. You can use pretty much any non-alphanumeric char as the pattern delimiter, I personally like ~ because IMO it looks cleaner and more different than other chars, easier to see them, especially if you use modifiers (like the i modifier i added to make it case in-sensitive).
-
Firstly, whether or not you use the brackets is personal choice, though you certainly need them if you want to execute more than one line of code inside the condition. but as a side note, your ternary is kinda funky. The ternary would be cleaner like so: $icon = ($s_forum['type'] == 4) ? '' : ''; But on that note... you are also assigning an empty string to $icon whether whether true or false, so there's no point in having that at all...unless you typoed and meant to assign different values, you should just do if ($s_forum['type'] == 4) $icon = '';