index.php
<? session_start();
error_reporting(E_ERROR | E_PARSE);
//error_reporting(E_ALL);
ini_set("display_errors", 1);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<title>User list</title>
</head>
<body>
<?php
/// Please leave this message
/// Code generator, by http://www.phpcode.hu
include("connect.php"); // connect a mysql...
//PAGER -
function make_links($block,$query,$actual,$link,$site)
{
if($link==1)
{ $res=mysql_query($query);
$nums=mysql_num_rows($res);
if($nums>=$block)
{
$s=0;
for($i=1;$i<=$nums;$i=$i+$block)
{
print "[<a href=\"?$site=".$_GET["$site"]."&from=$s\"> ".($s+1).". page </a>] ";
$s++;
}
}
else
{
print "[<b><a href=\"?$site=".$_GET["$site"]."&from=0\"> 1.page </a> </b>] ";
}
}
if($link==2)
{
$actual=$actual*$block;
$query="$query LIMIT $actual,$block";
return $query;
}
}
$query="SELECT * FROM users_informations ";
// make_links( block_size , query , actual value, if _make_link , the site's value to navigate )
make_links(10,$query,0,1,"site"); //lets make a links according to a block size
print "<hr>";
if(!isset($_GET["from"]))
$query=make_links(10,$query,0,2,0);
else
$query=make_links(10,$query,$_GET["from"],2,0);
$result=mysql_query($query);
$num = mysql_num_rows ($result);
mysql_close();
if ($num > 0 ) {
$i=0;
while ($i < $num) {
$username = mysql_result($result,$i,"username");
$id = mysql_result($result,$i,"id");
echo "<b>username: ".stripslashes($username)."<br>";
echo "<a href=\"details.php?id=$id\">Details</a>";
echo "<br><br>";
$i++; } } else { echo "The database is empty"; }?>
</body>
</html>
----------------------------------------------------------------------------------
And this is details.php
<? session_start();
error_reporting(E_ERROR | E_PARSE);
//error_reporting(E_ALL); // just for debugging...
ini_set("display_errors", 1);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<title>Details</title>
</head>
<body>
<?php
/// Plese leave this message
/// generated by http://www.phpcode.hu
include("connect.php");
$id = (int)$_GET['id'];
$qProfile = "SELECT * FROM users_informations WHERE id=$id ";
$rsProfile = mysql_query($qProfile);
$row = mysql_fetch_array($rsProfile);
extract($row);
$ip = stripslashes($ip);
$registration_date = stripslashes($registration_date);
$username = stripslashes($username);
$email = stripslashes($email);
mysql_close();?>
<?php
//put this part for example in a table...
echo "ip: ".$ip ."<br>" ;
echo "reg date: ". $registration_date ."<br>";
echo " username: ".$username."<br>";
echo "Email: ".$email."<br>";
echo "User id: ".$id."<br>";
?>
</body>
</html>
and in connect.php put this:
<?php
/// For the following details,
/// please contact your server vendor
$hostname='***'; //// specify host, i.e. 'localhost'
$user='****'; //// specify username
$pass='****'; //// specify password
$dbase='****'; //// specify database name
$connection = mysql_connect("$hostname" , "$user" , "$pass")
or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
?>