What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » [FIXED]PHP script issue

[FIXED]PHP script issue
Author: Message:
YottabyteWizard
Senior Member
****

Avatar

Posts: 709
Reputation: 23
37 / Male / Flag
Joined: Mar 2005
O.P. [FIXED]PHP script issue
Well, I'm still a newbie programming PHP... but I already read several ebooks and another book I have.... still unable to fix this issue.

What I'm trying to do is login system, but the cookie is unable to be set.

I tried writting the code on a separate file, and it doesn't work.

This is the code I currently have (named usuario.php)

code:
<?php
error_reporting(E_ALL);
require('./inc/connect.php');
echo ("<br /> Webaction: ".$webaction."<br />");
echo ($_COOKIE['lagoweb[username]']);

//Desloguea al usuario
if ($webaction == "logout") {
echo ("Testing logout");
setcookie('lagoweb[username]');
}

//Procesa la forma de login
elseif ($webaction == "login") {
if (isset($_COOKIE['lagoweb[username]'])) {
echo "You are already logged in!, do you want to <a href=usuario.php?webaction=logout>logout</a>?";
} else {
echo ("<form method='POST' class='loginform'><table><tr><td>Usuario:</td><td><input type='text' name='username'></td></tr><tr><td>Contrase&ntilde;a:</td><td><input type='password' name='password'></td></tr><tr><td><input type='submit'></td></tr><tr><td><input type='hidden' value='do_login' name='webaction'></td></tr>
</table></form>");
}
}

//Proceso de inicio de sesion
elseif ($webaction == "do_login") {
$dbquery = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'") or die (mysql_error);
if (mysql_num_rows($dbquery) == 1) {
setcookie("lagoweb[username]",$username,time()+3600);
echo "Success!";
} else {
echo "Failed";
}
}
?>

Any help will be greatly appreciated.

Thanks in advance.

This post was edited on 06-26-2007 at 03:07 PM by YottabyteWizard.
06-26-2007 07:11 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[FIXED]PHP script issue - by YottabyteWizard on 06-26-2007 at 07:11 AM
RE: PHP script issue - by NanaFreak on 06-26-2007 at 07:15 AM
RE: PHP script issue - by YottabyteWizard on 06-26-2007 at 08:05 AM
RE: PHP script issue - by WDZ on 06-26-2007 at 08:20 AM
RE: PHP script issue - by markee on 06-26-2007 at 01:28 PM
RE: PHP script issue - by YottabyteWizard on 06-26-2007 at 03:07 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On