Jump to content


Photo

Where do I add $connection?


  • Please log in to reply
3 replies to this topic

#1 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 25 March 2006 - 05:40 AM

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?

#2 Hooker

Hooker
  • Members
  • PipPipPip
  • Advanced Member
  • 193 posts
  • LocationWales, UK

Posted 25 March 2006 - 06:00 AM

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

#3 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 25 March 2006 - 03:40 PM


<?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");
  }

?>



#4 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 25 March 2006 - 05:36 PM

can you post the exact error that you're getting?

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users