Php > action

Titreaction
Postée le27-07-2012
Affichée556
Mini-lien
Description

php

EtatInconnu. Inconnu.
Code d'insertion
Options
Afficher les numéros de lignes  Mettre la source en plein ecran  Selectionner la source  Partager sur Facebook 
Téléchargement Telecharger en format txt  Telecharger en format pdf  Telecharger en format php
Plein ecran
<?php require_once('../Connections/host.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO compte (id_cpt, date_depot, montant) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['id_cpt'], "int"),
                       GetSQLValueString($_POST['date_depot'], "text"),
                       GetSQLValueString($_POST['montant'], "int"));

  mysql_select_db($database_host, $host);
  $Result1 = mysql_query($insertSQL, $host) or die(mysql_error());

  $insertGoTo = "somme.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_host, $host);
$query_Rscompe = "SELECT SUM(compte.montant) FROM compte";
$Rscompe = mysql_query($query_Rscompe, $host) or die(mysql_error());
$row_Rscompe = mysql_fetch_assoc($Rscompe);
$totalRows_Rscompe = mysql_num_rows($Rscompe);

$maxRows_RsAffiche = 10;
$pageNum_RsAffiche = 0;
if (isset($_GET['pageNum_RsAffiche'])) {
  $pageNum_RsAffiche = $_GET['pageNum_RsAffiche'];
}
$startRow_RsAffiche = $pageNum_RsAffiche * $maxRows_RsAffiche;

mysql_select_db($database_host, $host);
$query_RsAffiche = "SELECT * FROM compte";
$query_limit_RsAffiche = sprintf("%s LIMIT %d, %d", $query_RsAffiche, $startRow_RsAffiche, $maxRows_RsAffiche);
$RsAffiche = mysql_query($query_limit_RsAffiche, $host) or die(mysql_error());
$row_RsAffiche = mysql_fetch_assoc($RsAffiche);

if (isset($_GET['totalRows_RsAffiche'])) {
  $totalRows_RsAffiche = $_GET['totalRows_RsAffiche'];
} else {
  $all_RsAffiche = mysql_query($query_RsAffiche);
  $totalRows_RsAffiche = mysql_num_rows($all_RsAffiche);
}
$totalPages_RsAffiche = ceil($totalRows_RsAffiche/$maxRows_RsAffiche)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template2.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>

<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<link href="../style.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
body,td,th {
        font-size: 14px;
}
a:link {
        color: #39F;
        text-decoration: none;
}
a:visited {
        text-decoration: none;
        color: #F00;
}
a:hover {
        text-decoration: underline;
        color: #099;
}
a:active {
        text-decoration: none;
        color: #000;
}
-->
</style>
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
</head>

<body class="twoColFixLtHdr">

<div id="container">
  <div id="header"> <a href="index.php"><img src="../images/bandeau.png" width="1000" height="93" /></a>
  <!-- end #header --></div>

<div  id="menu">
   <ul id="MenuBar1" class="MenuBarHorizontal">
     <li><a class="MenuBarItemSubmenu" href="#">Accueil</a>
       <ul>
         <li><a href="#">Item 1.1</a></li>
         <li><a href="#">Item 1.2</a></li>
         <li><a href="#">Item 1.3</a></li>
       </ul>
     </li>
     <li><a href="#">Qui suis -je</a></li>
     <li><a class="MenuBarItemSubmenu" href="#">Bukavu Bk</a>
       <ul>
         <li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a>
           <ul>
             <li><a href="#">Item 3.1.1</a></li>
             <li><a href="#">Item 3.1.2</a></li>
           </ul>
         </li>
         <li><a href="#">Item 3.2</a></li>
         <li><a href="#">Item 3.3</a></li>
       </ul>
     </li>
     <li><a href="#">Forum &amp; FAQ</a></li>
     <li><a href="#">Boutique Online</a></li>
     <li><a href="a">Salon Tchat</a></li>
     <li><a href="#">Mes cours</a></li>
   </ul>
</div>  
  <div><img src="../images/banner_04.jpg" width="1000" height="275" /></div>
<!-- InstanceBeginEditable name="center" -->
  <div id="sidebar1">

    <!-- end #sidebar1 -->
   
    <table width="435" border="0" cellspacing="2">
      <tr>
        <td width="201">&nbsp;</td>
        <td width="224">&nbsp;</td>
      </tr>
      <tr>
        <td>solde du compte</td>
        <td><?php echo $row_Rscompe['SUM(compte.montant)']; ?></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
      <table align="center">
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Date_depot:</td>
          <td><input type="text" name="date_depot" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Montant:</td>
          <td><input type="text" name="montant" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">&nbsp;</td>
          <td><input type="submit" value="Insert record" /></td>
        </tr>
      </table>
      <input type="hidden" name="id_cpt" value="" />
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <p>&nbsp;</p>
    <table width="654" border="0" align="center" cellpadding="5" cellspacing="5">
      <tr>
        <td width="124">id_cpt</td>
        <td width="247">date_depot</td>
        <td width="233">montant</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_RsAffiche['id_cpt']; ?></td>
          <td><?php echo $row_RsAffiche['date_depot']; ?></td>
          <td><?php echo $row_RsAffiche['montant']; ?></td>
        </tr>
        <?php } while ($row_RsAffiche = mysql_fetch_assoc($RsAffiche)); ?>
    </table>
  </div>
  <!-- InstanceEndEditable -->
  <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
  <div class="footer_1">
      <table width="966" border="0" align="center">
        <tr>
          <td width="164" class="back_menu" style="text-align: center">Site Penzi langu</td>
          <td width="156" class="back_menu" style="text-align: center">Contact</td>
          <td width="134" class="back_menu" style="text-align: center">Partenaire</td>
          <td width="147" class="back_menu" style="text-align: center">GDN IT</td>
          <td width="173" class="back_menu" style="text-align: center">RDC</td>
          <td width="181" class="back_menu" style="text-align: center">Suivez-nous</td>
        </tr>
        <tr>
          <td valign="top"><ul >
            <li class="back_menu2"  style="list-style-image:url(fleche_droite.png);"><a href="#">Plan du site</a></li>
            <li class="back_menu2" style="list-style-image:url(fleche_droite.png);><a href="http://www.siteduzero.com/membres-304.html"><a href="#">L'équipe</a></li>
           
            <li class="back_menu2" style="list-style-image:url(fleche_droite.png);> <a href="#">Accessibilité </a></li>
            <li class="back_menu2" style="list-style-image:url(fleche_droite.png);><a href="http://www.penzilangu.com/livreor.html" ><a href="#">Livre d'or </a></li>
          </ul></td>
          <td valign="top"><span class="back_menu2"></span>
            <ul>
            <li class="back_menu2"><a href="http://www.simple-it.fr/simpleit/le-site-du-zero/">Espace annonceurs</a></li>
              <li class="back_menu2"><a href="http://www.siteduzero.com/presse.html">Espace presse</a></li>
              <li class="back_menu2"><strong><a href="http://www.siteduzero.com/contact.html" accesskey="7">Nous contacter</a></strong></li>
              <li class="back_menu2"><a href="http://www.siteduzero.com/promouvoir.html">Promouvoir le site</a></li>
              <li class="back_menu2"><a href="http://suggestions.siteduzero.com/forums/97879-rapports-de-bugs">Signaler un bug</a></li>
        </ul></td>
          <td valign="top"><ul class="back_menu2">
            <li><a href="http://www.planethoster.net/Site-du-Zero">GDN</a></li>
            <li><a href="http://www.planethoster.net/Site-du-Zero">BRT-AFRICA</a></li>
            <li><a href="http://www.planethoster.net/Site-du-Zero">IBOSPRL</a></li>
            <li><a href="http://www.planethoster.net/Site-du-Zero">VODACOM</a></li>
            <li><a href="http://www.zcorrecteurs.fr/">OXITO</a></li>
          </ul></td>
          <td valign="top"><ul class="back_menu2">
            <li><a href="http://www.simple-it.fr/simpleit/l-entreprise/">L'entreprise</a></li>
            <li><strong><a href="http://www.siteduzero.com/recrutement/simple-it">On recrute !</a></strong></li>
            <li><a href="http://www.simple-it.fr/blog/">Notre blog</a></li>
            <li><a href="http://www.simple-it.fr/blog/">Sugestion</a></li>
          </ul></td>
          <td valign="top"><ul class="back_menu2">
            <li>Sud-kivu</li>
            <li><a href="http://www.planethoster.net/Site-du-Zero">Nord-Kivu</a></li>
            <li><a href="http://www.planethoster.net/Site-du-Zero">Kishangani</a></li>
            <li><a href="http://www.planethoster.net/Site-du-Zero">Lubumbashi</a></li>
            <li><a href="http://www.zcorrecteurs.fr/">Bandundu</a></li>
          </ul></td>
          <td valign="top" style="background-image:url(images/index_09.png);"><ul>
            <li><a href="http://www.siteduzero.com/Templates/xml/news_fr.xml"><img src="images/rss_mini.png" alt="Flux RSS" /> Flux RSS News</a>, </li>
            <li><a href="https://twitter.com/siteduzero"><img src="images/twitter_mini.png" alt="Twitter" /> Twitter</a></li>
            <li><a href="http://www.facebook.com/siteduzero"><img src="images/fb_mini.png" alt="Facebook" /> Facebook</a></li>
            <li><a href="https://plus.google.com/u/1/b/102435188684051308704/"><img src="images/gplus_mini.png" alt="Google+" /> Google+</a></li>
          </ul></td>
        </tr>
      </table>
  </div><br class="clearfloat" />
 
  <div id="footer">
    <p>&copy;GDN 2012, All rigths reseved</p>
  <!-- end #footer --></div>
<!-- end #container --></div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($Rscompe);

mysql_free_result($RsAffiche);
?>