questo è l'index, con un form per il login.
il file head risiede nel server dove è presente il Database.
Codice PHP:
<?php
@session_start();
require('http://www.blablabla.it/admin/config/head.php');
if(!isset($_GET['option']))
$option=0;
else
$option=$_GET['option'];
if(!isset($_GET['error']))
$error=0;
else
$error=$_GET['error'];
?>
<body>
<?
if(!isset($_SESSION['id'])){
$txt .= '
</p>
</p>
</p>
<form id="accesso" name="accesso" method="post" action="login.php">
<div align="center">
<div class="login" align="center"><table width="400" align="center" cellspacing="20">
<tr>
<td colspan="3" align="center">[img]../ftpdati/logo-Azemar-Ok2.png[/img]</td>
</tr>
<tr>
<td width="30%"></td>
<td></td>
<td></td>
</tr>
<tr>
<td align="right">Nome utente</td>
<td width="20%"></td>
<td align="left"><input type="text" name="nomeutente" id="nomeutente" /> </td>
</tr>
<tr>
<td align="right">Password</td>
<td></td>
<td align="left"><input type="password" name="password" id="password" /></td>
</tr>
<tr>
<td align="right"></td>
<td></td>
<td align="left"><input name="invia" type="submit" value="Accedi" /></td>
</tr>
</table>
</div></div>
</form>
<div class="footer" align="center">Azemar © 2009</div>';
echo $txt;
Ora di seguito, posto il file login.php che è il file dove mi da errore:
Codice PHP:
<?php
require('http://www.blablabla.it/admin/config/head.php');
// LOGIN
$query="SELECT id FROM ".$dbname.".admin WHERE (nomeutente='".$_POST['nomeutente']."' AND password='".$_POST['password']."')";
$ris=mysql_query($query);
$file=mysql_fetch_array($ris);
if($file['id']!="")
$_SESSION['id']=$file['id'];
?>
Infine, posto il file head.php:
Codice PHP:
<?php
$dbhost = xxx;
$dbuser = xxx;
$dbpasswd = xxx;
$dbname = xxx_xxx';
/* database connection */
$conn=mysql_connect($dbhost, $dbuser, $dbpasswd)
or die("Not connected: ".mysql_error());
$_SESSION['db_name']=$dbname;
$txt = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Azemar :: Admin</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="icona_azemar.ico" />
</head>';
echo $txt;
?>
Dove sbaglio??
grazie ancora per l'aiuto!!