[SOLVED]Viewing all member's username and passwords!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

[SOLVED]Viewing all member's username and passwords!

Post by Straterra »

I have a database with a view users, and I am trying to add a feature so that I can view all passwords..I have this code, but it does some really funky things. Please help me fix it. It shows one user, but shows every password with that user

EXAMPLE

straterra : moo
straterra : thisisanotherpw
straterra : foo
mofo : moo
mofo : thisisanotherpw
mofo : foo

Code: Select all

<?php
include('banned.php');
?>
<?php
$tester = isset($_SESSION["username"]);
if ( $tester == false ) {
header("Location: loginform.php");
} else {
$user = $_SESSION["username"];
if ( $user == "straterra" ) {
$dbname = 'eckbios';
if ($db = sqlite_open($dbname, 0666, $sqliteerror)){
$result = (sqlite_query($db, "SELECT username from logintable ORDER BY username"));
while ($row=sqlite_fetch_array($result)) {
$result2 = (sqlite_query($db, "SELECT password from logintable ORDER BY username"));
while ($row2=sqlite_fetch_array($result2)) {
echo $row['username']." : ".$row2['password']."<br>";
}
}
}
} else {
header("Location: loginform.php");
}
}
?>
Last edited by Straterra on Sat Jan 10, 2004 3:43 pm, edited 1 time in total.
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

I have fixed this myself. Here is the code that works! ^_^

Code: Select all

<?php
include('banned.php');
?>
<?php
$tester = isset($_SESSION["username"]);
if ( $tester == false ) {
header("Location: loginform.php");
} else {
$user = $_SESSION["username"];
if ( $user == "straterra" ) {
$dbname = 'eckbios';
if ($db = sqlite_open($dbname, 0666, $sqliteerror)){
$result = (sqlite_query($db, "SELECT username from logintable ORDER BY username"));
while ($row=sqlite_fetch_array($result)) {
$moo = $row['username'];
$result2 = sqlite_query($db, "select password from logintable where username = '$moo'");
$result2 = sqlite_fetch_array($result2);
echo $row['username']." : ".$result2['password']."<br>";
}
}
} else {
header("Location: loginform.php");
}
}
?>
Post Reply