include("a-annonces/configuration/informations.php3");
$color = "
";
if ($TestFunction != "1")
{
function MyAddSlashes($chaine ) {
return( get_magic_quotes_gpc() == 1 ?
$chaine :
AddSlashes($chaine) );
}
function MyStripSlashes($chaine) {
return( get_magic_quotes_gpc() == 1 ?
StripSlashes($chaine) :
$chaine );
}
function MyStripSlashes_2($chaine) {
return( get_magic_quotes_runtime() == 1 ?
StripSlashes($chaine) :
$chaine );
}
$TestFunction = "1";
}
$mysql_link = mysql_connect($Hote, $Login, $Pass_mysql);
mysql_select_db($Base);
function msg_fin($Message)
{
include("a-annonces/configuration/informations.php3");
$color = "";
// Déclration du menu
$Menu .= "";
$Menu .= "";
$Menu .= "";
$Menu .= "$color Hardware Database
";
$mysql_link = mysql_connect($Hote, $Login, $Pass_mysql);
mysql_select_db($Base);
$Query = "SELECT * FROM $Table_categorie WHERE Sous_rubrique='0' ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$C_ID = $row[0];
$C_Nom = $row[1];
$C_Nom = MyStripSlashes_2($C_Nom);
$Query2 = "SELECT * FROM $Table_categorie WHERE Sous_rubrique='1' AND Correspondance='$C_ID' ";
$Menu .= " ";
$mysql_result2 = mysql_query($Query2, $mysql_link);
while($row = mysql_fetch_row($mysql_result2))
{
$SC_ID = $row[0];
$SC_Nom = $row[4];
$SC_Nom = MyStripSlashes_2($SC_Nom);
$Menu .= "$SC_Nom ";
}
}
$Menu .= " ";
$Menu .= "$color> Create your profile ";
$Menu .= " ";
$Menu .= " > Profile modification: ";
$Menu .= " ";
$Menu .= " ";
$Menu .= " ";
$Menu .= "";
$Menu .= " ";
$Menu .= "$color> Search: ";
$Menu .= "";
$Menu .= "$color PHPlive © ";
$Menu .= " ";
$Menu .= " ";
$Menu .= "
";
$query = "SELECT * FROM $TablePer WHERE ID='1' ";
$mysql_result = mysql_query($query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$P_ID = $row[0];
$P_Affichage = $row[1];
$P_Affichage = MyStripSlashes_2($P_Affichage);
$P_Affichage = ereg_replace("<", "<", $P_Affichage);
$P_Affichage = ereg_replace(">", ">", $P_Affichage);
$P_Affichage2 = $P_Affichage;
}
$P_Affichage = $P_Affichage2;
// On remplace les balises
$P_Affichage = str_replace("[Menu]", "$Menu", $P_Affichage);
$P_Affichage = str_replace("[Page]", "$Message", $P_Affichage);
echo "
";
echo "$P_Affichage";
echo "";
// On termine l'excution du programme
exit();
}
if ($action == "")
{
// Si l'action est nulle alors on affiche le message de la page d'accueil
include("a-annonces/configuration/perso.php3");
$color = "";
$Message_accueil = StripSlashes($Message);
// On envoi le texte à afficher
msg_fin($Message_accueil);
}
// Si on arrive jusqu'ici cela veut dire que $action n'est pas nul
switch($action)
{
case"lire":
// Action lire - Affichage des messages des sous rubirques
$Query = "SELECT * FROM $Table_categorie WHERE ID='$id_sc'";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$SC_ID = $row[0];
$SC_Correspondance = $row[3];
$SC_Nom = $row[4];
}
include("a-annonces/configuration/perso.php3");
$color = "";
$affi_page = "$Nb_msg_page";
//Gestionnaire des pages
if ($page == "" or $page == "1")
{
$page = "1";
$debut = "0";
}
else
{
$debut = ($page - 1) * $affi_page;
}
$Selection = "SELECT * FROM $Table_annonce WHERE Correspondance_srubrique='$SC_ID' ";
$mysql_result = mysql_query($Selection, $mysql_link);
// Nb totel d'annonces dans cette sous rubriques
$nb_t = mysql_num_rows($mysql_result);
$test = $page * $affi_page;
//Gestionnaire des pages - suite
if ($test > $nb_t)
{
$page_c = $page - 1;
$affi_page = $nb_t - ($affi_page * $page_c);
}
$Query = "SELECT * FROM $Table_categorie WHERE ID='$id_sc'";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$SC_ID = $row[0];
$SC_Correspondance = $row[3];
$SC_Nom = $row[4];
$SC_Nom = MyStripSlashes_2($SC_Nom);
}
$Query = "SELECT * FROM $Table_categorie WHERE ID='$SC_Correspondance' LIMIT $debut,$affi_page ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$C_ID = $row[0];
$C_Nom = $row[1];
$C_Nom = MyStripSlashes_2($C_Nom);
}
$Affichage .= " ";
$Affichage .= "$SC_Nom
";
$Affichage .= " ";
$Query = "SELECT * FROM $Table_annonce WHERE Correspondance_srubrique='$SC_ID' ORDER BY ID DESC LIMIT $debut,$affi_page";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
$A_Nom = $row[1];
$A_OS = $row[2];
$A_Mail = $row[3];
$A_CPU = $row[4];
$A_description = $row[5];
$A_mobo = $row[8];
$A_graphic = $row[9];
$A_sound = $row[10];
$A_other = $row[11];
$A_ans = $row[12];
$A_description = MyStripSlashes_2($A_description);
$Affichage .= "";
$Affichage .= "";
$Affichage .= "";
$Affichage .= "ID :$color$A_ID ";
$Affichage .= "Nom :$color$A_Nom ";
$Affichage .= "Mail : $A_Mail ";
$Affichage .= " ";
$Affichage .= "OS : $color$A_OS ";
$Affichage .= "CPU : $color$A_CPU ";
$Affichage .= "Motherboard and chipset : $color$A_mobo ";
$Affichage .= "Video Card : $color$A_graphic ";
$Affichage .= "Sound Card : $color$A_sound ";
$Affichage .= "Other : $color$A_other ";
$Affichage .= "Trouble : $A_description ";
$Affichage .= "Answers : $A_ans";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= "
";
$Affichage .= " ";
}
$Affichage .= " ";
// Gestionnaire de pages - suite (terminus)
if($page != 1)
{
$n_page = $page - 1;
$Affichage .= "[previous] ";
}
if($test < $nb_t)
{
$n_page = $page + 1;
$Affichage .= "[Next] ";
}
$Affichage .= " ";
msg_fin($Affichage);
break;
case"recherche":
include("a-annonces/configuration/perso.php3");
$color = "
";
// Traitement de la chaine
$FRecherche = trim($FRecherche);
$affi_page = "$Nb_msg_page";
// Gestionnaire de pages
if ($page == "" or $page == "1")
{
$page = "1";
$debut = "0";
}
else
{
$debut = ($page - 1) * $affi_page;
}
$motclef=strtolower($FRecherche);
sql_regcase($mot_clef);
$Selection = "SELECT * FROM $Table_annonce WHERE description LIKE '%$motclef%' OR cpu LIKE '%$motclef%' OR mobo LIKE '%$motclef%' OR graphic LIKE '%$motclef%' OR sound LIKE '%$motclef%' OR other LIKE '%$motclef%'";
$query_result_handle = mysql_query($Selection, $mysql_link);
// Nb total d'annonces trouvé
$nb_t = mysql_num_rows($query_result_handle);
$test = $page * $affi_page;
if ($test > $nb_t)
{
$page_c = $page - 1;
$affi_page = $nb_t - ($affi_page * $page_c);
}
$Selection = "SELECT * FROM $Table_annonce WHERE description LIKE '%$motclef%' OR cpu LIKE '%$motclef%' OR mobo LIKE '%$motclef%' OR graphic LIKE '%$motclef%' OR sound LIKE '%$motclef%' OR other LIKE '%$motclef%' LIMIT $debut,$affi_page";
$query_result_handle = mysql_query($Selection, $mysql_link);
$Affichage .= "
$nb_t Profile(s) found for the following query: $motclef ";
while($row = mysql_fetch_row($query_result_handle))
{
$A_ID = $row[0];
$A_Nom = $row[1];
$A_OS = $row[2];
$A_Mail = $row[3];
$A_CPU = $row[4];
$A_description = $row[5];
$A_mobo = $row[8];
$A_graphic = $row[9];
$A_sound = $row[10];
$A_other = $row[11];
$A_description = MyStripSlashes_2($A_description);
$Affichage .= "
";
$Affichage .= "";
$Affichage .= "";
$Affichage .= "ID : $color$A_ID ";
$Affichage .= "Nom : $color$A_Nom ";
$Affichage .= "Mail : $A_Mail ";
$Affichage .= " ";
$Affichage .= "OS : $color$A_OS ";
$Affichage .= "CPU : $color$A_CPU ";
$Affichage .= "Motherboard and chipset :$color$A_mobo ";
$Affichage .= "Video Card : $color$A_graphic ";
$Affichage .= "Sound Card : $color$A_sound ";
$Affichage .= "Other : $color$A_other ";
$Affichage .= "Trouble : $A_description ";
$Affichage .= "Answers : $A_ans";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= "
";
$Affichage .= "
";
}
$Affichage .= "
";
if($page != 1)
{
$n_page = $page - 1;
$Affichage .= "[Previous] ";
}
if($test < $nb_t)
{
$n_page = $page + 1;
$Affichage .= "[Next] ";
}
$Affichage .= " ";
msg_fin($Affichage);
break;
case"ajouter":
$Affichage .= "
";
msg_fin($Affichage);
break;
case"ajouter_go":
if (($FNom == "") OR ($FOS == "") OR ($FMail == "") OR ($Fdescription == "") OR ($FRubrique == "") OR ($Fmobo == "") OR ($Fgraphic == "") OR ($Fsound == "") OR ($FCPU == "") OR (!ereg( '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$FMail)))
{
$Affichage .= "
Registration NOT Successful
";
$Affichage .= "
";
$Affichage .= "
$color ERROR: Data entry is not valid.
";
$Affichage .= "
";
$Affichage .= " $color - Please check if all the fields are filled up
";
$Affichage .= " $color - Please check the e-mail adress is valid.
";
$Affichage .= "
$color - Please check the category of your hardware problem is selected ";
$Affichage .= "
$color - Press the back botton
";
}
else
{
$chaine = "!abBDEFcd!efghijkm!nPQRSTUVWXYpq!rst01234!56789!";
srand((double)microtime()*1000000);
for($i=0; $i<6; $i++) {
$pass .= $chaine[rand()%strlen($chaine)];
}
$FNom = MyAddSlashes($FNom);
$FOS = MyAddSlashes($FOS);
$FMail = MyAddSlashes($FMail);
$Fmobo = MyAddSlashes($Fmobo);
$Fgraphic = MyAddSlashes($Fgraphic);
$Fsound = MyAddSlashes($Fsound);
$Fother = MyAddSlashes($Fother);
$Fdescription = MyAddSlashes($Fdescription);
$Fdescription = nl2br($Fdescription);
$Query = "INSERT INTO $Table_annonce (Nom, OS, Mail, CPU, description, Pass, Correspondance_srubrique, mobo, graphic, sound, other) VALUES ('$FNom', '$FOS', '$FMail', '$FCPU', '$Fdescription', '$pass', '$FRubrique', '$Fmobo', '$Fgraphic', '$Fsound', '$Fother') ";
$mysql_result = mysql_query($Query, $mysql_link);
$Query = "SELECT * FROM $Table_annonce WHERE Pass='$pass' ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
}
$Affichage .= "
Registration Successful
";
$Affichage .= "
";
$Affichage .= "
$colorYour hardware profile has been updated. Here are your ID and password
DON'T LOOSE THEM , there is no way that you can have it back for the moment.
These are necessary to update your profile.
";
$Affichage .= "
";
$Affichage .= "
ID : $A_ID ";
$Affichage .= "Password : $pass";
}
msg_fin($Affichage);
break;
case"modifier":
$FPass = trim($FPass);
$FId = trim($FId);
if (($FPass != "") OR ($FId != ""))
{
$Query = "SELECT * FROM $Table_annonce WHERE ID='$FId' ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
$A_Nom = $row[1];
$A_OS = $row[2];
$A_Mail = $row[3];
$A_CPU = $row[4];
$A_description = $row[5];
$A_Pass = $row[6];
$A_mobo = $row[8];
$A_graphic = $row[9];
$A_sound = $row[10];
$A_other = $row[11];
$A_description = MyStripSlashes_2($A_description);
}
if (($A_ID == $FId) AND ($A_Pass == $FPass))
{
$Affichage .= " Profile Administration ";
$Affichage .= "
";
$Affichage .= "
$colorDelete Profile ";
$Affichage .= "
";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= "";
$Affichage .= " ";
}
else
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= "$color - ID or/and password invalid ";
}
}
else
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= "$color - Please check if all the fields are filled up ";
}
msg_fin($Affichage);
break;
case"modifier_go":
if (($FPass != "") OR ($FId != ""))
{
$Query = "SELECT * FROM $Table_annonce WHERE ID='$FId' ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
$A_Nom = $row[1];
$A_OS = $row[2];
$A_Mail = $row[3];
$A_CPU = $row[4];
$A_description = $row[5];
$A_Pass = $row[6];
$A_mobo = $row[8];
$A_graphic = $row[9];
$A_sound = $row[10];
$A_other = $row[11];
}
if (($A_ID == $FId) AND ($A_Pass == $FPass))
{
$Affichage .= "
User Profile Administration ";
$Affichage .= "
";
if (($FNom == "") OR ($FOS == "") OR ($FMail == "") OR ($Fdescription == "") OR ($FRubrique == "") OR ($Fmobo == "") OR ($Fgraphic == "") OR ($Fsound == "") OR ($FCPU == "") OR (!ereg( '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$FMail)))
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= " - Please check if all the fields are filled up. ";
$Affichage .= " - Please check if the e-mail adress is valid. ";
}
else
{
$FNom = MyAddSlashes($FNom);
$FOS = MyAddSlashes($FOS);
$FMail = MyAddSlashes($FMail);
$Fmobo = MyAddSlashes($Fmobo);
$Fgraphic = MyAddSlashes($Fgraphic);
$Fsound = MyAddSlashes($Fsound);
$Fother = MyAddSlashes($Fother);
$Fdescription = MyAddSlashes($Fdescription);
$Fdescription = nl2br($Fdescription);
$Query = "UPDATE $Table_annonce SET Nom='$FNom',OS='$FOS',Mail='$FMail',CPU='$FCPU',description='$Fdescription',Correspondance_srubrique='$FRubrique',mobo='$Fmobo', graphic='$Fgraphic',sound='$Fsound',other='$Fother' WHERE ID='$FId' ";
/*$Query = "INSERT INTO $Table_annonce (Nom, OS, Mail, CPU, description, Pass, Correspondance_srubrique, mobo, graphic, sound, other) VALUES ('$FNom', '$FOS', '$FMail', '$FCPU', '$Fdescription', '$pass', '$FRubrique', '$Fmobo', '$Fgraphic', '$Fsound', '$Fother') ";*/
$mysql_result = mysql_query($Query, $mysql_link);
$Query = "SELECT * FROM $Table_annonce WHERE ID='$FId' ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
$A_Nom = $row[1];
$A_OS = $row[2];
$A_Mail = $row[3];
$A_CPU = $row[4];
$A_description = $row[5];
$A_Pass = $row[6];
$A_mobo = $row[8];
$A_graphic = $row[9];
$A_sound = $row[10];
$A_other = $row[11];
$A_description = MyStripSlashes($A_description);
}
$Affichage .= "Your profile has been updated !
";
$Affichage .= "
";
$Affichage .= "
$colorDelete your profile ";
$Affichage .= "
";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= "";
$Affichage .= " ";
}
}
else
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= "- ID and/or password is invalid. ";
}
}
else
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= " - Please check if all the fields are filled up ";
}
msg_fin($Affichage);
break;
case"supprimer":
$Query = "DELETE FROM $Table_annonce WHERE ID='$FId'";
$mysql_result = mysql_query($Query, $mysql_link);
$Affichage .= "Your profile has been deleted.";
msg_fin($Affichage);
break;
case"ans":
$GId = trim($GId);
if ($GId != "")
{
$Query = "SELECT * FROM $Table_annonce WHERE ID='$GId'";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
$A_nick = $row[1];
$A_email = $row[3];
$A_description = $row[5];
$A_ans = $row[12];
}
if ($A_ID == $GId)
{
$Affichage .= "
";
$Affichage .= " ";
$Affichage .= " ";
$Affichage .= "";
$Affichage .= " ";
}
else
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= "$color - ID invalid ";
}
}
else
{
$Affichage .= "
$color ERROR: Data entry is not valid. ";
$Affichage .= "$color - Please check if you have submited an ID ";
}
msg_fin($Affichage);
break;
case"ans_go":
if ($GId != "")
{
$Query = "SELECT * FROM $Table_annonce WHERE ID='$GId' ";
$mysql_result = mysql_query($Query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
$A_ID = $row[0];
$A_ans = $row[12];
}
if ($A_ID == $GId)
{
$Affichage .= "
Solution proposed ";
$Affichage .= "
";
$Gans = MyAddSlashes($Gans);
$Gans = nl2br($Gans);
$Query = "UPDATE $Table_annonce SET ans='$Gans' WHERE ID='$GId' ";
/*$Query = "INSERT INTO $Table_annonce ans VALUES '$Gans' ";*/
$mysql_result = mysql_query($Query, $mysql_link);
$Affichage .= "Thank you !
";
msg_fin($Affichage);
}
}
break;
}
?>