Partie du code View
// Publier les articles dans la page d'accueil if ( isset ($_GET
[ 'actfp'])){
$idart = $_GET [ 'actfp'];
$tabfp =
$frontPage->findFrontPage(array('conditions'=>'orderArt=(SELECT
Max(orderArt) FROM frontpage)'));
$rows = $frontPage->rows;
if($rows == 0){
$datafp = array('articleid'=>$idart,'orderArt'=>1);
$frontPage->saveFrontPage($datafp);
header('location:index2.php?article='.$_GET['article']);
}
foreach($tabfp as $fp){
$orderfp = $fp['orderArt']+1;
$datafp = array('articleid'=>$idart,'orderArt'=>$orderfp);
$frontPage->saveFrontPage($datafp);
$artpage = $_GET['article'];
header('location:index2.php?article='.$artpage);
}
}
Partie du code Section
// fonction pour afficher le page section
public function findSection($data=array()){
$conditions = "1=1";
$fields = "*"; $limit = " ";
$order = "orderS ASC";
$max = " ";
if(isset($data['conditions'])){$conditions =
$data['conditions'];} if(isset($data['fields'])){$fields = $data['fields'];}
if(isset($data['limit'])){$limit = $data ['limit'];}
if(isset($data['order'])){$order = $data ['order'];}
if(isset($data['max'])){$order = $data ['max'];}
$sql = "SELECT " .$fields. " FROM section " .$max." WHERE "
.$conditions." ORDER BY "
.$order." ".$limit." ";
$req = mysql_query ($sql) or die (mysql_error());
7. Code Inscription
if(isset($_GET['inscription'])){
if($_GET['inscription'] == 'redacteur' ){
$this->contenu = '<form id="from" name="inscrie"
action="inscription-valide.html"
method="POST" enctype="application/x-www-form-urlencoded">
<table align="left" width = "100%">
<tr> <td>Nom:</td>
<td><input id="text" name="nom" type="text"
/></td>
</tr>
<tr> <td>Prenom:</td>
<td><input id="text" name="prenom" type="text"
/></td>
</tr>
<tr> <td>Pseudo:</td>
<td><input id="text" name="user_name" type="text"
/></td>
</tr>
<tr>
<td>Mot de passe:</td>
<td><input id="text" name="mot_de_passe" type="password"
/></td>
</tr> <tr>
<td>Vérifier mot de passe:</td>
<td><input id="text" type="password" /></td>
</tr> <tr>
<td>Email:</td>
<td><input id="text" name="email" type="text"
/></td>
</tr> <tr>
<td>date de naissence:</td>
<td><input id="text" name="date_naissence" type="text"
/></td>
</tr> <tr>
<input type="hidden" name="date_insc" value="'.date('y-m-d
G:i:s').'" />
<input type="hidden" name="act_dact" value="2" />
<td colspan="2" align="center"><input id="bouton"
type="submit" value="Inscrie" /></td> </tr>
</table>
</form>';
}
if($_GET['inscription'] == 'erreur'){
$this->contenu = '<div id ="erreur-vide">
<h3>remplir les champs !!!</h3>
<p id="retour"><a
href="inscription-redacteur.html">Retour</a></p>
</div>';
if($_GET['inscription'] == 'valide' ){
if(isset($_POST)){ $user->saveUser($_POST);
$id = $user->id;
$redacteur = $user->findUser(array('conditions'=>'iduser =
'.$id.' '));
foreach ($redacteur as $red){
$this->contenu = $red['iduser'];
} } } }
|