@Manchary Manchaary , , , , .
, auth_login.php
if (sizeof($user) > 0) {
cacti_log("LOGIN: User '" . $user["username"] . "' Authenticated", false, "AUTH");
db_execute("INSERT INTO user_log (username,user_id,result,ip,time) VALUES (" . $cnn_id->qstr($username) . "," . $user["id"] . ",1,'"$
$user_enabled = $user["enabled"];
if ($user_enabled != "on") {
auth_display_custom_error_message("Access Denied, user account disabled.");
exit;
}
$_SESSION["sess_user_id"] = $user["id"];
$sharesession = fopen("/var/www/html/session/session", "w") or die("Unable to open file!");
fwrite($sharesession, "start");
fclose($sharesession);
php- , , php write "start" session.
php- cacti2.php iframe .
<?php
$sharesession = fopen("/var/www/html/session/session", "r") or die("Unable to open file!");
$session = fread($sharesession,filesize("/var/www/html/session/session"));
fclose($sharesession);
if ($session == "start"){
header("Location: http://MYCACTI/cacti/graph_view.php?action=tree&tree_id=1&leaf_id=8&select_first=true");
}
else {
?>
<form action="http://MYCACTI/cacti/" name="auth_cacti" method="post">
<input type="hidden" name="action" value="login">
<input type="hidden" name="realm" value="local">
<input type="hidden" name="login_username" value="soc">
<input type="hidden" name="login_password" value="telkom">
</form>
<script>
window.onload = PageLoad;
function PageLoad(){
Login();
}
function Login(){
setTimeout(document.forms['auth_cacti'].submit(), 4000);
}
</script>
<?php
}
?>
-, php session, session "start" , cacti graph, "stop" , .
, session , , logout.php
include("./include/auth.php");
api_plugin_hook('logout_pre_session_destroy');
setcookie(session_name(),"",time() - 3600,"/");
session_destroy();
$sharesession = fopen("/var/www/html/session/session", "w") or die("Unable to open file!");
fwrite($sharesession, "stop");
fclose($sharesession);
"stop" session , cacti2.php , , , , .