Jump to content

followInTo

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by followInTo

  1. So I'm debating whats the best method. I'm aware that catch/blocks should be used in exceptional cases but what if it saves me from having 4 nested if/else conditions? The following is code for an xbox registration site try { // check code is valid $c1 = $this->input->post('code1',true); $c2 = $this->input->post('code2',true); $c3 = $this->input->post('code3',true); $gt = $this->input->post('gamertag',true); $pass = $this->input->post('password',true); if( $c1 == '' || $c2 == '' || $c3 == '') { throw new FormError("Authorization code invalid."); } // check db for code validation $q = $this->db->query("select * from `codes` where `activated` = 0 and `code` = ".$c1.$c2.$c3." limit 0,1"); if($q->num_rows() != 1) { throw new FormError("Authorization code invalid."); } $r = $q->row_array(); $email = $r["recipient_email"]; $codeGt = $r["gamertag"]; // check valid gamertag $q = $this->db->query("select * from `users` where `gamertag` = '".$gt."'"); if($q->num_rows() > 0) { throw new FormError("Gamertag already exists."); } // validate gamertag /w inputted gamertag if(strtolower($codeGt) != strtolower($gt)) { throw new FormError("Gamertag Invalid"); } $this->_createAccount($email,$pass,$gt); // show register-thanks screen $this->load->view("register-thanks",$data); $success = true; } catch (Exception $e) { $data['error'] = $e->getMessage(); }
  2. its just overriding the previous one, anyways i alrdy checked, that doesnt seem to be the problem It can read the directory just perfect but cannot put them in the array, i dont know why
  3. it just doesnt work but no PHP Error comes up. something with the variable i think. Their not recording or something.
  4. the code doesnt work outside a function either, can someone just redo this thing please?
  5. could u help me redo that code i'm a little noobie at php
  6. This is reading a txt base database The code works outside a function but not inside. I'm not sure why, if someone can help alter the coding or tell me an answer, that'd be great! function getTheStuff($usname) { //Begin Pre coding if ($handle = opendir('db/us/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $file = eregi_replace(".php", "", $file); $file = array($file); foreach($file as $listed) { $item3 = file("db/us/".$listed.".php"); foreach ($item3 as $item4) { list($rusername,$rpassword,$rpoints) = explode ("|^|", $item4); } // put all members into an array $allmembers[] = $rpoints."|^|".$rusername."|^|x|^|"; } } } closedir($handle); } // Begin to return data asort($allmembers); $count = 0; foreach($allmembers as $item) { ++$count; list($pointsxx,$usernamexx) = explode("|^|",$item); if($usernamexx == $usname) { return $count; } } }
×
×
  • 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.