Shuffle Table rows and column cells

I am using this table to generate dynamic password when each time user logs in the website. The password will be generated once generate button password is clicked. The password is generated based on picking alternate rows and columns from the table. Also the table will be displayed when clicks on generate button password.

a   b   c   d   e

a y9 2j t1 r3 f8
b g5 k4 39 i2 j9
c w3 e2 t9 w3 r2
d oo h3 h5 96 45
e f6 k7 i3 a1 e3

Password

LOGIN PROCESS




<?php $k=0; do { $matrix[3][0]="h5";$matrix[3][1]="h3";$matrix[3][2]="96";$matrix[3][3]="45";$matrix[3][4]="oo"; $matrix[1][0]="39";$matrix[1][1]="k4";$matrix[1][2]="i2";$matrix[1][3]="j9";$matrix[1][4]="g5"; $matrix[0][0]="t1";$matrix[0][1]="2j";$matrix[0][2]="r3";$matrix[0][3]="f8";$matrix[0][4]="y9"; $matrix[4][0]="i3";$matrix[4][1]="k7";$matrix[4][2]="a1";$matrix[4][3]="e3";$matrix[4][4]="f6"; $matrix[2][0]="t9";$matrix[2][1]="e2";$matrix[2][2]="w3";$matrix[2][3]="r2";$matrix[2][4]="w3"; } while($k>0); $key[0]=4; $key[1]=2; $key[2]=1; $key[3]=5; $key[4]=3; for($i=0;$i<5;$i++) { for($j=$i+1;$j<5;$j++) { if($key[$i]>$key[$j]) { for($y=0;$y<5;$y++) { $temp[$y]=$matrix[$y][$i]; $temp1[$y]=$matrix[$y][$j]; } for($y=0;$y<5;$y++) { $matrix[$y][$j]=$temp[$y]; $matrix[$y][$i]=$temp1[$y]; } } } } ?>
     a b c d e
a <?php echo $matrix[0][0]; ?> <?php echo $matrix[0][1]; ?> <?php echo $matrix[0][2]; ?> <?php echo $matrix[0][3]; ?> <?php echo $matrix[0][4]; ?>
b <?php echo $matrix[1][0]; ?> <?php echo $matrix[1][1]; ?> <?php echo $matrix[1][2]; ?> <?php echo $matrix[1][3]; ?> <?php echo$matrix[1][4]; ?>
c <?php echo $matrix[2][0]; ?> <?php echo $matrix[2][1]; ?> <?php echo $matrix[2][2]; ?> <?php echo $matrix[2][3]; ?> <?php echo $matrix[2][4]; ?>
d <?php echo $matrix[3][0]; ?> <?php echo $matrix[3][1]; ?> <?php echo $matrix[3][2]; ?> <?php echo $matrix[3][3]; ?> <?php echo $matrix[3][4]; ?>
e <?php echo $matrix[4][0]; ?> <?php echo $matrix[4][1]; ?> <?php echo $matrix[4][2]; ?> <?php echo $matrix[4][3]; ?> <?php echo $matrix[4][4]; ?>




Password : 

But question is how could I possibly shuffle these cells values and show user in a table when they log in each time. Really appreciate any help on this.

I hope you are just doing this for fun and not planning to use this for a real working website. No offensive, but that would be hacker heaven if you are. ;D

What he said. :o

Sponsor our Newsletter | Privacy Policy | Terms of Service