-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
you can also try file_get_contents, but again, all you're going to get is the parsed output, not any actual serverside code. There is no way to get un-parsed code unless you have direct server access or else the file is permissioned and formatted to be read unparsed.
-
another random one which may or may not suit your needs: $b = "-" . (substr($b,-); eh...i didn't read that bit about there maybe not being a - sign nvm.
-
perhaps a SELECT DISTINCT could be of use?
-
Sessions and preventing resubmission of a form
.josh replied to jobsonandrew's topic in PHP Coding Help
In the real world it really depends on how important it really is for you to make sure people don't do that. You could make your script track IP and cookie at the same time and that will probably take care of most people not really intending to circumvent it. But if someone does intend to circumvent it, then again, depends on how important it really is to you to keep it from happening. If it's really that important then yes, you're going to have to force a login. -
Sessions and preventing resubmission of a form
.josh replied to jobsonandrew's topic in PHP Coding Help
tracking it by ip is not effective, as ip's can be easily spoofed or changed. -
Sessions and preventing resubmission of a form
.josh replied to jobsonandrew's topic in PHP Coding Help
Most effective way is to wrap the form around a login. Make the user login and then don't display the form unless it's been 30m since last time. -
left is a reserved word you can use it with mysql if you put backticks around it like this `left` but it's good programming practice to not use reserved words in the first place
-
There's no such thing as endif in php. The brackets are what signify the beginning and end of the code blocks to be executed. In my first post in this thread I pointed out that he is using a colon instead of brackets. Well colons can be used if you are only going to be executing 1 line of code, but he's not, so he needs to wrap the code blocks in brackets (see my first post). He said he didn't see any colons, so I pointed them out. I don't know whether or not this will completely fix his problem but I do know that that's at least one thing wrong with his code. I didn't look any further into it than that.
-
assuming that by $b = 1,2,3; you really meant $b = "1,2,3"; just explode $b
-
I too, am an expert at something or other, and so I can say with great expertness that vermillion is shorthand for a million rats.
-
I don't think there would be an awful lot to look at though, lol. And that's without going into the problems of looking at things if you're travelling at light speed... I'd still hang my head out the window and let the solar wind make my face do those funny : Q shapes with my tongue flapping every which way.
-
first thing I personally see wrong is that you are using a colon instead of brackets with your if...else statement. Colons are used for executing just one expression but you have multiple expressions (multiple lines of code to be executed) so they need to be wrapped in brackets if (condition) { // code here } else { // code here }
-
You can refer to this thread for checking for duplicates. The only thing you really need to add to the solution(s) presented there is to convert all your dropdowns to a posted array or put them into an array.
-
That won't pinpoint the user's mistake because you're throwing all 3 things into one condition. If you want to pinpoint it break it up into 3 conditions. That's not a bit more complicated, nor do you need to be throwing some jsp framework into the mix... and I would not advise using javascript for form validation except as a "bell and whistle" feature for users. That is, it's *more* convenient for them to have a popup before form submission, but you should still have php verify it, because it's on the server, where people can't circumvent your validation. Surely wouldn't $_POST['blah'] come back true regardless if it exists in the form? I could be wring but if it were me, I'd be checking the string length. if (empty($_POST['blah']) { // Error... } Try it and find out
-
just check if the input fields are missing (all inclusive example): <?php if(!$_POST['blah']) { echo "nothing entered <br />"; } ?> <form action = '' method = 'post'> <input type = 'text' name = 'blah'> <input type = 'submit' value = 'submit'> </form>
-
Well if you want to avoid religious discussion then okay. I just thought that since you said both those things, you were somehow linking the two, so I thought I'd throw that in there. But anyways, oh come on now, nobody really knows what will happen, except for what they theorize on paper with equations and variables that aren't 100% proven. I'll do the guinea pig thing. Who knows? Maybe sci-fi has it right and I'll go through some wormhole to the other side of the galaxy Yes, my boldness is only exceeded by my dashing good looks
-
The bible doesn't say aliens don't exist (at least, by our definition). It doesn't mention them one way or the other. To assume that God doesn't feel it's relevant to your christian growing experience would probably be okay, but to outright say they don't exist at all is not a belief based on anything in the scriptures. and anyways, it's 4 years to the next sun-like star. There's lots of things along the way to look at. I wouldn't mind doing it.
-
Okay yeah, i went to nasa.gov and they say in order to retain orbit, it has to go about 17.5k mph so that's like, 4.86 miles per second, but that's still nothing compared to 300k mps...just seems like if we lowered the bar a little we'd go a lot farther in space, exploratory-wise. IDK. Like I said, I'm not a scientist, I'm probably talking out my arse.
-
http://www.phpfreaks.com/forums/index.php/topic,106377.msg977426.html#msg977426
-
I vaguely recall watching some sci-fi movie that seemed to be based off that theory. Or maybe it was some kind of theory involving space being like a piece of paper and you fold it and poke a hole in the paper and push the ship through the hole and then unfold the paper and that makes the ship on the other side of the paper or something. I don't remember what it was called. Anyways: I don't understand why we are trying to go faster than light at this time, if it's supposedly impossible. Why are we trying to get around it? Why can't we focus on something slower, like say, 200,000 km/sec or 100,000 or hell, even 1 km/sec. I mean seriously, even that is pretty F'in fast compared to where we're at right now, right? Or is it like...equally 'impossible' for other reasons, so we're just like, F it, we can't do any of the above, so may as well focus on the big enchilada sort of thing? I'm sure you can tell science is not my thing.
-
Look at that formula. let's assume: strength = 5 defence = 5 dexterity = 5 5-((5+5/[0,1])/[0,1,2,3,4,5]+2) possible outcomes: 5-((10/0)/2) = error (can't divide by 0) 5-((10/0)/3) = error (can't divide by 0) 5-((10/0)/4) = error (can't divide by 0) 5-((10/0)/5) = error (can't divide by 0) 5-((10/0)/6) = error (can't divide by 0) 5-((10/0)/7) = error (can't divide by 0) 5-((10/1)/2) = 0 5-((10/1)/3) = 1.66666666667 5-((10/1)/4) = 2.5 5-((10/1)/5) = 3 5-((10/1)/6) = 3.33333333333 5-((10/1)/7) = 3.57142857143 Your formula won't work half the time, because it will throw out an error. Even if you fix that (like doing rand(1,2) instead), you have to decide whether you want someone to be doing 0-3.5 damage with those levels or not. That may or may not work for your game. Traditionally, defense is not part of a damage equation to begin with, unless you are wanting to consider damage reduction, due to the opponent's defense. Traditionally, dexterity isn't party of a damage equation, unless you are wanting to consider the opponent being able to dodge or parry the attack. Something like this would be more "accurate" traditionally: // find out whether attack will be dodged or not. If it's dodged, no need to calculate damage $dodge = rand(1, 20) + $defender->dexterity; // success is traditionally based on rolling 1d20 with 15+ roll // if successful... if ($dodge > 15) { // damage is nothing $attacker->damage = 0; // if not successful dodge... } else { // example. You would use this to scale $defense = rand(1, $defender->defense); // damage is traditionally calculated by rolling 1d20 and adding modifiers (like strength) // you could in addition include something like player's level by doing rand($level, 20) but you // would have to scale 20 to always be at least equal to level $damage = rand(1,20); // if you scale $defense, you might have to scale this // add the base damage to strength modifier and subtract how much damage was 'absorbed' $attacker->damage = ($damage + $attacker->strength) - $defense; // make sure attacker doesn't end up doing negative damage if ($attacker->damage < 0) { $attacker->damage = 0; } } // subtract damage done from defender's health $defender->health -= $attack->damage; But even that may or may not work for your specific game. Point of my example over paschim's is that you need to use the vars logically, as in, what are those variables representing in your game mechanics. You need to base your formula on what makes sense "physically" in your game reality.
-
Light a match when ChuckNorris farts and voila! Instant firewall.
-
How should we know? We don't have your code sitting in front of us (please don't dump all your code on us; only post relevant stuff, like...just the "fields" method). Not to mention...I'm getting the impression this isn't your script. I suggest you contact the person who made the script or find a community based on it (like a support forum for that specific script) or post in 3rd party forum (this may just end up getting moved there anyways) or hire someone.