Código PHP:
define('ROOT_PATH', dirname(__FILE__));
session_start();
$wpath = explode('/login.php', $_SERVER['REQUEST_URI']);
$_SESSION['WPATH']= $wpath[0];
require_once ROOT_PATH . '/lib/models/eimadmin/Login.php';
require_once ROOT_PATH . '/lib/common/authorize.php';
if ((isset($_POST['actionID'])) && $_POST['actionID'] == 'chkAuthentication') {
$login = new Login();
$rset=$login->filterUser(trim($_POST['txtUserName']));
if (md5($_POST['txtPassword']) == $rset[0][1]) {
if ($rset[0][5]=='Enabled') {
if (($rset[0][7] == "Yes") || (($rset[0][7] == "No") && !empty($rset[0][6]))) {
$_SESSION['user']=$rset[0][3];
$_SESSION['userGroup']=$rset[0][4];
$_SESSION['isAdmin']=$rset[0][7];
$_SESSION['empID']=$rset[0][6];
$_SESSION['fname']=$rset[0][2];
/* If not an admin user, check if a supervisor */
$isSupervisor = false;
if ($_SESSION['isAdmin'] == 'No') {
$authorizeObj = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
$isSupervisor = $authorizeObj->isSupervisor();
}
$_SESSION['isSupervisor'] = $isSupervisor;
$wpath = explode('/login.php', $_SERVER['REQUEST_URI']);
$_SESSION['WPATH']= $wpath[0];
setcookie('Loggedin', 'True', 0, '/');
header("Location: ./index.php");
} else {
$InvalidLogin=3;
}
} else $InvalidLogin=2;
} else {
$InvalidLogin=1;
}
}
y mi php cURL es el siguiente:
Código PHP:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://myserver/RRHH/login.php");
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
//curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "txtUserName=Admin&txtPassword=Admin&actionID=chkAuthentication&Submit=+Login+");
$store = curl_exec ($ch);
curl_close ($ch);
el resultado es a medias, ya que me muestra la pagina del admin, pero al momento de clockar algun link, me retorna a la pagina del login.
que hago mal?
saludos