0

Hi i got a scipt from github

i have found another problem i cannot login

if anyone has any ideas what it could be would be much appriecated ty all in advance x

heres login from function.php

function auth($login = '', $passwd = '')
{
    session_start();
    global $HTTP_SESSION_VARS;
    $authdata = $HTTP_SESSION_VARS['authdata'];

    if (!empty($login)) {
        $username = $login;
        $pw = $passwd;
        $register = true;
    } elseif (!empty($authdata['login'])) {
        $username = $authdata['login'];
        $pw = $authdata['password'];
        $register = false;
    } else {
        $auth = 0;
    }

    if (!empty($username)) {
        mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
        mysql_select_db(DB_NAME) or die(mysql_error());

        $sql = "SELECT * FROM " . DB_TABLE_PREFIX . "users WHERE username = '" . $username . "'";
        $result = mysql_query($sql) or die(mysql_error());
        $row = mysql_fetch_assoc($result);

        if ( $row["password"] == $pw ) {
            if ($register) {
                $HTTP_SESSION_VARS['authdata'] = array('login'=>$row['username'], 'password'=>$row['password'], 'userlevel'=>$row['user_level'], 'uid'=>$row['uid']);
            }
            $auth = $row['userlevel'];
        } else {
            unset($HTTP_SESSION_VARS['authdata']);
            $auth = 0;
        }
    }

    return $auth;
}

Heres the login.php form

<table> <form action="<?php
/**
    * Online Calendar WESPA CALENDAR 2.0
    * Author / Coder: Weslley A. Harakawa
    * weslley@wcre8tive.com
    *
    * PHP Script and SQL source.
    * Copyright © 2014. Wcre8tive // Weslley A. Harakawa. All rights reserved.
    */ 
    $HTTP_SERVER_VARS['PHP_SELF'] ?>?action=login&month=<?php
/**
    * Online Calendar WESPA CALENDAR 2.0
    * Author / Coder: Weslley A. Harakawa
    * weslley@wcre8tive.com
    *
    * PHP Script and SQL source.
    * Copyright © 2014. Wcre8tive // Weslley A. Harakawa. All rights reserved.
    */
    $m ?>&year=<?php
/**
    * Online Calendar WESPA CALENDAR 2.0
    * Author / Coder: Weslley A. Harakawa
    * weslley@wcre8tive.com
    *
    * PHP Script and SQL source.
    * Copyright © 2014. Wcre8tive // Weslley A. Harakawa. All rights reserved.
    */ 
    $y ?>" method="post"> <tr> <td nowrap valign="top" align="right" nowrap> <span class="login_label"><?php
/**
    * Online Calendar WESPA CALENDAR 2.0
    * Author / Coder: Weslley A. Harakawa
    * weslley@wcre8tive.com
    *
    * PHP Script and SQL source.
    * Copyright © 2014. Wcre8tive // Weslley A. Harakawa. All rights reserved.
    */ 
    $lang['username']?></span></td> <td><input type="text" name="username" size="29" maxlength="15"></td> </tr> <tr> <td nowrap valign="top" align="right" nowrap> <span class="login_label"><?php
/**
    * Online Calendar WESPA CALENDAR 2.0
    * Author / Coder: Weslley A. Harakawa
    * weslley@wcre8tive.com
    *
    * PHP Script and SQL source.
    * Copyright © 2014. Wcre8tive // Weslley A. Harakawa. All rights reserved.
    */ 
    $lang['password']?></span></td> <td><input type="password" name="password" size="29" maxlength="15"></td> </tr> <tr><td colspan="2" align="right"><input type="submit" value="<?php
/**
    * Online Calendar WESPA CALENDAR 2.0
    * Author / Coder: Weslley A. Harakawa
    * weslley@wcre8tive.com
    *
    * PHP Script and SQL source.
    * Copyright © 2014. Wcre8tive // Weslley A. Harakawa. All rights reserved.
    */ 
    $lang['login']?>"><td><tr> </form> </table>

and heres the database table for it

CREATE TABLE IF NOT EXISTS `calendar_users` (
  `uid` smallint(6) NOT NULL,
  `username` char(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `password` char(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `fname` char(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `lname` char(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `userlevel` tinyint(2) NOT NULL DEFAULT '0',
  `email` char(40) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
3
Contributors
3
Replies
25
Views
2 Years
Discussion Span
Last Post by pixelsoul
0

This is very poorly written, and it is also using deprecated code.
I would throw this out.

Amazing that it was apparently written in 2014.

Edited by pixelsoul

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.