« Programmation PHP/Exemples/MiniForum » : différence entre les versions

Contenu supprimé Contenu ajouté
Ligne 455 :
';
 
?>
</source>
}}
 
<b>increment 3:pages.inc.php</b>
:contenus des pages
{{Cadre fichier|pages.inc.php|
<source lang="php">
<?php
/* pager contents
 
*/
 
// mod 1
if(@$_REQUEST['mod'] == '1' && @$_SESSION['autho']) //
{
// list rubriq
$_res=Request::SQL($cnx,'SELECT * FROM topics ORDER BY id');
foreach($_res as $_tmp)
{
@$str .= '<br/><form method="post" action="' . $_SERVER['PHP_SELF'] . '?mod=1" name="f3"><input name="iDel" type="hidden" value="' . $_tmp['id'] . '" /><input type="submit" value="[-]"/> <a href="">' . $_tmp['title'] . '</a></form>';
}
$_content['pager'] = '
<div class="title">Rubriques existantes | <span class="toAct" onclick="showHide(getElementById(\'cRubriq\'));">Ajouter une rubrique</span><br/>
<!-- Rubriq adder -->
<table width="100%">
<tr valign="top">
<td>
<div id="cRubriq">Ajouter une nouvelle rubrique
<form name="f2" method="post" action="' . $_SERVER['PHP_SELF'] . '?mod=1">
<p><input name="iRubriq" type="text" size="50" /><input type="submit" value="add"/></p>
</form>
</div>
</td>
</tr>
<tr valign="top" height="500"><td><p>' . @$str . '</p></td></tr>
</table>
</div>
';
}
 
// rub 1
if(@$_REQUEST['rub'] == '1') //
{
if(!@$_REQUEST['tId'])
{
// list rubriq
$_res=Request::SQL($cnx,'SELECT * FROM topics ORDER BY id');
foreach($_res as $_tmp)
{
@$str .= '<br/> <a href="'.$_SERVER['PHP_SELF'].'?rub=1&tId=' . $_tmp['id'] . '">' . $_tmp['title'] . '</a>';
}
$_content['pager'] = '
<div class="title">Rubriques existantes
<table width="100%">
<tr valign="top" height="500"><td><p>' . @$str . '</p></td></tr>
</table>
</div>
';
} else {
// list rubriq
$_res=Request::SQL($cnx,'SELECT * FROM contents WHERE topicsId=' . @$_REQUEST['tId'] . ' ORDER BY id');
foreach($_res as $_tmp)
{
@$str .= '<br/> <a href="' . $_SERVER['PHP_SELF'] . '?rub=1&tId=' . $_tmp['topicsId'] . '">' . $_tmp['subject'] . '</a>';
}
$_content['pager'] = '
<div class="title">Topics existants
<table width="100%">
<!-- Topics adder -->
<tr valign="top">
<td>
<div id="cTopics">Ajouter un nouveau topic
<form name="f4" method="post" action="' . $_SERVER['PHP_SELF'] . '?rub=1">
<p><input name="iTopics" type="text" size="50" /><input type="submit" value="add" /></p>
</form>
</div>
</td>
</tr>
<tr valign="top" height="500"><td><p>' . @$str . '</p></td></tr>
</table>
</div>
';
}
}
?>
</source>