Jump to content

pastilhex

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pastilhex's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello PFMaBiSmAd, You are absolutely right, i was missing that wrong name. Has you easily noted i'm giving my first step's in php. Has you said it would be interesting to work with a code debugger that easily highlight some code errors or mismatchs. Could you kindly recommend me one of the systems that mentioned with error_reporting? Thanks PS: Sorry about my english...
  2. I reframed the code and the first thing that the code check's its the $_FILES["file"]["error"] > 0 <?php if ($_FILES["file"]["error"] > 0){ echo 'Problema: '; switch ($_FILES['userfile']['error']) { case 1: echo 'File exceeded upload_max_filesize'; break; case 2: echo 'File exceeded max_file_size'; break; case 3: echo 'File only partially uploaded'; break; case 4: echo 'No file uploaded'; break; case 6: echo 'Cannot upload file: No temp directory specified'; break; case 7: echo 'Upload failed: Cannot write to disk'; break; } exit; }else{ ?> I'm not really understanding where is the mistake. I have some files to upload. Some of them are uploaded correctly and others don't (i don't get any error msg) but they all are pdf files. Even with the error checking over the code i can't upload the file and worst of all i'm not receiving any error message.
  3. Hi there everyone! I'm working on uploader script that checks the extension files to comprove that the file is always an pdf extension. I've tried to upload diferent files, all of them pdf's but strainglly some pdf's are accepted and others not. Can someone please take a look to my code? <?php if (($_FILES["file"]["type"] == "application/pdf") // After checking the extension here some pdf files are accepted and others are not && ($_FILES["file"]["size"] < 1000000)) { if ($_FILES["file"]["error"] > 0) { echo 'Problema: '; switch ($_FILES['userfile']['error']) { case 1: echo 'File exceeded upload_max_filesize'; break; case 2: echo 'File exceeded max_file_size'; break; case 3: echo 'File only partially uploaded'; break; case 4: echo 'No file uploaded'; break; case 6: echo 'Cannot upload file: No temp directory specified'; break; case 7: echo 'Upload failed: Cannot write to disk'; break; } exit; } else { echo "Enviado: " . $_FILES["file"]["name"] . "<br />"; echo "Tipo: " . $_FILES["file"]["type"] . "<br />"; echo "Tamanho: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Ficheiro Temporário: " . $_FILES["file"]["tmp_name"] . "<br />"; /* if (file_exists("horario/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " já existe. "; } else { */ move_uploaded_file($_FILES["file"]["tmp_name"], "horario/" . $_FILES["file"]["name"]); echo "Guardado em: " . "horario/" . $_FILES["file"]["name"]; rename ("horario/".$_FILES["file"]["name"], "horario/horario.pdf"); echo "<br><input type='button' value='Voltar' onClick='history.go(-1)'>"; /* } */ } } else { echo "Ficheiro inválido"; // If the pdf has been refused i get this error msg - it means invalid file } ?>
  4. Thanks MasterACE14, That really solved my problem You're the man !!
  5. Hello, Im trying to order and sort 3 columns by pulling data from Mysql db. For now im able to order by headings, but the second click would be to sort the same column and its not working. Could any body take a look to my code and give me some help ? <?php session_start(); if(!session_is_registered(myusername) || $_SESSION['nivel']==2){ header("location:index.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="author" content="" /> <link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <title>Gestão e Controlo de Funcionários</title> </head> <body> <div id="wrapper"> <div id="header"><h1 align="center"><?php include('includes/header.php'); ?></h1></div><!-- end #header --> <div id="nav"><?php include('includes/nav.php'); ?></div> <div id="logout" align="right"><?php include('includes/nav_logout.php'); ?></div> <div id="content"> <?php if(isset($_GET['orderby'])){$order = $_GET['orderby'];}else{$order = "nome";} if(!isset($_GET['sortby'])){$newsort="ASC";}else{ switch ($newsort){ case "ASC": $newsort="DESC"; break; case "DESC": $newsort="ASC"; break; } } ?> <table width="950" cellpadding="2" cellspacing="1" class="texto"> <tr> <td width="130" height="30" bgcolor="#CBDCED"><a href="<? echo $_SERVER['PHP_SELF']."?orderby=nome&sortby=$newsort";?>">Nome</a></td> <td width="130" height="30" bgcolor="#CBDCED"><a href="<? echo $_SERVER['PHP_SELF']."?orderby=apelido&sortby=$newsort";?>">Apelido</a></td> <td width="130" height="30" bgcolor="#CBDCED"><a href="<? echo $_SERVER['PHP_SELF']."?orderby=num_funcionario&sortby=$newsort";?>">Nº de Funcionário</a></td> <td width="130" height="30" bgcolor="#CBDCED">Inserir Horas Extras</td> <td width="130" height="30" bgcolor="#CBDCED">Consultar Horas Extras</td> <td width="130" height="30" bgcolor="#CBDCED">Editar Perfil</td> <td bgcolor="#CBDCED">Última Visita</td> </tr> <?php require('config.php'); $sql=mysql_query("SELECT * FROM `infopessoal` ORDER BY `$order` $newsort"); while($row = mysql_fetch_array($sql)) { echo "<tr>"; echo "<td>" . $row['nome'] . "</td>"; echo "<td>" . $row['apelido'] . "</td>"; echo "<td>" . $row['num_funcionario'] . "</td>"; echo "<td><a href='insereh.php?id={$row['func_id']}'><img src='images/insert.png' border='0'></a></td>"; echo "<td><a href='detalheh.php?id={$row['func_id']}'><img src='images/lupa.png' border='0'></a></td>"; echo "<td><a href='modificaf.php?id={$row['func_id']}'><img src='images/perfil.png' border='0'></a></td>"; echo "</tr>"; } mysql_close($link); ?> </table> </div><!-- end #content --> <div id="footer"><?php include('includes/footer.php'); ?></div><!-- end #footer --> </div><!-- End #wrapper --> </body> </html>
  6. Hi guyfromfl, Thanks for the help. That really worked for me. To avoid connecting DB with the $_GET do have any ideia ? Saving the $_GET[value] to a variable and connect DB with the variable solves the problem ?
  7. Hi everyone, First, I apologize for my poor English. I would like to get some help on this php/mysql script. I’m trying to create 2 pages, the first one is the one with some input textboxes and a submit button that stores the data into a MySql database. So far so good. The second page that’s were i display all the records from the MySql database and that’s were my doubts start. I have First Name, Last Name and employee number being displayed in a table with 3 more icons per row what makes a total of 6 columns. For example, the last icon it will be "Edit Profile" so i want to click on the icon and query that same record back to the first page were i will be able to edit the textboxes. Can anybody help me with this? First Page <form id="form1" name="form1" method="post" action="second_page.php"> <input type="text" name="nome" id="nome" /> <p> <input type="text" name="apelido" id="apelido" /> </p> <p> <input type="text" name="num_funcionario" id="num_funcionario" /> </p> <p> <input type="submit" name="button" id="button" value="Enviar" /> </p> </form> Second Page <form id="consulta" method="get" action="first_page.php"> <table width="950" cellpadding="2" cellspacing="1" class="texto"> <tr> <td width="230" height="30" bgcolor="#CBDCED">Nome</td> <td width="230" height="30" bgcolor="#CBDCED">Apelido</td> <td width="120" height="30" bgcolor="#CBDCED">Nº de Funcionário</td> <td width="130" height="30" bgcolor="#CBDCED">Inserir Horas Extras</td> <td width="160" height="30" bgcolor="#CBDCED">Consultar Horas Extras</td> <td width="80" height="30" bgcolor="#CBDCED">Editar Perfil</td> </tr> <?php require('config.php'); $sql=mysql_query("SELECT * FROM `infopessoal` ORDER BY `nome` ASC LIMIT 0 , 30"«»); while($row = mysql_fetch_array($sql)) { echo "<tr>"; echo "<td>" . $row['nome'] . "</td>"; echo "<td>" . $row['apelido'] . "</td>"; echo "<td>" . $row['num_funcionario'] . "</td>"; echo "<td><img src='images/insert.gif'></td>"; echo "<td><img src='images/lupa.gif'></td>"; echo "<td><input type='image' src='images/perfil.gif'></td>"; echo "</tr>"; } mysql_close($link); ?> </table></form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.