Jump to content

Recommended Posts

I have fumbling around with this for awhile..lol. I organily was trying to make this alot more complaicted then it needed to be see [url=http://www.phpfreaks.com/forums/index.php/topic,99502.0.html]http://www.phpfreaks.com/forums/index.php/topic,99502.0.html[/url] for more information about my past issues on this subject.

I tried everything that I could think of to hide the login process and came up with nothing, untill now. I had a great idea, why not post to it's self. Well I thought that would work but no. I think I am real close to it working. Here is the script.

[code]<?php
if (isset($_POST['login'])){
  session_start();

  header("Cache-control: private");

  $user = $_POST['username'];
  $pass = $_POST['password'];

  include("db.php");

  $sql_user_check = "SELECT id, access, username FROM users WHERE username='$user' AND password = '".md5($pass)."'";
  $result_name_check = mysql_query($sql_user_check) or die(mysql_error());
  $usersfound = mysql_num_rows($result_name_check) or die(mysql_error());

  if($usersfound < 1){
  $error = "Wrong username/password";
  }
  else {
          $text = mysql_fetch_array($result_name_check);
  $id = $text['id'];
  $access = $text['access'];
          $_SESSION['username'] = $text['username'];
          header('Location: http://www.owpt.biz/account.php?'.SID);
          echo '<html><head><title>Redirecting</title></head>';
          echo '<body><a href="http://www.owpt.biz/account.php?'.SID.'">Continue</a></body></html>';
          exit;
  }
}
$filename = "login.php";
$title = "Login";
$content= "
    <form action=\"test_login.php\" method=\"post\">
      <label>&nbsp;&nbsp&nbsp;&nbsp;login</label>
      <p>
      &nbsp;&nbsp&nbsp;&nbsp<input type=\"text\" name=\"username\" size=\"20\" maxlength=\"15\" value=\"username\">
      </p>
      <p>
      &nbsp;&nbsp&nbsp;&nbsp<input type=\"password\" name=\"password\" size=\"20\" maxlength=\"15\" value=\"password\">
      </p>   
      <p>
      &nbsp;&nbsp&nbsp;&nbsp<input name=\"goButton1\" type=\"submit\" value=\"go\" alt=\"go\">
      </p>
      </form>";
include('includes/main.php'); 
?>[/code]

Any suggestions would be great.
Link to comment
https://forums.phpfreaks.com/topic/13737-login-script-not-logining-in/
Share on other sites

a suggestion, put session_start(); at the top of the page, regardless of whether or not the user is loggin in or not.  The session has to be called before the rest of the script. 

Don't know if that will solve your problem, but its a start.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.