thanks.
ps its for a register and admin setup
i keep getting errors.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /index.php on line 37.
and
on line 39.
ive tryed alsorts but cant fix the code.
the code is ...
<?PHP
include ("..//functions.php");
//if the user is logged in.
if (is_logged_in($user)) {
include ("../header.php");
$cookie_read = explode("|", base64_decode($user));
$username = $cookie_read[1];
//put your code here (protected page).
echo "Welcome <b>$username</b>, [ <a href=users.php>Manage Account</a> ] [ <a href=users.php?maa=Logout>Logout</a> ]<br><br>";
echo "<br><br><br>
<h3>an example of protected page, put your protected code/stuff here.</h3>";
include ("../footer.php");
//if the user is not logged in, then tell him to login.
}else{
include ("../header.php");
//header("Location: users.php"); die();
echo "Welcome visitor, would you like to [ <a href/=users.php>Login</a> ] or [ <a href/='users.php?maa=Register/'>Register</a> ]";
//this code will load all registered users
$sql = mysql_query("SELECT * FROM '.$prefix.'_users ORDER BY userid DESC");
$query = mysql_num_rows($sql);
echo '<br><br><br><hr size=1>Total registered users ($num):';
While($row = mysql_fetch_array($sql)){
$userid = $row['userid'];
$username = $row['username'];
$password = $row['password'];
$ipaddress = $row['ipaddress'];
#comment this line if you don't want to print user names.
echo " [ $username ]";
}
}
include (".//footer.php");
?>
<?php
include ("..//functions.php");
//if the user is logged in.
if (is_logged_in($user)) {
include ("../header.php");
$cookie_read = explode("|", base64_decode($user));
$username = $cookie_read[1];
//put your code here (protected page).
echo "Welcome <b>$username</b>, [ <a href=users.php>Manage Account</a> ] [ <a href=users.php?maa=Logout>Logout</a> ]<br><br>";
echo "<br><br><br>
<h3>an example of protected page, put your protected code/stuff here.</h3>";
include ("../footer.php");
//if the user is not logged in, then tell him to login.
}else{
include ("../header.php");
//header("Location: users.php"); die();
echo "Welcome visitor, would you like to [ <a href/=users.php>Login</a> ] or [ <a href/='users.php?maa=Register/'>Register</a> ]";
//this code will load all registered users
$sql = mysql_query("SELECT * FROM '.$prefix.'_users ORDER BY userid DESC");
$query = mysql_num_rows($sql);
echo '<br><br><br><hr size=1>Total registered users ($num):';
while($row = mysql_fetch_array($sql)){
$userid = $row['userid'];
$username = $row['username'];
$password = $row['password'];
$ipaddress = $row['ipaddress'];}
#comment this line if you don't want to print user names.
echo " [ $username ]";
}
include (".//footer.php");
?>
ps its for a register and admin setup
i keep getting errors.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /index.php on line 37.
and
on line 39.
ive tryed alsorts but cant fix the code.
the code is ...
<?PHP
include ("..//functions.php");
//if the user is logged in.
if (is_logged_in($user)) {
include ("../header.php");
$cookie_read = explode("|", base64_decode($user));
$username = $cookie_read[1];
//put your code here (protected page).
echo "Welcome <b>$username</b>, [ <a href=users.php>Manage Account</a> ] [ <a href=users.php?maa=Logout>Logout</a> ]<br><br>";
echo "<br><br><br>
<h3>an example of protected page, put your protected code/stuff here.</h3>";
include ("../footer.php");
//if the user is not logged in, then tell him to login.
}else{
include ("../header.php");
//header("Location: users.php"); die();
echo "Welcome visitor, would you like to [ <a href/=users.php>Login</a> ] or [ <a href/='users.php?maa=Register/'>Register</a> ]";
//this code will load all registered users
$sql = mysql_query("SELECT * FROM '.$prefix.'_users ORDER BY userid DESC");
$query = mysql_num_rows($sql);
echo '<br><br><br><hr size=1>Total registered users ($num):';
While($row = mysql_fetch_array($sql)){
$userid = $row['userid'];
$username = $row['username'];
$password = $row['password'];
$ipaddress = $row['ipaddress'];
#comment this line if you don't want to print user names.
echo " [ $username ]";
}
}
include (".//footer.php");
?>
<?php
include ("..//functions.php");
//if the user is logged in.
if (is_logged_in($user)) {
include ("../header.php");
$cookie_read = explode("|", base64_decode($user));
$username = $cookie_read[1];
//put your code here (protected page).
echo "Welcome <b>$username</b>, [ <a href=users.php>Manage Account</a> ] [ <a href=users.php?maa=Logout>Logout</a> ]<br><br>";
echo "<br><br><br>
<h3>an example of protected page, put your protected code/stuff here.</h3>";
include ("../footer.php");
//if the user is not logged in, then tell him to login.
}else{
include ("../header.php");
//header("Location: users.php"); die();
echo "Welcome visitor, would you like to [ <a href/=users.php>Login</a> ] or [ <a href/='users.php?maa=Register/'>Register</a> ]";
//this code will load all registered users
$sql = mysql_query("SELECT * FROM '.$prefix.'_users ORDER BY userid DESC");
$query = mysql_num_rows($sql);
echo '<br><br><br><hr size=1>Total registered users ($num):';
while($row = mysql_fetch_array($sql)){
$userid = $row['userid'];
$username = $row['username'];
$password = $row['password'];
$ipaddress = $row['ipaddress'];}
#comment this line if you don't want to print user names.
echo " [ $username ]";
}
include (".//footer.php");
?>