LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   php, iframes and loading a page (https://www.linuxquestions.org/questions/programming-9/php-iframes-and-loading-a-page-301352/)

poeta_boy 03-14-2005 01:54 AM

php, iframes and loading a page
 
Hello Mina San:

I'm bulding an small site based on php and I have a page Login.php, which in turn has an iframe coming from loginForm.php....

I've managed to get the login info, and check whether or not the user is registered, with something like this:

Code:


<?php

      include("connect.php");

        $sql = "SELECT * FROM users WHERE userName = '" . $user ."' AND
password = '" . $password . "'";
        $result = mysql_query($sql, $db);

        if($myRow = mysql_fetch_array($result))
        {
                        session_register("$user");
        }
        else
        {
                echo "User not registered";
        }
?>

Where connect.php is the database connection.......... the thing is that once the user has been validated, I'd like to load welcome.php in the whole page, not just the iframe where the validation has been done.

Is there a way to do that? I tried something like :

Code:

        if($myRow = mysql_fetch_array($result))
        {
                        session_register("$user");
                        echo "<script language=JavaScript1.1>
parent.load(/registro.php); </script>";
        }

But the parent.load won't work :( any ideas?

thanks

keefaz 03-14-2005 07:02 PM

Did you put a session_start(); at the top of your php code
In the main page, not in frames, session has to be started
before any output to browser

poeta_boy 03-14-2005 10:35 PM

thanks a lot, but the thing is that I'd like to load a whole new page, being triggered by an even in the iframe..... is that possible?

thanks :)

keefaz 03-15-2005 03:45 AM

I don't know your complete code, but try :
PHP Code:

if(($myRow mysql_fetch_array($result)) !== FALSE) {
    
session_register("user");
    
$_SESSION["user"] = $user;
   echo 
"<script language=\"JavaScript1.1\"> parent.location.replace(\"/registro.php\"); </script>";




All times are GMT -5. The time now is 06:12 AM.