Improve company productivity with a Business Account.Sign Up

x
?
Solved

Why dosent this work ?

Posted on 2013-05-27
9
Medium Priority
?
257 Views
Last Modified: 2013-05-28
Hi!

Have this code, but i cant get this to work ?

<!DOCTYPE html>
<?php require("RAY_EE_login.php"); ?>  
<html>
<head>
<title>Create a nice login form using CSS3 and HTML5</title>
<style>
html, body
{
    height: 100%;
}

body
{
    font: 12px 'Lucida Sans Unicode', 'Trebuchet MS', Arial, Helvetica;    
    margin: 0;
    background-color: #614912; 
}

/*--------------------*/

#login
{
    background-color: #614912;
    border: none ! important;
    box-shadow: none ! important;
    outline: none ! important;
    max-width: 400px;
    margin: -150px 0 0 -230px;
    padding: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
  
}


/*--------------------*/

h1
{
    text-shadow: 0 1px 0 rgba(255, 255, 255, .7), 0px 2px 0 rgba(0, 0, 0, .5);
    text-transform: uppercase;
    text-align: center;
    color: #666;
    margin: 0 0 30px 0;
    letter-spacing: 4px;
    font: normal 26px/1 Verdana, Helvetica;
    position: relative;
}

h1:after, h1:before
{
    background-color: #777;
    content: "";
    height: 1px;
    position: absolute;
    top: 15px;
    width: 120px;   
}

h1:after
{ 
    background-image: -webkit-gradient(linear, left top, right top, from(#777), to(#fff));
    background-image: -webkit-linear-gradient(left, #777, #fff);
    background-image: -moz-linear-gradient(left, #777, #fff);
    background-image: -ms-linear-gradient(left, #777, #fff);
    background-image: -o-linear-gradient(left, #777, #fff);
    background-image: linear-gradient(left, #777, #fff);      
    right: 0;
}

h1:before
{
    background-image: -webkit-gradient(linear, right top, left top, from(#777), to(#fff));
    background-image: -webkit-linear-gradient(right, #777, #fff);
    background-image: -moz-linear-gradient(right, #777, #fff);
    background-image: -ms-linear-gradient(right, #777, #fff);
    background-image: -o-linear-gradient(right, #777, #fff);
    background-image: linear-gradient(right, #777, #fff);
    left: 0;
}

h1:after2
{ 
    background: #614912;    
    right: 0;
}

h1:before2
{
    background: #614912;
    left: 0;
}

/*--------------------*/

fieldset
{
    border: 0;
    padding: 0;
    margin: 0;
}

/*--------------------*/

#inputs input
{
	background: #96825a url(http://www.softkey.no/webtest/images/login-sprite.png) no-repeat right;
    padding-right: 25px;
    padding: 15px 15px 15px 30px;
    margin: 0 0 10px 0;
    width: 353px; /* 353 + 2 + 45 = 400 */
	font: bold 20px Arial;
	color:#ffffff; 
	align: center;
	border: none ! important;
    box-shadow: none ! important;
    outline: none ! important;
}

#username
{
    background-position: 5px -2px !important;
}

#password
{
    background-position: 5px -52px !important;
}

#inputs input:focus
{
    background-color: #96825a;
    outline: none;
}

/*--------------------*/
#actions
{
    margin: 25px 0 0 0;
}

#LOGIN
{		
    background-color: #e4ab15;
    float: left;
    height: 55px;
    padding: 10px;
    width: 100%;
    cursor: pointer;
    font: bold 30px Arial, Helvetica;
    color: #ffffff;
    border: none ! important;
    box-shadow: none ! important;
    outline: none ! important;
}

#submit2
{		
    background-color: #96825a;
    float: left;
    height: 35px;
    padding: 0;
    width: 100%;
    cursor: pointer;
    font: bold 20px Arial, Helvetica;
    color: #ffffff;
    border: none ! important;
    box-shadow: none ! important;
    outline: none ! important;
}

#actions a
{
    color: #ffffff;    
    float: left;
    line-height: 35px;
    margin-left: 10px;
}

/*--------------------*/

#back
{
    display: block;
    text-align: center;
    position: relative;
    top: 60px;
    color: #999;
}


</style>

</head>

<body>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<form id="login">
    <fieldset id="inputs">
        <input id="uid" type="text" placeholder="E-post" autofocus required>   
        <input id="pwd" type="password" placeholder="Passord" required>
    </fieldset>
    <fieldset id="actions">
	    <br>
	    <input type="submit" id="submit2" value="Glemt passord?">
        <br><br>
		<input type="submit" id="LOGIN" value="Logg inn">
    </fieldset>
</form>



</body>
</html>

Open in new window


Seems to me that it dosent include the PHP -> <?php require("RAY_EE_login.php"); ?>  

What is wrong ?
0
Comment
Question by:team2005
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39198694
use an absolute path relative to the server root, so start with $_SERVER["DOCUMENT_ROOT"] and add the application path and the RAY_EE_login.php path inside the require.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39198701
Is this HTML file or php?

Php will render only in .php extension file
0
 
LVL 2

Author Comment

by:team2005
ID: 39198719
Have renamed the file to php now, but still dosent work ?
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39198725
can u try my suggestion?
0
 
LVL 62

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 39198727
Does it give an error?

If the file is PHP and the included file does not exist then you should get an error - if not add this to the start of the file

<?php error_reporting(E_ALL); ?>

See if an error is shown.

If this is an .html file - won't work for reasons stated above.

Failing that - how do you know it is not being included - what are you expecting to see that you are not?

What is in RAY_EE_login.php?
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39198763
make sure you have this file "RAY_EE_login.php" in the same directory?
0
 
LVL 2

Author Comment

by:team2005
ID: 39198956
Hi!

Have done some modifications to my project.

Now, when i try to login.
I get a blank page ?

Include all files

<?php // RAY_EE_controlled.php
require_once('RAY_EE_config.php');
error_reporting(E_ALL);
ini_set('display_errors', True);

// WAS EVERYTHING WE NEED POSTED TO THIS SCRIPT?
if ( (!empty($_POST["uid"])) && (!empty($_POST["pwd"])) )
{
    // YES, WE HAVE THE POSTED DATA. ESCAPE IT FOR USE IN A QUERY
    $uid = mysql_real_escape_string($_POST["uid"]);
    $pwd = mysql_real_escape_string($_POST["pwd"]);

    // CONSTRUCT AND EXECUTE THE QUERY - COUNT THE NUMBER OF ROWS RETURNED
    $sql = "SELECT uid, uuk FROM EE_userTable WHERE uid = '$uid' AND pwd = '$pwd' LIMIT 1";
    $res = mysql_query($sql);

    // IF THE QUERY FAILED, GIVE UP
    if (!$res) die( mysql_error() );

    // THERE SHOULD BE ONE ROW IF THE VALIDATION WAS PROCESSED SUCCESSFULLY
    $num = mysql_num_rows($res);
    if ($num)
    {
        // RETRIEVE THE ROW FROM THE QUERY RESULTS SET
        $row = mysql_fetch_assoc($res);

        // STORE THE USER-ID IN THE SESSION ARRAY
        $_SESSION["uid"] = $row["uid"];

        // IS THE "REMEMBER ME" CHECKBOX SET?
        if (isset($_POST["rme"]))
        {
            remember_me($row["uuk"]);
        }
    } // END OF SUCCESSFUL VALIDATION
    else
    {
      echo "<br/>INGEN TILGANG 22.";
      echo "<br/>Ønsker du og registrere deg <a href=\"RAY_EE_register.php\">Registrer</a> ";
      echo "<br/>Er du allerede registrert, Du kan <a href=\"RAY_EE_login2.php\">logge deg på her</a>";       
    }
}
// ACCESS TO THIS PAGE IS CONTROLLED
// ACCESS TO THIS PAGE IS TESTED BUT NOT CONTROLLED
if ($uid = access_control(TRUE))
{
    echo "<br/>HELLO $uid velkommen til kontrollsiden din";
}

Open in new window



<?php // RAY_EE_login.php
require_once('RAY_EE_config.php');
?>

<!DOCTYPE html>
<html>
<head>
<title>Prototype 1.0</title>
<link rel="stylesheet" href="default.css">

</head>

<body>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<form method="post" action="RAYTEST.php">
    <fieldset id="inputs">
        <input id="uid" type="text" placeholder="E-post" autofocus required>   
        <input id="pwd" type="password" placeholder="Passord" required>
    </fieldset>
    <fieldset id="actions">
	    <br>
	    <input type="submit" id="submit2" value="Glemt passord?">
        <br><br>
		<input type="submit" id="LOGIN" value="Logg inn">
    </fieldset>
</form>



</body>
</html>

Open in new window



<?php // RAY_EE_config.php

// WHEN WE ARE DEBUGGING OUR CODE, WE WANT TO SEE ALL THE ERRORS!
error_reporting(E_ALL);

// REQUIRED FOR PHP 5.1+
date_default_timezone_set('America/Chicago');

// THE LIFE OF THE "REMEMBER ME" COOKIE
define('REMEMBER', 60*60*24*7); // ONE WEEK IN SECONDS

// WE WANT TO START THE SESSION ON EVERY PAGE
session_start();

// CONNECTION AND SELECTION VARIABLES FOR THE DATABASE
$db_host = "softkey5.mysql.domeneshop.no"; // Host
$db_name = "softkey5";        // database navn
$db_user = "softkey5";       //  Bruker
$db_word = "kPBT4biL";       // Passord  

// OPEN A CONNECTION TO THE DATA BASE SERVER
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-connect.php
if (!$db_connection = mysql_connect("$db_host", "$db_user", "$db_word"))
{
    $errmsg = mysql_errno() . ' ' . mysql_error();
    echo "<br/>NO DB CONNECTION: ";
    echo "<br/> $errmsg <br/>";
}

// SELECT THE MYSQL DATA BASE
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-select-db.php
if (!$db_sel = mysql_select_db($db_name, $db_connection))
{
    $errmsg = mysql_errno() . ' ' . mysql_error();
    echo "<br/>NO DB SELECTION: ";
    echo "<br/> $errmsg <br/>";
    die("NO DATA BASE $db_name");
}

// DEFINE THE ACCESS CONTROL FUNCTION
function access_control($test=FALSE)
{
    // REMEMBER HOW WE GOT HERE
    $_SESSION["entry_uri"] = $_SERVER["REQUEST_URI"];

    // IF THE UID IS SET, WE ARE LOGGED IN
    if (isset($_SESSION["uid"])) return $_SESSION["uid"];

    // IF WE ARE NOT LOGGED IN - RESPOND TO THE TEST REQUEST
    if ($test) return FALSE;

    // IF THIS IS NOT A TEST, REDIRECT TO CALL FOR A LOGIN
    header("Location: login.php");
    exit;
}

// DEFINE THE "REMEMBER ME" COOKIE FUNCTION
function remember_me($uuk)
{
    // CONSTRUCT A "REMEMBER ME" COOKIE WITH THE UNIQUE USER KEY
    $cookie_name    = 'uuk';
    $cookie_value   = $uuk;
    $cookie_expires = time() + date('Z') + REMEMBER;
    $cookie_path    = '/';
    $cookie_domain  = NULL;
    $cookie_secure  = FALSE;
    $cookie_http    = TRUE; // HIDE COOKIE FROM JAVASCRIPT (PHP 5.2+)

    // SEE http://us3.php.net/manual/en/function.setcookie.php
    setcookie
    ( $cookie_name
    , $cookie_value
    , $cookie_expires
    , $cookie_path
    , $cookie_domain
    , $cookie_secure
    , $cookie_http
    )
    ;
}



// DETERMINE IF THE CLIENT IS ALREADY LOGGED IN BECAUSE OF THE SESSION ARRAY
if (!isset($_SESSION["uid"]))
{

    // DETERMINE IF THE CLIENT IS ALREADY LOGGED IN BECAUSE OF "REMEMBER ME" FEATURE
    if (isset($_COOKIE["uuk"]))
    {
        $uuk = mysql_real_escape_string($_COOKIE["uuk"]);
        $sql = "SELECT uid FROM EE_userTable WHERE uuk = '$uuk' LIMIT 1";
        $res = mysql_query($sql);

        // IF THE QUERY SUCCEEDED
        if ($res)
        {
            // THERE SHOULD BE ONE ROW
            $num = mysql_num_rows($res);
            if ($num)
            {
                // RETRIEVE THE ROW FROM THE QUERY RESULTS SET
                $row = mysql_fetch_assoc($res);

                // STORE THE USER-ID IN THE SESSION ARRAY
                $_SESSION["uid"] = $row["uid"];

                // EXTEND THE "REMEMBER ME" COOKIE
                remember_me($uuk);
            }
        }
    }
}

Open in new window



So why do i get blank page ?
0
 
LVL 2

Author Comment

by:team2005
ID: 39199111
Hi!

Nobody know why i get this blank page ?

This is driving me crazy
0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39201112
thanks
0

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question