Foros del Web » Programando para Internet » PHP »

Problema con setcookie!

Estas en el tema de Problema con setcookie! en el foro de PHP en Foros del Web. Antes que nada, muchas gracias por su tiempo, el problema que tengo y que llevo horas intentando encontrarlo es que no puedo lograr hacer funcionar ...
  #1 (permalink)  
Antiguo 06/04/2011, 00:23
 
Fecha de Ingreso: mayo-2005
Mensajes: 5
Antigüedad: 18 años, 10 meses
Puntos: 0
Problema con setcookie!

Antes que nada, muchas gracias por su tiempo, el problema que tengo y que llevo horas intentando encontrarlo es que no puedo lograr hacer funcionar el setcookie que lo demarco en rojo....esta funcion me rula muy bien antes de la funcion show_it pero adentro de ella no puedo hacerla funcionar :S ya intente de todo inclusive me fije el tema de los espacios ya que lei el manual de PHP donde me habla de ello y de los header y los espacios.....alguien puede descifrirar cual puede ser el posible problema?? Se lo agradeceria mucho!!!

<?php
if (@$_GET['do']=='logout'){
setcookie("WebShopUsername", '');
setcookie("WebShopPassword", '');
unset($_COOKIE['WebShopUsername']);
}
if (!@$_COOKIE['WebShopUsername']) {
$GLOBALS['loginform'] = '<br><form name="lol" id="lol" style="padding: 0px;merging: 0px;" method="request" action="" onSubmit="webshopa(document.getElementById(\'usern ame\').value+\' \'+document.getElementById(\'password\').value+\' \'+document.getElementById(\'remember\').value); return false;">
<fieldset style="width:200px; padding: 1px;">
<legend style="padding: 0px; font-weight:bold ; font-variant: small-caps;">WebShop Login Form</legend>
<table border=0 cellpadding=8 cellspacing=0>
<tr>
<td style="font-size: 11px; font-family: arial; font-variant: small-caps; font-weight:bold;">Username</td>
<td align="right"><input style="background-color: #CCCCCC; font-size: 11px; font-family: verdana; color: #777777; padding:3px;" size="9" type="text" maxlength="10" name="username" id="username"></td>
</tr>
<tr>
<td style="font-size: 11px; font-family: arial; font-variant: small-caps; font-weight:bold;">Password</td>
<td align="right"><input style="background-color: #CCCCCC; font-size: 11px; font-family: verdana; color: #777777; padding:3px;" size="9" type="password" maxlength="10" name="password" id="password"></td>
</tr>
<tr>
<td colspan=2 align="center" style="font-size: 12px; font-family: arial; font-variant: small-caps; font-weight:bold;"><label><input type="checkbox" name="remember" id="remember" value="yup">Remember</label>
&nbsp;&nbsp;&nbsp;<input type="submit" value="Login"></td>
</tr>
</table>
</fieldset></form>';
} else $GLOBALS['loginform'] = 'You are already logged in as <b>'.htmlspecialchars($_COOKIE['WebShopUsername']).'</b><br><br><a href="?do=logout">Logout</a>';
require 'inc/sajax.php';
function show_it($info){
require_once 'inc/sqlcfg.inc';
$data = @preg_split("/\s+/", $info);
$account = @secure($data[0]);
$passwd = @secure($data[1]);
$showistay = @secure($data[2]);

if (@!$data[1])
return $GLOBALS['loginform'];
if ($showistay=='remember')
$lawl=4;
else
$lawl=3;
if (count($data)<$lawl)
return 'You cannot leave empty fields<br> <a onClick="webshopa();" href="#">Go back</a>';

$query = mssql_query("Select [id_passwd] From [member_info] WHERE [id_loginid]='$account'");
$result = mssql_fetch_row($query);

if (!$result[0])
return '<br><br><br><br><span style="font-size: 11px;font-family:arial;font-variant: small-caps;font-weight:bold">Account Does not Exist <br> <a onClick="webshopa();" href="#"><font color="#111111">&lt; Try again &gt;</font></a></span>';

if ($webshop['mssq']['use_md5'])
{

$axd = base64_decode($result[0]);
$axd = strtolower($axd);
$asd = $passwd;
$_newpwd = $asd;
}
else {
$axd = $result[0];
$asd = $passwd;
$_newpwd=md5($asd);
}

if ($axd != $asd)
return '<br><br><br><br><span style="font-size: 11px;font-family:arial;font-variant: small-caps;font-weight:bold">I am sowwy wabbit, the password you have specified seems to be invalid. <br> <a onClick="webshopa();" href="#"><font color="#111111">&lt; Try again &gt;</font></a></span>';
else {
if ($showistay == NULL) {
setcookie("WebShopUsername", $account, "0");
setcookie("WebShopPassword", $_newpwd, "0");

} else {
setcookie("WebShopUsername", $account, time()+172576000);
setcookie("WebShopPassword", $_newpwd, time()+172576000);

}
return '<br><br><br><span style="font-size: 13px;font-family:arial;font-variant: small-caps;font-weight:none;color:#333333;">Login successful, welcome in<br> <a style="font-size: 13px;font-family:arial;font-variant: small-caps;font-weight:bold;color:#333333;" href="index.php">click here to enter the shop</a></span>';
}
}
$sajax_request_type = "GET";
sajax_init();
sajax_export("show_it");
sajax_handle_client_request();
?>
<title>ACCOUNT SHOP</title>
<script type="text/javascript">
<?php echo xweb_return(); ?>
function change_ws_content(content)
{

document.getElementById("login_content").innerHTML = content;

}

function webshopa(accountandpassword)
{

change_ws_content("<br><br><br><span style=\"font-variant:small-caps; font-weight:bold;color: #666666;\" valign=\"middle\"><img src=\"index/loading.gif\" border=0><br>Proccessing your login... Please wait</span>");
x_show_it(accountandpassword, change_ws_content);
}


</script>
<body style="background-color: #CCCCCC; margin: 0px;">
<div style="width:100%;background-color: #BBBBBB; font-family: arial;font-size:11px;">&nbsp;&nbsp;Mu WebShop Login</div>
<table width=100% height=80% cellpadding=0 cellspacing=0 border=0>
<tr><td align=center valign="middle">
<div id="login_content" name="login_content" style="width:100%;background-color: #DDDDDD; border-top: 1px solid #888888; border-bottom: 1px solid #777777; height:180px;" valign="middle" align="center">
<?php echo $GLOBALS['loginform']; ?>
</div>
</td></tr></table><div style="font-variant: small-caps;font-weight:bold; font-size:12px;font-family:arial;" align="center">(c)
<?php @include_once('wshconf.php'); print date("Y").' <a title="Visit Our Home Page" style="color: #555555;border-bottom: 1px dashed #000000; text-decoration: none;" href="'.$webshop['misc']['serverlink'].'">'.$webshop['misc']['servername'].'</a> WebShop'; ?></div>

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:10.