Jump to content

papaface

Members
  • Posts

    1,437
  • Joined

  • Last visited

    Never

Posts posted by papaface

  1. Ah I have found the error:
    was:
    [code] $_SESSION["username"] = $_POST["username"];
    $_SESSION["password"] = $_POST["password"][/code]
    should have been:

    [code] $_SESSION["username"] = $_POST["username"];
    $_SESSION["password"] = $encpass;[/code]

    Thanks for all of your help guys!
  2. I should have included the checklogin.php file:
    [code]<?php

    require ('connect.php') ;

    session_start();

    if (!isset($_SESSION["username"]) || !isset($_SESSION["password"]))
    {
    $logged_in = 0;
    return;
    }
    else
    {
    $pass = mysql_query("select password from users where username='".$_SESSION['username']."'",$con);
    list($password) = mysql_fetch_array($pass);

    if(mysql_num_rows($pass) != 1)
    {
    $logged_in = 0;
    unset($_SESSION['username']);
    unset($_SESSION['password']);
    }

    if ($password = $_SESSION["password"])
    {
    $logged_in = 1;
    }
    else
    {
    $logged_in = 0;
    unset($_SESSION['username']);
    unset($_SESSION['password']);
    }

    }

    ?>[/code]
  3. Hello,
    My script works on everyones server so far except one person.
    The sessions arent being set.
    Is there anything I can add to the below code to set the session if $_SESSION["username"] and $_SESSION["password"] arent set?
    [code]<?php
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    require("../includes/checker.php");
    require ('../includes/connect.php') ;
    require ('../includes/checklogin.php') ;

    if ($logged_in == 1)
    {
    echo "You are already logged in ".$_SESSION["username"];
    echo "<br>" . '<a href="submissions.php">' . "Click here to view pending Link Exchanges" . "</a>";
    echo "<br>" . '<a href="approved.php">' . "Click here to view approved(active) Link Exchanges" . "</a>";
    echo "<br>" . '<a href="logout.php">' . "Click here to logout!" . "</a>";
    exit;
    }

    if (isset($_POST["submit"]))
    {
    if(!$_POST["username"] | !$_POST["password"])
    {
    die("You did not enter the required fields");
    }

    $check = mysql_query("select username,password from users where username='".$_POST["username"]."'") or die ("error" . mysql_error());
    list($username,$password) = mysql_fetch_array($check);

    $_POST["username"] = stripslashes($_POST["username"]); //strip the slashes

    if (!$_POST["username"] == $username)
    {
    echo "The username you entered does not exist";
    exit;
    }

    $_POST["password"] = stripslashes($_POST["password"]); //strip the slashes

    $encpass = md5($_POST["password"]);


    if ($encpass != $password)
    {
    die("Sorry you entered the wrong password");
    }
    else
    {

    $_SESSION["username"] = $_POST["username"];
    $_SESSION["password"] = $_POST["password"];

    echo "You are now logged in " . $_SESSION["username"];
    echo "<br>" . '<a href="submissions.php">' . "Click here to view pending Link Exchanges" . "</a>";
    echo "<br>" . '<a href="approved.php">' . "Click here to view approved(active) Link Exchanges" . "</a>";
    echo "<br>" . '<a href="logout.php">' . "Click here to logout!" . "</a>";
    mysql_close($con);

    }

    }
    else
    {
    echo '<table width="100%" height="100%" cellpadding="2" cellspacing="2" border="0">
    <tr>
    <td align="center" valign="middle">
    <form action="'. $_SERVER['PHP_SELF'] .'" method="post" enctype="application/x-www-form-urlencoded">
    Username: <input name="username" type="text" />

    Password: <input name="password" type="password" />
    <input name="submit" type="submit" value="Submit" />
    </form>
    </td>
    </tr>
    </table>';
    }
    ?>[/code]
  4. I have tried:
    [code]<?php

    $checkurl = file("http://localhost/ee/admin/reciprocaltest.html");
    $checkurl = array_map("trim", $checkurl);
    $check = '<a href="http://www.domain.com/enter.php?refer=1">';


    if(in_array($check, $checkurl))
    {
    echo "link found";
    }
    else
    {
    echo "link NOT found";
    }

    ?>[/code] But it still doesnt work.
  5. Ive tried to go this but I cant get it to work.
    The code i have is:
    reciprocalcheck.php:
    [code]<?php

    $checkurl = file("http://localhost/ee/admin/reciprocaltest.html");

    $check = '<a href="http://www.domain.com/enter.php?refer=1">';


    if(in_array($check, $checkurl))
    {
    echo "link found";
    }
    else
    {
    echo "link NOT found";
    }

    ?>[/code]
    reciprocaltest.html:
    [code]<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <a href="http://www.domain.com/enter.php?refer=1">Your Site Name Here</a>
    </body>
    </html>[/code]
    Why isnt this working?
×
×
  • 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.