Contenu du répertoire ./

headerinc.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>welcome portal links</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <link rel="stylesheet" type="text/css" href="standard.css">
</head>
<body>
<table><tr><td>
<a href='./'><img src='pics/links.jpg' width=100 height=80 border=0></td><td valign=center><h1>Links portal</h1></td><td><img src='pics/links.jpg' width=100 height=80 border=0></a>
</td></tr></table>
<p>
1


footerinc.php
 <hr>
<b>Portal links</b>, <? echo "Last modified: " date("d/m/y"getlastmod()) ?>
, <a href='http://www.akademia.ch/writemail.php' class='ns'>fr</a>

  
</body>
</html>
1
getin.php
<?

    
echo "<h1>Welcome, $username!</h1>";
    echo 
"<b></b>";
    switch (
$look) {
    case 
'cuisine'$pic='caviar.jpg';
    break;
    case 
'web'$pic='computer.jpg';
    break;
    case 
'jeun'$pic='family.jpg';
    break;
    case 
'cultu'$pic='intello.jpg';
    break;
    case 
'pol'$pic='marx.jpg';
    break;
    }

include(
"connect.php");

if (!
$order) {
$order='name';
}

if (
$order=='date') {
$sort='desc';
 } else {
$sort='asc';
}

$result mysql_query("select * from links where category='$look' order by $order $sort");
if (
$look=='pol') {
$result=mysql_query("select * from links where category like '%pol%' or category like '%marx%' order by $order $sort");
}

$nbRec mysql_num_rows($result);

$today=date("Y-m-d");
$sql=mysql_query("select * from logins where login = '$username'");
$last_visit=mysql_result($sql,0,'date');
$id=mysql_result($sql,0,'id');
$interest=mysql_result($sql,0,'interest');
$res mysql_query("replace into logins (id, login, interest, date) VALUES ('$id', '$login', '$interest', '$today')");

echo 
"<table><tr><td><img src='pics/$pic' width=150 heigth=150 alt='$look'><br>Your category: $look";


echo 
"
</td><td width=450><span valign='top'>&nbsp;#number of links: $nbRec</span>
<br><li>Today: $today;
<li>Your last visit: $last_visit;<br>You can see the new links since your last visit by the <img src='pics/new.gif'> icon.<p> To get the links ordered by reverse date, click on the \"Date\" on the yellow table; to get them alphabetically, click on \"webSite\". <p align='center'><a href='new-link.php?look=$look&login=$login'>To insert a new link</a>
<br>
</td>
</tr></table>
<table>
<tr bgcolor='yellow'><th align=center><a href='welcome2.php?look=$look&username=$username&last_visit=$last_visit&order=name'>webSite</a></th><th align=center><a href='welcome2.php?look=$look&username=$username&last_visit=$last_visit&order=date'>Date</a></th></tr>
<tr>"
;

$i 0;
while (
$i mysql_num_rows($result)) {
echo  
"<tr";
if (
intval($i/2)==($i/2)) {
echo 
" bgcolor='lightgrey'";
}
echo 
">";   
    echo  
"<td>";   
    
$curr_date=mysql_result($result,$i,'date');
    if (
$last_visit<$curr_date) {
echo 
"<img src='pics/new.gif'>";
}   

    echo 
"<a href=",mysql_result($result,$i,'url')," class='ns'>";
    echo 
mysql_result($result,$i,'name');
    echo 
"</a>";
    echo  
"<br>";   
    echo 
mysql_result($result,$i,'comments');
    echo 
"</td>";   
    echo  
"<td>";   
    echo 
mysql_result($result,$i,'date');
    echo 
"</td>";   
    
$i++;
};

?>
</table> 
1
welcome2.php
<?
include ("header.inc.php");
include(
"connect.php");
$sql="select * from logins where login = '$username'";
$login=mysql_query($sql);
$nbl=mysql_num_rows($login);
if (
$nbl==0) {
    die (
"Your login doesn't exist, please <a href='login.php'>register</a>!");
    } else {
    
$look mysql_result($login,0,'interest');
    
$login mysql_result($login,0,'login');
    
#echo "Ok $username, lets <a href='getin.php?username=$login&look=$look'>get in right there</a>!";
    
include("getin.php");
}
include (
"footer.inc.php");
?>
1
welcome.php
<?
$title
="Links portal";
include (
"header.inc.php");
?>

This portal uses <img src='pics/php.gif' width=70 height=40> & <img src='pics/mysql.gif'  width=70 height=40>; it allows you to:
<li> find interesting links in relationship with your interests;<br>
<li> introduce links and share them with other users of the portal
<li> get the <img src='pics/new.gif'> links quickly on connecting
 <p>
<b>Please enter your pseudo</b><br>

<form action="welcome2.php">
<table><tr><td>
<input type=text name='username' value='test'>
</td><td>
<p align="center">
<input type='submit' value="Get in!">
 </table>
</form>
Not registered? <a href='login.php' class='ns'>Click Here</a>
  <p>
<i><a href="source.php" class='ns'>Source files</a></i><br>
<i><a href="admin/" class='ns'>Administrator interface (password protected)</a></i><br>

<?
include ("footer.inc.php");
?>
1
login.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>welcome portal links - login</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <link rel="stylesheet" type="text/css" href="standard.css">
</head>
<body>
<h1><a href='./'>Links portal</a> - login</h1>

<b>Please enter your pseudo and interest</b><br>

<form action="insert-login.php">
<table><tr><td>
*User name: <input type=text name=login value=toto>
</td><td>
Interest: <select name=interest>
<option value='cuisine'>Cooking
<option value='web'>Web
<option value='pol'>Politics
<option value='jeun'>Kids
<option value='cultu'>Culture
</select>
</td><td>
<p align="center">
<input type='submit' value="Subscribe">
 </table>
</form>
 <hr>
<? echo "Last modified: " date("d/m/y"getlastmod()) ?>
, <a href='http://www.akademia.ch/writemail.php'>fr</a>

  
</body>
</html>
1
new-link.php
<?
$title
="Add a new link";
include (
"header.inc.php");
?>
<form method='post' action='insert-entry.php'>

<table>
<input type='hidden' name='id'>
<input type='hidden' name='login' value='<? echo $login ?>'>
<input type='hidden' name='look' value='<? echo $look ?>'>
<tr><td>Name</td><td><input type='text' name='name' cols=90 rows=2></td></tr>
<tr><td>URL</td><td><input type='text' name='url' cols=90 rows=2></td></tr>

<tr><td valign=top>Notes</td><td><textarea name='comments' cols=27 rows=4></textarea></td></tr>

<tr><td></td><td>
<input type='submit' value="Add link">
</td></tr>
</table>

</form>
<?
include ("footer.inc.php");
?>
1
insert-login.php
<?
include("connect.php");
$result mysql_query ("insert into logins (login, interest) VALUES ('$login', '$interest')");
if (
$result) {
echo 
"<p>OK, your login is: $login. <a href='./'>Return</a>";
}
else {
echo 
"<p>Problem! Probably your login has already been used, please choose another one! <a href='login.php'>back to login</a>";
}
?>
1
insert-entry.php
<?
$date
=date("Y-m-d");
$title="New link";
include (
"header.inc.php");
include(
"connect.php");
$result mysql_query ("insert into links (id, category, name, url, date, comments) VALUES ('$id', '$look', '$name', '$url', '$date', '$comments')");
if (
$result) {
echo 
"<p>OK, thank you very much for your new links. You will be now automatically redirected to your page or <a href='welcome2.php?username=$login'>click here</a>";
   echo 
"<meta http-equiv='refresh' content='1;URL=welcome2.php?username=$login'>";
}
else {
echo 
"<p>Problem! Probably your link is already registred!<br>
You will be now automatically redirected to your page or <a href='welcome2.php?username=$login'>click here</a>"
;
   echo 
"<meta http-equiv='refresh' content='2;URL=welcome2.php?username=$login'>";
}

include (
"footer.inc.php");
?>

1
date.php
<html>
<head>
  <title>Links portal, category $look</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <link rel="stylesheet" type="text/css" href="standard.css">
</head>
<body>

<?

    
echo "<h1>Welcome, $username!</h1>";
    switch (
$look) {
    case 
'cuisine'$pic='caviar.jpg';
    break;
    case 
'web'$pic='computer.jpg';
    break;
    case 
'jeun'$pic='family.jpg';
    break;
    case 
'cultu'$pic='intello.jpg';
    break;
    case 
'pol'$pic='marx.jpg';
    break;
    }
echo 
"<table><tr><td><img src='pics/$pic' width=150 heigth=150 alt='$look'>";
include(
"connect.php");
$result mysql_query("select * from links where category='$look' order by date desc");
if (
$look=='pol') {
$result=mysql_query("select * from links where category like '%pol%' or category like '%marx%' order by date desc");
}

$nbRec mysql_num_rows($result);
echo 
"
</td><td><span valign='top'>&nbsp;#number of links: $nbRec</span></td></tr></table>
<table>
<tr bgcolor='yellow'><th><a href='welcome2.php?look=$look&username=$username'>webSite</th></a><th>Date</th></tr>
<tr>"
;

$i 0;
while (
$i mysql_num_rows($result)) {
echo  
"<tr";
if (
intval($i/2)==($i/2)) {
echo 
" bgcolor='grey'";
}
echo 
">";   
    echo  
"<td>";
    
$curr_date=mysql_result($result,$i,'date');
    if (
$last_visit<$curr_date) {
echo 
"<img src='pics/new.gif'>";
}   
    echo 
"<a href=",mysql_result($result,$i,'url')," class='ns'>";
    echo 
mysql_result($result,$i,'name');
    echo 
"</a>";
    echo  
"<br>";   
    echo 
mysql_result($result,$i,'comments');
    echo 
"</td>";   
    echo  
"<td>";   
    echo 
mysql_result($result,$i,'date');
    echo 
"</td>";   
    
$i++;
};

?>
</table> 
 <hr>
<? echo "Last modified: " date("d/m/y"getlastmod()) ?>
, <a href='http://www.akademia.ch/writemail.php'>fr</a>

  
</body>
</html>
1