Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #######################
- # www.marcofbb.com.ar #
- #######################
- // Incluimos la configuracion y conexion a la MySQL.
- session_start();
- if(!session_is_registered(myusername)){
- header("location:main_login.php");
- }
- // Check if session is not registered, redirect back to main page.
- // Put this code in first line of web page.
- // Definimos la variable $msg por seguridad.
- $msg = "";
- // Si se apreta el boton Agendar, da la condicion como true.
- if($_POST['agendar'])
- {
- // Verificamos que no haya ningun dato sin rellenar.
- if(!empty($_POST['local']) || !empty($_POST['visitante']) || !empty($_POST['ratiol']) || !empty($_POST['ratiov']) || !empty($_POST['ratioe']) || !empty($_POST['sportid']) || !empty($_POST['start']))
- {
- // Pasamos los datos de los POST a Variables, y le ponemos seguridad.
- $local = htmlentities($_POST['local']);
- $visitante = htmlentities($_POST['visitante']);
- $ratiol = htmlentities($_POST['ratiol']);
- $ratiov = htmlentities($_POST['ratiov']);
- $ratioe = htmlentities($_POST['ratioe']);
- $sportid = htmlentities($_POST['sportid']);
- $start = htmlentities($_POST['start']);
- $liga = htmlentities($_POST['liga']);
- $take = floatval("0.91");
- $ratio1 = floatval($ratiol);
- $ratio2 = floatval($ratiov);
- $ratio3 = floatval($ratioe);
- // Configuracion de la base de datos.
- $dbhost = "localhost"; // Servidor
- $dbuser = "kv000179_bet"; // Usuario
- $dbpass = "Betiana1"; // Contraseña
- $dbname = "kv000179_bet"; // Tabla
- // Creando conexion.
- $link = mysql_connect($dbhost,$dbuser,$dbpass);
- mysql_select_db($dbname,$link);
- // Insertamos los datos en la base de datos, si da algun error lo muestra.
- $sql = "INSERT INTO events (hometeam, awayteam, ratiohome, ratioaway, ratiox, sportid, starttime, liga) VALUES ('".$local."','".$visitante."','".$ratio1 * $take."', '".$ratio2 * $take."', '".$ratio3 * $take."', '".$sportid."', '".$start."', '".$liga."')";
- mysql_query($sql,$link) or die(mysql_error());
- // Mostramos un mensaje diciendo que todo salio como lo esperado
- $msg = "Evento cargado correctamente.";
- } else {
- // Si hay un dato sin rellenar mostramos el siguiente texto.
- $msg = "Falta rellenar algun dato.";
- }
- }
- ?>
- <!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">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Agregar Eventos</title>
- </head>
- <style type="text/css">
- .agenda {
- margin:10px auto 0 auto;
- width:701px;
- height:468px;
- background-image:url(imagenes/agenda.jpg);
- }
- .agenda #contenidor {
- padding:5px;
- width:276px;
- height:428px;
- }
- .style2 {color: #000000}
- .style5 {color: #990000; font-weight: bold; }
- .style6 {color: #000000; font-weight: bold; }
- </style>
- <body>
- <script language="javascript">
- function toggle() {
- var ele = document.getElementById("toggleText");
- var text = document.getElementById("displayText");
- if(ele.style.display == "block") {
- ele.style.display = "none";
- text.innerHTML = "Mostrar Apuestas en Progreso";
- }
- else {
- ele.style.display = "block";
- text.innerHTML = "Esconder Apuestas en Progreso";
- }
- }
- </script>
- <tr>
- <td valign="top"><center><em><span style="color:red;"><?=$msg;?></span></em></center>
- <form action="agregar.php" method="post">
- <p align="center">CARGAR EVENTOS</p>
- <table width="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
- <tr>
- <td><table width="465" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
- <tr>
- <td width="318"><strong>Local</strong></td>
- <td width="185"><input type="text" name="local" id="local" /></td>
- </tr>
- <tr>
- <td><strong>Visitante</strong></td>
- <td><input type="text" name="visitante" id="visitante" /></td>
- </tr>
- <tr>
- <td><strong>Ratio Local</strong></td>
- <td><input type="text" name="ratiol" id="ratiol" /></td>
- </tr>
- <tr>
- <td><strong>Ratio Visitante</strong></td>
- <td><input type="text" name="ratiov" id="ratiov" /></td>
- </tr>
- <tr>
- <td><strong>Ratio Empate</strong></td>
- <td><input type="text" name="ratioe" id="ratioe" /></td>
- </tr>
- <tr>
- <td><strong>Sport ID (1 Futbol 2 Tennis)</strong></td>
- <td><input name="sportid" type="text" id="sportid" value="1" /></td>
- </tr>
- <tr>
- <td><strong>Comienzo (Ejemplo: 2012/05/07 14:00)</strong></td>
- <td><input name="start" type="text" id="start" value="2012/11/" /></td>
- </tr>
- <tr>
- <td><strong>Liga</strong></td>
- <td><label>
- <select name="liga" id="liga">
- <option value="LFP">A. Liga Española</option>
- <option value="BRA">B. Liga Brasilera</option>
- <option value="ARG">C. Liga Argentina</option>
- <option value="ITA">D. Liga Italiana</option>
- <option value="CHL">E. Champions League</option>
- <option value="EUL">F. Europa League</option>
- <option value="LIB">G. Copa Libertadores</option>
- <option value="SUD">H. Copa Sudamericana</option>
- <option value="ENG">I. Liga Inglesa</option>
- <option value="NBA">J. Basquet</option>
- <option value="ATP">K. Tennis</option>
- <option value="OTH">L. Otros</option>
- <option value="TUR">M. Liga Turquia</option>
- <option value="GER">N. Liga Alemania</option>
- <option value="FRA">O. Liga Francia</option>
- <option value="INT">P. Internacional</option>
- </select>
- </label></td>
- </tr>
- <tr>
- <td> </td>
- <td><div align="right">
- <div align="left">
- <input type="submit" name="agendar" value="Cargar" />
- </div></td>
- </tr>
- </table></td>
- </tr>
- </table>
- <table width="424" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
- <tr>
- <td width="315"><div align="center">(copiar exacto de <a href="http://www.livescore.in/" target="_blank">www.livescore.in</a>)</div></td>
- </tr>
- <tr>
- <td><div align="center"><a href="http://www.goleado.com.ar/bet/extra/logout.php"><img src="http://www.enlacepymes.com/enlaceb2b/images/logout.gif" alt="SALIR" width="32" height="32" /></a></div> </td>
- </tr>
- </table>
- <div align="center">
- <?php
- include('config.php');
- $sql2 = "SELECT SUM(`money`) as jugador FROM `users` WHERE `status` ='0'";
- $result2 = mysql_query($sql2) or die(mysql_error());
- $r = mysql_fetch_array($result2, MYSQL_ASSOC);
- $sql3 = "SELECT SUM(`enjuego`) as apostado FROM `users` WHERE `status` ='0'";
- $result3 = mysql_query($sql3) or die(mysql_error());
- $t = mysql_fetch_array($result3, MYSQL_ASSOC);
- $sql4 = "SELECT SUM(`depositado`) as depositado FROM `users` WHERE status = 0";
- $result4 = mysql_query($sql4) or die(mysql_error());
- $w = mysql_fetch_array($result4, MYSQL_ASSOC);
- $sql4 = "SELECT SUM(`depositado`) as depositado FROM `users` WHERE status = 1";
- $result4 = mysql_query($sql4) or die(mysql_error());
- $xx = mysql_fetch_array($result4, MYSQL_ASSOC);
- $sql = "SELECT * FROM users WHERE userid='marketing'";
- $result = mysql_query($sql) or die(mysql_error());
- $d = mysql_fetch_array($result, MYSQL_ASSOC);
- $tot_dep = $w[depositado];
- $en_apuesta = $t[apostado];
- $dinero_jug = $r[jugador];
- $marketing = $d[depositado];
- $div = $xx[depositado] - $marketing;
- $ganancia = $tot_dep - $en_apuesta - $dinero_jug - $div - $marketing;
- ?>
- </div>
- </form>
- <table width="493" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000" bgcolor="#CCCCFF">
- <tr>
- <td width="276"> Total Depositado: </td>
- <td width="217">$
- <?=number_format($tot_dep, 2);?></td>
- </tr>
- <tr>
- <td>Dinero de Jugadores:</td>
- <td>$
- <?=number_format($dinero_jug, 2);?></td>
- </tr>
- <tr>
- <td>Apuestas en Progreso:</td>
- <td>$
- <?=number_format($en_apuesta, 2);?></td>
- </tr>
- <tr>
- <td>Marketing:</td>
- <td>$
- <?=number_format($marketing, 2) ;?></td>
- </tr>
- <tr>
- <td>Dividendos Pagados:</td>
- <td>$
- <?=number_format($div, 2); ?></td>
- </tr>
- <tr>
- <td>Ganancias Sin Repartir:</td>
- <td>$
- <?=number_format($ganancia, 2);?></td>
- </tr>
- </table>
- <p> </p>
- <div align="center"><a href="javascript:toggle();" id="displayText">Mostrar/Esconder Apuestas en Progreso</a>
- </div>
- <div id="toggleText" style="display: none;"><table width="54%" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000" bgcolor="#CCCCCC">
- <tr>
- <td colspan="5">
- <div align="center">
- <?php
- include('config.php');
- $sql5 = "SELECT * FROM bets ORDER BY ticket";
- $result5 = mysql_query($sql5) or die (mysql_error());
- while($r = mysql_fetch_array($result5))
- {
- $sqlz = "SELECT * FROM events WHERE id =$r[eventid]";
- $resultz = mysql_query($sqlz) or die (mysql_error());
- $e = mysql_fetch_array($resultz) or die (mysql_error());
- $mybetz .= "$e[hometeam] - $e[awayteam] </br>";
- $eventid .= "$r[eventid] </br>";
- $user .= "$r[userid] </br>";
- $seleccion .= "$r[bet] </br>";
- $dinero .= "$r[money] </br>";
- $ticket .= "$r[ticket] </br>";
- $pubdate .= "$r[pubdate] </br>";
- }
- ?>
- Apuestas en Progreso </div></td>
- <td>
- Total Bets:
- <?php
- include('config.php');
- $sql = "SELECT `id` FROM `bets` GROUP BY `ticket`";
- $result = mysql_query($sql) or die(mysql_error());
- $total_bets_count = mysql_num_rows($result);
- ?>
- <?php echo $total_bets_count; ?> </td>
- </tr>
- <tr>
- <td width="36%"><div align="center" class="style5">Event ID</div></td>
- <td width="14%"><div align="center" class="style5">Usuario</div></td>
- <td width="10%"><div align="center" class="style5">Seleccion</div></td>
- <td width="9%"><div align="center" class="style5">Dinero</div></td>
- <td width="12%"><div align="center" class="style5">Ticket</div></td>
- <td width="19%"><div align="center" class="style5">Pubdate</div></td>
- </tr>
- <tr>
- <td><div align="center" class="style2"><?php echo $mybetz; ?></div></td>
- <td><div align="center" class="style2"><?php echo $user; ?></div></td>
- <td><div align="center" class="style2"><?php echo $seleccion; ?></div></td>
- <td><div align="center" class="style2"><?php echo $dinero; ?></div></td>
- <td><div align="center" class="style2"><?php echo $ticket; ?></div></td>
- <td><div align="center" class="style2"><?php echo $pubdate; ?></div></td>
- </tr>
- </table></div>
- <p> </p>
- <table width="54%" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000" bgcolor="#CCCCCC">
- <tr>
- <td colspan="6"><div align="center">
- <?php
- include('config.php');
- $sql5 = "SELECT * FROM users WHERE enjuego > 0 ORDER BY enjuego DESC";
- $result5 = mysql_query($sql5) or die (mysql_error());
- while($w = mysql_fetch_array($result5))
- {
- $jugador .= "$w[userid] </br>";
- $enjuego .= "$w[enjuego] </br>";
- }
- ?>
- Cantidad Apostada por Jugador</div></td>
- </tr>
- <tr>
- <td colspan="2"><div align="center" class="style5">Usuario</div> <div align="center" class="style2"><?php echo $jugador; ?></div></td>
- <td colspan="4"><div align="center" class="style5">Total en Apuestas</div> <div align="center" class="style2"><?php echo $enjuego; ?></div></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment