
Problema sistema de logeo
Publicado por Gabriel (2 intervenciones) el 06/05/2016 23:20:52
Hola soy nuevo en el desarrollo web y tengo el siguiente problema cree un sistema de logeo pero a la hora de entrar a la pagina me tira el siguiente error:
Tengo 3 archivos, 2 en el directo y un en la carpeta includes:
index.php
login.php
Y el que esta en la carpeta include que seria el config.php
1
Fatal error: Can't use function return value in write context in C:\xampp\htdocs\Gestion\login.php on line 18
Tengo 3 archivos, 2 en el directo y un en la carpeta includes:
index.php
1
2
3
<?php
header("Location: login.php")
?>
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
session_start();
include("includes/config.php");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// USUARIO Y CONTRAEÑA ENVIADO DESDE FORMULARIO
$myusername = addslashes($_POST['username']);
$mypassword = md5(addslashes($_POST['password']));
$sql = "SELECT userid FROM tbl_users WHERE username='$myusername' and password='$password'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count == 1){
//session_register("myusername");
$_SESSION('login_admin')=$myusername;
header("location: http://localhost/gestion/");
}
}
?>
!DOCTYPE html>
<html lang="en">
<head>
<title>SG v1</title>
<meta name="viewport" content="width=device-width, initial-escale=1.0">
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<link rel="stylesheet" type="text/css" href="framework/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
</head>
<body class="fondo">
<div class="jumbotron loginbox">
<form method="POST" name="login" id="login">
<h2>Iniciar Sesion</h2>
<input type="text" name="username" id="username" placeholder="Ingrese Usuario" class="form-control">
<input type="password" name="password" placeholder="Ingrese Contraseña" class="form-control">
<input type="submit" class="btn btn-success" value="Conectarse">
<input type="reset" class="btn btn-warning" value="Limpiar">
</form>
</div>
</body>
</html>
Y el que esta en la carpeta include que seria el config.php
1
2
3
4
5
6
7
8
9
<?php
$mysql_hostname = "locahost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "gestion";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps algo salió mal");
mysql_select_db($mysql_database, $bd) or die("Opps algo salió mal");
?>
Valora esta pregunta


0