Ir para conteúdo
Fórum Script Brasil

Enio Ribeiro

Membros
  • Total de itens

    9
  • Registro em

  • Última visita

Sobre Enio Ribeiro

  • Data de Nascimento 09/04/2000

Contatos

  • MSN
    eniojacui12@gmail.com

Perfil

  • Gender
    Male
  • Location
    Brazil

Últimos Visitantes

618 visualizações

Enio Ribeiro's Achievements

0

Reputação

  1. Opa, fico feliz em saber que pude ajudar. Obrigado pelas palavras. Desejo lhe o mesmo. Felicidades!
  2. Como você falou no início em colocar os botões em uma lista SELECT tenta da seguinte maneira: <script> function Redireciona(obj) { var src = "pessoa/gerar_carteira/"+obj.value; window.location.href = src; } </script> <select name="pessoas" id="pessoas" onchange="Redireciona(this)"> <option value="<?php echo $registro['id_pessoa'];?>">Pessoa 01</option> <option value="PHP aqui">Pessoa 02</option> </select> tenta assim: <script> function Redireciona(obj) { window.location.href = obj.value; } </script> <select name="pessoas" id="pessoas" onchange="Redireciona(this)"> <option value="<?php echo base_url('pessoa/gerar_carteira')."/".$registro['id_pessoa'];?>">Pessoa 01</option> <option value="PHP aqui">Pessoa 02</option> </select>
  3. E framework php você está utilizando? Exemplo: Laravel, CakePHP, WaterPHP...?
  4. Tenta usar AJAX, ao clicar no campo do SELECT você consegue gerar o relatório sem refresh na mesma página ou redirecionar para outra.
  5. De nada, e muito bom saber que eu pude ajudar, se tiver alguma duvida ou se precisar de ajuda com algum código pode me mandar ok. Meu e-mail e eniojacui12@gmail.com. Qual é o curso que você está fazendo? Fiquei curioso rsrs.
  6. Não sei se entendi direito mas tenta da seguinte maneira: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="submit" name="calc" value="Calcular"> </form> <hr> <?php if (isset($_POST['calc'])) { $qtde = 0; // Cria uma array com números de 1 a 100 $a = range(1, 100); $b = range(1, 100); $c = range(1, 100); // Enquanto a quantidade de vezes for menor ou igual a 1 while($qtde <= 3) { // Sorteia um número aleatorio das array $A = $a[rand(0,100 - 1)]; $B = $b[rand(0,100 - 1)]; $C = $c[rand(0,100 - 1)]; // Se a sentença não for verdadeira, volta e procura novos números que obedeçam a sentença if( ($A * $A) + ($B * $B) != ($C * $C) ){ continue; }else{ // Exibe os números sorteados echo "N&uacute;meros sorteados: " . $A . '&nbsp;' . $B . '&nbsp;' . $C . "<br />"; // Exibe a sentença verdadeira echo "As tripas s&atilde;o: " . $A * $A . '&nbsp;+&nbsp;' . $B * $B . '&nbsp;=&nbsp;' . $C * $C . "<br /><br />"; } // Incremento na quantidade $qtde++; } } ?> Deste geite ele exibe as 4 triplas de uma só vez, se quiser que exiba mais de 4 e do mudar a quantidade no "while($qtde <= 3 )" alterano 3 o por outro número, mas acontece que entre 1 e 100 só e possível formar 4 triplas verdadeiras. Qualquer dúvida e só perguntar OK.
  7. <?php $qtde = 0; // Cria uma array com números de 1 a 100 $a = range(1, 100); $b = range(1, 100); $c = range(1, 100); // Enquanto a quantidade de vezes for menor ou igual a 1 while($qtde <= 4) { // Sorteia um número aleatorio das array $A = $a[rand(0,100 - 1)]; $B = $b[rand(0,100 - 1)]; $C = $c[rand(0,100 - 1)]; // Se a sentença não for verdadeira, volta e procura novos números que obedeçam a sentença if( ($A * $A) + ($B * $B) != ($C * $C) ){ continue; } // Incremento na quantidade $qtde++; } // Exibe os números sorteados echo "N&uacute;meros sorteados: " . $A . '&nbsp;' . $B . '&nbsp;' . $C . "<br />"; // Exibe a sentença verdadeira echo "As tripas s&atilde;o: " . $A * $A . '&nbsp;+&nbsp;' . $B * $B . '&nbsp;=&nbsp;' . $C * $C . "<br />"; ?> Tenta este código aqui funcionou
  8. Enio Ribeiro

    .

    <?php ini_set('memory_limit', '-1'); session_start(); error_reporting(0); require('../../class_ajax_request/classAjax.php'); include('../../application/functions.php'); include('../../application/DataConfig.php'); $session_id = $_SESSION['authenticated']; //$session id $path = "../../tmp/"; $path_avatar = "../avatar/"; $obj = new AjaxRequest(); $infoUser = $obj->infoUserLive( $_SESSION['authenticated'] ); $imgOld = $path_avatar.$infoUser->avatar; $imgOldLarge = $path_avatar.'large_'.$infoUser->avatar; if ( isset( $session_id ) ) { $valid_formats = array("jpg", "JPG", "jpeg","png","x-png","gif","pjpeg"); if( isset( $_POST ) && $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['photo']['name']; $size = $_FILES['photo']['size']; if( strlen( $name ) ) { $ext = pathinfo( $name ); if( in_array( $ext['extension'], $valid_formats ) ) { if( $size < ( 2250 * 2250 ) ) { $random = _Function::randomString( 5, FALSE, TRUE, FALSE ); $photo_post = strtolower( $infoUser->username )."_".$session_id."".$random.".".strtolower ( $ext['extension'] ); $photo_large = 'large_'.strtolower( $infoUser->username )."_".$session_id."".$random.".".strtolower ( $ext['extension'] ); $tmp = $_FILES['photo']['tmp_name']; /* Get Width and Height */ $dimensionsImage = getimagesize( $tmp ); $widthImage = $dimensionsImage[0]; $heightImage = $dimensionsImage[1]; /* Width and Height */ if( $widthImage >= 62 && $heightImage >= 62 ) { if( move_uploaded_file( $tmp, $path.$photo_large ) ) { //=============== px =================// $width = _Function::getWidth( $path.$photo_large ); $height = _Function::getHeight( $path.$photo_large ); $max_width = '800'; if( $width < $height ) { $max_width = '400'; } if ( $width > $max_width ) { $scale = $max_width / $width; $uploaded = _Function::resizeImage( $path.$photo_large, $width, $height, $scale, $path.$photo_large ); } else { $scale = 1; $uploaded = _Function::resizeImage( $path.$photo_large, $width, $height, $scale, $path.$photo_large ); } /* 62x62 px */ $_size = 62; $file = $path.$photo_large; list( $width, $height, $imageType ) = getimagesize( $file ); $imageType = image_type_to_mime_type($imageType); $newImage = imagecreatetruecolor( $_size, $_size); switch($imageType) { case "image/gif": $source=imagecreatefromgif($file); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": $source=imagecreatefromjpeg($file); break; case "image/png": case "image/x-png": $source=imagecreatefrompng($file); imagefill( $newImage, 0, 0, imagecolorallocate( $newImage, 255, 255, 255 ) ); imagealphablending( $newImage, TRUE ); break; } if ( $width > $height ) { $new_height = $_size; $new_width = ( $width / $height ) * $new_height; $x = ( $width - $height ) / 2; $y = 0; } else { $new_width = $_size; $new_height = ( $height / $width ) * $new_width; //($height-$width)/2 $y = ( $height - $width ) / 2; $x = 0; } imagecopyresampled( $newImage, $source, 0, 0, $x, $y, $new_width, $new_height, $width, $height ); switch($imageType) { case "image/gif": $file = $path.$photo_post; imagegif($newImage,$file); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": $file = $path.$photo_post; imagejpeg($newImage,$file,90); break; case "image/png": case "image/x-png": $file = $path.$photo_post; imagepng($newImage,$file); break; } imagedestroy( $source ); //<=// PHOTO LARGE =//> $photo_post_id = $photo_post; //==================================================// //= * COPY FOLDER AVATAR / * =// //==================================================// if ( file_exists( $path.$photo_post ) && isset( $photo_post_id ) ) { /* 62x62x */ copy( $path.$photo_post, $path_avatar.$photo_post ); unlink( $path.$photo_post ); /* Large Image */ copy( $path.$photo_large, $path_avatar.$photo_large ); unlink( $path.$photo_large ); }//<--- IF FILE EXISTS #2 //<<<-- Delete old image -->>>/ if ( file_exists( $imgOld ) && $imgOld != $path_avatar.'avatar.png' && $photo_post_id ) { unlink( $imgOld ); }//<--- IF FILE EXISTS #1 if ( file_exists( $imgOldLarge ) ) { unlink( $imgOldLarge ); }//<--- IF FILE EXISTS #1 //<<<--- * UPDATE DB * -->>> $obj->uploadAvatar( $photo_post_id ); echo json_encode( array ( 'output' => '', 'error' => 0, 'photo' => $photo_post ) ); //<--- move_uploaded_file } else { echo json_encode( array ( 'output' => $_SESSION['LANG']['error'], 'error' => 1 ) ); } //<--- Width && Height } else { echo json_encode( array ( 'output' => $_SESSION['LANG']['width_height_min_avatar'], 'error' => 1 ) ); } // size } else { echo json_encode( array ( 'output' => $_SESSION['LANG']['max_size_5'], 'error' => 1 ) ); } // Formats Images } else { echo json_encode( array ( 'output' => $_SESSION['LANG']['formats_available'], 'error' => 1 ) ); } //Error } else { echo json_encode( array ( 'output' => $_SESSION['LANG']['please_select_image'], 'error' => 1 ) ); exit; } } // ISSET // SESSION ACTIVE } else { echo json_encode( array ( 'output' => $_SESSION['LANG']['error'], 'error' => 1, 'reload' => 1 ) ); exit; } ?>
×
×
  • Criar Novo...