please if u can help me
i have created a log in on dreamweaver and i had created one intranet in one company coz i have on study project to do
i have created emploeys with their datas
and created a log in form on dreamweaver
but the problem is: when i log in as a username :grisel with the pasword :grisel the programs showed me my datas and all the other users datas
i want a restrict acces when i log in as grisel, program show me only grisel datas and not the others users datas
if u got it the problem,please give me an asnwer
sincerely grisel ndria

Recommended Answers

Hi, you have to use a WHERE condition in your query to select only the data related to the logged user. For example:

select * from user_details where user_id = 12;

If you paste:

  • the query used to select the data to display
  • the tables …
Jump to Post

This should continue here:

Please don't open more than one thread on the same question. Bye.

Jump to Post

All 5 Replies

Hi, you have to use a WHERE condition in your query to select only the data related to the logged user. For example:

select * from user_details where user_id = 12;

If you paste:

  • the query used to select the data to display
  • the tables structures (just run explain tablename or show create table tablename)
  • and the relations between the table queried in the login step and data tables

then it will be easier to help you.

please help me with smth else,coz i am newer on databased and i had on project on my school.i will send u the codes and please help me if i have any error or wrong query and told me after how to show the details

prova _db.php :

# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_prova_db = "localhost";
$database_prova_db = "intranet_db";
$username_prova_db = "root";
$password_prova_db = "";
$prova_db = mysql_pconnect($hostname_prova_db, $username_prova_db, $password_prova_db) or trigger_error(mysql_error(),E_USER_ERROR); 

prova.php :
<?php require_once('../Connections/prova_db.php'); ?>
mysql_select_db($database_prova_db, $prova_db);
$query_rs1 = "SELECT * FROM punonjesit ";
$rs1 = mysql_query($query_rs1, $prova_db) or die(mysql_error());
$row_rs1 = mysql_fetch_assoc($rs1);
$totalRows_rs1 = mysql_num_rows($rs1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<?php echo $row_rs1['Emri_Depart']; ?>
<p><?php echo $row_rs1['Emri_drejtor']; ?></p>

loglog.php :
<?php require_once('../../../Connections/user1_db.php'); ?><?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];

if (isset($_POST['username'])) {
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "Connections/user1.php";
  $MM_redirectLoginFailed = "loglog.php";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_user1_db, $user1_db);

  $LoginRS__query=sprintf("SELECT username, mbiemri FROM punonjesit WHERE username='%s' AND mbiemri='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 

  $LoginRS = mysql_query($LoginRS__query, $user1_db) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";

    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;      

    if (isset($_SESSION['PrevUrl']) && true) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
    header("Location: " . $MM_redirectLoginSuccess );
  else {
    header("Location: ". $MM_redirectLoginFailed );
?><!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="description" content="Your description">
    <meta name="keywords" content="Your keywords">
    <meta name="author" content="Your name">
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery-1.6.4.min.js"></script>
    <script src="js/cufon-yui.js"></script>
    <script src="js/Franklin_Gothic_Medium_400.font.js"></script>
    <script src="js/cufon-replace.js"></script>
    <script src="js/script.js"></script>
<!--[if lt IE 7]>
  <div class='aligncenter'><a href=""><img src=""border="0"></a></div>  
    <!--[if lt IE 9]>
    <script src="js/html5.js"></script>
  <link rel="stylesheet" href="css/ie.css"> 
<div class="bg">
        <div class="main">
                <ul class="sf-menu">
                    <li class="current"><a href="index.html">home</a><ul>
                            <li><a href="../../../Home.htm">Historik</a></li>
                            <li><a href="more.html">Struktura Organizative</a></li>
                            <li><a href="Kushtet_e_pergjithshme_te_punes_te_Bankes_se_Shqiperise.pdf">Rregulla Administrative </a></li>
                    <li><a href="../../../POLITIKA MONETARE.docx">politika monetare </a></li>
                    <li><a href="../../../ISO_14001_TRAINING_ALB.pdf">trajnime</a></li>
                    <li><a href="index-4.html">blog</a></li>

                <form action="/webroot/intranet_site/intranet_result.php" method="get" name="fmsearch" id="fmsearch">
                <table width="323">
                    <th width="40" height="35"><!--DWLayoutEmptyCell-->&nbsp;</th>
<th width="150" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</th>
<th width="52" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</th>
            <div class="clear"></div>
          <div class="shadow">
                <div class="main-img"></div>
                <img src="../../../images/banka2.bmp" alt="banka" longdesc="../../../images/banka2.bmp">
                <ul class="links">
    <section id="content">

                    <h3>User Login</h3>

<table border="0">
<form method="POST" action="<?php echo $loginFormAction; ?>">
<tr><td>Username</td><td>:</td><td><input type="text" name="username" size="20"></td></tr>
  <td><a href="http://localhost/webroot/intranet_site/Templates/free_extended-package-templates_udwl2lyk39k5pqr9/site/user1.php"></a>
    <input type="password" name="password" size="20"></td></tr>
  <td><a href="http://localhost/webroot/intranet_site/Templates/free_extended-package-templates_udwl2lyk39k5pqr9/site/user1.php">
    <input name="submit" type="submit" value="Login" >

<form name="form1" method="post" action="">

ok but give me an answer for this if u can

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.