par
mickael1989 » 08 juin 2014, 18:14
Bonjour,
J'ai un soucis j'ai créer une page functions.php et index.php
il se passe rien .
function.php
<?php
//connexion à la base de données
mysql_connect ('', '','') or die ('error');
mysql_select_db('rs') or die ('bdd introuvable');
mysql_query('SET NAMES utf8');
//function qui va se charger d'inscrire l'utilisateur
function inscrire_utilisateur($pseudo, $password, $email, $sexe,$situation,$apropos)
{
$password = sha1($password);
mysql_query("INSERT INTO utilisateurs(id,pseudo,password,email,sexe,situation,apropos)
VALUES('','$pseudo','$password','$email','$sexe','$situation','$apropos')
")
or die (mysql_error());
}
index.php
<?php
include('functions.php');
$page = htmlentities($_GET['page']);
$pages = scandir('pages');
if(!empty($page)&& in_array($_GET['page'].".php",$pages))
{
$content = 'pages/'.$_GET['page'].".php";
}else{
header("Location:index.php?page=login");
}
?>
<!DOCTYPE html>
<html
<head>
<link rel='stylesheet' href='css/style.css'>
</head>
<body>
<div id='content'>
<?php
include($content);
?>
</div>
</body>
</html>
<config>Windows / Chrome 35.0.1916.114</config>
Bonjour,
J'ai un soucis j'ai créer une page functions.php et index.php
il se passe rien .
function.php
[php]<?php
//connexion à la base de données
mysql_connect ('', '','') or die ('error');
mysql_select_db('rs') or die ('bdd introuvable');
mysql_query('SET NAMES utf8');
//function qui va se charger d'inscrire l'utilisateur
function inscrire_utilisateur($pseudo, $password, $email, $sexe,$situation,$apropos)
{
$password = sha1($password);
mysql_query("INSERT INTO utilisateurs(id,pseudo,password,email,sexe,situation,apropos)
VALUES('','$pseudo','$password','$email','$sexe','$situation','$apropos')
")
or die (mysql_error());
}
[/php]
index.php
[php]<?php
include('functions.php');
$page = htmlentities($_GET['page']);
$pages = scandir('pages');
if(!empty($page)&& in_array($_GET['page'].".php",$pages))
{
$content = 'pages/'.$_GET['page'].".php";
}else{
header("Location:index.php?page=login");
}
?>
<!DOCTYPE html>
<html
<head>
<link rel='stylesheet' href='css/style.css'>
</head>
<body>
<div id='content'>
<?php
include($content);
?>
</div>
</body>
</html>[/php]
<config>Windows / Chrome 35.0.1916.114</config>