Jump to content

Archived

This topic is now archived and is closed to further replies.

marcus

Where do I add $connection?

Recommended Posts

I think this is a problem in my script.

The login script can't seem to find the $connection= path.

Where would I put this path?

Or even, what goes after the = ?

$connection=?

what does it equal?

Share this post


Link to post
Share on other sites
You'd have to show us the login system to help you with this :) $connection should be set by the script somewhere

Share this post


Link to post
Share on other sites
[code]

<?php

  include("./inc/ryu786.php");

  $connection = mysql_connect($host, $user, $password);
  [quote]$db = mysql_select_db($database, $connection);[/quote]
  $sql = "SELECT id FROM user
          WHERE user='$_POST[login]'
          AND pass='$_POST[pass]'";

  $result = mysql_query($sql);
  $num = mysql_num_rows($result);
  if ($num > 0) {                                // ### USER AND PASSWORD ARE CORRECT
    $id = mysql_fetch_assoc($result);

    $ip = $REMOTE_ADDR;
    $sql = "INSERT INTO logip (userid, ip) VALUES ('$id[id]', '$ip')";
    $result = mysql_query($sql);

    setcookie("auth", "yes");
    setcookie("id", $id['id']);

    header("Location: main.php");

  }else{                                          // ### USER OR PASSWORD IS INCORRECT
    header("Location: failed.php");
  }

?>

[/code]

Share this post


Link to post
Share on other sites

×

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.