Jump to content

teknospr

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by teknospr

  1. Actually, they told me to increase to 100MB. Im gonna white some hours, maybe the settings do need 3 hours to be enabled.
  2. Good day: What I did was enabled htaccess, and created an .htaccess file with the following code: php_value upload_max_filesize 100M php_value post_max_size 100M php_value max_execution_time 6000 php_value max_input_time 6000 I know it seems overkill, but just wanted to make sure. Still, anything over 7MB gives me an empty array and does not upload. The upload form is multipart and works fine for anything under 8MB.
  3. Good day: How can I make a simple progress bar or progress indicator in php for an upload form? Here is my upload form code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Registrese</title> <script src="gen_validatorv4.js" type="text/javascript"></script> <script type="text/javascript"> function getfileextension(inputId) { var fileinput = document.getElementById("uploadFile"); if(!fileinput ) return ""; var filename = fileinput.value; if( filename.length == 0 ) return ""; var dot = filename.lastIndexOf("."); if( dot == -1 ) return ""; var extension = filename.substr(dot,filename.length); return extension; } function checkfileType(inputId,allowedExt) { var ext = getfileextension(inputId); if( ext == allowedExt ) return true; else alert("Archivo debe ser video .flv"); return false; } </script> <script type="text/JavaScript"> function TestFileType(fileName, fileTypes) { var myReturn = false; if (!fileName) return; dots = fileName.split("."); //get the part AFTER the LAST period. fileType = dots[dots.length-1]; if (fileTypes.indexOf(fileType) != -1) myReturn = true; else{ alert("Please only upload files that end in types: \n\n" + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again."); document.getElementById('cf_file').value = ''; myReturn = false; } return myReturn; } </script> <SCRIPT TYPE="text/javascript"> <!-- var resetRolls = new Object(); function resetimage(src) { this.src=src; this.confirm=true; this.alt="Reset"; this.write=resetimage_write; } function resetimage_write() { document.write('<A '); if (this.rollover) { if (! this.name) { alert('to create a rollover you must give the image a name'); return; } resetRolls[this.name] = new Object(); resetRolls[this.name].over = new Image(); resetRolls[this.name].over.src=this.rollover; resetRolls[this.name].out = new Image(); resetRolls[this.name].out.src=this.src; document.write( ' onMouseOver="if (document.images)document.images[\'' + this.name + '\'].src=resetRolls[\'' + this.name + '\'].over.src"' + ' onMouseOut="if (document.images)document.images[\'' + this.name + '\'].src=resetRolls[\'' + this.name + '\'].out.src"' ); } document.write(' HREF="javascript:'); if (this.confirm) document.write('if(confirm(\'¿Desea borrar todos los campos?\'))'); document.write( 'document.forms[' + (document.forms.length - 1) + '].reset();void(0);">'); document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '"'); document.write(' BORDER=0'); if (this.name)document.write(' NAME="' + this.name + '"'); if (this.height)document.write(' HEIGHT=' + this.height); if (this.width)document.write(' WIDTH=' + this.width); if (this.otheratts)document.write(' '+ this.otheratts); document.write('></A>'); } //--> </SCRIPT> </head> <body bgcolor="#f2efe0"> <table width="700" border="0" align="center" valign="top" cellpadding="0" cellspacing="0"> <tr> <th scope="row"> </th> </tr> <tr> <th scope="row"><table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="241" scope="row" align="center"><font size="5" color="#000000" face="century gothic"> Subir Video</font></th> </tr> </table></th></tr> <tr> <th scope="row"> </th> </tr> </table> <form action="insertvideo.php" method="post" id="video" enctype="multipart/form-data"> <table width="390" valign="top" align="center"> <td valign="top"> <table valign="top" align="center" width="550" border="0" cellpadding="0" cellspacing="0"> <font size="-1" color="#000000" face="century gothic"> <td><label for="fileToUpload"><font size="-1" color="#000000" face="century gothic">Nombre del video</font></label></td><td align="left"><input type="text" name="videoname" id="videoname" size=50 maxlength=25> </td> </tr> <tr> <td><font size="-1" color="#000000" face="century gothic">Seleccione Video</font></td><td align="left"><input type="file" name="uploadFile" id="uploadFile"> </td> </tr> <tr> <td><font face="century gothic" size="-1">Fecha</font></td> <td> <?php $now = time(); // or your date as well $your_date = strtotime("2011-07-25"); $datediff = $now - $your_date; $days = floor($datediff/(60*60*24)); $todayyear=date("Y"); $todaymonth=date("m"); $todayday=date("d"); $currentyear=date("Y"); $curdate=date("Y-m-d"); $currentyear=date("Y"); require_once('classes/tc_calendar.php'); $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2011, $currentyear); $myCalendar->dateAllow('2011-05-13', '2015-03-01'); $myCalendar->setDateFormat('Y-m-d'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month'); $myCalendar->setSpecificDate(array("2011-06-01"), 0, ''); $myCalendar->writeScript(); ?> </td> </table> <table width="600" border="0"> <tr> <td width="48"> </td> <td width="35"><a href="truquitosadmin.php"><img src="images/003063-blue-jelly-icon-media-a-media23-arrows-seek-back.png" width="35" border="0" /></a></td> <td width="124"><a href="truquitosadmin.php"><img src="images/003061-blue-jelly-icon-media-a-media21-arrow-back.png" width="35" height="35" border="0" /></a></td> <td width="48"><SCRIPT TYPE="text/javascript"> <!-- var ri = new resetimage("images/074368-simple-red-glossy-icon-alphanumeric-circled-x2.png"); ri.write(); //--> </SCRIPT> <NOSCRIPT> <INPUT TYPE=RESET> </NOSCRIPT></td> <td width="237"><input type="image" text="Añadir" alt="Insertar" src="images/019225-green-jelly-icon-symbols-shapes-check-mark.png" onClick="TestFileType(this.form.uploadFile.value, ['flv', 'FLV', 'mp4', 'm4v', 'webm', 'ogg']);" /></td> <td width="82"><img src="images/069497-blue-jelly-icon-alphanumeric-icon_091.png" width="35" height="35" /></td> </tr> </table> <br></td> </td> </table> </form><script type="text/javascript"> var frmvalidator = new Validator("video"); frmvalidator.addValidation("videoname","req","Debe llenar el campo de Nombre"); frmvalidator.addValidation("uploadFile","req","Debe seleccionar un video"); </script> </body> </html> Thanks for the help.
  4. I enabled htaccess in the server. It says I have to wait 3 hours. Will an htaccess file be generated or will I have to create one?
  5. htaccess is disabled. Should I create a php.ini file? I don't know really have a php.ini file either.
  6. Good day File size is 10MB. With flv files that are 6 and 7 MB the upload works fine. Also, I was able to upload an mp4 file of 7.5 MB. How can I increase the max upload size? And ensure that it does not time out?
  7. I am getting Array ( ) Here is the updated script: <html> <body bgcolor="#FFFFFF"> <?php $mydate = isset($_REQUEST["date5"]) ? $_REQUEST["date5"] : ""; echo '<pre>' . print_r($_FILES, true) . '</pre>'; // Your file name you are uploading $file_name = $_FILES['video']['name']; $file_type = $_FILES['video']['type']; // random 4 digit to add to our file name // some people use date and time in stead of random digit $random_digit=rand(0000,9999); //combine random digit to you file name to create new file name //use dot (.) to combile these two variables $new_file_name=$random_digit.$file_name; //set where you want to store files //in this example we keep file in folder upload //$new_file_name = new upload file name $path= "../videos/".$new_file_name; if($ufile !=none) { if(move_uploaded_file($_FILES['video']['tmp_name'], $path)) { echo "Video loaded<BR/>"; //$new_file_name = new file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$new_file_name."<BR/>"; echo "File Size :".$_FILES['video']['size']."<BR/>"; echo "File Type :".$_FILES['video']['type']."<BR/>"; $con = mysql_connect("*********", "*******","***********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("*******", $con); $sql="INSERT INTO videos (videoname, video, date) VALUES ('$_POST[videoname]', '$new_file_name', '$mydate')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Video loaded"; mysql_close($con); } else { echo "Video not loaded"; } } ?> </body> </html>
  8. I changed the script and this is what I get with the <pre> snippet: Array ( )
  9. Could you please give me a small example of the updated script?
  10. Just a simple upload form. This is the code that does the actual upload: <html> <body bgcolor="#FFFFFF"> <?php $mydate = isset($_REQUEST["date5"]) ? $_REQUEST["date5"] : ""; // Your file name you are uploading $file_name = $HTTP_POST_FILES['video']['name']; $file_type = $HTTP_POST_FILES['video']['type']; // random 4 digit to add to our file name // some people use date and time in stead of random digit $random_digit=rand(0000,9999); //combine random digit to you file name to create new file name //use dot (.) to combile these two variables $new_file_name=$random_digit.$file_name; //set where you want to store files $path= "../videos/".$new_file_name; if($ufile !=none) { if(copy($HTTP_POST_FILES['video']['tmp_name'], $path)) { echo "Video agregado <BR/>"; //$new_file_name = new file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$new_file_name."<BR/>"; echo "File Size :".$HTTP_POST_FILES['video']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['video']['type']."<BR/>"; $con = mysql_connect("********", "*************","************"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("*********", $con); $sql="INSERT INTO videos (videoname, video, date) VALUES ('$_POST[videoname]', '$new_file_name', '$mydate')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Video añadido"; mysql_close($con); } else { echo "Error no se cargo video"; } } ?> </body> </html>
  11. Good day: I have a simple uploader form to upload video files. FLV and mpg files will upload without problems. But mp4, m4v, ogg and webm files will not upload. I get this error: Warning: copy() [function.copy]: Unable to access in /mounted-storage/home7/sub007/sc30390-PTUD/**********.com/admin123/insertvideo.php on line 32 Error Video not loaded. I have read about adding the files in config/mimes.php but I do not see that folder or files in my hosting service (which is servage). Any help will be appreciated. Thanks.
  12. Good day: I am tryint to redirect back to a page based on non selection. I am using this code, it is redirecting but not passing the $aid variable on the url. The page is getting the passed variable before doing the redirect. Here is the code: if ($_POST['hid']==0) { header('Location: sample.php?aid=."$aid"'); } Thanks in advance.
  13. Good day: I'm trying to insert the local date, time at the moment of an entry in mysql. I have changed the date timezone and when I echo the date time to view it is on local time, however, it inserts the GMT time on mysql using the NOW()) function. I have that in mysql column setup as date. My time zone is America/Puerto_Rico or GMT -4. Thanks in advance for the help.
  14. teknospr

    Query

    Good day: Im trying to do a query where I select all users in a table except myself by using the column id as identifier. My id number is passed as variable and I have used the GET command to convert it in a variable for the query. So i need to do a query of all other users. Here is the code to select all users: $query="SELECT id, name, initial, last, secondlast, phone, last4, username FROM users WHERE active='1' AND id <> $usid ORDER BY last, secondlast, name, initial"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); Thanks in advance for the help.
  15. Good day: Im trying to insert some information in a database. The information is passing from one page to the other as evidenced by the echo I did to test this. But it is not inserting in the database and it says error, empty query. Here is the code: <html> <?php $aid = $_GET['aid']; $uid = $_GET['uid']; $page='sample.php'; ?> <body bgColor="#FFFFFF"> <meta http-equiv="refresh" content="25; url=<?php echo $page."?aid=".$aid; ?>"> <?php $con = mysql_connect("xxxxxxxx","xxxxxxxx","xxxxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxxxxxxl", $con); $mysql="INSERT INTO visits (name, initial, last, secondlast, plate, brand, model, color, uid, homeid, purpose, guard) VALUES ('$_POST[nombre]', '$_POST[inicial]', '$_POST[apellido]', '$_POST[apellido2]', '$_POST[tablilla]', '$_POST[marca]', '$_POST[modelo]', '$_POST[color]', '$uid', '$_POST[hid]', '$_POST[purpose]', '$aid')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Visita agregada"; mysql_close($con) ?> </body> </html> Any help will be appreciated. Thanks in advance
  16. Im trying to pass two variables to a page that will insert into a database some info. I can pass one but when I code it to pass two I get a wrong redirect page and an error. Here is the part of the code giving me trouble, including the get variables <?php $aid = $_GET['aid']; $page='insertvisits.php'; $urbid = $_POST['urbid']; ?> <form action="<?php echo $page."?aid=".$aid&"uid=".$urbid; ?>" method="post"> Any help will be appreciated
  17. Good day: Im doing a login page for a website, but the mysql database is on a server computer and not on the hosting account. It gives me a cannot select db message. Im using the IP address as the host. This is the script: <?php ob_start(); $host="000.000.000.000"; // Host name $username="ert4567"; // Mysql username $password="xxxxxxxx"; // Mysql password $port="3306"; $db_name="files"; // Database name $tbl_name="users"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password", "$port")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> Any help will be appreciated.
  18. Good day: Is there a way to create a proxy or coding in php that it is constantly getting the data from a sql database and inserting it into a mysql database? Any help will be appreciated.
  19. Yes I changed. Also changed the mysql closing statement and it fixed the last error. Thanks.
  20. Fixed that too. Now Im getting this error: Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /mounted-storage/home7/sub007/sc30390-PTUD/***********.com/form2.php on line 31
  21. mysql_query(): supplied argument is not a valid MySQL-Link resource in /mounted-storage/home7/sub007/sc30390-PTUD/xxxxxxxxxxxxx.com/form2.php on line 26
  22. Im trying to insert some values automatically into a table once the form loads, but Im getting an error. Here is the code <?php $aid = $_GET['aid']; $sd = $_GET['sd']; ?> <style> #message {margin:20px; padding:20px; display:block; background:#cccccc; color:#cc0000;} </style> <div id="message">Your notification has been submitted.</div> <div style="text-align:center "> <?php $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("articles", $connection); $query="INSERT INTO broken_links (articleid, article) VALUES ('$aid', '$sp')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Submitted"; mysql_close($con) ?> <table border="0" cellpadding="3" cellspacing="3" style="margin:0 auto;" > <input type="submit" id="Login" value=" Thank you. Please press to close " onclick="tb_remove()"></td> </tr> </table> </div> Any help will be appreciated
  23. It worked. Thanks
  24. Sorry about the question, but inst that the amount of rows? Or is it the number that is stored in the table? Im trying to retrieve the number in the table which is where the amount of pages of the article is stored.
  25. Good day: Im trying to get a numer from a table and use it to know how many pages are in the article so the script knows how many hyperlinks for the pages to generate (ex. links for pages 1 to 5). This is the script so far: <?php $aid = $_GET['aid']; $sd = $_GET['sd']; $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("articles", $connection); $query="SELECT pages FROM articles_description WHERE articleid=$sd"; $result=mysql_query($query); $num=$result; mysql_close(); ?> <table width ="600" border="0" cellspacing="2" cellpadding="2" align="center"> <th><font face="Arial, Helvetica, sans-serif">pages</font></th> <?php $i=1; while ($i <= $num) { ?> <td align="center"><font face="Arial, Helvetica, sans-serif"><?php echo "<a href=\"$f3?aid=$aid&sd=$i\" target=\"_self\">$i</a>"; ?></font></td> </td> <?php $i++; } ?> Any help will be appreciated.
×
×
  • 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.