Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35
  1. #21
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Try this:

    PHP Code:
    <?php
    if(@file_exists("installer.php"))
    {
    header("Location: installer.php?stage=1");
    }
    session_start();
    include(
    "includes/functions.php");
    include(
    "includes/config.php");

    // Check for login
    if($_GET['inside'] == "yes" || isset($_SESSION['username']) && isset($_SESSION['password']) && !$_SESSION['level'] == "banned") {
    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));
    $username $_POST['username'];
    // mySQL
    $sql "SELECT * FROM users";
    $select mysql_query("SELECT username FROM users");
    while (
    $display mysql_fetch_array($select)) {
    $name $display['name'];

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } else {
    header('location: miniprofile.php?name=$name');
    die();
    }
    }


    elseif(
    $_GET['method'] == "login") {

    $username $_POST['username'];
    $password $_POST['password'];

    if(empty(
    $username) || empty($password)) {
    header('location: minilogin.php?error=2');
    die();
    }




    // Clean out and encrypt strings

    $username clean($username);
    $password encrypt($password);

    // We have encrypted and cleaned the strings.

    $check mysql_query("SELECT * FROM users WHERE username = '$username'");
    while(
    $rows mysql_fetch_array($check)) {
    $realpass $rows[password];
    $level $rows[level];
    $realuser $rows[username];
    }

    $rows3 mysql_num_rows($check);


    if(
    $rows3 == "0") {
    header('location: minilogin.php?error=1');
    die();
    }

    if(
    $password == $realpass) {
    // Set the sessions
    $_SESSION['username'] = $realuser;
    $_SESSION['password'] = $password;
    $_SESSION['level'] = $level;

    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } elseif(
    $_SESSION[level] == "banned") {
    header('location: minilogin.php?banned=true');
    } else {
    header('location: minilogin.php?inside=yes');
    die();
    }
    }
    else {
    session_destroy();
    header('location: minilogin.php?error=1');
    die();
    }



    }
    ?>
    <?
    if(isset($_SESSION['username']) && isset($_SESSION['password']) && isset($_SESSION['level'])) {
    header('location: miniprofile.php');
    die();
    }
    ?>

    <link href="../default.css" rel="stylesheet" type="text/css" />

    <center>
    <form method="post" action="?method=login">
    <br>Username:<br />
    <input name="username" type="text" id="username" onChange="check(this.value)" /><div id="results"></div>

    <br />
    Password:<br />
    <label>
    <input name="password" type="password" id="password" />
    </label>
    <br />
    <br />
    <label>
    <input type="submit" name="Submit" value="Login" />
    </label>
    </form>



    <?php
    if($_GET['error'] == "1") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Invalid username and/or password<br>");
    echo(
    " <br></div>");
    }
    elseif(
    $_GET['error'] == "2") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> You must fill in both fields<br>");
    echo(
    " <br></div>");
    }
    elseif(
    $_GET['banned'] == "true") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Your account is disabled or banned!<br>");
    echo(
    " <br></div>");
    }
    else {
    echo(
    " <br></div>");
    }
    ?>
    <a href="register.php" target="home">Register</a><br>
    <a href="retreivepass.php" target="home">Forgot your password?</a>

    </body>

    </html>

  2. #22
    Join Date
    Dec 2004
    Location
    UK
    Posts
    534
    Tokens
    141

    Default

    Parse error: syntax error, unexpected T_ELSEIF in /home/blazerad/public_html/v2/panel/minilogin.php on line 31
    Post Count: :eusa_danc 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 :eusa_danc

  3. #23
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Try:

    PHP Code:
    <?php
    if(@file_exists("installer.php"))
    {
    header("Location: installer.php?stage=1");
    }
    session_start();
    include(
    "includes/functions.php");
    include(
    "includes/config.php");

    // Check for login
    if($_GET['inside'] == "yes" || isset($_SESSION['username']) && isset($_SESSION['password']) && !$_SESSION['level'] == "banned") {
    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));
    $username $_POST['username'];
    // mySQL
    $sql "SELECT * FROM users";
    $select mysql_query("SELECT username FROM users");
    while (
    $display mysql_fetch_array($select)) {
    $name $display['name'];

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } else {
    header('location: miniprofile.php?name=$name');die();
    }
    }


    else
    (
    $_GET['method'] == "login") {

    $username $_POST['username'];
    $password $_POST['password'];

    if(empty(
    $username) || empty($password)) {
    header('location: minilogin.php?error=2');
    die();
    }




    // Clean out and encrypt strings

    $username clean($username);
    $password encrypt($password);

    // We have encrypted and cleaned the strings.

    $check mysql_query("SELECT * FROM users WHERE username = '$username'");
    while(
    $rows mysql_fetch_array($check)) {
    $realpass $rows[password];
    $level $rows[level];
    $realuser $rows[username];
    }

    $rows3 mysql_num_rows($check);


    if(
    $rows3 == "0") {
    header('location: minilogin.php?error=1');
    die();
    }

    if(
    $password == $realpass) {
    // Set the sessions
    $_SESSION['username'] = $realuser;
    $_SESSION['password'] = $password;
    $_SESSION['level'] = $level;

    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } elseif(
    $_SESSION[level] == "banned") {
    header('location: minilogin.php?banned=true');
    } else {
    header('location: minilogin.php?inside=yes');
    die();
    }
    }
    else {
    session_destroy();
    header('location: minilogin.php?error=1');
    die();
    }



    }
    ?>
    <?
    if(isset($_SESSION['username']) && isset($_SESSION['password']) && isset($_SESSION['level'])) {
    header('location: miniprofile.php');
    die();
    }
    ?>

    <link href="../default.css" rel="stylesheet" type="text/css" />

    <center>
    <form method="post" action="?method=login">
    <br>Username:<br />
    <input name="username" type="text" id="username" onChange="check(this.value)" /><div id="results"></div>

    <br />
    Password:<br />
    <label>
    <input name="password" type="password" id="password" />
    </label>
    <br />
    <br />
    <label>
    <input type="submit" name="Submit" value="Login" />
    </label>
    </form>



    <?php
    if($_GET['error'] == "1") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Invalid username and/or password<br>");
    echo(
    " <br></div>");
    }
    elseif(
    $_GET['error'] == "2") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> You must fill in both fields<br>");
    echo(
    " <br></div>");
    }
    elseif(
    $_GET['banned'] == "true") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Your account is disabled or banned!<br>");
    echo(
    " <br></div>");
    }
    else {
    echo(
    " <br></div>");
    }
    ?>
    <a href="register.php" target="home">Register</a><br>
    <a href="retreivepass.php" target="home">Forgot your password?</a>

    </body>

    </html>

  4. #24
    Join Date
    Dec 2004
    Location
    UK
    Posts
    534
    Tokens
    141

    Default

    Parse error: syntax error, unexpected T_ELSE in /home/blazerad/public_html/v2/panel/login2.php on line 30
    Post Count: :eusa_danc 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 :eusa_danc

  5. #25
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Erm, try this. If this doesn't work I don't know.

    PHP Code:
    <?php
    if(@file_exists("installer.php"))
    {
    header("Location: installer.php?stage=1");
    }
    session_start();
    include(
    "includes/functions.php");
    include(
    "includes/config.php");

    // Check for login
    if($_GET['inside'] == "yes" || isset($_SESSION['username']) && isset($_SESSION['password']) && !$_SESSION['level'] == "banned") {
    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));
    $username $_POST['username'];
    // mySQL
    $sql "SELECT * FROM users";
    $select mysql_query("SELECT username FROM users");
    while (
    $display mysql_fetch_array($select)) {
    $name $display['name'];

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } else {
    header('location: miniprofile.php?name=$name');die();
    }
    }


    if
    (
    $_GET['method'] == "login") {

    $username $_POST['username'];
    $password $_POST['password'];

    if(empty(
    $username) || empty($password)) {
    header('location: minilogin.php?error=2');
    die();
    }




    // Clean out and encrypt strings

    $username clean($username);
    $password encrypt($password);

    // We have encrypted and cleaned the strings.

    $check mysql_query("SELECT * FROM users WHERE username = '$username'");
    while(
    $rows mysql_fetch_array($check)) {
    $realpass $rows[password];
    $level $rows[level];
    $realuser $rows[username];
    }

    $rows3 mysql_num_rows($check);


    if(
    $rows3 == "0") {
    header('location: minilogin.php?error=1');
    die();
    }

    if(
    $password == $realpass) {
    // Set the sessions
    $_SESSION['username'] = $realuser;
    $_SESSION['password'] = $password;
    $_SESSION['level'] = $level;

    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } elseif(
    $_SESSION[level] == "banned") {
    header('location: minilogin.php?banned=true');
    } else {
    header('location: minilogin.php?inside=yes');
    die();
    }
    }
    else {
    session_destroy();
    header('location: minilogin.php?error=1');
    die();
    }



    }
    ?>
    <?
    if(isset($_SESSION['username']) && isset($_SESSION['password']) && isset($_SESSION['level'])) {
    header('location: miniprofile.php');
    die();
    }
    ?>

    <link href="../default.css" rel="stylesheet" type="text/css" />

    <center>
    <form method="post" action="?method=login">
    <br>Username:<br />
    <input name="username" type="text" id="username" onChange="check(this.value)" /><div id="results"></div>

    <br />
    Password:<br />
    <label>
    <input name="password" type="password" id="password" />
    </label>
    <br />
    <br />
    <label>
    <input type="submit" name="Submit" value="Login" />
    </label>
    </form>



    <?php
    if($_GET['error'] == "1") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Invalid username and/or password<br>");
    echo(
    " <br></div>");
    }
    elseif(
    $_GET['error'] == "2") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> You must fill in both fields<br>");
    echo(
    " <br></div>");
    }
    elseif(
    $_GET['banned'] == "true") {
    echo(
    " </div>
    <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Your account is disabled or banned!<br>");
    echo(
    " <br></div>");
    }
    else {
    echo(
    " <br></div>");
    }
    ?>
    <a href="register.php" target="home">Register</a><br>
    <a href="retreivepass.php" target="home">Forgot your password?</a>

    </body>

    </html>

  6. #26
    Join Date
    Feb 2006
    Location
    Scotland
    Posts
    2,087
    Tokens
    138

    Latest Awards:

    Default

    Hey,

    PHP Code:
                                  <?php
    if(@file_exists("installer.php"))
    {
        
    header("Location: installer.php?stage=1");
    }
    session_start();
    include(
    "includes/functions.php");
    include(
    "includes/config.php");

    // Check for login
    if($_GET['inside'] == "yes" || isset($_SESSION['username']) && isset($_SESSION['password']) && !$_SESSION['level'] == "banned") {
    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } else {
    header("location: miniprofile.php?name=$name");
    die();
    }
    }


    elseif(
    $_GET['method'] == "login") {

    $username $_POST['username'];
    $password $_POST['password'];

    if(empty(
    $username) || empty($password)) {
    header('location: minilogin.php?error=2');
    die();
    }




    // Clean out and encrypt strings

    $username clean($username);
    $password encrypt($password);

    // We have encrypted and cleaned the strings.

    $check mysql_query("SELECT * FROM users WHERE username = '$username'");
    while(
    $rows mysql_fetch_array($check)) {
    $realpass $rows[password];
    $level $rows[level];
    $realuser $rows[username];
    }

    $rows3 mysql_num_rows($check);


    if(
    $rows3 == "0") {
    header('location: minilogin.php?error=1');
    die();
    }

    if(
    $password == $realpass) {
    // Set the sessions
    $_SESSION['username'] = $realuser;
    $_SESSION['password'] = $password;
    $_SESSION['level'] = $level;

    ##### CHECK FOR FIRST-TIME USER #####
    $checker mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'"));

    if(
    $checker['firsttime'] == "") {
    header('location: miniprofile.php?firstime=yes');
    die();
    } elseif(
    $_SESSION[level] == "banned") {
    header('location: minilogin.php?banned=true');
    } else {
    header('location: minilogin.php?inside=yes');
    die();
    }
    }
    else {
    session_destroy();
    header('location: minilogin.php?error=1');
    die();
    }



    }
    ?>
    <?
    if(isset($_SESSION['username']) && isset($_SESSION['password']) && isset($_SESSION['level'])) {
    header('location: miniprofile.php');
    die();
    }
    ?>

    <link href="../default.css" rel="stylesheet" type="text/css" />

    <center>        
    <form method="post" action="?method=login">
    <br>Username:<br />
    <input name="username" type="text" id="username" onChange="check(this.value)" /><div id="results"></div>
     
              <br />
        Password:<br />
        <label>
        <input name="password" type="password" id="password" />
        </label>
        <br />
        <br />
        <label>
        <input type="submit" name="Submit" value="Login" />
        </label>
    </form>

            
            
    <?php
    if($_GET['error'] == "1") {
    echo(
    "        </div>
            <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Invalid username and/or password<br>");
    echo(
    "        <br></div>");
    }
    elseif(
    $_GET['error'] == "2") {
    echo(
    "        </div>
            <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> You must fill in both fields<br>");
    echo(
    "        <br></div>");
    }
    elseif(
    $_GET['banned'] == "true") {
    echo(
    "        </div>
            <div id=\"error\">"
    );
    echo(
    "<font color='#FF0000'><b>Error:</b> Your account is disabled or banned!<br>");
    echo(
    "        <br></div>");
    }
    else {
    echo(
    "        <br></div>");
    }
    ?>        
    <a href="register.php" target="home">Register</a><br>
    <a href="retreivepass.php" target="home">Forgot your password?</a>

    </body>

    </html>
    I don't think it will work but give it a try

    .:; Johno

  7. #27
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    In your orignal example, you want to get the userlogged in varible as the text yes?
    $_SESSION[username] as far as i can tell is currenlty holding the username.
    So just shove that in the the header:

    header('location: miniprofile.php?name='.$_SESSION[username]);

    Now, whatevers in the username session var will become part of the location header, so with luck its holding the username and will fix ya code

    for other attemptes by the looks of it your getting magic $name varibles from no where, then in the versions that do get it, your saving it as $username then trying to call $name again
    :p
    Last edited by Mentor; 16-12-2007 at 05:34 PM.

  8. #28
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Quote Originally Posted by 01101101entor View Post
    In your orignal example, you want to get the userlogged in varible as the text yes?
    $_SESSION[username] as far as i can tell is currenlty holding the username.
    So just shove that in the the header:

    header('location: miniprofile.php?name='.$_SESSION[username]);

    Now, whatevers in the username session var will become part of the location header, so with luck its holding the username and will fix ya code

    for other attemptes by the looks of it your getting magic $name varibles from no where, then in the versions that do get it, your saving it as $username then trying to call $name again
    :p
    Woah, I never thought of that.

  9. #29
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    As 01101101entor said

    Code:
     header('location: miniprofile.php?name='.$_SESSION[username]);
    but put as:

    Code:
     header('location: miniprofile.php?name=$_SESSION[username]');
    Looking for a good desiner to design a social networking template.

    PM me.

  10. #30
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Quote Originally Posted by Ini View Post
    As 01101101entor said

    Code:
     header('location: miniprofile.php?name='.$_SESSION[username]);
    but put as:

    Code:
     header('location: miniprofile.php?name=$_SESSION[username]');
    No...

    Put it as;
    PHP Code:
    header('location: miniprofile.php?name='.$_SESSION[username]); 

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •