| Index
» Projekty
» phpMyEdit
» Fórum
» Restricting changing entries |
 |
proycon
Založený: 08.08.2007
Príspevky: 1
Zaslal: 2007-08-08 11:23
Návrat hore
Odpovedať s citátom
|
I'm not sure if what I want to do is possible with phpMyEdit, but I do hope so: I want to restrict changing entries, so users can only change their own entries (I want to match the logged in user against a user_id field in the database), whilst viewing all. Would this be possible?
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-08-24 12:48
Návrat hore
Odpovedať s citátom
|
yes,
$opts['filters'] = "user_id = ".$COOKIE['whatever'];
is your friend
|
ceaza
Založený: 05.09.2007
Príspevky: 3
Zaslal: 2007-09-09 18:05
Návrat hore
Odpovedať s citátom
|
session_start(); //Starting session
if (!$_SESSION['loggedin'] == 1) {
header("Location: /login.php");
}
require_once($_SERVER['DOCUMENT_ROOT']."classes/db.class.php");// my db class file
if (!empty($PME_sys_rec)){
$sql=("SELECT CustomersID, ID
FROM " . $opts['tb'] . "
WHERE CustomersID='" . $_SESSION['CustomersID'] . "'
AND ID='" .$PME_sys_rec. "'"); // checks the record ID and DB record match.
// echo $sql ."<br>";
$db->Query($sql);
$rows=$db->NumRows($db->Table);
if($rows == 0){
header("Location: /login.php");// send then back to the login page :)
}
}
I know may be slower but I am not relient on anything else.
(does not log them out but lets them know I know they tried something :), if they click the back button they are back at the record.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|