Jump to content

jsschmitt

Members
  • Posts

    105
  • Joined

  • Last visited

    Never

About jsschmitt

  • Birthday 05/08/1988

Profile Information

  • Gender
    Male
  • Location
    York, PA

jsschmitt's Achievements

Member

Member (2/5)

0

Reputation

  1. My hero. Forgot about classes and global variables. Told you I was feeling stupid.
  2. Is the last part of: if($state==TRUE){ return $this->new_letters; } else { $trys++; $this->bruteForce($base, $state, $trys); } Not enough?
  3. I'm trying to return to array of letters that bruteForce finally decides upon. However, I can't seem to pass the array to librarySolve. I'm feeling dumb, any help? function librarySolve($string){ $temp = $this->bruteForce($string, FALSE, 0); return $temp; } function bruteForce($string, $state, $trys){ $base = $string; $state = $state; $new_letters = array(); if($trys <= 6000){ $this->new_letters = $this->generateRandomCipher(); $string = preg_replace('/[^a-zA-Z0-9-\s]/', '', $string); for($a=0;$a<=strlen($string);$a++){ $letter = substr($string, $a, 1); $pattern = "/[A-Z]/"; if(preg_match($pattern, $letter)!=0){ $new_letter = $this->new_letters[$letter]; } else if(preg_match($pattern, $letter)==0) { $new_letter = $letter; } $decipher .= $new_letter; } $word_array = explode(" ", $decipher); $count = 0; for($a=0;$a<count($word_array);$a++){ $do = $this->checkWord($word_array[$a]); if(!empty($do)){ $count++; } } if($count>=2){ $state = TRUE; } else { $state = FALSE; } if($state==TRUE){ return $this->new_letters; } else { $trys++; $this->bruteForce($base, $state, $trys); } } }
  4. Well... in case anyone cares.. I figured it out... $sql = 'SELECT t1.uname, t2.aboutMe, t3.url, t4.crap FROM `table1` AS t1 LEFT JOIN `table2` AS t2 ON t2.uname_id=t1.id LEFT JOIN `table3` AS t3 ON t3.uname_id=t1.id LEFT JOIN `table4` AS t4 ON t4.uname_id=t1.id'; $run = mysql_query($sql) or die(mysql_error()); $i=0; while($row = mysql_fetch_array($run, MYSQL_ASSOC)) { if (!is_array($records[$row['uname']])) $records[$row['uname']] = array( 'uname' => $row['uname'], 'aboutMe' => $row['aboutMe'], 'crap' => $row['crap']); $records[$row['uname']][] = array( 'url' => $row['url']); } foreach ($records as $userinfo) { echo $userinfo['uname'].' <br/> '; echo $userinfo['aboutMe'] . ' <br/> '; for($i=0; $i<$n, $n=count($userinfo[$i]); $i++){ echo $userinfo[$i]['url'] . ' <br/> '; } echo $userinfo['crap'] . '<br /><br/>'; } Outputs: tester I am tester! http://www.tester.com www.gmail.com www.google.com crap bob Testing? www.ohcrap.com crap2 tom
  5. Can you take that page down to 3 images?
  6. $sql="SELECT amount FROM payments WHERE user='".$_SESSION['user']."' AND member_id='".$_SESSION['id']."'" Is not ended with a ;
  7. Ok... so I sorta found something: $sql = 'SELECT t1.uname, t2.aboutMe, t3.url, t4.crap FROM `table1` AS t1 LEFT JOIN `table2` AS t2 ON t2.uname_id=t1.id LEFT JOIN `table3` AS t3 ON t3.uname_id=t1.id LEFT JOIN `table4` AS t4 ON t4.uname_id=t1.id'; $run = mysql_query($sql) or die(mysql_error()); $i=0; while($row = mysql_fetch_array($run, MYSQL_ASSOC)) { if (!is_array($records[$row['uname']])) $records[$row['uname']] = array( 'uname' => $row['uname'], 'aboutMe' => $row['aboutMe'], 'crap' => $row['crap']); $records[$row['uname']][] = array( 'url' => $row['url']); } foreach ($records as $userinfo) { echo $userinfo['uname'].' - '; echo $userinfo['aboutMe'] . ' - '; foreach ($records as $userinfo => $urls) { foreach ($urls as $url) { echo $url['url'] . ' - '; } } echo $userinfo['crap'] . '<br />'; } echo "<pre>"; print_r($records); echo "</pre>"; mysql_free_result($run); It outputs the following: tester - I am tester! - t - I - c - http://www.tester.com - www.gmail.com - www.google.com - b - T - c - www.ohcrap.com - t - - - - t bob - Testing? - t - I - c - http://www.tester.com - www.gmail.com - www.google.com - b - T - c - www.ohcrap.com - t - - - - t tom - - t - I - c - http://www.tester.com - www.gmail.com - www.google.com - b - T - c - www.ohcrap.com - t - - - - t Array ( [tester] => Array ( [uname] => tester [aboutMe] => I am tester! [crap] => crap [0] => Array ( [url] => http://www.tester.com ) [1] => Array ( [url] => www.gmail.com ) [2] => Array ( [url] => www.google.com ) ) [bob] => Array ( [uname] => bob [aboutMe] => Testing? [crap] => crap2 [0] => Array ( [url] => www.ohcrap.com ) ) [tom] => Array ( [uname] => tom [aboutMe] => [crap] => [0] => Array ( [url] => ) ) ) Now I just need to figure out where the single character items are being output from! Any help?
  8. Not a problem... ran into the same issue myself ^.^
  9. Here is the situation: I am learning (teaching myself) about mySQL joins... and I have reached a spot where I need some help. Below is my table structure, and while I know it's not intricate and my not make much sense, it is how I am learning. Table1 ID uname Table2 ID aboutMe uname_ID Table3 ID url uname_ID Table4 id crap uname_ID The code I currently have is this: $sql = 'SELECT t1.uname, t2.aboutMe, t3.url, t4.crap FROM `table1` AS t1 LEFT JOIN `table2` AS t2 ON t2.uname_id=t1.id LEFT JOIN `table3` AS t3 ON t3.uname_id=t1.id LEFT JOIN `table4` AS t4 ON t4.uname_id=t1.id'; $run = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($run)){ echo $row['uname']. " - ". $row['aboutMe']. " - ". $row['url']. " - ". $row['crap']; echo "<br />"; } mysql_free_result($run); This outputs the following: tester - I am tester! - http://www.tester.com - crap tester - I am tester! - www.gmail.com - crap tester - I am tester! - www.google.com - crap bob - Testing? - www.ohcrap.com - crap2 What I want / need to understand, is how to have it loop through, but not output all of the information if there is duplicates. i.e. tester - I am tester! - http://www.tester.com - www.gmail.com - www.google.com - crap bob - Testing? - www.ohcrap.com - crap2 Any help?
  10. Did you make sure to turn on short open tags?
  11. Gah... Still lost.. Ok... Here is what I have.. Families: ID Name 1 Schmitt Users: id username first_name last_name family password 1 jschmitt Schmitt Schmitt 1 xxxxxxxxx And the code I currently have.. <?php session_start(); $sesuser = $_POST['username']; $sespass = $_POST['password']; include 'php/includes/dbconnect.php'; $query = "SELECT `username` , `family` FROM `users` WHERE `username` = '".$sesuser."' AND `password` = '".$sespass."' INNER JOIN `group` ON users.family = families.id"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result)){ $_SESSION['username'] = $sesuser; } while ($row = mysql_fetch_array($result)) { $_SESSION['family'] = $row['family']; } include 'php/includes/closedb.php'; zheader('Location: http://anomymage.com/famshare/') ?> Please... tell me what I am doing wrong!
  12. Ok... So I follow you. I think. Groups: ID Group 1 Testers Users: ID Name Group 1 Josh 1 Now... how do I show that interaction between them?
×
×
  • 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.