-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
regex is not really that great at dealing with nested tags. You should look into DOM.
-
I've never been disappointed by samsung tv's but I am pretty disappointed with my samsung cell phone right now.
-
<Ctrl+F> Input field: st<stopped myself. doh!>
-
In a further effort to hijack this thread, I thought I'd mention a dumb moment I just had. Was reading through my emails and someone mentioned being stuck in some random city on their flight back home and I wasn't sure where it was and before I had time to actually process it, my fingers automatically Ctrl+F'd
-
I don't think it's so much that it's because it says "Microsoft" on the label as that they already have microsoft stuff and for a lot of companies it is easier for them to stick in a disk and push an upgrade-to-the-next-version button than to migrate over to a completely different system. That involves significantly more time and money in actual migration and also in training people. And not just the IT people. Have to train all the employees how to work in the new environment, even on a user level. Learning a new menu system doesn't sound like a big deal to an IT person but to a regular Joe user it is a big deal, like learning a whole new language. People like us do things like code forms all day long and think nothing of the actual form content. Who cares whether the input field is described one way or the other, in this order or that, etc... what does it matter? Use some basic common sense / rudimentary reduction/reasoning and you'll figure it out in like 2 seconds. Well that's not how average Joe user is. It's not that they are stupid, it's just that they aren't trained to think that way, so you can't just dump a new system on them and walk away. Point is, it is not a matter of simply going out and getting the new software and installing it.
-
[SOLVED] PHP GD Image Resize and Watermarking HELP!
.josh replied to iceman023's topic in PHP Coding Help
There is nothing wrong with the GD library or with php in general when it comes to graphics. What's wrong is the people who try to use php as a solution for their graphics needs. It is not meant to be some full blown graphic manipulation language. That sort of language belongs in an environment where you can dedicate a lot of ram and processing power and stuff to it. That is not a server environment. php is a language built to be run on a server, for the web. From that context, GD is actually quite impressive. -
[SOLVED] PHP GD Image Resize and Watermarking HELP!
.josh replied to iceman023's topic in PHP Coding Help
I'm not going to bother picking apart some 3rd party function you picked up, but just looking at the name of the function and the arguments being passed to it, it looks like all you need to do is pass the information you want to it, including the width you want. -
I don't understand what you're asking... somewhere earlier in your script you query your database for info. Then you have this loop that goes through each row returned from your query. So you want those rows to be displayed in an html table 7 columns wide and however many rows tall that works out to, right? Well the normal structure of an html table is: <table> <tr> <td></td> </tr> </table> So before your loop, you echo out the opening table tag and the first opening row tag. Then for your loop, for each iteration, you just echo the data out with td tags wrapped around it. So you want to make a new row every 7 times, so you have a variable incrementing every iteration. Use a modulus condition to see if we're on a 7th iteration. If we are, close out the row and open a new one. After the loop ends, put the final row's closing tag and the table's closing tag. Was there something in there you don't understand, or am I not understanding your problem/goal?
-
yes. That's what you want, right?
-
echo '<table width="400" border="0" cellspacing="0" cellpadding="0">'; echo '<tr><td>'.CLOSE_OUT_MESSAGE.'</td></tr>'; echo '</table>'; echo '<table width="800" border="0" cellspacing="0" cellpadding="0"><tr>'; $rowcnt = 0; while($row = db_fetch_array($letterQuery)) { $tempLetter = explode(" ", $row['products_description']); if(!in_array($tempLetter[0], $used)) { $rowcnt++; $used[] = $tempLetter[0]; echo '<td><a href="'.link_url(PAGENAME_FEATURES, 'featI4yrDauy=4&letter=' . $tempLetter[0]).'" >'.$tempLetter[0].'</a></td>'; if ($rowcnt%7==0) echo "</tr><tr>"; } } echo '</tr></table>';
-
// example 1 if (!ctype_digit($_GET['variable'])) { // not a number } // example 2 if (!preg_match('~^[0-9]+$~',$_GET['variable'])) { // not a number } // example 3 $id = (int) $_GET['variable'];
-
try urbandictionary.com for all your slang definition needs.
-
you are such a buzzkill.
-
someone can change your GET vars to whatever they want but if the value is not in the whitelist, it's invalid, and that's all there is to it. But it obviously depends on what kind of values you are expecting as to the effectiveness of a whitelist. It is not really efficient or even possible to make an array of "allowed" values if for instance the value can be a number. So you have to just validate it, like anything else. So in other words, a whitelist is a very effective way to validate some values/situations, but it's just one thing, and it really depends on the situation.
-
Yes, as a matter of fact I am. You make out like you're so smart by using big fancy words like "preferences" and "fraction" and "credibility" and it makes me bite my thumb at you and fart in your general direction.
-
wow...never ceases to amaze me how when I read "opinion" threads like this, it's usually full of people regurgitating buzz words they heard from somewhere else, and based on the context, have no idea what they actually mean.
-
That's fine, yes. It's called a whitelist. But, you can just make use of in_array to make that more efficient and less long-winded. For one thing, not really sure why you are looping through the $_GET array, as you probably are only passing and using just one, to signify some page id, right? So just refer to it explicitly instead of using a whole foreach loop. Then you can get rid of the nested foreach loop with that in_array so overall you'd just have this: $allow = array('pageid', 'sectionid', 'articleid'); if (!in_array($_GET['variable'],$allow)) { header('location:errorpage.php'); exit(); } It's in essence the same principle of whitelisting, just written more efficiently.
-
Also just thought I'd throw this out there... is there a specific way you were wanting to track this? Like, does this data need to be in your own system? Because you can setup a free google analytics account at http://www.google.com/analytics/ throw the global, generic tracking code on the bottom of your page(s), and it will automatically track all kinds of stuff for you, including exit link clicks (in other words, it already does what I mentioned in the previous post, as far as event listeners)
-
In that case, the only way you are going to be able to do that is with javascript. The easiest way to implement that is by putting something in the link's onclick. Is there a reason why this isn't an option? If it is really not an option, you could setup an event listener to capture it on page exit, but that's still a javascript thing.
-
if you understand the concept in java then you should have no problem understanding the concept in php.
-
RAWR! preg_match('~<input[^>]*((?:id|name)\s?=\s?["\']__VIEWSTATE["\'])?[^>]*value\s?=\s?["\']([^"\']*)["\'](?(1)|[^>]*(?:id|name)\s?=\s?["\']__VIEWSTATE["\'])[^>]*>~i', $html, $matches); Your value will be found in $match[2] Yessiree, unlike your last prom date, this chica won't say no to you! So basically this model offers top of the line fault-tolerance for your content stealing scraping needs. Basically, if your input tag has an id or name attribute with __VIEWSTATE in it somewhere, it will get that value. - Only id? MATCHED. - Only name? MATCHED. - Both? MATCHED. - Before the value? MATCHED. - After the value? MATCHED. - spaces in-between equal signs? MATCHED. - Single quotes used? MATCHED. - Double quotes used? MATCHED. - Case-insensitive? MATCHED.
-
AlexWD your pattern won't work. Your * is greedy and therefore will keep gobbling up everything until it reaches the last > it can find before a new line. At the very least you need to make it non-greedy by adding a ? after the *, but the better thing to do would be to use a negative character class. Also, I threw an 'i' modifier in there for a case-insensitive match on 'img' just in case. $text = preg_replace('/<img([^>]*)>/i' , "<img $1 />", $text);