ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
Because otherwise sessions don't work right ;-)
-
Eval() is not supposed to be used in real applications, it's for debugging and testing and stuff. Why can't you just...call this function? I still don't know what you're trying to do.
-
That code in your example won't work, actually. $code will have lexical scope.
-
You must die() after a header call.
-
No, you cannot do that. What problem are you trying to solve here? What are you actually trying to do?
-
You're not understanding what I'm saying: Don't have a "backup solution," have a real solution. Javascript is not a real validation solution. It can never be. Ever. Users can get around your javascript. Whatever you put in javascript is "fancy", it is not real functionality. Your back-end code most do the real validation.
-
Never ever ever rely on JavaScript to protect yourself from SQL injection. Any check done in JS must be done identically (or more strictly) at the server side.
-
What debugging steps have you tried?
-
Split() is deprecated, which doesn't mean it's unavailable. It means it's officially not recommended to use it, and sometime in the future it will be removed entirely from the language. Split accepted a regular expression, which preg_split accepts. What are you trying to do? The first line of your code segment should split the constant MODULE_SHIPPING_TABLE_COST on a comma or colon. If you need to split only on a single character or non-variant string, explode() is orders of magnitude faster.
-
That code you pasted will remove the effects of magic_quotes if it's enabled. The code is specifically designed to remove magic_quotes, so it, itself, was doing what you were trying to do by removing it.
-
How to hide personal information about domain?
ManiacDan replied to godsent's topic in Miscellaneous
Not through SOPA/PIPA, but it can be seized and turned off through the existing laws. -
You keep saying "branch names" like we know what that term means. If he's changing the home page, he has access to the code as well, unless the string he's inserting comes from a database table.
-
How to hide personal information about domain?
ManiacDan replied to godsent's topic in Miscellaneous
Obfuscating your domain registration is also illegal in many countries. -
Code like this is used if you're going to be moving your code to a server and you're unsure if magic_quotes will be on or not. This is true for scripts you will sell or otherwise distribute, or sites you'll be placing on shared hosts. If you know magic_quotes will be off, don't handle it in your code.
-
Unsure on SQL for INSERT... ON DUPLICATE UPDATE with two columns
ManiacDan replied to nemovc's topic in MySQL Help
Make another unique index for that combination of columns. The "on duplicate" condition will trigger when a unique key (primary or otherwise) is violated. -
What is the actual problem? What are the symptoms? How far down does the hack go? Are files on the filesystem being modified?
-
If you're saying that your SVN was hacked, it's not a problem with your code, it's the server itself.
-
You're not quite understanding how it works. Functions are completely self-contained. Nothing outside the function knows anything about the contents of the function. The variables and methods used inside the function do not exist outside the function. Imagine that all your functions happen on another computer entirely. So when you assign something to $total inside your function, it doesn't do anything outside your function. Returning a value means that your function can be used in an assignment: function doAdd($a, $b) { $total = $a + $b; return $total; } //won't work: echo $total; //won't work: doAdd(1, 2); echo $total; //will work: $total = doAdd(2, 3); echo $total; -Dan
-
You're still not really understanding: empty() is a function that checks to see if the variable is empty. If it is, empty() returns true. Otherwise, false. Once you overwrite a variable with something else, you cannot recover the old value.
-
If you know one or 2 languages, then you know them all??
ManiacDan replied to OM2's topic in Miscellaneous
There's actually multiple KINDS of programming. There's straight procedural programming, there's OOP, and then there's functional languages like python and lisp which allow for language-level recursion and self modification. So I think the basic premise is: If you can think like a programmer in 2 or 3 of the above paradigms, then the language itself doesn't matter. You might make some "noob" mistakes, but you'll still have the logic correct. I knew a C programmer who was asked to do some emergency maintenance to a PHP app. His code was gorgeous...except he wrote his own sorting algorithm instead of using sort(). That's the kind of "gotcha" you'll run into with a new language. Certain languages have built-in features to make common difficult tasks much easier. You'll also have to learn specific syntax and the data types. Perl has two kinds of arrays (ok, more, but two main ones). Python's handling of function arguments, especially inside classes, is mind boggling to a new user. PHP has more than 40,000 built in functions, none of them namespaced, organized, or even named with a consistent style. However, all of these languages have IF, FOR, FOREACH, WHILE, functions, classes, and lists. That's all you need to be a programmer. -
Note, for any newbies coming across this, that instead of reading the manual the OP asked us to do the research for him. Not only is that bad form, but he immediately received a wrong answer. Not a completely wrong answer, but an answer wrong enough that it would hamper his understanding of the output functions.
-
Right, what you were doing was assigning $naq to the result of "is $naq empty?" Since $naq was not empty, the result of empty($naq) was false, which isn't a number, which is why it doesn't count in min().