Treceți la conținutul principal

o aplicatie complexa librarie php

//adauga_comentariu.php

<?PHP
$ID_CARTE=$_POST['ID_CARTE'];
IF($_POST['NUME_UTILIZATOR'] == ""
||$_POST['ADRESA_EMAIL'] == ""
||$_POST['COMENTARIUL'] == "")
{
 PRINT " TREBUI SA COMPLETEZI TOATE CAMPURILE";
 EXIT;
}

INCLUDE("CONECTARE.PHP");
$NUMEFARATAGS = STRIP_TAGS($_POST['NUME_UTILIZATOR']);
$MAILFARATAGS = STRIP_TAGS($_POST['ADRESA_EMAIL']);
$COMENTARIUFARATAGS = STRIP_TAGS($_POST['COMENTARIUL']);

$SQL = "INSERT INTO comentarii(ID_CARTE,NUME_UTILIZATOR,ADRESA_EMAIL,COMENTARIU)
VALUES(".$_POST['ID_CARTE'].",'".$NUMEFARATAGS."','".$MAILFARATAGS."','".$COMENTARIUFARATAGS."')";

mysql_query($SQL);
/*
$INAPOI="CARTE.PHP?ID_CARTE=".$ID_CARTE;
HEADER("LOCATION: $INAPOI");
*/

PRINT '<A HREF="CARTE.PHP?id_carte='.$ID_CARTE.'">INAPOI</A>';
?>



//autor.php


<?
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
?>

<?
$ID_AUTOR = $_GET['ID_AUTOR'];
$SQLNUMEAUTOR = "SELECT NUME_AUTOR, ID_AUTOR  FROM AUTORI WHERE ID_AUTOR =".$ID_AUTOR;
$RESURSANUMEAUTOR = mysql_query($SQLNUMEAUTOR);
$NUMEAUTOR = mysql_result($RESURSANUMEAUTOR,0,"NUME_AUTOR");
?>

<TD VALIGN="TOP">
<H2> AUTOR: <?=$NUMEAUTOR?></H2>
<B>CARTI SCRISE DE <?=$NUMEAUTOR?></B>
<TABLE CELLPADDING="5">
<?
$SQL = "SELECT ID_CARTE, TITLU, DESCRIERE, PRET, NUME_AUTOR FROM CARTI, AUTORI
 WHERE CARTI.ID_AUTOR = AUTORI.ID_AUTOR AND CARTI.ID_AUTOR = ".$ID_AUTOR;
$RESURSATOT = mysql_query($SQL);
WHILE($ROW = mysql_fetch_array($RESURSATOT))
{
 ?>

 <TD ALIGN="CENTER">
 <?
 $ADRESAIMAGINE = "COPERTE/".$ROW['ID_CARTE'].".JPG";
 IF(FILE_EXISTS($ADRESAIMAGINE))
 {
  PRINT '<IMG SRC="'.$ADRESAIMAGINE.'" WIDTH="75" HEIGHT="100"><BR>';
 }
 ELSE
 {
 PRINT '<DIV >
 FARA IMAGINE</DIV>';
 }
?>
</TD><TD>
<B>
<A HREF="CARTE.PHP?ID_CARTE=<?=$ROW['ID_CARTE']?>">
<?=$ROW['TITLU']?></A></B><BR><I>DE<?=$ROW['NUME_AUTOR']?></I><BR>
 PRET:<?=$ROW['PRET']?>LEI
 </TD>
 </TR>
<?
}
?>
</TABLE></TD>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>
//carte.php
<TD VALIGN="TOP">
<?PHP
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
$ID_CARTE=$_GET['id_carte'];
$sql = "SELECT TITLU, NUME_AUTOR, DESCRIERE, PRET FROM CARTI, AUTORI WHERE
ID_CARTE=".$ID_CARTE." AND CARTI.ID_AUTOR = AUTORI.ID_AUTOR";
$RESURSA =mysql_query($sql);
$ROW= mysql_fetch_array($RESURSA);
?>




</TD>
<TD VALIGN="TOP">
<H2><?=$ROW['TITLU']?></H2>

<?
$ADRESAIMAGINE ="COPERTE/".$ID_CARTE.".JPG";
IF(FILE_EXISTS($ADRESAIMAGINE))
{
 PRINT '<IMG SRC="'.$ADRESAIMAGINE.'" WIDTH="75" HEIGHT ="100" HSPACE="10"><BR>';
}
ELSE
 {
 PRINT '<DIV ><CENTER>
 FARA IMAGINE</CENTER></DIV>';
 }

?>

<I> DE <B> <?=$ROW['NUME_AUTOR']?></B></I>
<P><I><?=$ROW['DESCRIERE']?></I></P>
<P>PRET: <?=$ROW['PRET']?> LEI</P>

<?
$TITLU = $ROW['TITLU'];
$NUME_AUTOR = $ROW['NUME_AUTOR'];
$PRET = $ROW['PRET'];

?>
<br>
<!-- FORMULAR ASCUNS-->
<FORM ACTION ="COS.PHP?ACTIUNE=ADAUGA" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="ID_CARTE" VALUE="<?=$ID_CARTE?>">
<INPUT TYPE="HIDDEN" NAME="TITLU" VALUE="<?=$TITLU?>">
<INPUT TYPE="HIDDEN" NAME="NUME_AUTOR" VALUE="<?=$NUME_AUTOR?>">
<INPUT TYPE="HIDDEN" NAME="PRET" VALUE="<?=$PRET?>">
<INPUT TYPE="SUBMIT" NAME="BTNCUMPARAACUM" VALUE="CUMPARA ACUM!">
</FORM>
<!-- FORMULAR ASCUNS-->



<P><B> OPINIILE CITITORILOR</B></P>
<?
$SQLCOMENTARII = "SELECT ID_COMENTARIU, ID_CARTE, NUME_UTILIZATOR, ADRESA_EMAIL, COMENTARIU
 FROM comentarii WHERE comentarii.ID_CARTE=".$ID_CARTE;
$RESURSACOMENTARII =mysql_query($SQLCOMENTARII);
WHILE($ROW = mysql_fetch_array($RESURSACOMENTARII))
{
 PRINT '<hr><DIV >
 <A HREF="MAILTO:'.$ROW['ADRESA_EMAIL'].'">'.$ROW['NUME_UTILIZATOR'].'</A>
 <BR>'.$ROW['COMENTARIU'].'</DIV>';
}
?>

<BR><DIV >
<B>ADAUGA OPINIA TA: </B><HR SIZE="1">

<FORM ACTION="ADAUGA_COMENTARIU.PHP" METHOD="POST">
NUME:<INPUT TYPE="TEXT" NAME="NUME_UTILIZATOR"><BR><BR>
E-MAIL:<INPUT TYPE="TEXT" NAME="ADRESA_EMAIL"><BR><BR>
COMENTARIU:<TEXTAREA NAME="COMENTARIUL" COLS="45"></TEXTAREA><BR><BR>
<INPUT TYPE="HIDDEN" NAME="ID_CARTE" VALUE="<?=$ID_CARTE?>">
<CENTER><INPUT TYPE="SUBMIT" VALUE="ADAUGA"></CENTER></FORM>

</DIV></center>
</td>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>



//casa.php

<?
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
?>
<TD VALIGN="TOP">
<H2>CASA</H2>
ACESTEA SUNT CARTILE COMANDATE DE DVS.:
<TABLE BORDER="1" CELLSPACING="0" CELLPADING="4">
<TR BGCOLOR="#F9F1E7">
<TD><B>NR.BUC</B></TD>
<TD><B>CARTE</B></TD>
<TD><B>PRET</B></TD>
<TD><B>TOTAL</B></TD>
</TR>
<?

FOR($I=0;$I<COUNT($_SESSION['ID_CARTE']);$I++)
{
IF($_SESSION['NR_BUC'][$I] !=0)
 {
  PRINT '<TR><TD>'.$_SESSION['NR_BUC'][$I].'</TD>
  <TD><B>'.$_SESSION['TITLU'][$I].'</B> DE '.$_SESSION['NUME_AUTOR'][$I].'
  </TD>
  <TD ALIGN="RIGHT">'.$_SESSION['PRET'][$I].' LEI</TD>
  <TD ALIGN="RIGHT">'.($_SESSION['PRET'][$I]* $_SESSION['NR_BUC'][$I]).' LEI
  </TD></TR>';
 
  $TOTALGENERAL = $TOTALGENERAL + ($_SESSION['PRET'][$I] * $_SESSION['NR_BUC'][$I]);
 }
}

PRINT '<TR>
<TD ALIGN="RIGHT" COLSPAN="3">
<B>TOTAL DE PLATA</B></TD>
<TD ALIGN="RIGHT">
<B>'.$TOTALGENERAL.'</B> LEI</TD>
</TR>';
?>

</TABLE>
<H1>DETALII</H1>

<FORM ACTION="PRELUCRARE.PHP" METHOD="POST">
<TABLE>
<TR>
<TD><B>NUMELE:</B></TD>
<TD><INPUT TYPE="TEXT" NAME="NUME"></TD></TR>
<TR>
<TD VALIGN="TOP"><B>ADRESA:</B></TD>
<TD><TEXTAREA NAME="ADRESA" ROW="6"></TEXTAREA></TD>
</TR>
<TR>
<TD></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="TRIMITE!"</TD>
</TR>
</TABLE>
</FORM>
</TD>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>
//cautare.php
<?
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
$CUVANT = $_GET['CUVANT'];
?>
<TD VALIGN="TOP"><H1>REZULTATELE CAUTARII</H1><P>TEXTUL CAUTAT:<B><?=$CUVANT?></B></P>

<B>AUTORI</B><BLOCKQUOTE>

<?
$SQL = "SELECT ID_AUTOR, NUME_AUTOR FROM AUTORI WHERE NUME_AUTOR LIKE '%".$CUVANT."%'";
$RESURSA = mysql_query($SQL);

IF(mysql_num_rows($RESURSA)== 0)
{
 PRINT '<I>NICI UN REZULTAT</I>';
}
WHILE($ROW=mysql_fetch_array($RESURSA))
{
 $NUME_AUTOR = STR_REPLACE($CUVANT,"<B>$CUVANT</B>",$ROW['NUME_AUTOR']);
 PRINT '<A HREF="AUTOR.PHP?ID_AUTOR='.$ROW['ID_AUTOR'].'">'.$ROW['NUME_AUTOR'].'</A><BR>';
}
?>
</BLOCKQUOTE>

<B>TITLURI</B>
<BLOCKQUOTE>
<?PHP
$SQL="SELECT ID_CARTE, TITLU FROM CARTI WHERE TITLU LIKE '%".$CUVANT."%'";
$RESURSA = mysql_query($SQL);
IF(mysql_num_rows($RESURSA)== 0)
{
 PRINT "<I>NICI UN REZULTAT</I>";
}
WHILE($ROW=mysql_fetch_array($RESURSA))
{
 $TITLU = STR_REPLACE($CUVANT,"<B>$CUVANT</B>",$ROW['TITLU']);
 PRINT '<A HREF="CARTE.PHP?ID_CARTE='.$ROW['ID_CARTE'].'">'.$ROW['TITLU'].'</A><BR>';
}
?>
</BLOCKQUOTE>

<B>DESCRIERI</B>
<BLOCKQUOTE>
<?PHP
$SQL="SELECT ID_CARTE, TITLU , DESCRIERE FROM CARTI WHERE DESCRIERE LIKE '%".$CUVANT."%'";
$RESURSA = mysql_query($SQL);
IF(mysql_num_rows($RESURSA)== 0)
{
 PRINT "<I>NICI UN REZULTAT</I>";
}
WHILE($ROW=mysql_fetch_array($RESURSA))
{
 $DESCRIERE = STR_REPLACE($CUVANT,"<B>$CUVANT</B>",$ROW['DESCRIERE']);
 PRINT '<A HREF="CARTE.PHP?ID_CARTE='.$ROW['ID_CARTE'].'">'.$ROW['TITLU'].'</A><BR>'
 .$ROW['DESCRIERE'].'<BR><BR>';
}
?>
</BLOCKQUOTE>
</TD>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>
//conectare.php

<?PHP

mysql_connect("localhost", "root", "");
mysql_select_db("librarie2");
           
?>
                                                 <?php error_reporting (E_ALL ^ E_NOTICE); ?>
//cos.php
<?PHP
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
if (isset($_POST['ACTIUNE'])){ 
$ACTIUNE = $_GET['ACTIUNE'];
}


IF(ISSET($_GET['ACTIUNE']) && $_GET['ACTIUNE'] == "ADAUGA")
{
    FOR($I=0;$I < COUNT($_SESSION['ID_CARTE']);$I++)
 {
 IF($_SESSION['ID_CARTE'][$I] == $_POST['ID_CARTE'])
     {
      PRINT 'ATENTIE! CARETEA ESTE DEJA IN COS';
      EXIT;
  }
 }
$_SESSION['ID_CARTE'][]=$_POST['ID_CARTE'];
$_SESSION['NR_BUC'][]= 1;
$_SESSION['PRET'][]=$_POST['PRET'];
$_SESSION['TITLU'][]=$_POST['TITLU'];
$_SESSION['NUME_AUTOR'][]=$_POST['NUME_AUTOR'];
}

IF(ISSET($_GET['ACTIUNE']) && $_GET['ACTIUNE'] == "MODIFICA")
{
 FOR($I=0;$I < COUNT($_SESSION['ID_CARTE']);$I++)
 {
  $_SESSION['NR_BUC'][$I]=$_POST['NOULNRBUC'][$I];
 }
}
?>

<TD VALIGN="TOP">
<H2>COSUL DE CUMPARATURI</H2>

<FORM ACTION="COS.PHP?ACTIUNE=MODIFICA" METHOD="POST">
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR BGCOLOR="#F9F1E7">
<TD><B>NR.BUC</B></TD>
<TD><B>CARTE</B></TD>
<TD><B>PRET</B></TD>
<TD><B>TOTAL</B></TD>
</TR>
<?
if (isset($_POST['ID_CARTE'])){ 
FOR($I=0;$I<COUNT($_SESSION['ID_CARTE']);$I++)
{
 IF($_SESSION['NR_BUC'][$I] != 0)
 /* DOAR DACA NUMARUL DE BUCATI NU E 0 ,AFISEAZA RANDUL*/
 {
 PRINT '<TR>
 <TD>
 <INPUT TYPE="TEXT" NAME="NOULNRBUC['.$I.']" SIZE="1" VALUE="'.$_SESSION['NR_BUC'][$I].'">
 </TD>
 <TD><B>'.$_SESSION['TITLU'][$I].'</B> DE '.$_SESSION['NUME_AUTOR'][$I].'</TD>
 <TD ALIGN="RIGHT">'.$_SESSION['PRET'][$I].' LEI</TD>
 <TD ALIGN="RIGHT">'.($_SESSION['PRET'][$I] * $_SESSION['NR_BUC'][$I]).' LEI</TD>
 </TR>';
 $TOTALGENERAL = $TOTALGENERAL + ($_SESSION['PRET'][$I]* $_SESSION['NR_BUC'][$I]);
 }
}
}

PRINT '<TR><TD ALIGN="RIGHT" COLSPAN="3"<B>TOTAL</B></TD><TD ALIGN="RIGHT"><B>'.$TOTALGENERAL.'</B> LEI</TD></TR>';

?>
</TABLE>
<INPUT TYPE="SUBMIT" VALUE="MODIFICA">
</FORM>

<BR><BR>
INTRODUCETI <B>0</B> PENTRU CARTILE CE DORITI SA LE SCOATETI DIN COS!<H1>CONTINUARE</H1>
<TABLE>
<TR><TD WIDTH="200" ALIGN="CENTER"><IMG SRC="COS.GIF"><A HREF="CASA.PHP">MERGI LA CASA</A></TD>
</TR>
</TABLE>
</TD>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>


//domeniu.php

<?
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
?>
<?
$ID_DOMENIU = $_GET['id_domeniu'];
$SQLNUMEDOMENIU = "SELECT nume_domeniu  FROM DOMENIU WHERE id_domeniu =".$ID_DOMENIU;
$RESURSANUMEDOMENIU = mysql_query($SQLNUMEDOMENIU);
$NUMEDOMENIU = MYSQL_RESULT($RESURSANUMEDOMENIU,0,"nume_domeniu");
?>

<TD VALIGN="TOP">
<H2> DOMENIU: <?=$NUMEDOMENIU?></H2><B> CARTI IN DOMENIUL <U><I><?=$NUMEDOMENIU?></I></U>:
</B>
<TABLE CELLPADDING="5">
<?
$SQL = "SELECT ID_CARTE, TITLU, DESCRIERE, PRET, NUME_AUTOR FROM CARTI, AUTORI
,DOMENIU WHERE CARTI.ID_DOMENIU = DOMENIU.id_domeniu AND CARTI.ID_AUTOR = AUTORI.ID_AUTOR AND
DOMENIU.id_domeniu=".$ID_DOMENIU;
$RESURSA = mysql_query($SQL);


WHILE($ROW = mysql_fetch_array($RESURSA))
{
 ?>

 <TD ALIGN="CENTER">
 <?
  
  
  $faraimagine = "coperte/faraimagine.jpg";
    
 $ADRESAIMAGINE = "COPERTE/".$ROW['ID_CARTE'].".JPG";
 IF(FILE_EXISTS($ADRESAIMAGINE))
 {
  PRINT '<IMG SRC="'.$ADRESAIMAGINE.'" WIDTH="75" HEIGHT="100"><BR>';
 }
 ELSE
 {
 print '<div >  <img src="'.$faraimagine.'" width="75" height="100"<br>
 fara imagine</div>';
 }
?>
</TD><TD>
<B>
<A HREF="CARTE.PHP?id_carte=<?=$ROW['ID_CARTE']?>">
<?=$ROW['TITLU']?></A></B><BR><I>DE<?=$ROW['NUME_AUTOR']?></I><BR>
 PRET:<?=$ROW['PRET']?>LEI
 </TD>
 </TR>
<?
}
?>


</TABLE></TD>

<?
INCLUDE ("PAGE_BOTTOM.PHP");
?>
//index.php
<?
session_start();
include("conectare.php");
include("page_top.php");
include("meniu.php");
?>
<td width="600px">
<h2>Prima pagina</h2>
<h3>Cele mai noi carti</h3>
<?
$sql = "select id_carte, titlu, nume_autor, pret, data from carti, autori where carti.id_autor= autori.id_autor order by  carti.data desc limit 0,3";
$resursa =  mysql_query($sql);
while($row = mysql_fetch_array($resursa))
{ $adresaimagine = "coperte/".$row['id_carte'].".jpg";
  $faraimagine = "coperte/faraimagine.jpg";
 if(file_exists($adresaimagine)) {  print '<img src="'.$adresaimagine.'" width="75" height="100"'; }
 else { print '  <img src="'.$faraimagine.'" width="75" height="100">'; }
 print ' <br><center><a href="carte.php?id_carte='.$row['id_carte'].'">' .$row['titlu'].'</a> de <i>'.$row['nume_autor'].'</i> <br> pret:'.$row['pret'].' lei</center> <br> ';
  }
?>
<h3>Cele mai populare carti</h3>
<?
$sqlvanzari = "select id_carte, sum(nr_buc) as bucativandute from vanzari group by id_carte order by bucativandute desc limit 0,3";
$resursavanzari= mysql_query($sqlvanzari);
while($rowvanzari =  mysql_fetch_array($resursavanzari))
{$sqlcarte = "select titlu, nume_autor, pret from carti, autori where carti.id_autor=autori.id_autor and id_carte=".$rowvanzari['id_carte'];
$resursacarte = mysql_query($sqlcarte);
while($rowcarte = mysql_fetch_array($resursacarte))
{ $adresaimagine = "coperte/".$rowvanzari['id_carte'].".jpg";
if(file_exists($adresaimagine)) {  print '<img src="'.$adresaimagine.'" width="75" height="100">';}
 else { print ' <img src="'.$faraimagine.'" width="75" height="100">'; }
print '<br><center> <a href="carte.php?id_carte='.$rowvanzari['id_carte'].'">' .$rowcarte['titlu'].'</a> de <i>'.$rowcarte['nume_autor'].'</i> <br> pret:'.$rowcarte['pret'].' lei</center> <br>';
}}
?>
</td>

</tr> 
  <?
  include("page_bottom.php");
?>

//meniu.php


              <tr><td>
<DIV >

<B> Alege Domeniul</B>  <br>
<?
mysql_connect("localhost", "root", "");
mysql_select_db("librarie2");

$sql = "SELECT * FROM DOMENIU ORDER BY nume_domeniu ASC";
$resursa = mysql_query($sql);
WHILE($row = mysql_fetch_array($resursa))
{
            //verifica daca exista vreo carte pentru fiecare domeniu in parte
  $sqlCountBook = "SELECT TITLU, COUNT(TITLU) FROM carti WHERE carti.id_domeniu =". $row['id_domeniu'] ;
  $resursaCountBook = mysql_query($sqlCountBook) or die(mysql_error());
  while($rowCountBook = mysql_fetch_array($resursaCountBook)){
 


  
 PRINT '&#8195;<A  HREF="DOMENIU.PHP?id_domeniu='.$row['id_domeniu'].
 '">'.$row['nume_domeniu'].'&#8195;( '.$rowCountBook['COUNT(TITLU)'].' ) </A><BR>';
  }
}
?>
</DIV>

<DIV >
            <br>
<FORM ACTION ="CAUTARE.PHP" METHOD="GET">
<B>CAUTARE</B>                      <br>
<INPUT TYPE="TEXT" NAME="CUVANT" SIZE="12">  <br>
<INPUT TYPE="SUBMIT" VALUE="CAUTA">
</FORM>

</DIV>



<?
if ($LOGAT == true){
print '<DIV><br><B>COS</B><br>';
$NRCARTI = 0;
$TOTALVALOARE = 0;


FOR($I = 0;$I<COUNT($_SESSION['TITLU']);$I++)
{
 $NRCARTI = $NRCARTI+$_SESSION['NR_BUC'][$I];
 $TOTALVALOARE = $TOTALVALOARE+($_SESSION['NR_BUC'][$I] * $_SESSION['PRET'][$I]);
  
}
print 'AVETI <B>'.$NRCARTI.'</B> CARTI IN COS,<br> IN VALOARE TOTALA DE <B>'.$TOTALVALOARE.'</B> LEI. <br><A HREF="COS.PHP">CLICK AICI PENTRU A VEDEA CONTINUTUL COSULUI!</A></DIV>';
}
else
{
print '<a href="login.php">Login</a> | <a href="signin.php">SignIn</a>';
}


?>


                      </td>

  
//page_bottom.php
    <tr>
    <td> </td> 
     <td>     

 <P ALIGN="CENTER"><A HREF="HTTP://www.trufinalex.ro">&Copy Trufin Alex 2012</A></P>

          
          
         </td>
          
          </tr>
          </table>  
          
          
          <br>
          
          
          
 </BODY>
 </HTML>


//page_top.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;CHARSET=ISO-8859-2">



       <TITLE>LIBRARIA MEA</TITLE>
        <link rel="stylesheet" type="text/css" href="style.css" />
</HEAD>
<BODY>
<?
include("user.php");
?>
<table border="0" width="800px">
          <tr>  
          <td colspan="2"><center>  
<A HREF="INDEX.PHP"><h1>LIBRARIA MEA</h1></A>
</center>
               </td>       
               </tr>





//prelucrare.php

<?PHP
IF($_POST["NUME"]== "")
{
 PRINT 'TREBUIE SA COMPLETATI NUMELE!
 <A HREF="COS.PHP">INAPOI</A>';
 EXIT;
}

IF($_POST["ADRESA"]== "")
{
 PRINT 'TREBUIE SA COMPLETATI ADRESA!<A HREF="COS.PHP">INAPOI</A>';
 EXIT;
}

SESSION_START();

$NRCARTI=array_sum($_SESSION['NR_BUC']);
IF($NRCARTI == 0)
{
PRINT 'TREBUIE SA CUMPARATI CEL PUTIN O CARTE!
 <A HREF="COS.PHP">INAPOI</A>';
EXIT;
}

INCLUDE("CONECTARE.PHP");

$SQLTRANZACTIE = "INSERT INTO tranzactii(NUME_CUMPARATOR, ADRESA_CUMPARATOR)
VALUES('".$_POST['NUME']."','".$_POST['ADRESA']."')";
$RESURSATRANZACTIE = mysql_query($SQLTRANZACTIE);
$ID_TRANZACTIE = mysql_insert_id();

FOR($I=0;$I<COUNT($_SESSION['ID_CARTE']);$I++)
{
 IF($_SESSION['NR_BUC'][$I] > 0)
 {
 /*CREAM O INTEROGARE*/
 $SQLVANZARE = "INSERT INTO VANZARI(ID_TRANZACTIE, ID_CARTE, NR_BUC)
  VALUES('".$ID_TRANZACTIE."',
  '".$_SESSION['ID_CARTE'][$I]."',
  '".$_SESSION['NR_BUC'][$I]."')";
 /*RULAM INTEROGAREA*/
 mysql_query($SQLVANZARE);

 }
}
$MAILDESTINATAR= "TRUFIN_ALEX@YAHOO.COM";
$SUBIECT = "O NOUA COMANDA!";

$MESAJ = " O NOUA COMANDA DE LA <B>".$_POST['NUME']."</B><BR>";
$MESAJ .= "ADRESA: ".$_POST['ADRESA']."<BR>";
$MESAJ .= "CARTILE COMANDATE:<BR><BR>";
$MESAJ .="<TABLE BORDER='1' CELLSPACING='0' CELLPADING='4'>";
FOR($I=0;$I<COUNT($_SESSION['ID_CARTE']);$I++)
{
 IF($_SESSION['NR_BUC'][$I]>0)
 {
  $MESAJ .= "<TR><TD>"
  .$_SESSION['TITLU'][$I]." DE
  ".$_SESSION['NUME_AUTOR'][$I].
  "</TD><TD>".$_SESSION['NR_BUC'][$I].
  " BUC</TD></TR>";
  $TOTALGENERAL = $TOTALGENERAL + ($_SESSION['NR_BUC'][$I] * $_SESSION['PRET'][$I]);
  }
}
$MESAJ .= "</TABLE>";
$MESAJ .= "TOTAL: <B>".$_TOTALGENERAL."</B>";
$HEADERS = "MIME-VERSION:1.0\R\NCONTENT-TYPE: TEXT/HTML; CHARSET=ISO-8859-2\R\N";

@MAIL($MAILDESTINATAR, $SUBIECT,$MESAJ,$HEADERS);
SESSION_UNSET();
SESSION_DESTROY();

INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
?>

MULTUMIN!
VA MULTUMIN CA ATI CUMPARAT DE LA NOI! VETI PRIMI COMANDA SOLICITATA IN CEL MAI SCURT TIMP.
<td>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>
//rosu.php
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>rosu</title>
</head>
<body>
<?php
$text = "un text oarecare";
$text = str_replace("text","<b><font color='red'>text</font></b>",$text);
print $text
?>
</body>
</html>



///test.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<HTML>
<HEAD>
       <TITLE>TESTARE SESSION</TITLE>
</HEAD>
<BODY>
<?PHP
//PORNIM SESIUNEA
SESSION_START();


IF(ISSET($_POST['BUTONULADAUGA']));
{
$_SESSION['TITLU'][]=$_POST['TITLU'];
$_SESSION['AUTOR'][]=$_POST['AUTOR'];
$_SESSION['PRET'][]=$_POST['PRET'];
$_SESSION['NR_BUC'][]=$_POST['NR_BUC'];
}

$_SESSION['TITLU'][0]="CARTE";
$_SESSION['AUTOR'][0]="NUME";
$_SESSION['PRET'][0]="LEI";
$_SESSION['NR_BUC'][0]="BUC";

?>

<FORM ACTION="COS.PHP" METHOD="POST">
<TABLE>
<TR>
<TD>TITLU:</TR>
<TD><INPUT TYPE="TEXT" NAME="TITLU"></TD>
</TR>
<TR>
<TD>AUTOR:</TD>
<TD><INPUT TYPE="TEXT" NAME="AUTOR"></TD>
</TR>
<TR>
<TD>PRET:</TD>
<TD><INPUT TYPE="TEXT" NAME="PRET"></TD>
</TR>
<TR>
<TD>NR_BUC:</TD>
<TD><INPUT TYPE="TEXT" NAME="NR_BUC"></TD>
</TR>
<TR>
<TD>PRET:</TD>
<TD><INPUT TYPE="SUBMIT" NAME="BUTONULADAUGA" VALUE="ADAUGA"></TD>
</TR>
</TABLE>
</FORM>
<?PHP


 PRINT '<TABLE BORDER="1" CELLSPACING="0" CELLPADDING"4">';
 $NRCARTI=COUNT($_SESSION['TITLU']);
 PRINT '<TR>
<TD><B>TITLU</B></TD>
<TD><B>AUTOR</B></TD>
<TD><B>PRET</B></TD>
<TD><B>NR_BUC</B></TD>
<TD><B>TOTAL</B></TD>
</TR>';
 FOR($I=0;$I<$NRCARTI;$I++)
 {
  PRINT '<TR>';
  PRINT '<TD>'.$_SESSION['TITLU'][$I].'</TD>';
  PRINT '<TD>'.$_SESSION['AUTOR'][$I].'</TD>';
  PRINT '<TD>'.$_SESSION['PRET'][$I].'</TD>';
  PRINT '<TD>'.$_SESSION['NR_BUC'][$I].'</TD>';
    $TOTAL = $_SESSION['NR_BUC'][$I]* $_SESSION['PRET'][$I];
  PRINT '<TD>'.$TOTAL.'</TD>';
  $TOTALGENERAL = $TOTALGENERAL + $TOTAL;

  PRINT '<TR>';

 }
 PRINT '</TABLE>';
 PRINT 'TOTAL GENERAL:'.$TOTALGENERAL;

 ?>


</BODY>
</HTML>
//user.php
      <center>
<?
$LOGAT=true;
$user_name="razvantrufin99x";
$user_email="razvantrufin99x@gmail.com";
$user_pass_id="1111111111111111111";
print '<a href="login.php">Login</a> | <a href="signin.php">SignIn</a> | ';
print 'User name:'.$user_name.' | User email:'.$user_email.' | User id'.$user_pass_id;

?>

 | <A HREF="ADMINISTRARE/INDEX.PHP">Admin</A>
 </center>





//verif.php

<?PHP
SESSION_START();
INCLUDE("CONECTARE.PHP");

$_SESSION['ID_CARTE'][1]=$_POST['ID_CARTE'];
$_SESSION['NR_BUC'][1]= 1;
$_SESSION['PRET'][1]=$_POST['PRET'];
$_SESSION['TITLU'][1]=$_POST['TITLU'];
$_SESSION['NUME_AUTOR'][1]=$_POST['NUME_AUTOR'];

?>

<TD VALIGN="TOP">
<H1>COSUL DE CUMPARATURI</H1>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR BGCOLOR="#F9F1E7">
<TD><B>NR.BUC</B></TD>
<TD><B>CARTE</B></TD>
<TD><B>PRET</B></TD>
<TD><B>TOTAL</B></TD>
</TR>
<?
FOR($I=0;$I<COUNT($_SESSION['ID_CARTE']);$I++)
{
 
 PRINT '<TR> <TD>'.$_SESSION['NR_BUC'][1].'></TD>
 <TD><B>'.$_SESSION['TITLU'][1].'</B> DE '.$_SESSION['NUME_AUTOR'][1].'</TD>
 <TD ALIGN="RIGHT">'.$_SESSION['PRET'][1].' LEI</TD>
 <TD ALIGN="RIGHT">'.($_SESSION['PRET'][1] * $_SESSION['NR_BUC'][1]).' LEI</TD>
 </TR>';
 $TOTALGENERAL = $TOTALGENERAL + ($_SESSION['PRET'][1]* $_SESSION['NR_BUC'][1]);

}

PRINT '<TR><TD ALIGN="RIGHT" COLSPAN="3"<B>TOTAL</B></TD><TD ALIGN="RIGHT"><B>'.
$TOTALGENERAL.'</B> LEI</TD></TR>';
?>
</TABLE>
<BR><BR>
INTRODUCETI <B>0</B> PENTRU CARTILE CE DORITI SA LE SCOATETI DIN COS!<H1>CONTINUARE</H1>
<TABLE>
<TR><TD WIDTH="200" ALIGN="CENTER"><IMG SRC="COS.GIF"><A HREF="CASA.PHP">MERGI LA CASA</A></TD>
</TR>
</TABLE>
</TD>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>


///////////////////////////administrare/////////////////////////

//adaugare.php

<?php
/*INCLUDE("AUTORIZARE.PHP");*/
INCLUDE("ADMIN_TOP.PHP");
INCLUDE("../CONECTARE.PHP");
?>

<H2>ADAUGARE</H2>
<B>ADAUGA DOMENIU</A>
<FORM ACTION="PRELUCRARE_ADAUGARE.PHP" METHOD="POST">
DOMENIU NOU: <INPUT TYPE="TEXT" NAME="DOMENIU_NOU">
<INPUT TYPE="SUBMIT" NAME="ADAUGA_DOMENIU" VALUE="ADAUGA">
</FORM>

<B>ADAUGA AUTOR</A>
<FORM ACTION="PRELUCRARE_ADAUGARE.PHP" METHOD="POST">
AUTOR NOU: <INPUT TYPE="TEXT" NAME="AUTOR_NOU">
<INPUT TYPE="SUBMIT" NAME="ADAUGA_AUTOR" VALUE="ADAUGA">
</FORM>

<B>ADAUGA CARTE</A>
<FORM ACTION="PRELUCRARE_ADAUGARE.PHP" METHOD="POST">
<TABLE>
<TR>
<TD>DOMENIU: </TD>
<TD>
<SELECT NAME="ID_DOMENIU">

<?
$SQLND ="SELECT * FROM DOMENIU ORDER BY nume_domeniu ASC";
$RESURSAND = MYSQL_QUERY($SQLND);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSAND))
{
 PRINT '<OPTION VALUE="'.$ROW['id_domeniu'].'">'.$ROW['nume_domeniu'].'</OPTION>';
}
?>
</SELECT>
</TD>
</TR>
<TD>AUTOR:</TD>
<TD>
<SELECT NAME="ID_AUTOR">
<?
$SQL = "SELECT * FROM AUTORI ORDER BY NUME_AUTOR ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
 PRINT '<OPTION VALUE="'.$ROW['ID_AUTOR'].'">'.$ROW['NUME_AUTOR'].'</OPTION>';
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD>TITLU: </TD>
<TD><INPUT TYPE="TEXT" NAME="TITLU">
</TD>
</TR>
<TR>
<TD VALIGN="TOP">DESCRIERE:</TD>
<TD><TEXTAREA NAME="DESCRIERE" ROWS="8"></TEXTAREA></TD>
</TR>
<TR>
<TD>PRET: </TD>
<TD><INPUT TYPE="TEXT" NAME="PRET">
</TD>
</TR>
<TR>
<TD></TD>
<TD><INPUT TYPE="SUBMIT" NAME="ADAUGA_CARTE" VALUE="ADAUGA"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>


//admin_top.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;CHARSET=ISO-8859-2">
       <TITLE>LIBRARIA MEA</TITLE>
 <link rel="stylesheet" type="text/css" href="style.css" />
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<A HREF="INDEX.PHP"><center><h1>LIBRARIA MEA</h1></A>

<TABLE BGCOLOR="#F9F1E7" CELLSPACING="0" CELLPADDING="4" BORDER="1">
<TR>
<TD>
<A HREF="ADAUGARE.PHP">ADAUGA</A>
</TD>
<TD>
<A HREF="MODIFICARE_STERGERE.PHP">MODIFICA SAU STERGE</A>
</TD>
<TD>
<A HREF="OPINII.PHP">OPINII VIZITATORI</A>
</TD>
<TD>
<A HREF="COMENZI.PHP">COMENZI</A>
</TD>
</TR>
</TABLE>


//admin.php

<?PHP
/*INCLUDE("AUTORIZARE.PHP");*/
INCLUDE("ADMIN_TOP.PHP");
PRINT "ACEASTA ESTE PRIMA PAGINA!";
?>


//admin.top.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;CHARSET=ISO-8859-2">
       <TITLE>LIBRARIA MEA</TITLE>
 <link rel="stylesheet" type="text/css" href="style.css" />
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<A HREF="INDEX.PHP"><center><h1>LIBRARIA MEA</h1></center></A>

<TABLE BGCOLOR="#F9F1E7" CELLSPACING="0" CELLPADDING="4" BORDER="1">
<TR>
<TD>
<A HREF="ADAUGARE.PHP">ADAUGA</A>
</TD>
<TD>
<A HREF="MODIFICARE_STERGERE.PHP">MODIFICA SAU STERGE</A>
</TD>
<TD>
<A HREF="OPINII.PHP">OPINII VIZITATORI</A>
</TD>
<TD>
<A HREF="COMENZI.PHP">COMENZI</A>
</TD>
</TR>
</TABLE>


//autorizare.php

<?PHP
SESSION_START();

IF($_SESSION['KEY_ADMIN'] != SESSION_ID())
{
 PRINT 'ACCESS NEAUTORIZAT!';
 EXIT;
}

INCLUDE("../CONECTARE.PHP");
$SQL= "SELECT * FROM ADMIN WHERE ADMIN_NUME'".$_SESSION['NUME_ADMIN']."'
AND ADMIN_PAROLA = '".$_SESSION['PAROLA_ENCRIPTATA']."'";
$RESURSA = MYSQL_QUERY($SQL);
/*
INDEPARTATI COMENTARIUL DE DESUBT
INCEPUT
IF(MYSQL_NUM_ROWS($RESURSA) != 1)
{
 PRINT 'ACCESS NEAUTORIZAT!';
 EXIT;
}
SFARSIT
*/

?>


//comenzi.php

<?
/*INCLUDE("AUTORIZARE.PHP");*/
INCLUDE("ADMIN_TOP.PHP");
INCLUDE("../CONECTARE.PHP");
?>

<H2>COMENZI</H2>
<B>COMENZI INCA NEONORATE</B>

<?
$SQLTRANZACTII = "SELECT ID_TRANZACTII, DATE_FORMAT(DATA_TRANZACTIE,'%D-%M-%y')
AS DATA_TRANZACTIE, NUME_CUMPARATOR, ADRESA_CUMPARATOR FROM tranzactii WHERE COMANDA_ONORATA=0";
$RESURSATRANZACTII = MYSQL_QUERY($SQLTRANZACTII);
WHILE($ROWTRANZACTIE = MYSQL_FETCH_ARRAY($RESURSATRANZACTII))
{
 ?>
 
<FORM ACTION="PRELUCRARE_COMENZI.PHP" METHOD="POST">
DATA COMENZII:<B><?=$ROWTRANZACTIE['DATA_TRANZACTIE']?>
</B>
<DIV STYLE="WIDTH:500PX; BORDER:1PX SOLID #FFFFFF; BACKGROUND-COLOR:#F9F1E7; PADDING:5PX">
<B><?=$ROWTRANZACTIE['NUME_CUMPARATOR']?></B><BR>
<?=$ROWTRANZACTIE['ADRESA_CUMPARATOR']?>

<TABLE BORDER="1" CELLPADDING="4" CELLSPACING="0">
<TR>
<TD ALIGN="CENTER"><B>CARTE</B></TD>
<TD ALIGN="CENTER"><B>NR.BUC</B></TD>
<TD ALIGN="CENTER"><B>PRET</B></TD>
<TD ALIGN="CENTER"><B>TOTAL</B></TD>
</TR>

<?
$SQLCARTI = "SELECT TITLU, NUME_AUTOR, PRET, NR_BUC FROM VANZARI, CARTI, AUTORI
WHERE CARTI.ID_CARTE = VANZARI.ID_CARTE AND
CARTI.ID_AUTOR = AUTORI.ID_AUTOR AND VANZARI.ID_TRANZACTIE=".$ROWTRANZACTIE['ID_TRANZACTII'];
$RESURSACARTI = MYSQL_QUERY($SQLCARTI);

WHILE($ROWCARTE = MYSQL_FETCH_ARRAY($RESURSACARTI))
{
 PRINT '<TR><TD>'.$ROWCARTE['TITLU'].' DE '.$ROWCARTE['NUME_AUTOR'].'</TD>
 <TD ALIGN="RIGHT">'.$ROWCARTE['NR_BUC'].'</TD><TD ALIGN="RIGHT">'.$ROWCARTE['PRET'].'</TD>';

 $TOTAL = $ROWCARTE['PRET'] * $ROWCARTE['NR_BUC'];

 PRINT '<TD ALIGN="RIGHT">'.$TOTAL.'</TD></TR>';

 $TOTALGENERAL = $TOTALGENERAL + $TOTAL;
}
?>

<TR><TD COLSPAN="3" ALIGN="RIGHT">TOTAL COMANDA:</TD>
<TD><?=$TOTALGENERAL?>LEI </TD></TR>
</TABLE>
<INPUT TYPE="HIDDEN" NAME="ID_TRANZACTII" VALUE="<?=$ROWTRANZACTIE['ID_TRANZACTII']?>">
<INPUT TYPE="SUBMIT" NAME="COMANDA_ONORATA" VALUE="COMANDA ONORATA">
<INPUT TYPE="SUBMIT" NAME="ANULEAZA COMANDA" VALUE="ANULEAZA COMANDA">
</DIV>
</FORM>

<?
}
?>

</BODY>
</HTML>


//comenzi2.php

<?
/*INCLUDE("AUTORIZARE.PHP");
INCLUDE("ADMIN_TOP.PHP");*/
INCLUDE("../CONECTARE.PHP");
?>

<H1>COMENZI</H1>
<B>COMENZI INCA NEONORATE</B>

<?
$SQLTRANZACTII = "SELECT ID_TRANZACTII, DATE_FORMAT(DATA_TRANZACTIE,'%D-%M-%y')
AS DATA_TRANZACTIE, NUME_CUMPARATOR, ADRESA_CUMPARATOR FROM tranzactii WHERE COMANDA_ONORATA=0";
$RESURSATRANZACTII = MYSQL_QUERY($SQLTRANZACTII);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSATRANZACTII))
{
 ?>
 
<FORM ACTION="PRELUCRARE_COMENZI.PHP" METHOD="POST">
DATA COMENZII:<B><?=$ROW['DATA_TRANZACTIE']?>
</B>
<DIV STYLE="WIDTH:500PX; BORDER:1PX SOLID #FFFFFF; BACKGROUND-COLOR:#F9F1E7; PADDING:5PX">
<B><?=$ROW['NUME_CUMPARATOR']?></B><BR>
<?=$ROW['ADRESA_CUMPARATOR']?>

<TABLE BORDER="1" CELLPADDING="4" CELLSPACING="0">
<TR>
<TD ALIGN="CENTER"><B>CARTE</B></TD>
<TD ALIGN="CENTER"><B>NR.BUC</B></TD>
<TD ALIGN="CENTER"><B>PRET</B></TD>
<TD ALIGN="CENTER"><B>TOTAL</B></TD>
</TR>

<?
$SQLCARTI = "SELECT TITLU, NUME_AUTOR, PRET, NR_BUC FROM VANZARI, CARTI, AUTORI
WHERE CARTI.ID_CARTE = VANZARI.ID_CARTE AND
CARTI.ID_AUTOR = AUTORI.ID_AUTOR AND ID_TRANZACTII=".$ROW['ID_TRANZACTII'];
$RESURSACARTI = MYSQL_QUERY($SQLCARTI);

WHILE($ROWCARTE = MYSQL_FETCH_ARRAY($RESURSACARTI))
{
 PRINT '<TR><TD>'.$ROWCARTE['TITLU'].' DE '.$ROWCARTE['NUME_AUTOR'].'</TD>
 <TD ALIGN="RIGHT">'.$ROWCARTE['NR_BUC'].'</TD><TD ALIGN="RIGHT">'.$ROWCARTE['PRET'].'</TD>';

 $TOTAL = $ROWCARTE['PRET'] * $ROWCARTE['NR_BUC'];

 PRINT '<TD ALIGN="RIGHT">'.$TOTAL.'</TD></TR>';

 $TOTALGENERAL = $TOTALGENERAL + $TOTAL;
}
?>

<TR><TD COLSPAN="3" ALIGN="RIGHT">TOTAL COMANDA:</TD>
<TD><?=$TOTALGENERAL?>LEI </TD></TR>
</TABLE>
<INPUT TYPE="HIDDEN" NAME="ID_TRANZACTIE" VALUE="<?=$ROW['ID_TRANZACTIE']?>">
<INPUT TYPE="SUBMIT" NAME="COMANDA_ONORATA" VALUE="COMANDA_ONORATA">
<INPUT TYPE="SUBMIT" NAME="ANULEAZA_COMANDA" VALUE="ANULEAZA COMANDA">
</DIV>
</FORM>

<?
}
?>

</BODY>
</HTML>


//formulare_moderare_opinii.php

<?

/*INCLUDE("AUTORIZARE.PHP");
INCLUDE("ADMIN_TOP.PHP");
FORMULAR MODIFICARE COMENTARII*/

INCLUDE("../CONECTARE.PHP");

IF(ISSET($_POST['MODIFICA']))
{
 $SQL = "SELECT * FROM comentarii WHERE ID_COMENTARIU='".$_POST['ID_COMENTARIU']."'";
 $RESURSA= MYSQL_QUERY($SQL);
 $ROW = MYSQL_FETCH_ARRAY($RESURSA);
?>

<H1>MODIFICA</H1>
<B>MODIFICA ACEST COMENTARIU</B>
<FORM ACTION="PRELUCRARE_MODERARE_COMENTARII.PHP" METHOD="POST">
NUME:<INPUT TYPE="TEXT" NAME="NUME_UTILIZATOR" VALUE="<?=$ROW['NUME_UTILIZATOR']?>">
E-MAIL:<INPUT TYPE="TEXT" NAME="ADRESA_EMAIL" VALUE="<?=$ROW['ADRESA_EMAIL']?>">
COMENTARIU:<TEXTAREA NAME="COMENTARIU" COLS="45" ROWS"8"><?=$ROW['COMENTARIU']?></TEXTAREA>
<BR><BR>
<INPUT TYPE="HIDDEN" NAME="ID_COMENTARIU" VALUE="<?=$_POST['ID_COMENTARIU']?>">
<INPUT TYPE="SUBMIT" NAME="MODIFICA" VALUE="MODIFICA">
</FORM>
<?
}

IF(ISSET($_POST['STERGE']))
{
?>
<H1>STERGE</H1>
ESTI SIGUR CA VREI S ASTERGI ACEST COMENTARIU
<FORM ACTION="PRELUCRARE_MODERARE_COMENTARII.PHP" METHOD="POST">

<INPUT TYPE="HIDDEN" NAME="ID_COMENTARIU" VALUE="<?=$_POST['ID_COMENTARIU']?>">
<INPUT TYPE="SUBMIT" NAME="STERGE" VALUE="STERGE">
</FORM>
 <?
}

IF(ISSET($_POST['SETEAZA_MODERARE']))
{
 ?>
<H1>SETEAZA COMENTARIIL CA FIIND MODERATE</H1>
ESTI SIGUR CA VREI SA SETEZI ACESTE COMENTARII CA FIIND MODERATE? LE-AI VERIFICAT PE TOATE?
<FORM ACTION="PRELUCRARE_MODERARE_COMENTARII.PHP" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="ULTIMUL_ID" VALUE="<?=$_POST['ULTIMUL_ID']?>">
<INPUT TYPE="SUBMIT" NAME="SETEAZA_MODERARE" VALUE="DA!">
</FORM>
<?
}
?>
</BODY></HTML>
 

//formulare_modificare_stergere.php

<?
/*INCLUDE('AUTORIZARE.PHP');
INCLUDE('ADMIN_TOP.PHP');*/
/*MODIFICARE NUME DOMENIU*/
INCLUDE("../CONECTARE.PHP");
IF(ISSET($_POST['modifica_domeniu']))
{
$SQL="SELECT NUME_DOMENIU FROM DOMENIU WHERE id_domeniu='".$_POST['id_domeniu']."'";
$RESURSA = MYSQL_QUERY($SQL);
$NUME_DOMENIU = MYSQL_RESULT($RESURSA,0,"NUME_DOMENIU");
?>
<H1>MODIFICA NUME DOMENIU <?=$NUME_DOMENIU?></H1>
<FORM ACTION="PRELUCRARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
<INPUT TYPE="TEXT" NAME="NUME_DOMENIU" VALUE="<?=$NUME_DOMENIU?>">
<INPUT TYPE="HIDDEN" NAME="ID_DOMENIU" VALUE="<?=$_POST['id_domeniu']?>">
<INPUT TYPE="SUBMIT" NAME="MODIFICARE_DOMENIU" VALUE="MODIFICA">
</FORM>
<?

}
/*STERGE DOMENIUL*/

IF(ISSET($_POST['sterge_domeniu']))
{
$SQL="SELECT TITLU, NUME_AUTOR FROM CARTI, AUTORI, DOMENIU WHERE
CARTI.ID_DOMENIU=DOMENIU.ID_DOMENIU AND CARTI.ID_AUTOR = AUTORI.ID_AUTOR
AND DOMENIU.ID_DOMENIU=".$_POST['id_domeniu'];
$RESURSA = MYSQL_QUERY($SQL);
$NRCARTI = MYSQL_NUM_ROWS($RESURSA);

IF($NRCARTI > 0)
{
PRINT "<P>SUNT ".$NRCARTI." CARTI CARE APARTIN ACESTUI DOMENIU!</P>:";
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
PRINT "<B>".$ROW['TITLU']."</B> DE ".$ROW['NUME_AUTOR']."<BR>";
}
PRINT "<P>NU PUTETI STERGE ACEST DOMENIU!</P>";
}
ELSE
{
?>
<H1>STERGE NUME DOMENIU</H1>
ESTI SIGUR CA VREI SA STERGI ACEST DOMENIU?
<FORM ACTION="PRELUCRARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="ID_DOMENIU" VALUE="<?=$_POST['id_domeniu']?>">
<INPUT TYPE="SUBMIT" NAME="STERGE_DOMENIU" VALUE="STERGE!">
</FORM>
<?
}
}
/*MODIFICA AUTOR*/
IF(ISSET($_POST['MODIFICA_AUTOR']))
{
$SQL="SELECT NUME_AUTOR FROM AUTORI WHERE ID_AUTOR='".$_POST['id_autor']."'";
$RESURSA = MYSQL_QUERY($SQL);
$NUME_AUTOR = MYSQL_RESULT($RESURSA,0,"NUME_AUTOR");
?>
<H1>MODIFICA NUME AUTOR <?=$NUME_AUTOR?></H1>
<FORM ACTION="PRELUCRARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
<INPUT TYPE="TEXT" NAME="NUME_AUTOR" VALUE="<?=$NUME_AUTOR?>">
<INPUT TYPE="HIDDEN" NAME="ID_AUTOR" VALUE="<?=$_POST['id_autor']?>">
<INPUT TYPE="SUBMIT" NAME="MODIFICA_AUTOR" VALUE="MODIFICA">
</FORM>

 <?
 }
 /*STERGE AUTOR*/
 
IF(ISSET($_POST['sterge_autor']))
 {
 $SQL="SELECT NUME_AUTOR FROM CARTI, AUTORI WHERE
 CARTI.ID_AUTOR = AUTORI.ID_AUTOR AND CARTI.ID_AUTOR = '".$_POST['id_autor']."'";

$RESURSA = MYSQL_QUERY($SQL);
$NRCARTI = MYSQL_NUM_ROWS($RESURSA);

IF($NRCARTI > 0)
{
PRINT "<P>SUNT ".$NRCARTI." CARTI CARE APARTIN ACESTUI AUTOR!</P>:";
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
PRINT "<B>".$ROW['TITLU']."</B> DE ".$ROW['NUME_AUTOR']."<BR>";
}
PRINT "<P>NU PUTETI STERGE ACEST autor!</P>";
}
ELSE
{
?>
<H1>STERGE NUME AUTOR</H1><BR>
ESTI SIGUR CA VREI SA STERGI ACEST AUTOR?
<FORM ACTION="PRELUCRARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="ID_AUTOR" VALUE="<?=$_POST['id_autor']?>">
<INPUT TYPE="SUBMIT" NAME="STERGE_AUTOR" VALUE="STERGE!">
</FORM>
<?
}
}
 
 /* MODIFICARE CARTE*/

IF(ISSET($_POST['modifica_carte']))
{
PRINT "<H1>MODIFICARE CARTE</H1> ";
$SQLCARTE="SELECT * FROM CARTI WHERE TITLU='".$_POST['TITLU']."' AND
ID_AUTOR='".$POST['id_autor']."'";
$RESURSACARTE = MYSQL_QUERY($SQLCARTE);

IF(MYSQL_NUM_ROWS($RESURSACARTE)==0)
{
PRINT "ACEASTA CARTE NU EXISTA IN BAZA DE DATE";
}
ELSE
{
$ROWCARTE = MYSQL_FETCH_ARRAY($RESURSACARTE);
?>
<FORM ACTION="PRELUCRARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
<TABLE>
<TR>
<SELECT NAME="id_domeniu">

<?
$SQL = "SELECT * FROM DOMENIU ORDER BY NUME_DOMENIU ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
IF($ROW['id_domeniu'] == $ROWCARTE['id_domeniu'])
{
PRINT '<OPTION SELECTED VALUE="'.$ROW['id_domeniu'].'">'.$ROW['NUME_DOMENIU'].'</OPTION>';
}
ELSE
{
PRINT '<OPTION VALUE="'.$ROW['id_domeniu'].'">'.$ROW['NUME_DOMENIU'].'</OPTION>';
}
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD>AUTOR;</TD>
<TD>
<SELECT NAME="ID_AUTOR">
<?
$SQL = "SELECT * FROM AUTORI ORDER BY NUME_AUTOR ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
IF($ROW['id_autor']==$ROWCARTE['id_autor'])
{
PRINT'<OPTION SELECTED VALUE='.$ROW['id_autor'].'">'.$ROW['NUME_AUTOR'].'</OPTION>';
}
ELSE
{
PRINT '<OPTION VALUE="'.$ROW['id_autor'].'">'.$ROW['NUME_AUTOR'].'</OPTION>';
}
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD>TITLU!:</Td>
<TD>
<INPUT TYPE="TEXT" NAME="TITLU" VALUE="<?=$ROWCARTE['TITLU']?>">
</TD>
<TR>
<TD VALIGN="TOP">DESCRIERE:</TD>
<TD><TEXTAREA NAME="DESCRIERE" ROWS="8"><?=$ROWCARTE['DESCRIERE']?>
</TEXTAREA></TD></TR>
<TR>
<TD>PRET</TD>
<TD>
<INPUT TYPE="TEXT" NAME="PRET" VALUE="<?=$ROWCARTE['PRET']?>">
</TD>
</TR>
</TABLE>
<INPUT TYPE="HIDDEN" NAME="ID_CARTE" VALUE="<?=$ROWCARTE['ID_CARTE']?>">
<INPUT TYPE="SUBMIT" NAME="MODIFICA_CARTE" VALUE="MODIFICA!">
</FORM>
<?
}
}
IF(ISSET($_POST['STERGE_CARTE']))
{
PRINT "<H1>STERGE CARTE</H1>";
$SQLCARTE = "SELECT * FROM CARTI WHERE TITLU='".$_POST['TITLU']."' AND
ID_AUTOR=".$_POST['ID_AUTOR'];
$RESURSACARTE = MYSQL_QUERY($SQLCARTE);

IF(MYSQL_NUM_ROWS($RESURSACARTE)==0)
{
PRINT "ACEASTA CARTE NU EXISTA IN BAZA DE DATE";
}
ELSE
{
$ID_CARTE = MYSQL_RESULT($RESURSACARTE,0,ID_CARTE);
?>

ESTI SIGUR CA VREI SA STERGI ACEASTA CARTE?
<FORM ACTION="PRELUCRARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="ID_CARTE" VALUE="<?=$ID_CARTE?>">
<INPUT TYPE="SUBMIT" NAME="STERGE_CARTE" VALUE="STERGE">
</FORM>
<?
}
}
?>
</BODY>
</HTML>





//index.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;CHARSET=ISO-8859-2">
       <TITLE>LIBRARIA MEA</TITLE>
              <link rel="stylesheet" type="text/css" href="style.css" />
</HEAD> 
<BODY BGCOLOR=#FFFFFF>
<A HREF="INDEX.PHP"><center><h1>LIBRARIA MEA</h1></A>
<H1>AUTENTIFICARE</H1>
<FORM ACTION="LOGIN.PHP" METHOD="POST">
<TABLE>
<TR>
<TD ALIGN="RIGHT">NUME: </TD>
<TD><INPUT TYPE="TEXT" NAME="NUME"></TD>
</TR>
<TR>
<TD ALIGN="RIGHT">PAROLA: </TD>
<TD><INPUT TYPE="PASSWORD" NAME="PAROLA"></TD>
</TR>
<TR>
<TD></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="AUTENTIFICARE"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
//login.php
<?PHP
/*VERIFICA INTATI DACA AU FOST COMPLETATE AMANDOUA CAMPURILE*/
IF($_POST['NUME'] == "" || $_POST['PAROLA'] == "")
{
 PRINT 'TREBUIE SA COMPLETEZI AMANDOUA CAMPURILE!<BR>
 <A HREF="INDEX.PHP">INAPOI</A>';
 EXIT;
} 

INCLUDE("../CONECTARE.PHP");

$PAROLAENCRIPTATA = MD5($_POST['PAROLA']);

$SQL = "SELECT * FROM ADMIN WHERE ADMIN_NUME='".$_POST['NUME']."' AND ADMIN_PAROLA='".$PAROLAENCRIPTATA."'";
$RESURSA = MYSQL_QUERY($SQL);

IF(MYSQL_NUM_ROWS($RESURSA) != 1)
{
 PRINT 'NUME SAU PAROLA GRESITE!<BR>
 <A HREF="INDEX.PHP">INAPOI</A>';
}

SESSION_START();
$_SESSION['NUME_ADMIN'] = $_POST['NUME'];
$_SESSION['PAROLA_ENCRIPTATA'] = $PAROLAENCRIPTATA;

$_SESSION['KEY_ADMIN'] = SESSION_ID();
/*
HEADER("LOCATION: ADMIN.PHP");
*/

?>
<a href="ADMIN.PHP">intrare</a>


//modificare_stergere.php

<?
/*INCLUDE('AUTORIZARE.PHP');*/
INCLUDE('ADMIN_TOP.PHP');
INCLUDE("../CONECTARE.PHP");
?>

<H2>MODIFICARE SAU STERGERE</H2>
<P><B>NOTA:</B>NU VETI PUTEA STERGE CARE AU CARTI IN ELE.INAINTE
DE A STERGE DOMENIUL,MODIFICATI CARTILE DIN EL ASTFEL INCAT SA APARTINA ALTOR DOMENII.
DE ASEMENEA NU VETIU PUTEA STERGE UN AUTOR DACA EXISTA CARTI IN BAZA
DE DATE CARE AU ACELASI AUTOR.</P>




<FORM ACTION="FORMULARE_MODIFICARE_STERGERE.PHP" METHOD="POST">
DOMENIU:
<SELECT NAME="id_domeniu">
<?
$SQL = "SELECT * FROM DOMENIU ORDER BY nume_domeniu ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
 PRINT '<OPTION VALUE="'.$ROW['id_domeniu'].'">'.$ROW['nume_domeniu'].'</option>';
}
?>
</select>
<input type="submit" name="modifica_domeniu" value="modifica">
<input type="submit" name="sterge_domeniu" value="sterge">
</form>

<b>Selecteaza autorul pe care doresti sa il stergi sau modifici:</b>



<form action="FORMULARE_MODIFICARE_STERGERE.PHP" method="POST">
AUTOR:<SELECT NAME="id_autor">
<?
$SQL="SELECT * FROM AUTORI ORDER BY NUME_AUTOR ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
PRINT '<OPTION VALUE="'.$ROW['ID_AUTOR'].'">'
.$ROW['NUME_AUTOR'].'</OPTION>';
}

?>
</SELECT>
<input type="submit" name="MODIFICA_AUTOR" value="modifica">
<input type="submit" name="sterge_autor" value="sterge">
</FORM>



<b>Selecteaza autorul si scrie titlul carti <BR>pe care doresti sa o modifici sau sterge:</b>
<form action="FORMULARE_MODIFICARE_STERGERE.PHP" method="POST">
<TABLE>
<TR>
<TD>AUTORI:</TD>
<TD>
<SELECT NAME="id_carte">
<?
$SQL="SELECT * FROM AUTORI ORDER BY NUME_AUTOR ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
PRINT '<OPTION VALUE="'.$ROW['ID_AUTOR'].'">'
.$ROW['NUME_AUTOR'].'</OPTION>';
}
?>
</SELECT>

</TD>
</TR>
<TR>
<TD>TITLU:</TD>
<TD><INPUT TYPE="TEXT" NAME="TITLU">
</TD>
</TR>
</TABLE>
<input type="submit" name="modifica_carte" value="modifica">
<input type="submit" name="sterge_carte" value="sterge">
</FORM>
</BODY>
</HTML>
//opinii.php
<?
/*INCLUDE("AUTORIZARE.PHP");*/
INCLUDE("ADMIN_TOP.PHP");
INCLUDE("../CONECTARE.PHP");
?>

<H2>MODIFICARE SAU STERGERE COMENTARII UTILIZATORI</H2>
<B>COMENTARIILE UTILIZATORILOR DE LA ULTIMA MODERARE</B>

<?
$SQL = "SELECT * FROM comentarii, ADMIN, CARTI, AUTORI WHERE ID_COMENTARIU > ADMIN.ULCOMO
AND comentarii.ID_CARTE = CARTI.ID_CARTE AND
CARTI.ID_AUTOR = AUTORI.ID_AUTOR ORDER BY ID_COMENTARIU ASC";
$RESURSA = MYSQL_QUERY($SQL);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSA))
{
?>

 <FORM ACTION="FORMULARE_MODERARE_OPINII.PHP" METHOD="POST">
 <DIV STYLE = "WIDTH:500PX; BORDER:1PX SOLID #FFFFFF; BACKGROUND-COLOR:#F9F1E7; PADDING:5PX">
 <B><?=$ROW['TITLU']?></B> DE<?=$ROW['NUME_AUTOR']?><HR SIZE="1">
 <A HREF="MAILTO:<?=$ROW['ADRESA_EMAIL']?>"><?=$ROW['NUME_UTILIZATOR']?></A><BR>
   <?=$ROW['COMENTARIU']?>
 </DIV>
 <INPUT TYPE="HIDDEN" NAME="ID_COMENTARIU" VALUE="<?=$ROW['ID_COMENTARIU']?>">
 <INPUT TYPE="SUBMIT" NAME="MODIFICA" VALUE="MODIFICA">
 <INPUT TYPE="SUBMIT" NAME="STERGE" VALUE="STERGE">
 </FORM>

<?
$ULTIMUL_ID=$ROW['ID_COMENTARIU'];
}
  $NRCOMENTARII=MYSQL_NUM_ROWS($RESURSA);
  IF($NRCOMENTARII > 0)
  {
   ?>
 <FORM ACTION="FORMULARE_MODERARE_OPINII.PHP" METHOD="POST">
 <INPUT TYPE="HIDDEN" NAME="ULTIMUL_ID" VALUE="<?=$ULTIMUL_ID?>">
  <INPUT TYPE="SUBMIT" NAME="SETEAZA_MODERARE" VALUE="SETEAZA ACESTE COMENTARII CA FIIND MODERATE">
 </FORM>
<?
}
ELSE
{
 PRINT "<P>NU EXISTA COMENTARII NOI.</P>";
}
?>
</BODY></HTML>


//prelucrare_adaugare.php

<?php
/*INCLUDE("AUTORIZARE.PHP");
INCLUDE("ADMIN_TOP.PHP");*/
INCLUDE("../CONECTARE.PHP");

IF(ISSET($_POST['ADAUGA_DOMENIU']))
{
 IF($_POST['DOMENIU_NOU']== "")
 {
  PRINT 'TREBUIE SA COMPLETEZI NUMELE DE DOMENIU!<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 }
$SQL = "SELECT * FROM DOMENIU WHERE nume_domeniu='".$_POST['DOMENIU_NOU']."'";
$RESURSADNOU = MYSQL_QUERY($SQL);

 IF(MYSQL_NUM_ROWS($RESURSADNOU) !=0)
 {
  PRINT 'DOMENIUL<B>'.$_POST['DOMENIU_NOU'].'</B>
  EXISTA DEJA IN BAZA DE DATE!<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 }
$SQLDNOU = "INSERT INTO DOMENIU(nume_domeniu) VALUES('".$_POST['DOMENIU_NOU']."')";
$RESURSA = MYSQL_QUERY($SQLDNOU);
PRINT 'DOMENIUL <B>'.$_POST['DOMENIU_NOU'].'</B> A
FOST ADAUGAT IN BAZA DE DATE!<BR>
<A HREF="ADAUGARE.PHP">INAPOI</A>';
EXIT;
}
 
IF(ISSET($_POST['ADAUGA_AUTOR']))
{
 IF($_POST['AUTOR_NOU']== "")
 {
  PRINT 'TREBUIE SA COMPLETEZI NUMELE AUTORULUI!<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 }
$SQL = "SELECT * FROM AUTORI WHERE NUME_AUTOR='".$_POST['AUTOR_NOU']."'";
$RESURSA = MYSQL_QUERY($SQL);

 IF(MYSQL_NUM_ROWS($RESURSA) !=0)
 {
  PRINT 'AUTORUL<B>'.$_POST['AUTOR_NOU'].'</B>
  EXISTA DEJA IN BAZA DE DATE!<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 }
$SQL = "INSERT INTO AUTORI(NUME_AUTOR) VALUES('".$_POST['AUTOR_NOU']."')";
$RESURSA = MYSQL_QUERY($SQL);
PRINT 'AUTORUL <B>'.$_POST['AUTOR_NOU'].'</B> A
FOST ADAUGAT IN BAZA DE DATE!<BR>
<A HREF="ADAUGARE.PHP">INAPOI</A>';
EXIT;
}

IF(ISSET($_POST['ADAUGA_CARTE']))
{
 IF($_POST['TITLU']== "" || $_POST['DESCRIERE']== "" || $_POST['PRET']== "")
 {
  PRINT 'TITLUL, DESCRIERE SAU PRETUL SUNT GOALE!<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 }
 
 IF(!IS_NUMERIC($_POST['PRET']))

 {
        PRINT 'CAMPUL PRET TREBUIE SA FIE DE TIP NUMERIC!(SCRIETI<B>1000
  </B>IN LOC DE <B>1000 LEI</B>)<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 } 

 
$SQL = "SELECT * FROM CARTI WHERE ID_AUTOR='".$_POST['ID_AUTOR']."'
AND TITLU='".$_POST['TITLU']."'";
$RESURSA = MYSQL_QUERY($SQL);

 IF(MYSQL_NUM_ROWS($RESURSA) !=0)
 {
  PRINT 'ACEASTA CARTE
  EXISTA DEJA IN BAZA DE DATE!<BR>
  <A HREF="ADAUGARE.PHP">INAPOI</A>';
  EXIT;
 }
$SQL = "INSERT INTO CARTI(id_domeniu ,ID_AUTOR ,TITLU ,DESCRIERE ,PRET)
 VALUES('".$_POST['ID_DOMENIU']."','".$_POST['ID_AUTOR']."','".$_POST['TITLU']."','".$_POST['DESCRIERE'].
"','".$_POST['PRET']."')";
MYSQL_QUERY($SQL);
PRINT 'CARTEA A
FOST ADAUGAT IN BAZA DE DATE!<BR>
<A HREF="ADAUGARE.PHP">INAPOI</A>';
EXIT;
}
?>

</BODY></HTML>



//prelucrare_comenzi.php

<?
/*INCLUDE("AUTORIZARE.PHP");
INCLUDE("ADMIN_TOP.PHP");*/
INCLUDE("../CONECTARE.PHP");
PRINT "<H1>COMENZI</H1>";
IF(ISSET($_POST['COMANDA_ONORATA']))
{
 $SQL = "UPDATE tranzactii SET COMANDA_ONORATA = 1 WHERE ID_TRANZACTII=".$_POST['ID_TRANZACTII'];
 MYSQL_QUERY($SQL);
 PRINT "COMANDA A FOST ONORATA!";
}

IF(ISSET($_POST['ANULEAZA_COMANDA']))
{
 $SQLTRANZACTII = "DELETE FROM tranzactii WHERE ID_TRANZACTII=".$_POST['ID_TRANZACTII'];
 MYSQL_QUERY($SQLTRANZACTII);
 $SQLCARTI = "DELETE FROM VANZARI WHERE ID_TRANZACTIE=".$_POST['ID_TRANZACTII'];
 MYSQL_QUERY($SQLCARTI);
 PRINT "COMANDA A FOST ANULATA!";
}
?>
</BODY>
</HTML>

//prelucrare_moderare_comentarii.php


<?
/*INCLUDE("AUTORIZARE.PHP");
INCLUDE("ADMIN_TOP.PHP");*/
/*MODIFICARE COMENTARIU*/
INCLUDE("../CONECTARE.PHP");

IF(ISSET($_POST['MODIFICA']))
{
 IF($_POST['NUME_UTILIZATOR']=="")
 {
  PRINT "NU AI COMPLETAT NUMELE UTILIZATORULUI";
 }
 ELSE IF($_POST['ADRESA_EMAIL']=="")
 {
  PRINT "NU AI COMPLETAT ADRESA DE EMAIL";
 }
 ELSE IF($_POST['COMENTARIU']=="")
 {
  PRINT "CAMPUL COMENTARIU ESTE GOL!";
 }
 ELSE
 {
 $SQL = "UPDATE comentarii SET NUME_UTILIZATOR='".$_POST['NUME_UTILIZATOR'].
 "',ADRESA_EMAIL='".$_POST['ADRESA_EMAIL']."',COMENTARIU='".$_POST['COMENTARIU'].
 "' WHERE ID_COMENTARIU ='".$_POST['ID_COMENTARIU']."'";
 MYSQL_QUERY($SQL);
 PRINT "COMENTARIUL A FOST MODIFICAT!";
 }
}



IF(ISSET($_POST['STERGE']))
{
$SQL = "DELETE FROM comentarii WHERE ID_COMENTARIU='".$_POST['ID_COMENTARIU']."'";
MYSQL_QUERY($SQL);
PRINT "COMENTARIUL A FOST STERS!";
PRINT '<br><b>OK</b>';
EXIT;
}

IF(ISSET($_POST['SETEAZA_MODERARE']))
{
$SQL = "UPDATE ADMIN SET ULCOMO ='".$_POST['ULTIMUL_ID']."'";
MYSQL_QUERY($SQL);
PRINT "VALOAREA A FOST SETATA!";
PRINT '<br><b>OK</b>';
EXIT;

}

?>
</BODY></HTML>
//prelucrare_modificare_stergere.php
<?
/*INCLUDE("AUTORIZARE.PHP");
INCLUDE("ADMIN_TOP.PHP");*/
/*MODIFICARE NUME DOMENIU*/
INCLUDE("../CONECTARE.PHP");

IF(ISSET($_POST['MODIFICARE_DOMENIU']))
{
/*VERIFICAM DACA NOUL NUME DE DOMENIU A FOST INTRODUS*/
IF($_POST['NUME_DOMENIU']=="")
{
PRINT "NU ATI INTRODUS NUMELE DOMENIULUI";
}
ELSE
{
$SQL = "UPDATE DOMENIU SET NUME_DOMENIU='".$_POST['NUME_DOMENIU']."' WHERE id_domeniu =".
$_POST['ID_DOMENIU'];

MYSQL_QUERY($SQL);
PRINT "NUME DOMENIU A FOST MODIFICAT";
PRINT '<BR>OK';
EXIT;
}
}


IF(ISSET($_POST['sterge_domeniu']))
{
$SQL = "DELETE FROM DOMENIU WHERE ID_DOMENIU = ".$_POST['id_domeniu'];
MYSQL_QUERY($SQL);
PRINT "DOMENIU A FOST STERS!";
}

/*MODIFICA NUME AUTOR*/
IF(ISSET($_POST['MODIFICA_AUTOR']))
{
 IF($_POST['NUME_AUTOR']=="")
 {
  PRINT "NU ATI INTRODUS NUMELE AUTORULUI";
 }
 ELSE
 {
 $SQL ="UPDATE AUTORI SET NUME_AUTOR='".$_POST['NUME_AUTOR']."' WHERE
 ID_AUTOR='".$_POST['ID_AUTOR']."'";
 MYSQL_QUERY($SQL);
 PRINT "NUMELE AUTORULUI A FOST MODIFICAT";
 EXIT;
 }
}

/*STERGE AUTOR*/


IF(ISSET($_POST['STERGE_AUTOR']))
{
$SQL ="DELETE FROM AUTORI WHERE ID_AUTOR=".$_POST['ID_AUTOR'];
MYSQL_QUERY($SQL);
PRINT "NUMELE AUTORULUI A FOST STERS";
}


/*MODIFICARE INFORMATII CARTE*/
IF(ISSET($_POST['modificare_carte']))
{
IF($_POST['TITLU']== "")
{
PRINT "NU ATI INTRODUS TITLUL";
}
ELSE IF($_POST['DESCRIERE']=="")
{
PRINT "NU ATI INTRODUS DESCRIEREA";
}
ELSE IF($_POST['PRET']=="")
{
PRINT "NU ATI INTRODUS PRETUL";
}
ELSE IF(!IS_NUMERIC($_POST['PRET']))
{
PRINT "PRETUL TREBUIE SA FIE NUMERIC! SCRIETI <100</B>, NU<B>1000 LEI</B>!";
}
ELSE
{
$SQL ="UPDATE CARTI SET ID_DOMENIU=".$_POST['ID_DOMENIU'].",ID_AUTOR=".$_POST['ID_AUTOR'].
",TITLU='".$_POST['TITLU']."', DESCRIERE='".$_POST['DESCRIERE']."',
PRET=".$_POST['PRET']." WHERE ID_CARTE=".$_POST['ID_CARTE'];
MYSQL_QUERY($SQL);
PRINT "INFORMATIILE AU FOST MODIFICATE";
}
}

/*STERGE CARTE*/

IF(ISSET($_POST['sterge_carte']))
{
$SQLCARTE = "DELETE FROM CARTI WHERE ID_CARTE=".$_POST['ID_CARTE'];
MYSQL_QUERY($SQLCARTE);
$SQLCOMENTARII="DELETE FROM COMENTARII WHERE ID_CARTE=".$_POST['ID_CARTE'];
MYSQL_QUERY($SQLCOMENTARII);
PRINT "CARTEA A FOST STEARSA DIN BAZA DE DATE";
print '<BR>CE MAMA  MASAI';
}

?>
</BODY>
</HTML>






//verif.php


<?PHP
SESSION_START();
INCLUDE("CONECTARE.PHP");
INCLUDE("PAGE_TOP.PHP");
INCLUDE("MENIU.PHP");
$ACTIUNE = $_GET['ACTIUNE'];

IF(ISSET($_GET['ACTIUNE']) && $_GET['ACTIUNE'] == "ADAUGA")
{
$_SESSION['ID_CARTE'][]=$_POST['ID_CARTE'];
$_SESSION['NR_BUC'][]= 1;
$_SESSION['PRET'][]=$_POST['PRET'];
$_SESSION['TITLU'][]=$_POST['TITLU'];
$_SESSION['NUME_AUTOR'][]=$_POST['NUME_AUTOR'];
}

?>

<TD VALIGN="TOP">
<H1>COSUL DE CUMPARATURI</H1>
<FORM ACTION="COD.PHP?ACTIUNE=MODIFICA" METHOD="POST">
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR BGCOLOR="#F9F1E7">
<TD><B>NR.BUC</B></TD>
<TD><B>CARTE</B></TD>
<TD><B>PRET</B></TD>
<TD><B>TOTAL</B></TD>
</TR>
<?
FOR($I=0;$I<COUNT($_SESSION['ID_CARTE']);$I++)
{
 IF($_SESSION['NR_BUC'][$I] != 0)
 /* DOAR DACA NUMARUL DE BUCATI NU E 0 ,AFISEAZA RANDUL*/
 {
 PRINT '<TR>
 <TD>
 <INPUT TYPE="TEXT" NAME="NOULNRBUC['.$I.']" SIZE="1" VALUE="'.$_SESSION['NR_BUC'][$I].'">
 </TD>
 <TD><B>'.$_SESSION['TITLU'][$I].'</B> DE '.$_SESSION['NUME_AUTOR'][$I].'</TD>
 <TD ALIGN="RIGHT">'.$_SESSION['PRET'][$I].' LEI</TD>
 <TD ALIGN="RIGHT">'.($_SESSION['PRET'][$I] * $_SESSION['NR_BUC'][$I]).' LEI</TD>
 </TR>';
 $TOTALGENERAL = $TOTALGENERAL + ($_SESSION['PRET'][$I]* $_SESSION['NR_BUC'][$I]);
 }
}

PRINT '<TR><TD ALIGN="RIGHT" COLSPAN="3"<B>TOTAL</B></TD><TD ALIGN="RIGHT"><B>'.
$TOTALGENERAL.'</B> LEI</TD></TR>';
?>
</TABLE>
<INPUT TYPE="SUBMIT" VALUE="MODIFICA">
</FORM><BR><BR>
INTRODUCETI <B>0</B> PENTRU CARTILE CE DORITI SA LE SCOATETI DIN COS!<H1>CONTINUARE</H1>
<TABLE>
<TR><TD WIDTH="200" ALIGN="CENTER"><IMG SRC="COS.GIF"><A HREF="CASA.PHP">MERGI LA CASA</A></TD>
</TR>
</TABLE>
</TD>
<?
INCLUDE("PAGE_BOTTOM.PHP");
?>


//nume_domeniu_selectat.php



<SELECT NAME="ID_DOMENIU">

<?
mysql_connect("localhost", "root", "");
mysql_select_db("librarie2");
$SQLND ="SELECT * FROM DOMENIU ORDER BY nume_domeniu ASC";
$RESURSAND = MYSQL_QUERY($SQLND);
WHILE($ROW = MYSQL_FETCH_ARRAY($RESURSAND))
{
 PRINT '<OPTION VALUE="'.$ROW['id_domeniu'].'">'.$ROW['nume_domeniu'].'</OPTION>';
}
?>
</SELECT>
















Comentarii

Postări populare de pe acest blog

WINDOWS 10 COMPUTER FREEZING PROBLEM SOLVED

good news : a BIOS UPDATE can resolve the problem but just for a Windows 7 on 64 bits o.s. and the system is not stable all the time. even after  bios update the system can freeze.
new info : u can try to low the screen brightness and see if this error appear so often after 
news: last info !!! maybe a virus. scann our system now with an antivirus i generate this error using other device ( a tablet pc) connected in the same network and the laptop i have this problem just freeze  http://thehackernews.com/2013/10/backdoor-found-in-chinese-tenda.html

news : if u use a tenda router this make couse all this problems



what i discover so far :
1.the electric company have many failure and affect the main ISP router/switch for building  also the router/switch installed by the ISP may be affected by overheating and will crash after a long utilisation on heat conditions 2.the router/switch of ISP affect any router of the user between this router and pc/laptop of client 3.the router and any other device of t…

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…