Author Topic: problem with login script  (Read 363 times)

0 Members and 1 Guest are viewing this topic.

Offline jsucupiraTopic starter

  • Irregular
  • Posts: 23
    • View Profile
problem with login script
« on: August 30, 2007, 03:32:02 PM »
I was having problems with my login script could someone help me.

Code: [Select]
<?

include "library/session.php";

$dbservertype='mysql';
$servername='localhost';
$dbusername='root';
$dbpassword='ace';
$dbname='tallynightlife';

connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>Loginck</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
$userid=mysql_real_escape_string($userid);
$password=mysql_real_escape_string($password);

if($rec=mysql_fetch_array(mysql_query("SELECT * FROM userid WHERE userid='$userid' AND password = '$password'"))){
if(($rec['userid']==$userid)&&($rec['password']==$password)){
include "include/newsession.php";
            echo "<p class=data> <center>Successfully,Logged in<br><br><a href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if your browser is not redirecting automatically or you don't want to wait.</a><br></center>";
     print "<script>";
       print " self.location='welcome.php';";
          print "</script>";

}
}
else {

session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct  Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";

}
?>

----------------------------------------------------

Code: [Select]
<?php
session_start
();
session_register("session");
?>

-------------------------------------

Code: [Select]
<?

include "library/session.php";
session_unset();
session_destroy();

?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>

<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?

echo "<center><font face='Verdana' size='2' >Successfully logged out. <br><br> <a href=login.php>Login</a></font></center>";

?>

------------------------------

Code: [Select]
<?php
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
$session['id']=session_id();
$session['userid']=$userid;
//echo $session['userid'];
?>

I appreciate any help.

Offline jesirose

  • Fanatic
  • Posts: 3,819
  • Gender: Female
  • PHP Goddess
    • View Profile
    • Reed's Training Blog
Re: problem with login script
« Reply #1 on: August 30, 2007, 03:32:47 PM »
What is the problem? What are all these bits of code?
Every time you post "It didn't work" without more explanation, God kills a kitten.
When you post code without code tags, He just teases a puppy. But it's still sad.
What does that php function do? | What does that term mean? | I don't see any errors! | Awesome API Interface
PHP Goddess with Attitude since 2004

Offline jsucupiraTopic starter

  • Irregular
  • Posts: 23
    • View Profile
Re: problem with login script
« Reply #2 on: August 30, 2007, 03:39:09 PM »
they do not work, they are not accessing mysql to get the usernames. also part of the code is showing up in the brower like this one for loginck.php

:Successfully,Logged in

Log OUT

Click here if your browser is not redirecting automatically or you don't want to wait.
"; print ""; } } else { session_unset(); echo "Wrong Login. Use your correct Userid and Password and Try
"; } ?>

these bits of codes are what my login script is calling: when I have includes "library/session.php":

Offline jsucupiraTopic starter

  • Irregular
  • Posts: 23
    • View Profile
Re: problem with login script
« Reply #3 on: August 30, 2007, 09:59:52 PM »
can anyone help me with this one?

Offline phpSensei

  • i can haz cool title?
  • Addict
  • Posts: 2,808
  • Everybody wants Kung-Fu Fighting
    • View Profile
    • Website Development Company
Re: problem with login script
« Reply #4 on: August 30, 2007, 10:02:13 PM »
edit: nevermind.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies."  — C.A.R. Hoare, The 1980 ACM Turing Award Lecture

Offline phpSensei

  • i can haz cool title?
  • Addict
  • Posts: 2,808
  • Everybody wants Kung-Fu Fighting
    • View Profile
    • Website Development Company
Re: problem with login script
« Reply #5 on: August 30, 2007, 10:04:02 PM »
SELECT * FROM userid WHERE userid='$userid' AND password = '$password'

why is both table name and userid the same?

"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies."  — C.A.R. Hoare, The 1980 ACM Turing Award Lecture