Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Aug 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Call to undefined function session_register

    i get this error when loging in

    Fatal error: Call to undefined function session_register() in E:\Server\Ampps\www\fbcovers\admincp\login.php on line 42

    i use php5.4

    Below is code of login.php file which causes above error

    PHP Code:
    <?
    session_start
    ();
    ob_start();
    ?>
    <?php 
    include('../db.php');?>
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Scripteen FB Covers Script - Admin Control Panel</title>
    <link href="css/style.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <header>
    <div class="headcontaint">
    <div class="logo"><a href="index.html"><img src="../images/logo.png" width="280" height="74"></a></div>

    </div>
    </header>
    <div class="container">
    <div class="maintitle">Login to Admin Contol Panel</div>
    <?php
    $err
    =isset($_GET['error'])?$_GET['error']:""
    if(
    $err=='error'){?>
    <div class="errormsgbox">Wrong Username or Password. Please try again.</div>    
    <?php }

    if(!isset(
    $_SESSION['adminuser'])){
    if(
    $_SERVER["REQUEST_METHOD"] == "POST")
    {
    // username and password sent from Form
    $adminuser=mysql_real_escape_string($_POST['adminuser']); 
    $adminpassword=mysql_real_escape_string($_POST['adminpassword']); 
    $gpassword=md5($adminpassword); // Encrypted Password
    $sql="SELECT id FROM admin WHERE adminuser='$adminuser' and adminpassword='$gpassword'";
    $result=mysql_query($sql);
    $count=mysql_num_rows($result);

    // If result matched $username and $password, table row must be 1 row
    if($count==1)
    {
    session_register("adminuser");

    header("location:index.php");
    }
    else
    {
    header("location:login.php?error=error");

    }
    }
    ob_end_flush();

    ?>
    <div class="box">
    <div class="login_box">
    <form action="login.php" method="post">
    <div class="login_input">
    <label class="loginlbl"  for="adminuser">UserName :</label>
    <input type="text" name="adminuser"/>
    </div>
    <div class="login_input">
    <label class="loginlbl"  for="adminpassword">Password :</label>
    <input type="password" name="adminpassword"/>
    </div>
    <div class="login_submit">
    <input type="submit" id="submit" value=" Login to Admin Contol Panel"/>
    </div>
    </form>
    </div>

    </div>
    <?php }else{
    header("location:index.php");
    }

    include(
    'footer.php');
    ?>
    please help me in this matter soon please

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,899
    Thanks
    15
    Thanked 226 Times in 226 Posts
    This is what the PHP Manual says.

    This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,089
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Change this:
    session_register("adminuser");

    To this:
    $_SESSION['adminuser'] = 1;

    Or set it to any other value you like.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #4
    New Coder
    Join Date
    Aug 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change this:
    session_register("adminuser");

    To this:
    $_SESSION['adminuser'] = 1;

    does not work when

    after changing what you told
    i tried to login using username and password but it does not get logged in and login page shows again

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    PHP Code:
    $_SESSION['adminuser'] = $adminuser
    That assumes that somewhere else you use the adminuser, but we don't see that here. Note that since this program was written for such an antiquated version of PHP, there is no guarantee that a single change will fix your issues.

    Although officially deprecated as of 5.3, use of session_register relies on the use of register_globals. It has been unofficially deprecated since PHP 4.2.0 when the register_globals directive defaulted to off.
    The code you've acquired (or tutorials if you wrote it) are oldsauce, and have been obsolescent for like over a decade.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #6
    New Coder
    Join Date
    Aug 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    PHP Code:
    $_SESSION['adminuser'] = $adminuser
    That assumes that somewhere else you use the adminuser, but we don't see that here. Note that since this program was written for such an antiquated version of PHP, there is no guarantee that a single change will fix your issues.

    Although officially deprecated as of 5.3, use of session_register relies on the use of register_globals. It has been unofficially deprecated since PHP 4.2.0 when the register_globals directive defaulted to off.
    The code you've acquired (or tutorials if you wrote it) are oldsauce, and have been obsolescent for like over a decade.
    than what editing should be done more can you please tell or should i give you the wole script so you can check what should be edited

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I'm not going to rewrite your scripts. I'd suggest you abandon them completely and find something that's been written for a 5.0+ version of PHP, or write your own. The use of both mysql library and register_globals reliance on just this script handling 80%+ of the processing tells me the rest of it's going to be the same way. Since mysql library will also be gone in the near future, you need to find something that was written for mysqli/pdo
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #8
    New Coder
    Join Date
    Aug 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok thanks


  •  

    Tags for this Thread

    Posting Permissions

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