redbullmarky
Staff Alumni-
Posts
2,863 -
Joined
-
Last visited
Never
Everything posted by redbullmarky
-
it's not gonna cause any serious issues, but valid code ensures that there's a higher likelihood that it'll work across a larger collection of browsers, and that people who use alternative means to look at the web (speech, text only, etc) can get full use out of it. so yes, & is the proper HTML way to output an ampersand. Also - you may see 200 errors, but 9 times out of 10, I find that many errors are knock-on effects of others, so don't necessarily assume that getting your code validated is such a tall order. cheers
-
hmm can't be 100% certain but doesnt Windows come with a bit of kit for handling basic video edits? It's nothing fancy, but it does the trick for overlaying text, fades, snipping, etc. [b]edit[/b] windows movie maker. it's kinda tucked away in Accessories/Entertainment in the start menu - at least on XP Pro anyhow.
-
you need to carefully check user input. one problem i sent you a PM about. the other is the fact that i can submit a blank contact form. cheers
-
yeah that's right. however, using .tpl as the definitive extension (as opposed to .tpl.php) or something is not a great idea unless the .tpl files are stored outside the web root. most servers out of the box will either server .tpl files (direct access that is) as plain text or offer them for download. so when using non-standard extensions (ie, not php/htm/html/jpg/gif/png, etc) it's always a good idea to either: 1, add a further extension (.tpl => .tpl.php) so that if the file IS accessed, it wont reveal anything potentially damaging - after all, the only REASON for a .tpl extension is for visual clues to developer that the file is in fact a template. 2, store them outside of the doc root 3, change the server settings to parse .tpl files as .php files
-
if he's actually getting the PHP file (with the actual code in it as written) then it'll be a server/setup issue, not specifically his browser. occasionally (though extremely rare) it can appear that this is happening, though the actual contents of the original file wont be found in the file itself if opened...
-
though i think it's something worth knowing, whether you enforce it is a different matter... personally i love the short tags (though just for templates, not my actual scripts). i've been with a tonne of hosts. most have had it turned on. the rest have allowed an easy addition of a htaccess file to allow it. those that dont allow this kind of flexibility aren't really worth the trouble, to be honest, as there will always be something you'll need to change at some point - be it short tags, mod_rewrite rules to sort out URLS, cookie's for sessions, register_globals, etc. PHP6 is keeping it, so that's thumbs up enough for me - especially considering the benefits.
-
can a PHP function return more than 1 value ??
redbullmarky replied to truegilly's topic in PHP Coding Help
now you're returning an array, make sure you're accessing the return result's elements, not the whole thing. [code] <?php $ret = consolidate(); // correct echo $ret['actual']; echo $ret['target']; // not correct echo $ret; ?> [/code] -
erm i cant see an else clause ... ? you do need to change the or if ($user==0) line to else if ($user ==0) though
-
[url=http://www.php.net/imagecopy]imagecopy()[/url] [url=http://www.php.net/imagecopyresized]imagecopyresized()[/url] [url=http://www.php.net/imagecopyresampled]imagecopyresampled()[/url]
-
why do you need to ftp in? if you're mail needs auth to send, then it maybe worth taking a look at [url=http://phpmailer.sourceforge.net/]phpMailer[/url]
-
in addition, i think it'd be nicer to match the drop shadow of the main site with that of the photo that hangs off the side. slightly offset and grey
-
CI and Cake both handle templating in the same way...Neither by default use what you would call an 'engine' (in the sense of using stuff like {VAR} and {NAME} etc - both use PHP natively as their template syntax. Nameless12, that's some good advice dude. I probably do get carried away a little when trying to get a particular point across. On the other hand though, Frameworks and MVC make a fantastic couple, and a framework can easily be designed AROUND the MVC pattern. As far as I'm concerned, MVC is more than just a pattern - it's an entire structure. Patterns to me are the more trivial things that complete specific tasks that would in turn become PART of an MVC setup. mod_rewrite just kinda helps things along in terms of getting everything going through a single point of entry to keep things all nice and compact. So i'm not actually stating that all of this is essential/a requirement of MVC, but it sure helps alot in the grand scheme of things, IMO of course. cheers
-
Best way to protect against SQL injection?
redbullmarky replied to Andrew R's topic in PHP Coding Help
[quote author=Snooble link=topic=123708.msg511789#msg511789 date=1169588842] restrict the use of hex. Snooble [/quote] ??? ??? -
i'm not 100% sure where you're coming from here, but taking a stab, you maybe missing how it works a bit. In CodeIgniter and Cake, only certain files are/can be directly accessed. Everything else is tucked away and included as required by the framework itself. The files that can be directly accessed are generally: 1, the main index.php, which handles the request, "boots" the framework according to the request and spits out the result. M's, V's and C's aren't directly accessed at any point via the URL - many of the URL's you see though have some form of mod_rewriting going on. 2, CSS files 3, Javascript files 4, Images so your Model/View/Controllers directories (at least when referring to Cake or CI, anyway) can be safely tucked away elsewhere, preferably out of the web root altogether.
-
Best way to protect against SQL injection?
redbullmarky replied to Andrew R's topic in PHP Coding Help
a good ol' dose of [url=http://www.php.net/mysql_real_escape_string]mysql_real_escape_string[/url] often does the trick. [code] <?php $name = mysql_real_escape_string($name); $date = mysql_real_escape_string($date); $query_qy = "SELECT * FROM tablename where name = '$name' && date = '$date'"; $qy= mysql_query($query_qy) or die(mysql_error()); $row_qy = mysql_fetch_assoc($qy); ?> [/code] -
a little off topic but: the use of @ has been mentioned, but personally I think it's seldom a good idea to use it. Amongst many other things, such as making life easier, frameworks should be handling errors properly rather than hiding them. If the day comes where you have an error and cant find it, you're stuffed. take a look at [url=http://www.php.net/set_error_handler]set_error_handler[/url]. it goes along way to push errors all into one single place which can, at your disretion, be turned on/off.
-
have you tried to get the answer [url=http://phpmailer.sourceforge.net/]straight from the horses mouth[/url] first? you need to use either AddCC or AddBCC in the place of AddAddress. cheers
-
i actually use the first method, based on trials with frameworks such as Cake and CodeIgniter. Once you get used to it, you'll find things much easier to maintain and use in the future than doing things the classic way.
-
splitting it into array elements would just involve [url=http://www.php.net/explode]explode[/url]. if the reason you're only using 'br' (ie, not the full tag) is to cater for both < br > and < br />, then a quick str_replace will help: [code] <?php $text = str_replace('<br>', '<br />', $text); $paragraphs = explode('<br />', $text); ?> [/code]
-
after this line: [code] $fullpath = str_replace("..", "", str_replace("\.", "", str_replace("//", "/", $fullpath))); [/code] just put an: echo $fullpath; to display the path, and then double check that the path displayed exists. you could be getting into a bit of a mix with relative/absolute paths.