Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. well then as I mentioned before, script querying your db != bandwidth consumption. However, requesting the page itself (user refreshing), will consume bandwidth.
  2. assuming your rows have a unique ID, you will need to modify your pagination to first select all IDs order by rand and then keep track of that list. Store it in a temp table or temp file or as a session array. Then, you're going to have to keep track of which "page" you are on (the offset and limit) through that list, and then for your actual mysql query, select the specific rows (..where id IN (a,b,c,...n) ) based on the ids.
  3. what do you mean down instead of across? How many rows you end up with will depend on how many elements are in your array. Are you saying you want to be able to set how many rows there will be, but have a variant number of columns? First off, I have to ask why would you possibly want to do that?
  4. $_GET is a global array that contains whatever variables are passed in the query string of a request to your script. For example: http://www.somesite.com/somepage.php?p=123 when somepage.php is requested and run, $_GET['p'] will be set to '123' as far as your error, that line of code is trying to make a new object from class 'pager'. Unless you have that class in your script (in the file or included from another file), that class don't exist.
  5. you have the general principle but I think you're over-complicating it. $aLine = array('Item01', 'Item02', 'Item03', 'Item04', 'Item05', 'Item06', 'Item07', 'Item08', 'Item09', 'Item10', 'Item11', 'Item12', 'Item13', 'Item14', 'Item15', 'Item16', 'Item17', 'Item18', 'Item19'); $numCols = 5; echo "<table><tr>"; foreach($aLine as $key => $val) { echo ($key % $numCols == 0)? "</tr><tr>" : ""; echo "<td>$val</td>"; } echo "</tr></table>";
  6. querying the db does not suck up bandwidth when your db is on your server. Are you connecting to a remote db?
  7. Also, since we probably won't be jumping in individually welcoming every single person comes by, here's your generic welcome message: Greetings, ___________ ! Thank you for joining the board! Feel free to ask any question, but please don't be stupid about it. Make an effort to pick the right forum, make an effort to be detailed about your question, make an effort to read relevant stickies/rules, and we'll make an effort to help you. .CV
  8. okay well you can clearly (hopefully) count that there are more numbers than there are in that string...if you use chr() instead of ord() or if you rightclick > view source you will see that your string contains &#39; instead of ' so at some point in time in your script, it's being encoded.
  9. what about in your editor? in your code, do you have an actual ' in your str_replace or did your editor make one of those funky single quotes?
  10. so...you're cheating on a mock exam? I think you're missing the point? I don't know for sure but if I had to guess I'd say A and D or maybe B and D
  11. well I think you are talking about the cursor/caret but can you please explain in more detail what you are trying to do?
  12. my approach $string = "head:body,head:body[0,1,2],head:body[x,y,z],head:body"; $string = preg_split('~(?<=\]),~',$string); edit: hmm i obviously didn't consider no brackets...
  13. i was gonna go for format <drive> does that even work anymore?
  14. Well some people in the other thread thought there were 4 buttons to choose from, despite nrg mentioning rollover states. But as you can see for yourself, it isn't mentioned until after 140 chars, and since 140 chars is the current de facto tl;dr threshold, it's nrg's fault.
  15. From: Button for PHP code? Cast your vote! Voting ends in 7 days, though that's just an estimate and can be haggled. Please refer to the above quote for a clean look of the buttons, and the image below as to what is "the left" and is "the right". Notice, there are only 2 buttons total being voted on. The 2nd row of buttons is the "hover state" of the top row buttons.
  16. http://www.phpfreaks.com/tutorial/php-basic-database-handling
  17. "level system" is pretty ambiguous... care to be more specific?
  18. http://www.phpfreaks.com/tutorial/php-add-text-to-image
  19. GENERAL RULES AND GUIDELINES FOR POSTING This forum is not meant to be a formal freelance service system. It is available for those who wish to seek out services or work from other people, as a courtesy to the members of the phpfreaks community. phpfreaks.com does not specialize in freelance services. This forum is an informal mechanism, as a courtesy to the community. We have no formal mechanism in place (like escrow) to guarantee payment, refund, work done, etc... phpfreaks.com shall not be held responsible for any losses you incur. we have never and continue to not act as any kind of mediator or verification/compensation source for people/organizations who use those forums. We will not be held responsible/liable for any damages, loss, etc. that occur from use of those forums. If you hire someone and they rip you off, don't come crying to us. If someone hires you and they rip you off, don't come crying to us. Those forums are a convenience. If you want something more official that offers guarantees, go to a real freelance site! If you have any questions regarding the freelance forum, feel free to ask them here. RULES: WHERE TO POST:If you want to offer your services, post in the Service Offerings sub-forum.If you want to offer a job or position of employment, post in the Job Offerings sub-forum. DO NOT post your 'resume' in job posting threads. You must directly contact the person you wish to reply to. The only reason replies are allowed is to ask for clarification/details about the job. Failure to adhere to this rule will result in all kinds of things, like you getting banned, or us disallowing replies. DO NOT make more than one thread offering your services. You can edit/reply to your thread to reflect additions/changes. DO NOT post advertisements to other sites offering freelance system services. For example, rentacoder.com, odesk.com, etc.. we have no partiality for or against those sites, but posts such as those are regarded as advertisement, which is against our main site rules. We fully acknowledge that this freelance system is limited, but we aren't here to provide free advertising for other places. If you prefer to do actual business through one of those sites, please specify in direct contacts with the person. You are allowed, as a freelancer or freelance company, to post a link to your personal portfolio/company to those sites, or a site that you own. But general promotions to those other sites are not allowed. GUIDELINES: When posting in the freelancing forum it's important that you provide a way for users to contact you. They will not be able to reply to your topics so they need a way to contact you privately. This can be using PMs, emails, any type of instant messaging service (MSN, Gtalk, AIM, Jabber, etc.) or however you see fit.The more specific you are about your skills, previous experience(s), availability, rates, etc.. the better your chances of getting serious inquiries. Posting vague "I'm available for anything and everything" might get more inquiries on average, but there's a good chance that it will come to nothing, based on any number of things that you could have posted here in the first place. Better to receive 10 emails from people who have some idea of your qualifications/terms, than 100 emails that don't.Be honest about your skills. All day long we see people posting about how they jumped on a job and bit off more than they could chew. They tell the client they can do everything they need and more, promise them the moon, and then promptly crap their pants about 5 minutes into it. Don't be that person! Some people get lucky and figure it out. Some people get lucky and get help that figures it out. Most people end up having to give up the project. Which leads us to....Wasting people's time and money. You waste the client's time. You waste your own time. That bad rep will more than likely come back to haunt you. All day long we get people trying to get us to delete their posts because they don't want their skeletons to come out of the closet (no we won't hide them for you). So be smart! Do the simplest easiest thing to avoid all this headache: be truthful about your skills. If you feel that being truthful will limit your potential clients, then get off your bum and hit the books. You can't seriously be in the business of trying to con people, are you?Be very clear about what you are doing. Some clients know your job, and are just looking for extra set of hands. Most do not, and therefore seek someone who does. Therefore, if you want to avoid headaches, it is your responsibility to be very clear about what it is you're going to do. What you're willing to do. What kind of support you offer after the fact, etc... on that note..Be up front and thorough about your prices. Take a look at the situation. Quote a price for it. Quote prices for things that might come up later. The more you have to go back later saying that xyz was unforseen or xyz wasn't part of the deal, regardless of whether or not you are in the right, the more you are going to come off as shady, to the client. It's like when you take your car to a mechanic and that funny noise goes from being one little $50 thing to a $2000 rebuild because the mechanic kept coming back to you saying something else is wrong. That stuff may indeed be needed, but the fact that you didn't think about it and let them know ahead of time speaks volumes about your skills as a coder. Some things just aren't foreseeable. Most things are.
  20. I believe thorpe is working on something like that right now. Don't have an ETA or anything.
  21. How about a captcha tutorial? Lots of them around, but we're supposed to be a resource, right? I may do it myself, if someone else doesn't volunteer.
  22. Honestly I don't really see anybody writing a tutorial like that on a technical level (actual code). Maybe on some kind of abstract level, like conveying general principles and program flow and good design, advice and pitfalls, etc.. but most tutorials that involve actual code are for teaching how to make building blocks. Things like forums and blogs and cms' are more like actual buildings, not building blocks. If you sit down and break down for instance all the things in a forum, you will quite easily find tutorials for just about all of those 'building blocks.' I suggest you either do that, or maybe find an open source version of one of those things and jump into it, instead.
  23. Basic Database Handling
  24. okay I thought I'd make a new post instead of editing the last one, since it's on a new page. Okay, It's all about.. Bride of Franky! <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); $adjectives = array('abhorrent','abject','abnormal','abrasive','absorbed','absurd', 'abusive','acrid','agonizing','ambiguous','ancient','apathetic', 'average','bad','barbarous','bawdy','belligerent','berserk', 'bizarre','black','boorish','brash','brawny','burly', 'callous','cold','colossal','combative','crabby','craven', 'crazy','creepy','crooked','cynical','demonic','deranged', 'devilish','direful','dirty','disagreeable','draconian','drunk', 'dysfunctional','erratic','evasive','evil','filthy','flippant', 'gaudy','giant','gigantic','greedy','grotesque','grouchy', 'gruesome','grumpy','guiltless','hellish','horrible','huge', 'hulking','icky','immense','irate','jaded','jittery', 'macho','maddening','malicious','mammoth','maniacal','massive', 'mighty','mindless','moaning','moldy','murky','mysterious', 'nasty','nauseating','noxious','oafish','obscene','psychotic', 'rabid','ruthless','sassy','scary','smelly','snobbish', 'snotty','spooky','threatening','tightfisted','tough','towering', 'trashy','ugly','unbecoming','unsightly','vagabond','vengeful', 'venomous','vulgar','wicked','wrathful','wretched'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Singleton { public static function getInstance(); } interface Actor { public function speak(); public function meet($person); public function eat($animalArr); } abstract class Intestant_Abstract { abstract public function input($input); abstract public function output(); } class Stomach extends Intestant_Abstract implements Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } public $kilosOfFood; public function input($input){ $this->kilosOfFood += strlen($input); echo 'Franky liky to eats '.$input.'..<br />'; if($this->kilosOfFood > (strlen(implode('',$GLOBALS['animals']))/1.5)){ $this->output(); } } public function output(){ echo '<br />Bhaarf..<br />'; } } class Guts implements ArrayAccess, Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } private $intestants; public function add($name){ $this->intestants[$name] = call_user_func(array($name, 'getInstance')); } public function remove($key) { unset($this->intestants[$key]); } public function offsetExists($offset) { return isset($this->intestants[$offset]); } public function offsetGet($offset) { return $this->intestants[$offset]; } public function offsetSet($name, $value) { $this->add($name); } public function offsetUnset($offset) { unset($this->intestants[$offset]); } } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } function eat($animals){ shuffle($animals); $guts = Guts::getInstance(); $guts->add('Stomach'); $guts['Stomach']->input(next($animals)); } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } if (isset($_POST['relativeName'])) { $relativeName = $_POST['relativeName']; $relativeType = $_POST['relativeType']; $h = new Franky; $h->speak(); $h->meet($relativeName); $h->speak(true); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $monstername = $adjectives[array_rand($adjectives)]; echo "<br/>Franky wants to marry your $relativeType.<br/>"; echo "$relativeName will join the monster family and<br/>"; echo "$relativeName's monster name will be $relativeName the $monstername.<br/>"; } else { $person = $relatives[array_rand($relatives)]; echo <<<FORMINT What's your $person's name?<br/> <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <input type = 'text' name = 'relativeName' size = '10'> <input type = 'hidden' name = 'relativeType' value = '$person'> <input type = 'submit' value = 'submit'> </form> FORMINT; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.