elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 2 3 4 [5] 6 7 8 9 10 11 12 13
41  Programación / PHP / Re: Cambiar los tipos de archivos permitidos en: 30 Mayo 2017, 20:10 pm
Ya lo resolví, saludos !!
42  Programación / PHP / Re: Cambiar los tipos de archivos permitidos en: 29 Mayo 2017, 17:26 pm
 :-(
43  Programación / PHP / Re: Cambiar los tipos de archivos permitidos en: 28 Mayo 2017, 17:53 pm
Ya lo encontré:
Código
  1.  
  2.    // Incluimos las funciones del sistema
  3.    require_once '../administrator/ss-functions.php';
  4.  
  5.  
  6.    // Revisamos si existe la sesion o si es valida
  7.    isuserajax();
  8.  
  9.    // Si el posttext es vacio
  10.    if (empty($_POST['descripcion'])){exit();}
  11.  
  12.  
  13.    // Si es un espacio
  14.    if (ctype_space($_POST['descripcion'])){exit();}
  15.  
  16.    // Primero el Año
  17.    $theyear = date('Y');
  18.  
  19.    // Ahora el Mes
  20.    $themonth = date ('m');
  21.  
  22.    // creamos directorio para el usuario el año
  23.    if(!is_dir("../attachments/".$_SESSION['ssid']))
  24.        mkdir("../attachments/".$_SESSION['ssid'], 0777);
  25.  
  26.    // creamos directorio para el usuario
  27.    if(!is_dir("../attachments/".$_SESSION['ssid']."/".$theyear))
  28.        mkdir("../attachments/".$_SESSION['ssid']."/".$theyear, 0777);    
  29.  
  30.  
  31.    // creamos directorio para el usuario el mes
  32.    if(!is_dir("../attachments/".$_SESSION['ssid']."/".$theyear."/".$themonth))
  33.        mkdir("../attachments/".$_SESSION['ssid']."/".$theyear."/".$themonth, 0777);
  34.  
  35.  
  36.    //obtenemos el archivo a subir
  37.    $file = $_FILES['archivo']['name'];
  38.  
  39.    // Obtenemos la extension
  40.    $fileext = new SplFileInfo($file);
  41.    $getextension = $fileext->getExtension();
  42.  
  43.    // convertimos extension a minusculas
  44.    $extension = strtolower($getextension);
  45.  
  46.    // Aqui sacamos la lista de extensiones
  47.    $extensionlst = gettheextattachment();
  48.  
  49.    // Aqui hacemos un explode para cada uno
  50.    $extexplode = explode("|", $extensionlst);
  51.  
  52.    // Contamos el total de extensiones
  53.    $exttotal = count($extexplode);
  54.  
  55.  
  56.    for ($i=0; $i < $exttotal; $i++) {
  57.  
  58.       if($extension === $extexplode[$i]){
  59.           attachmentfiles($file,$_POST['descripcion']);
  60.           exit();
  61.       }
  62.  
  63.    }
  64.  

Pero no entiendo cómo modificar las extensiones de ahí...

Saludos.
44  Programación / PHP / Cambiar los tipos de archivos permitidos en: 28 Mayo 2017, 08:12 am
Hola, buenas. Tengo un código para subir archivos a una plataforma con extensión "jpg, rar, txt y zip" y quisiera saber cómo hago para cambiar esas extensiones permitidas por las siguientes: "mp4, mpeg, mwv", el código es el siguiente:
Código
  1.  <!-- ### FORM POST ### -->
  2.          <div class="box box-info">
  3.            <!-- form start -->
  4.            <form id="poster" class="form-horizontal">
  5.              <div class="box-body">
  6.                 <textarea id="thetextpost" name="posttext" class="form-control" rows="3"></textarea>
  7.              </div>
  8.              <!-- /.box-body -->
  9.            </form>
  10.  
  11.              <div class="box-footer">
  12.                <button class="btn btn-danger btn-sm pull-left" data-toggle="modal" data-target="#ModalDocumment"> <i class="fa fa-file-archive-o" aria-hidden="true"></i> Archivo</button>
  13.                <button class="posterbtn btn btn-info btn-sm pull-right"><i class="fa fa-pencil"></i> Publicar</button>
  14.              </div>
  15.              <!-- /.box-footer -->
  16.          </div>          
  17.          <!-- ### FORM POST ### -->
  18.  
  19.  
  20.  
  21.          <!-- ### COMMENT ### -->
  22.          <div id="timeliner">
  23.  
  24.          <?php takemylast6post(); ?>          
  25.  
  26.          </div>
  27.          <!-- ### COMMENT ### -->
  28.          <div id="loaderlinetime" class="col-sm-12 text-center">
  29.            <div class="loader-inner ball-pulse-sync"><div></div><div></div><div></div></div>
  30.          </div>
  31.  
  32.  
  33.  
  34.       </div>
  35.       <div id="sidebar" class="col-sm-3">
  36.           <?php include 'includes/adsense.html'; ?>
  37.       </div>
  38.     </div>
  39.     <!-- container -->
  40.  
  41.  
  42.     <!-- Modal -->
  43.     <div class="modal fade" id="ModalDocumment" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  44.       <div class="modal-dialog" role="document">
  45.         <div class="modal-content">
  46.           <div class="modal-header">
  47.             <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  48.             <h4 class="modal-title" id="myModalLabel"><i class="fa fa-upload" aria-hidden="true"></i> Subir Archivo</h4>
  49.           </div>
  50.           <div class="modal-body">
  51.  
  52.  
  53.              <div id="thefilattch" class="col-sm-12">
  54.                <form id="attachmentfrm">
  55.                  <label>Descripción:</label>
  56.                  <textarea class="form-control" name="descripcion" rows="3"></textarea>
  57.                  <label>Archivo:</label>
  58.                  <input type="file" name="archivo" class="form-control">
  59.                </form>
  60.  
  61.                <p></p>
  62.                <p>Solo se aceptan archivos con la extension: <?php validextlist(); ?></p>
  63.  
  64.              </div>
  65.              <!-- progress -->
  66.              <div id="loadeingarchive" class="progress active">
  67.                <div class="progress-bar progress-bar-primary progress-bar-striped" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
  68.                </div>
  69.              </div>
  70.              <!-- progress -->
  71.              <button type="button" class="uploadarchive btn btn-primary pull-right">Subir Archivo</button>
  72.  
  73.           </div>
  74.         </div>
  75.       </div>
  76.     </div>


Código
  1. // Sacamos las extensiones permitidas para los archivos que se suben
  2. function gettheextattachment(){
  3.  
  4.    // conexion de base de datos
  5.    $conexion = Conexion::singleton_conexion();
  6.  
  7.    $SQL = 'SELECT archiveextensions FROM '.SSPREFIX.'socialconfig WHERE id = 1';
  8.    $stn = $conexion -> prepare($SQL);
  9.    $stn -> execute();
  10.    $rstl = $stn -> fetchAll();
  11.    if (empty($rstl)){
  12.    }else{
  13.      foreach ($rstl as $key){
  14.        $fileext = $key['archiveextensions'];
  15.        return $fileext;
  16.      }
  17.    }
  18. }
  19.  
  20.  
  21. function validextlist(){
  22.  
  23.    // conexion de base de datos
  24.    $conexion = Conexion::singleton_conexion();
  25.  
  26.    $SQL = 'SELECT archiveextensions FROM '.SSPREFIX.'socialconfig WHERE id = 1';
  27.    $stn = $conexion -> prepare($SQL);
  28.    $stn -> execute();
  29.    $rstl = $stn -> fetchAll();
  30.    if (empty($rstl)){
  31.    }else{
  32.      foreach ($rstl as $key){
  33.         echo '<b>'.str_replace('|', ' / ', $key['archiveextensions']).'</b>';
  34.      }
  35.    }
  36.  
  37. }
  38.  
  39.  
  40. function formatSizeUnits($bytes){
  41.        if ($bytes >= 1073741824)
  42.        {
  43.            $bytes = number_format($bytes / 1073741824, 2) . ' GB';
  44.        }
  45.        elseif ($bytes >= 1048576)
  46.        {
  47.            $bytes = number_format($bytes / 1048576, 2) . ' MB';
  48.        }
  49.        elseif ($bytes >= 1024)
  50.        {
  51.            $bytes = number_format($bytes / 1024, 2) . ' kB';
  52.        }
  53.        elseif ($bytes > 1)
  54.        {
  55.            $bytes = $bytes . ' bytes';
  56.        }
  57.        elseif ($bytes == 1)
  58.        {
  59.            $bytes = $bytes . ' byte';
  60.        }
  61.        else
  62.        {
  63.            $bytes = '0 bytes';
  64.        }
  65.  
  66.        return $bytes;
  67. }
  68.  
  69.  
  70. // Para subir un archivo
  71. function attachmentfiles($file,$description){
  72.  
  73.    // conexion de base de datos
  74.    $conexion = Conexion::singleton_conexion();
  75.  
  76.    // Primero el Año
  77.    $theyear = date('Y');
  78.  
  79.    // Ahora el Mes
  80.    $themonth = date ('m');
  81.  
  82.    // Ahora usamos la sesion del usuario para su respectiva carpeta
  83.    $theuser = $_SESSION['ssid'];
  84.  
  85.    // Creamos un alfanumerico aleatorio.
  86.    $characters = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  87.    $string = '';
  88.    for ($i = 0; $i < 60; $i++) {
  89.     $string .= $characters[rand(0, strlen($characters) - 1)];
  90.    }
  91.  
  92.    // Tomamos la fecha y hora con segundos
  93.    $fechaseconds = date('Y-m-d h:i:s');
  94.    $fechanormal =  date('Y-m-d');
  95.  
  96.    // Nuevo nombre del Archivo
  97.    $thenewname = sha1($fechaseconds.$theuser.$string);
  98.  
  99.    // Obtenemos la extension
  100.    $fileext = new SplFileInfo($file);
  101.    $getextension = $fileext->getExtension();
  102.  
  103.    // convertimos extension a minusculas
  104.    $extension = strtolower($getextension);
  105.  
  106.    //comprobamos si el archivo ha subido y lo movemos a una su respectiva ruta
  107.    if ($file && move_uploaded_file($_FILES['archivo']['tmp_name'],"../attachments/".$theuser."/".$theyear."/".$themonth."/".$thenewname.".".$extension)){
  108.    }  
  109.  
  110.    // Creamos ruta del temporal
  111.    $temporal = "../attachments/".$theuser."/".$theyear."/".$themonth."/".$thenewname.".".$extension;
  112.  
  113.  
  114.    // Creamos el permalink de la publicacion
  115.    $permalink = sha1($string.$fechaseconds);
  116.  
  117.  
  118.    // Limitamos las publicaciones a tan solo 1000 caracteres
  119.    $postparse = substr($description, 0,1000);
  120.  
  121.    // Filtramos para evitar XSS Injection
  122.    $filtro = new InputFilter();
  123.    $finalpost = $filtro->process($postparse);
  124.  
  125.    // Tamaño del archivo
  126.    $filesize = $_FILES['archivo']['size'];
  127.  
  128.    // Nombre del Archivo
  129.    $filename = $_FILES['archivo']['name'];
  130.  
  131.    // Revisamos si el resultado es vacio para no tener que postearlo
  132.    if (empty($finalpost)){
  133.       exit();
  134.    }
  135.  
  136.    if (is_null($finalpost)){
  137.       exit();
  138.    }
  139.  
  140.    // Hacemos el registro del Archivo
  141.    $FileAttch = 'INSERT INTO '.SSPREFIX.'attachment (ruta, nombre, usuario, fecha, ext, peso, permalink) VALUES (:ruta, :nombre, :usuario, :fecha, :ext, :peso, :permalink)';
  142.    $stnfile = $conexion -> prepare($FileAttch);
  143.    $stnfile -> bindParam(':ruta', $temporal ,PDO::PARAM_STR);
  144.    $stnfile -> bindParam(':usuario', $_SESSION['ssid'] ,PDO::PARAM_STR);
  145.    $stnfile -> bindParam(':nombre', $filename ,PDO::PARAM_INT);
  146.    $stnfile -> bindParam(':fecha', $fechaseconds ,PDO::PARAM_STR);
  147.    $stnfile -> bindParam(':ext', $extension ,PDO::PARAM_STR);
  148.    $stnfile -> bindParam(':peso', $filesize ,PDO::PARAM_STR);
  149.    $stnfile -> bindParam(':permalink', $thenewname ,PDO::PARAM_STR);
  150.    $stnfile -> execute();
  151.    $lastidfile = $conexion -> lastInsertId();
  152.  
  153.    // Post con archivo
  154.    $thepostpostarchive = $lastidfile.'|'.$finalpost;
  155.  
  156.    // Como es un post de archivo es 4
  157.    $tipo = 4;
  158.  
  159.    $SQL = 'INSERT INTO '.SSPREFIX.'posts (post, usuario, permalink, fecha, tipo) VALUES (:post, :usuario, :permalink, :fecha, :tipo)';
  160.    $stn = $conexion -> prepare($SQL);
  161.    $stn -> bindParam(':post', $thepostpostarchive ,PDO::PARAM_STR);
  162.    $stn -> bindParam(':usuario', $_SESSION['ssid'] ,PDO::PARAM_INT);
  163.    $stn -> bindParam(':permalink', $permalink ,PDO::PARAM_STR);
  164.    $stn -> bindParam(':fecha', $fechaseconds ,PDO::PARAM_STR);
  165.    $stn -> bindParam(':tipo', $tipo ,PDO::PARAM_INT);
  166.    $stn -> execute();
  167.    $lastid = $conexion -> lastInsertId();
  168.  
  169.    // imagen de perfil
  170.    $profileimg = userprofile($_SESSION['ssid']);
  171.  
  172.    // Fecha
  173.    $fechastronger = fechastring($fechanormal,$permalink);
  174.  
  175.    echo'
  176.        <div id="post-public'.$lastid.'" class="box box-widget">
  177.            <div class="box-header with-border">
  178.              <div class="user-block">
  179.                <img class="img-circle" src="'.$profileimg.'" alt="'.gettheusernamepost().'">
  180.                <span class="username"><a href="profile.php?leanserwebmaster">'.gettheusernamepost().'</a></span>
  181.                '.$fechastronger.'
  182.              </div>
  183.              <!-- /.user-block -->
  184.              <div class="box-tools">
  185.                <button data-post="'.$lastid.'" class="eliminarthispost btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
  186.              </div>
  187.              <!-- /.box-tools -->
  188.            </div>
  189.            <!-- /.box-header -->
  190.            <div class="box-body">
  191.              <!-- post text -->';
  192.  
  193.                $postexplode = explode('|', $thepostpostarchive);
  194.                getattachblock($postexplode[0],$postexplode[1]);
  195.  
  196.         echo'<!-- Social sharing buttons -->
  197.              <button id="liker'.$lastid.'" type="button" data-target="'.$lastid.'" onclick="thelikeloadtimeclick('.$lastid.');" class="btn btn-default btn-xs"><i class="fa fa-thumbs-o-up"></i> Me gusta</button>
  198.              <span id="likecomment'.$lastid.'" class="pull-right text-muted">
  199.  
  200.              </span>
  201.            </div>
  202.  
  203.            <!-- /.box-footer -->
  204.            <div class="box-footer">
  205.              <form class="commentfrm" data-form="'.$lastid.'" id="commentfrm'.$lastid.'">
  206.                <img  id="mypiccomment" class="img-responsive img-circle img-sm" src="'.$profileimg.'">
  207.                <!-- .img-push is used to add margin to elements next to floating images -->
  208.                <div class="img-push">
  209.                  <input type="text" class="form-control input-sm" name="comentario" placeholder="Comentar...">
  210.                </div>
  211.              </form>
  212.            </div>
  213.            <!-- /.box-footer -->
  214.  
  215.            <!-- /.box-body -->
  216.            <div id="box-commets-body-'.$lastid.'" class="box-footer box-comments">
  217.  
  218.            </div>
  219.  
  220.          </div>
  221.    ';
  222.  
  223.  
  224.    $conexion = '';
  225.  
  226.  
  227.  
  228. }
  229.  
  230.  
  231.  
  232. function downloadarchive($permalink){
  233.  
  234.     // conexion de base de datos
  235.     $conexion = Conexion::singleton_conexion();
  236.  
  237.     $SQL = 'SELECT * FROM '.SSPREFIX.'attachment WHERE permalink = :permalink LIMIT 1';
  238.     $stn = $conexion -> prepare($SQL);
  239.     $stn -> bindParam(':permalink', $permalink ,PDO::PARAM_STR);
  240.     $stn -> execute();
  241.     $rstl = $stn -> fetchAll();
  242.     if (empty($rstl)){
  243.       header('Location: 404.php');
  244.     }else{
  245.       foreach ($rstl as $key){
  246.          $ruta = str_replace('../', '', $key['ruta']);
  247.          $nombre = $key['nombre'];
  248.       }
  249.     }
  250.  
  251.     header("Content-type: application/octet-stream");
  252.     header("Content-Type: application/force-download");
  253.     header("Content-Disposition: attachment; filename=\"$nombre\"\n"); readfile($ruta);
  254.  
  255.  
  256. }
  257.  
  258.  
  259.  
  260.  
  261.  
  262. // Tomamos los ultimos 6 post
  263. function takepostperpermalink($permalink){
  264.  
  265.    // conexion de base de datos
  266.    $conexion = Conexion::singleton_conexion();
  267.  
  268.  
  269.    $SQL = 'SELECT '.SSPREFIX.'usuarios.id AS userid, '.SSPREFIX.'posts.tipo AS posttipo, '.SSPREFIX.'posts.id AS postingid, '.SSPREFIX.'posts.post, '.SSPREFIX.'posts.permalink, '.SSPREFIX.'posts.fecha, '.SSPREFIX.'usuarios.nombre, '.SSPREFIX.'usuarios.apellido, '.SSPREFIX.'usuarios.permalink AS userperma FROM '.SSPREFIX.'posts INNER JOIN '.SSPREFIX.'usuarios ON '.SSPREFIX.'usuarios.id = '.SSPREFIX.'posts.usuario WHERE '.SSPREFIX.'posts.permalink = :permalink ORDER BY '.SSPREFIX.'posts.fecha DESC LIMIT 1';
  270.    $stn = $conexion -> prepare($SQL);
  271.    $stn -> bindParam(':permalink' , $permalink, PDO::PARAM_INT);
  272.    $stn -> execute();
  273.    $rstl = $stn -> fetchAll();
  274.    if (empty($rstl)){
  275.      # code...
  276.    }else{
  277.      foreach ($rstl as $key){
  278.  
  279.  
  280.        // imagen de perfil
  281.        $profileimg = userprofile($key['userid']);
  282.  
  283.        // Fecha
  284.        $fecha = fechastring($key['fecha'],$key['permalink']);
  285.  
  286.        // Imagen de perfil en el post
  287.        $perfilactual = userprofile($_SESSION['ssid']);
  288.  
  289.  
  290.        echo'
  291.  
  292.        <div id="post-public'.$key['postingid'].'" class="box box-widget">
  293.            <div class="box-header with-border">
  294.              <div class="user-block">
  295.                <img class="img-circle" src="'.$profileimg.'" alt="'.$key['nombre'].' '.$key['apellido'].'">
  296.                <span class="username"><a href="profile.php?'.$key['userperma'].'">'.$key['nombre'].' '.$key['apellido'].'</a></span>
  297.                '.$fecha.'
  298.              </div>
  299.              <!-- /.user-block -->
  300.            </div>
  301.            <!-- /.box-header -->
  302.            <div class="box-body">
  303.              <!-- post text -->';
  304.  
  305.              if ($key['posttipo'] == 1){
  306.                profileimageposttake($key['post']);
  307.              }elseif ($key['posttipo'] == 3) {
  308.                portadaimageposttake($key['post']);
  309.              }elseif ($key['posttipo'] == 4) {
  310.  
  311.                $postexplode = explode('|', $key['post']);
  312.                getattachblock($postexplode[0],$postexplode[1]);
  313.  
  314.              }else{
  315.                echo'<p>'.emoticons($key['post']).'</p>';
  316.              }
  317.  
  318.              echo'<!-- Social sharing buttons -->
  319.              ';
  320.  
  321.              checklike($key['postingid']);
  322.  
  323.              echo'
  324.  
  325.              <span id="likecomment'.$key['postingid'].'" class="pull-right text-muted">
  326.                 ';
  327.  
  328.                      checklikeandcomments($key['postingid']);
  329.  
  330.                 echo'
  331.              </span>
  332.            </div>
  333.  
  334.            <!-- /.box-footer -->
  335.            <div class="box-footer">
  336.              <form class="commentfrm" data-form="'.$key['postingid'].'" id="commentfrm'.$key['postingid'].'">
  337.                <img  id="mypiccomment" class="img-responsive img-circle img-sm" src="'.$perfilactual.'">
  338.                <!-- .img-push is used to add margin to elements next to floating images -->
  339.                <div class="img-push">
  340.                  <input type="text" class="form-control input-sm" name="comentario" placeholder="Comentar...">
  341.                </div>
  342.              </form>
  343.            </div>
  344.            <!-- /.box-footer -->
  345.  
  346.            <!-- /.box-body -->
  347.            <div id="box-commets-body-'.$key['postingid'].'" class="box-footer box-comments">';
  348.  
  349.               commentsajx($key['postingid'],$key['permalink']);
  350.  
  351.             echo'</div>
  352.          </div>
  353.  
  354.        ';
  355.  
  356.      }
  357.    }
  358.  
  359.  
  360.    $conexion = '';
  361.  
  362. }

Gracias de antemano, saludos !!
45  Programación / PHP / Re: Descontar Cantidad en Utilidad en: 18 Mayo 2017, 22:15 pm
Modifica la etiqueta GeSHi y pon PHP pls. (Es muy dificil leer codigo asi).

¿Quieres descontar en la variable o quieres descontar en la base de datos? - (No he descargado la BD y no planeo hacerlo, si posees un modelo relacional seria genial)

Si lo que quieres es descontar de la variable solo tienes que agregar el codigo de los descuentos haciendo restas sobre la variable, por ejemplo:

Código
  1. $comision_total -= $pago

Aunque no creo que eso sea lo que quieras, ya que es muy facil.

He de suponer que tienes en la base de datos la cantidad de pagos y la cantidad de utilidades del mes (seleccionando los del ultimo mes), en dicho caso puedes seleccionar directamente la diferencia, o cargar los dos datos y luego restarlos.



Por otro lado, si es cosa de bases de datos ahi necesito el modelo y que bd es.


El problema aquí es que no es un sistema mío y no comprendo bien el código en sí. Sin mencionar que a penas estoy aprendiendo esto de php y programación.

Sobre tu respuesta, por lo que entiendo, debería crear una nueva variable de pago? y recibir ahí la cantidad que se descontará de "comision_total" ?, o algo así?

Saludos.
46  Programación / PHP / Descontar Cantidad en Utilidad en: 14 Mayo 2017, 06:30 am
Hola, buenas. Tengo un sistema de inventario que no fue creado por mi pero estoy intentando modificarle algunas cosas. Hay una opción que se llama "Utilidades" dentro del sistema, es la suma de comisiones de cada vendedor, lo que yo quisiera saber es cómo hago para descontarle x cantidad a ese número, osea, tener la opción de poder descontar ese número:


Se utiliza este código en esa parte:
Código:
<?php
$u = null;
if( Session::getUID() != "" && !empty( $_GET["id"] ) ):

$u = UserData::getById( Session::getUID() );
    $user = $u->name." ".$u->lastname;
    $client_id = $_GET["id"];
    $client = ClientData::getById( $client_id );
    $cliente = false;
elseif( Session::getUID() != "" && empty( $_GET["id"] ) ):

$u = UserData::getById( Session::getUID() );
    $user = $u->name." ".$u->lastname;
    
    $client = ClientData::getByIdUser( $u->id );
    $client_id = $client->id;
    $cliente = true;
else:

print "<script>window.location='index.php';</script>";
endif;
?>
<div class="row">
<div class="col-md-12">
<h1><i class='fa fa-clock-o'></i> <?php echo $client->name." ".$client->lastname; ?> </h1>
<br>

<?php
$products = array();
if(isset($_GET["start_at"]) && $_GET["start_at"]!="" && isset($_GET["finish_at"]) && $_GET["finish_at"]!=""){

if($_GET["start_at"]<$_GET["finish_at"]){

$products = OperationData::getAllByClientIdAndRange( $client->id,$_GET["start_at"], $_GET["finish_at"] );
}
}
else{

$products = OperationData::getAllByClientId( $client->id );
}
$comision_total = 0;
if( count( $products ) > 0 ){
?>
<br>
<table class="table table-bordered table-hover ">
<thead>
<th>Clave</th>
<th>Precio de Venta</th>
<th>Precio de Costo</th>
<th>Fecha del pedido</th>
<th>Comisión</th>
<?
                 if( $u->is_admin == 1 ):?>
<th></th>
<?
endif;?>
</thead>
<?php
#echo "<pre>";print_r( $products );echo "</pre>";
foreach($products as $sell):


#$item = $sell->getItem();
$book = BookData::getById( $sell->book_id );
?>
<tr>
<td>
<?php echo $book->isbn; ?>
</td>
<td><?php echo $book->cantidad; ?></td>
<td><?php echo $book->precio_costo; ?></td>
<td><?php echo $sell->start_at; ?></td>
<td>
<?
$comision = $book->cantidad - $book->precio_costo;
if( $comision >= 80 ){

echo '$40';
$comision_total = 40 + $comision_total;
}
else{

echo '$20';
$comision_total = 20 + $comision_total;
}
?>
</td>
<?
                 if( $u->is_admin == 1 ):?>
<td>
<a href="index.php?action=delorder&id=<?php echo $sell->id;?>" class="btn btn-danger btn-xs">Eliminar</a>
</td>
<?
endif;?>
</tr>
<?php
endforeach; ?>
</table>

<div class="clearfix"></div>
<?php
}
else{
?>
<p class="alert alert-danger">No hay pedidos.</p>
<?php
}
$inventario = OperationData::getInventory( $client->id );
$list_inventario = OperationData::Discount_list( $client->id );
$inventario_sum = OperationData::Discount_sum( $client->id );
$initial_vendedor = ClientData::getById( $client->id );
?>
<div class="row">
<div class="col-lg-3">
Inventario Inicial<br>
<?
if( !$cliente ):?>
<form action="index.php?action=updateinventory" method="post">
<input id="vendedor" type="hidden" name="vendedor" value="<?= $client->id ?>">
<input required id="invetory_initial" type="text" name="invetory_initial" value="<?= $initial_vendedor->initial_inventory ?>">
<button type="submit" class="btn btn-success">Editar</button>
</form>
<?
else:?>
<h3>$<?= $initial_vendedor->initial_inventory ?></h3>
<?
endif;?>
</div>
<div class="col-lg-2">
Pedidos Realizados: <h3> $<?= ( empty( $inventario[0]->total ) ) ? 0 : $inventario[0]->total ?></h3>
</div>
<div class="col-lg-2">
Abonos: <h3> $<?= ( empty( $inventario_sum[0]->total ) ) ? 0 : $inventario_sum[0]->total ?></h3>
</div>
<div class="col-lg-2">
Deuda Total: <h3>$<?= ( ( $initial_vendedor->initial_inventory + $inventario[0]->total ) - $inventario_sum[0]->total ) ?></h3>
</div>
<div class="col-lg-2">
<label><font color='red'>Utilidades:</font></label> <font color='red'><h3> $<?= $comision_total ?></h3></font>
</div><br>
</div>
<?
if( count( $list_inventario ) > 0 ){?>
<div class="row">
<h3 class="col-lg-4 col-lg-offset-4">Lista de Abonos:</h3><br>
<?
if( count( $list_inventario ) > 0 ){
?>
<br>
<table align="center" class="table table-bordered table-hover">
<thead>
<th>Abono:</th>
<th>Fecha del Abono:</th>
</thead>
<?php
foreach($list_inventario as $list_inventario):
?>
<tr>
<td>
<?php echo $list_inventario->discount_valor; ?>
</td>
<td>
<?php echo $list_inventario->discount_date; ?>
</td>
</tr>
<?php
endforeach; ?>
</table>
<?php
}?>
</div>
<?
}
if( !$cliente ):?>
<div>
<form action="index.php?action=addiscount" method="post">
<input id="cliente" name="cliente" type="hidden" value="<?= $client->id ?>">
<label>Abono: </label>
<input required id="discount_n" type="text" name="discount_n">
<button type="submit" class="btn btn-success">Abonar</button>
</form>
</div>
<?
endif;?>
<div class="clearfix"></div>
<br><br><br><br><br><br><br><br><br><br>
</div>
</div>

La utilidad se obtiene sumando la comisión de los productos. Ahora, cuando se paga esa utilidad a los vendedores es cuando ese número debe descontarse (la cantidad que se pague). Como mencioné, es un sistema gratuito que encontré en internet y que estoy modificando pero ya no encuentro la forma de aplicar esto. Les muestro el sistema y la base de datos actual: https://mega.nz/#!7chmSLwC!hr30QNhit...lJuVWdAqs9si68

Se los envío para que se den una idea más detallada de dónde está lo que intento hacer, no pido que resuelvan mi problema haciéndolo, sólo que me ayuden a saber qué debo hacer para realizar lo que pregunto..

Espero puedan apoyarme, saludos!

MOD: Imagen adaptada lo permitido.
47  Programación / PHP / No me permite eliminar un elemento en: 13 Abril 2017, 00:32 am
Hola, buenas. Tengo un sistema de inventario, cuando intento eliminar un producto del historial de ventas y presiono "Eliminar" no ocurre nada, me recarga la página con el mismo producto intacto:

Esta es la línea para ese botón:


Ahora, me meto al archivo donde tengo los errores y me marca el siguiente:


Entro a esa carpeta, en esa línea y no encuentro el error:


A que se debe que no se elimine el elemento??
Gracias de antemano, saludos !!


Mod: Resolución máxima de las imágenes en el foro 800x600.
48  Media / Multimedia / Re: El video se mira lento una vez exportado en: 29 Marzo 2017, 23:51 pm
Creo yo que mi computadora está en un rango aceptable para no tener problemas al momento de visualizar el avi:


Los he tenido que exportar en mp4 para poder mirarlos..
49  Media / Multimedia / El video se mira lento una vez exportado en: 21 Marzo 2017, 01:47 am
Hola, buenas. Estoy intentando editar un logo para una campaña de gimnasio, el problema es que al terminar y exportarlo como .avi cuando intento reproducirlo en mi computadora se mira muy lento, como que dura para cargar y se traba cosa que en After Effects no sucede.

Así es como lo exporto:




Cuando lo reproduzco dentro del After Effects corre bien, no se traba, pero cuando abro el archivo avi en distintos reproductores todo se miran igual, lento, como con pausas. Quiero saber si es problema de mi computadora o algo estoy haciendo mal al momento de exportarlo, qué creen que sea el problema??

Gracias de antemano !!
50  Media / Diseño Gráfico / Que software puedo usar para crear anuncios en movimiento? en: 10 Febrero 2017, 03:21 am
Hola, buenas. Quisiera saber si conocen algún software gratuito que me sirva para crear anuncios de texto con movimiento, por ejemplo un anuncio indicando "Funciones Agotadas" y que vayan pasando las funciones de derecha a izquierda. Y que se pueda exportar, osea, que se pueda ver en una pantalla...

Saludos
Páginas: 1 2 3 4 [5] 6 7 8 9 10 11 12 13
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines