-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
no I GOT IT: ChuckNorris
-
Hey yah that's a good one, too. Then you can name servers after marvel chars
-
1: $userstat="select * from pfile where playername='$player'"; 2: $userstats=$db->execute("select * from $dbtables[pfile] where playername='$player'"); - Both are query strings to be sent to the database, but #1 is just the string while #2 looks like it calls a method to actually execute the string (mentioned ^). #1 doesn't actually retrieve information. #2 'probably' does, but we can't know for sure, because we have no idea what $db->execute does, except for making an assumption based on the name. - #2 uses a variable instead of a hardcoded table name. This could mean that that there is more than one table being used, or maybe it's setup that way to allow the admin to specify table name during installation of the script. Could mean other things, but those are probably most likely 2 reasons. - Which is safer? Assuming that the variables are properly sanitized beforehand (which we can't determine from what you posted), they both look equally "safe." Can't really tell which one is "safer," based off just those two things. - #2 seems to utilize a class for database handling, which overall, is the "preferred" thing to do, because it's generally cleaner, more structured, and all those other reasons why people generally prefer object oriented programming over procedural. -On the other hand, #1 could just as easily be OOP based, as well. For all we know, the next line of #1 could be $result=$db->execute($userstat); Which is pretty much the same as #2, except that you're separating it into 2 lines, which is pretty useful for debugging or adding error handling. But #2 could just as easily have error handling inside the class, too. Well, that's about all I have to offer, based on what you've provided. The real point of this post is that there's really know way to tell you which is safer or better, based off what you posted.
-
You can write code into your script to send info to your site to track it, but someone could always remove that code. You could obfuscate your code to make it harder for someone to do that, but it wouldn't be impossible to get around that.
-
Not reliably, unless you force some kind of login system. edit: sorry. basically what ^ said.
-
How about Bean from the Ender's Game series by Orson Scott Card? His main story is told starting with Ender's Shadow and then through the Hedgemon series.
-
There is no trick to splitting long lines into separate lines. Just put your curser where you want to split and hit the enter/return key. The parser doesn't care about the extra spaces and stuff. Well, usually. It does for certain things, like with heredoc or with outputting headers and stuff. I'm sure you probably indent your code, right? Well it's the same thing...
-
No it sounds like the problem is that you are trying to access a file with 2 different programs at the same time: the file explorer and notepad. Windows has always been like that. Files can only be accessed and written to by one program at a time. I think if there's any kind of bug, it's that the file explorer is not releasing the file...which may or may not be considered a bug, depending on how you look at it. I mean, on the one hand, you're clearly using the file explorer to find the file and rightclick > edit, and clearly from there you don't care about file explorer; you've moved onto notepad. But as far as windows is concerned, you still have that file selected, so how is it supposed to know you're through with it there? As far as windows is concerned, you still want to do something with that file in file explorer.
-
Also, the problem with "give me an example code" questions is that with coding, 9/10 times that's pretty much the same as saying "code it for me." That may not be your intention, but to give an example more often than not, means to actually write it for you. It really boils down to what akitchin said: break it down into bite sized chunks as best you can. People are more willing to "give you an example," even if it is in essence the same as writing it for you, if it's just a line or 2 of code, because it only takes a min or 2 to do.
-
It depends. Are you wanting to somehow preserve which 2 values are duplicate, as far as error message? Go with mine. If you are simply wanting to display a generic "duplicate items not allowed" message, and your script doesn't need to preserve it? Go with guiltygear's. I would have suggested what he did in the first place, but I guess I just assumed you wanted to somehow preserve it.
-
- Display 20 records per page. In the tutorial, $rowsperpage defines how many records to display per page. It's set at 10 as an example. All you have to do is change it to 20 or whatever else you want. - Next Page Link. - Last Page Link. - First Page Link. - Previous Page Link. - Hyperlinks to page numbers. Perhaps you should clarify, because the tutorial does provide those things. Perhaps you wanted it to "look" different? I have a sneaking suspicion that there probably isn't some prefab out there that happens to match what you have in mind, and that the only way you are going to get it to "look" the way you want, is to tweak it yourself. - Sort by Rating / Review Name / Date Added. The original pagination tutorial I did (before the site went down), included "sort by" functionality. Basically I just made the column titles links with a sortby=columnname and used the GET method to grab that and sort by that column. Like the page number, I checked to make sure it was a valid column name. You can simply do something like $columns = array('column1','column2','column3'); $default = 'column1'; // default column, in case someone tries to mess with var $sortby = (in_array($_GET['sortby'], $columns))? $_GET['sortby'] : $default; Then just throw the $sortby into the query string and you're good to go. You can hardcode the columns in there or you can make $columns dynamic by doing a show columns query or something. Entirely up to you, depending on your needs. - Alternating line colours. Darkwater covered that. It's as simple as adding a condition in the loop (ternary is good) that acts like an "on/off" switch. - Nice to have: Ability to search within reviews. This isn't really part of pagination. That's something else, and you probably won't ever find a "pagination" script that encapsulates that, simply because it's not part of pagination. You're going to have to look for tutorials/scripts that deal with searching through data/results, and incorporate it into your script as a whole. Easy to apply and maintain. You should probably look for a pagination class for that, or else convert it into a class. The tutorial was meant to teach the concepts of pagination. It's up to you as the programmer to decide how to best fit those concepts into your own program/situation. Overall, you're probably not going to find some "all-in-one" script out there that does everything you want the way you want. That's why you are there, instead of your boss or someone else. It's your job to take something and add to it or tweak it to specifications.
-
dunno if there's a built in function for that (would like to know myself ) but I think you're wanting something like this? <?php // example array $list = array('a','b','c','d','e'); $c = count($list); for ($x = 0; $x < $c; $x++) { for($y = $x + 1; $y < $c; $y++) { if ($list[$x] == $list[$y]) { $duplicate = true; } // end if $x == $y } // end for $y } // end for $x ?>
-
Traditionally: Strength = damage Defense = absorbed damage Dexterity = speed (how fast you attack, ability to dodge attack) Charisma = not really associated with battles. Has to do with for example, getting better deals when buying things These are all modifiers to other things, like what weapon one has, what armor one has, any race/class modifiers if applicable, etc... and traditionally, a dice is rolled to determine certain things like who gets first hit, whether something is dodged or blocked and how much, etc... For instance, just because I have more strength than you doesn't mean I'm going to always hit harder than you on my "turn." If those variables are the only thing you are considering in your game, then you still need to explain how fighting is done in the first place. Do both people have X health and basically each person takes turns swinging at each other until one of them dies? Does the script automatically do this or is it done in "real time" somehow (using flash, ajax, whatever)? The reason I ask these things is because we could throw out any battle "formula" but it may or may not work for you, balance-wise. Do you just want some kind of generic "okay, let's just take turns swinging at each other, first person to 0 loses?" If $a->strength = 10 and $d->strength = 5, do you always want $a to hit for 10 straight damage, $d for 5? Do you want attacks to be absorbed by exactly what defense defender has? Chance of dodge/parry/evade? Chance of getting extra swing in, due to more dexterity? Incorporate charisma in it somehow, like...idk, someone loses a turn due to other one being more charismatic? Chance of critical hits? Are there any weapons or armor being considered? Any other game "features" like spells, potions, scrolls, etc..? Some kind of character level to consider? Figuring out your game mechanics is the hardest part of game design. It's also the funnest, because you get to make the rules. But it's hard because you will quickly learn from testing that any little one thing can end up vastly throwing off the balance of everything else. You need to sit down and picture in your head exactly how you want a "battle" to go. Write it down on paper. Put down everything that can happen during this battle and when. Once you have that down, the coding part will be easy.
-
There really is no magic wand to wave. There are a hundred things that could affect performance one way or the other, all going on at the same time. Most of them you have no control over at all. Even if you got the very best of the best on your end, you could still be puttering at a snail's pace. Sometimes all the stars line up and you're like speedy gonzalez sometimes you're a sloth. Most the time it's some happy medium in-between.
-
Agreed. Every job should have a training program, no matter what products/services they offer. When I was a manager at Hardees, I didn't just throw people on the line and tell them to have at it. Even if they were the badass at McD's or some other burger joint. They could have been the fastest grill slinger in the west, but that just means they'll probably pick it up quick, not be psychic. On the other hand, you'd be surprised how many times I've had to teach new employees how to sweep and mop the floor... so on that note, I think that in any given field, there are some things that should go without saying... Like for instance, I may need to teach Joe what goes on our burger and what order, but because he has fastfood experience, I shouldn't have to tell him pickles should be placed evenly on the bun, or to keep your workstation clean, or wrap the burger neatly. Or wear gloves. Etc... I've worked other jobs from sales to dispatching to accounting to tech support, and it's the same principle. If a company fails to make sure the newbie learns the ropes, then they are only hurting themselves. If a senior developer or manager fails to do carry out training, then not only does he fail at being in charge, but chances are, he's probably trying to sabotage the company. He probably feels that the more he teaches someone else to do the job, the less secure his own position is. The sad truth is, it's probably true. But that don't make it right to do that.
-
Actually, there have been several times in the last couple weeks that straight www.google.com has timed out on me, even just initially loading. Or it would say it's not found. Going anywhere else worked just fine. Lasted about 5-10m each time.
-
Freelancing board - 'burn list' ?
.josh replied to PC Nerd's topic in PHPFreaks.com Website Feedback
Our official stance is that we are not responsible, nor will we get involved in disputes coming from the freelance board. That's pretty much why we don't allow responses to posts; it's supposed to basically just be a calling card for services offered/needed. But in principle it's really no different than opening a thread ranting about some experience. People do it all the time and nobody seems to be bothered by it. So in principle, having a single thread dedicated to posting experiences shouldn't be a problem, either; in fact, it might even help make things more tidy. In addition to that, we do have all kinds of threads dedicated to people endorsing (or flaming) other things like hosts, books, programs, scripts, etc... so I don't really see how a list endorsing/flaming programming services/clients would be any different. We will explore and consider whether this or something like this is feasible. -
awesome. one last thing: I accidentally did seconds instead of minutes in the date format it should be $nt = date("m-d-y g:ia ", $ts);
-
I think what I would do is initially pull out all the ids from the database and put it in a session array and then base your GET var off the array position, and use the value of that position in your query. That way you are working with a list of numbers without any gaps. pseudo code: <?php session_start(); if (!$_SESSION['id_list']) { $sql = "select id from table"; $result = mysql_query($sql); while ($n = mysql_fetch_row($result)) { $_SESSION['id_list'][]= $n[0]; } // end while $n } // end if !$_SESSION['id_list'] $id = $_SESSION['id_list'][{$_GET['id']}]; // use $id in your query
-
Ah I know why. strtotime considers the first number to be the year when using "-" as a separator so it's parsing it as "y-m-d" instead of "m-d-y" You can fix this by changing your form to use "/" instead of "-" like "m/d/y" or by reordering the string using substr or maybe using explode like $date = "08-22-08"; $temp = explode("-",$date); $newdate = $temp[2] . "-" . $temp[0] . "-" . $temp[1]; then strtotime($newdate) etc...
-
you can do like $data = "The_egg_man</h3><pre>27676"; $t = explode ("<pre>", $data); echo $t[1]; or $t = substr(stristr($data,"<pre>"), 5); echo $t;
-
maybe something like $ts = strtotime("$date $time") + (60 * 60 * 18); $nt = date("m-d-y g:sa ", $ts);
-
Okay, this has gone on long enough. You came here looking for help. People are trying to help. You insist that that's not the problem, but you refuse to even try the solutions offered. Do you seriously believe that all of these people (myself included) would just randomly say "oh yes, must be whitespace," without actually checking it ourselves? You have resorted to e-screaming and yelling, and calling people names. You obviously are not getting the help you are looking for, so I am closing this thread. This is the second thread of yours that has ended up being closed, due to the thread degenerating into yelling and screaming on your part. If you feel that this community is worthless, then go somewhere else. If I see another thread or post by you along these lines, I will show you the door out.
-
I rightclicked > view source and .... <drum roll> White Space.
-
That really long changing number looks more like a token, than part of the password.