Location: PHPKode > projects > Mirroring Boards > add_mirror.php
<?

if (isset ($_POST['add']))
 {
mysql_connect ("localhost", "www.beng", "2pebv8mn");
mysql_select_db ("www_beng");

  $request = mysql_query ("SELECT * FROM mb_users WHERE login=\"".$_POST['author']."\"");
  @extract (mysql_fetch_array ($request), EXTR_PREFIX_ALL, "auth");

  if ($auth_pass == $_POST['pass'] && $auth_access ='admin')
   {

/*
** AUTHENTIFICATION Ok
**  Posting the new message :)
*/
    $sql = "INSERT INTO mb_mirrors (name, srv, protocol, uid, pass, path) ";
    $sql.= "VALUES ('".$_POST['name']."', '".$_POST['srv']."', ";
    $sql.= "'ftp', '".$_POST['uid']."', ";
    $sql.= "'".$_POST['paswd']."', '".$_POST['path']."')";
    mysql_query ($sql);

    $sql = "ALTER TABLE mb_spreads ADD ans".$_POST['id']." ENUM ('', 'sent', 'confirmed') DEFAULT NULL";
    mysql_query ($sql);

    echo "<a href=list_mirror.php>See Mirrors</a><br><br>\n";

   }
  else
   {
    echo "AUTHENTIFICATION ERROR !<br><br>\n";
   }
  mysql_close();
 }
else
 {
  echo "<table><tr><td align=center>\n";
  echo "<script language=\"JavaScript\" src=\"md5.js\"></script>\n";
  echo "<script language=\"Javascript\">\n";
  echo " function encode()\n";
  echo " { document.add_form.pass.value = hex_md5 (document.add_form.pass.value); }\n</script>\n";
  echo "<form name=add_form action=add_mirror.php method=post>\n";
  echo "<input type=hidden name=add value=true>\n";
  echo "<u>Identification :</u><br>\n";
  echo "<input type=text name=author value=author size=15 maxlenght=15><br>\n";
  echo "<input type=password name=pass value=password size=32><br><br>\n";
  echo "<u>Infos sur le mirroir :</u></u><br>\n";
  echo "<input type=text name=name value=name size=20 maxlenght=20><br>\n";
  echo "<input type=text name=uid value=user size=20 maxlenght=20><br>\n";
  echo "<input type=text name=paswd value=pass size=20 maxlenght=20><br>\n";
  echo "<input type=text name=srv value=serveur size=20 maxlenght=20><br>\n";
  echo "<input type=text name=path value=path size=40 maxlenght=40><br>\n";
  echo "<input type=submit value=post onclick=\"encode();\">\n";
  echo "</table><br><br>\n";
 }

include ("md5_info.php");

?>
Return current item: Mirroring Boards