-
Posts
354 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Irate
-
I was referring to the escape functions he has implemented.
-
More secure, yes. However, there are still some things wrong with this... First thing, you're using the mysql module which is deprecated as of PHP 5.2 (I think, it might have been an earlier version number) and it will be removed in the next major PHP release. Second, you're checking for $_POST['regname'] which will give you an error if the variable is not yet declared - such as if the input field is simply left empty. You should preceed the line with if( isset($_POST['regname'] && !empty($_POST['regname'] ) Same applies for basically every POST and GET variable you want to query.
-
Not all global variables are to be avoided, certain ones are pretty useful and nothing should keep you from using them (like the superglobal arrays $_GET, $_POST, $_SERVER etc. and constants; except if your script requires a certain type and deprecates the other). Using the global keyword breaks variable encapsulation and is usually a sign of doing it wrong.
-
Example why escaping - for example a password field - is important. Say you have two input fields, one for username, one for password. You query the input as following, assuming you are using $_POST and the fields are named "user" and "pass", respectively: $query = "SELECT * FROM `users` WHERE 'user' = '".$_POST['user']."' AND 'pass' = '".$_POST['pass']."'"; Now, since you don't escape the values, the user might put in "admin" as username and "' OR =''" as password, leaving the above $query with following result: $query = "SELECT * FROM `users` WHERE 'user' = 'admin' AND 'pass' = '' OR = ''", so the user doesn't need to supply any password to log into any account he wants to. Same works with inserting a semi-colon and then creating a new database user with all priviledges granted etc.
-
I don't think this forum condones data theft. If you are worrying that you could be banned, you surely are doing the wrong thing. Resort to open source resources or, even better, kindly submit a request to the remote server's administrator.
-
You want to integrate one site into the other? Is that what you mean?
-
Try ipgetinfo.com, maybe?
-
Maybe use .phps files? That way you can even share your PHP source without having to worry that the browser does not display the source because of some possible errors when using .txt files.
-
Most browsers nowadays do just that - they ask the user if they want to execute the geolocation part of the script, if there is any. There is no way to force the browser into sending the exact coordinates to your server (unless of course you use malicious approaches to this).
-
I haven't worked with Comet either, but it's basically just establishing and maintaining a connection while waiting for the server to push responses to you, rather than pulling the data from the server with Ajax (though both work). JavaScript works on all browsers, so this should work, and you're not sending any confident data, so it's fine. JavaScript function for that... function setTitle(title){ document.title = title; return null; }
- 13 replies
-
- dynamic title
- problem
-
(and 3 more)
Tagged with:
-
You could also use a server-side push once something changed on the client side and/or server-side(Ajax and Comet are the keywords, here) and change the title with JavaScript.
- 13 replies
-
- dynamic title
- problem
-
(and 3 more)
Tagged with:
-
Maybe my time's ready in a few years, heh. Anyway, congratz, you deserved it.
-
Cronjobs.
-
... Nevermind me... Was thinking of something completely different.
-
If you declare global variables, then yes, you can transfer variables to another script. Local variables, not so much. Variable scope's the keyword if you happen to struggle on that.
-
Use $(obj).animate( { scrollTop: $(elementToScrollTo).offset().top } , 500, "swing", function(whenComplete){});. Also check out the documentation at the jQuery site if you need to know more about it. http://api.jquery.com/animate/
-
jQuery requires to be loaded from an external source ( try http://code.jquery.com/jquery-1.4.2.min.js ) before you can use any jQuery functions, as jQuery is not integrated into the browser by default.
-
Of course, my bad, quote issues there.
- 17 replies
-
- mysql
- javavscript
-
(and 1 more)
Tagged with:
-
Actually, alert and basically everything else supports the newline escape sequence in JavaScript.
- 17 replies
-
- mysql
- javavscript
-
(and 1 more)
Tagged with:
-
Someone please advise/help. Unexplainable behaviour
Irate replied to codecreative's topic in PHP Coding Help
To get back to my suggestion, Stack Overflow has this small but handy topic about setting 403 errors for certain directories. http://stackoverflow.com/questions/11321998/htaccess-403-forbidden-exclusions -
Do you even get his point? Ajax is frankly said easiest to use with a framework... The developers do not have to make their work harder than it is when they can easily use premade stuff. So, assume this, because I use phpMyAdmin and don't hardcode all tables myself, that makes me a framework soldier? 'k.
-
How do I identify if a number starts with a zero?
Irate replied to Fluoresce's topic in PHP Coding Help
You could pass the number to a string function, then check for the first character. Or, better, remove any 0's not preceded by a 0 in a whole. -
Page URL keep anchor after header redirect
Irate replied to soycharliente's topic in PHP Coding Help
URL rewrite solves the problem.- 9 replies
-
- header
- html anchor
-
(and 1 more)
Tagged with: