Hola, tampoco funciona quitando el session_start del funciones.php.
VarDump's:
vardump al cargar la página index.php
array(6) { ["adws"]=> string(23) "http://localhost:23967/" ["adweb"]=> string(39) "http://portal.adhumansoft.com/index.php" ["adsession"]=> string(26) "xxxxxxxx" ["adlanguage"]=> string(3) "cat" ["adpage"]=> string(0) "" ["aderror"]=> string(0) "" }
vardump al cargar la página loginuser.php
array(2) { ["adpage"]=> string(0) "" ["aderror"]=> string(22) "Error inicio sesion..." }
Por algun motivo, es como si no recuperara la sesion en curso.
adjunto codigo:
---------------------------------------------------------------
index.php
---------------------------------------------------------------
Código PHP:
Ver original<?php
require_once($_SERVER['DOCUMENT_ROOT']."/utils/functions.php");
$cur_web = getVar('adweb');
if ($cur_web == "") {
ini_set("soap.wsdl_cache_enabled","0"); setVar('adws', "http://localhost:23967/");
try {
$url_actual = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
setVar('adweb', $url_actual);
$url = getVar('adws')."adConfig.asmx?WSDL";
$client = new SoapClient($url);
$response = $client->GetConfig($data)->GetConfigResult;
$xml = new SimpleXMLElement($response);
$lang = (string)$xml->config->language;
$data = array('sLang' => $lang); $response = $client->GetLanguage($data)->GetLanguageResult;
$xmllang = new SimpleXMLElement($response);
setVar('adpage', '');
setVar('aderror','');
} catch(Exception $e) {
$xmllang = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" standalone= "yes"?> <idiomas></idiomas>');
setVar('adsession', '');
setVar('adlanguage', '');
setVar('adpage', 'errorpage');
setVar('aderror', $e->getMessage());
}
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>PRUEBAS</title>
<meta name="description" content="PRUEBAS" />
<meta name="author" content="PRUEBAS" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
<link rel="shortcut icon" href="image/PRUEBAS.ico" />
<link rel="favicon" href="image/PRUEBAS.ico" />
<link rel="stylesheet" href="css/PRUEBAS.css" />
</head>
<body>
<?php
?>
<section class="mainContainer">
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/desktop.php');
?>
</section>
</body>
</html>
---------------------------------------------------------------
functions.php
---------------------------------------------------------------
Código PHP:
Ver original<?php
function getVar($idvar) {
if (isset($_SESSION[$idvar])){ return $_SESSION[$idvar];
} else {
return '';
}
}
function setVar($idvar,$value) {
$_SESSION[$idvar] = $value;
}
function XMLToArray($xml) {
if ($xml instanceof SimpleXMLElement) {
$children = $xml->children();
$return = null;
}
foreach ($children as $element => $value) {
if ($value instanceof SimpleXMLElement) {
$values = (array)$value->children();
if (count($values) > 0) { $return[$element] = XMLToArray($value);
} else {
if (!isset($return[$element])) { $return[$element] = (string)$value;
} else {
$return[$element] = array($return[$element], (string
)$value); } else {
$return[$element][] = (string)$value;
}
}
}
}
}
return $return;
}
function GetLang($xmllang,$idLang,$defaultvalue) {
$return = "*".$defaultvalue;
if ($idLang != "") {
try {
$readlang = (string) $xmllang->{getvar('adlanguage')}->{$idLang};
if ($readlang != "") {
$return = $readlang;
}
} catch (exception $e) {
}
}
return $return;
}
?>
---------------------------------------------------------------
desktop.php
---------------------------------------------------------------
Código PHP:
Ver original<?php
$cur_page = getVar('adpage');
$aduser = getVar('aduser');
switch ($cur_page) {
case 'errorpage':
require_once($_SERVER['DOCUMENT_ROOT'].'/errorpage.php');
break;
case '':
require_once($_SERVER['DOCUMENT_ROOT'].'/login.php');
break;
default:
break;
}
?>
---------------------------------------------------------------
login.php
---------------------------------------------------------------
Código PHP:
Ver original<?php
?>
<div class="loginform cf">
<form name="login" action="loginuser.php" method="post" accept-charset="utf-8">
<img src="./image/SistemaHumansoft.png" class="LoginImage" >
<table>
<tr>
<td><label for="userid"><?php echo GetLang($xmllang,'l60018',"Usuario");?></label></td>
<td><input type="text" name="userid" title="" placeholder="<?php echo GetLang($xmllang,'l1536',"Indicar código profesional");?>" required="prova"></td>
</tr>
<tr>
<td><label for="userpas"><?php echo GetLang($xmllang,'l60019',"Contraseña");?></label></td>
<td><input type="password" name="userpas" title="" placeholder="" required></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="<?php echo GetLang($xmllang,'l90008',"Validar");?>" ></td>
</tr>
<?php
$err = getVar('aderror');
if ($err != "") {
?>
<tr>
<td colspan="2"><?php echo $err ?></td>
</tr>
<?php
}
?>
</table>
</form>
<?php
$err = getVar('aderror');
if ($err != "") {
?>
<script>alert('error');</script>
<?php
setVar('aderror','');
}
?>
</div>
---------------------------------------------------------------
loginuser.php
---------------------------------------------------------------
Código PHP:
Ver original<?php
require_once($_SERVER['DOCUMENT_ROOT']."/utils/functions.php");
setVar('adpage','');
$url_actual = getVar('adweb');
$userid = $_POST['userid'];
$userpass = $_POST['userpas'];
$temp = getvar('adws');
$urlws = $temp."adPortal.asmx?WSDL";
/*$client = new SoapClient($urlws);
$data = array('sIdUser' => $userid,
'sIdPass' => $userpass);
if (( $client->IsValidUser($data)->IsValidUserResult) == true ) {
print_r("User Ok");
setVar('aderror','');
} else {
setVar('aderror','Error inicio sesion...');
}*/
setVar('aderror','Error inicio sesion...');
//header("location: ".$url_actual);
?>