Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Reply to Thread

Post a reply to the thread: php-mysql : Call to undefined function session_register()?

Your Message

Click here to log in

What is the number after 87?

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 12-19-2012, 10:00 AM
    prashant r

    php-mysql : Call to undefined function session_register()?

    I am getting a problem...when i post the form, i get this as fatal error...
    Call to undefined function session_register()...
    i changed it with $_session(),but still it is not working..

    can you tell me what is the problem??





    This is the index.html page.


    <form class="login active" method="post" action="login.php">
    <h3>Login</h3>
    <div>
    <label>Username:</label>
    <input type="text" name="myusername"/>
    <span class="error">This is an error</span>
    </div>
    <div>
    <label>Password:</label>
    <input type="password" name="mypassword" />
    <span class="error">This is an error</span>
    </div>
    <div class="bottom">
    <div class="remember"><input type="checkbox" /><span>Keep me logged in</span></div>
    <input type="submit" value="Login"></input>
    <div class="clear"></div>
    </div>
    </form>




    This is the login.php page..



    <?php
    $host="localhost";
    $username="root";
    $password="";
    $db_name="Example";
    $tbl_name="login";

    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");

    $myusername=$_POST['myusername'];
    $mypassword=$_POST['mypassword'];

    $myusername = stripslashes($myusername);
    $mypassword = stripslashes($mypassword);
    $myusername = mysql_real_escape_string($myusername);
    $mypassword = mysql_real_escape_string($mypassword);
    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result=mysql_query($sql);

    $count=mysql_num_rows($result);

    if($count>0){

    session_register("$myusername");
    session_register("$mypassword");
    header("location:welcome.php");
    }
    else {
    echo "Wrong Username or Password!";
    }
    ?>

    Thi is welcome.php page..

    <?php
    session_start();
    if(!session_is_registered(myusername)){
    header("location:index.html");
    }
    ?>

    <html>
    <body>
    Login Successful
    </body>
    </html>

Posting Permissions

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