Jump to content

jponte

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by jponte

  1. Hi, In have a Apache server with MySQL/PHP running on a Windows machine (Quad Core, 4Gb RAM). I have SSL enabled as well. I can upload a 150Mb file without any issues. Now, if I use a Filemanager to download the files here is that happens: Files of upto 20Mb work great after that they do not downlaod. For example, if I try a 150Mb file, I get prompted to download the file but it just saves a 0K file. I have a local WAMPS server which I use to develop and without SSL everything works OK. I have not re-created locally with SSL. I though at the begining that the problem was with the file manager but with a second different code the exact same thing happens. Any settings at the server level that will prevent this to happen? Why the smaller files download perfectly? I saw issues with 2G files but they do not get even close to that. Peace, JP
  2. Hi, I want to add that large files work OK locally with WAMPS and not SSL so I think the problem is related to SSL. Regards, Jack P
  3. Hi, In have a Apache server with MySQL/PHP running on a Windows machine. I have SSL running as well. I downloaded a couple of already coded Filemanagers and they are working OK with small files up to a few MB. However, if I try a 150Mb file it point to downloading the file but it just saves a 0K file. I though at the begining that the problem was with the file manager but with a second different code the exact same thing happens. Any settings at the server level that will prevent this to happen? Why the smaller files download perfectly? Peace, Jack P
  4. Hi, I'm using this awesome PHP File Manager written by Gerd Tentler http://www.gerd-tentler.de/tools/filemanager/index.php?page=introduction&PHPSESSID=a3a1da453c38470eb6856239e9b1f477 The toold worked well when used without SSL. I added SSL and started not to load a page for the download. If I removed the s from the HTTPs URL it works as well but the problem is that files of a few megabytes and higher do not download. They show as 0K. Small files do work. Has anyone encountered anything similar anywhere? Is this a server side setting? Here is the link to the tool http://www.rogers-esc.com/logs/admin/ pass: esc Regards
  5. Got it.... I just got rid of the line alltogether...
  6. Hi, The error is 2. Where can I check it? Thanks, JP
  7. Hi, I changed it to ; Maximum allowed size for uploaded files. upload_max_filesize = 200M ; Maximum size of POST data that PHP will accept. post_max_size = 200M Now my code stops in the middle giving my own error: Error: Please select the file by clicking on the Browse button }elseif (!$_FILES['uploadedfile']['tmp_name']){ echo "<center><b>Error: Please select the file by clicking on the Browse button"; Thanks for your help, JP
  8. Hi, I have a code to upload files to a directory after is created. It works great with small files. After I try uploading a 30Mb file and it dies with the following error: Here is my code: <?php $ticket_number = $_POST['ticketnumber']; $target_path = "uploads/$ticket_number/"; $filename = basename($_FILES['uploadedfile']['name']); //Check the form for completion of fields If (!$_POST['ticketnumber']){ echo "<center><b>Error: Please enter a valid ticket number"; }elseif (!$_FILES['uploadedfile']['tmp_name']){ echo "<center><b>Error: Please select the file by clicking on the Browse button"; } else { //If the directory with the ticket number does not exists one is created if (!file_exists($target_path)) { chdir ("D:/"); mkdir("uploads/$ticket_number", 0777); chmod("uploads/", 0777); chmod("uploads/$ticket_number", 0777); } //Check if the file name inside the directory already exists if (file_exists($filename)) { echo "<center><b>There is a file in your same directory already uploaded with the same name, please change the name and try again!</b>"; echo getcwd() . "<br>"; exit(); }else { $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); } //Move the file to the path selected above if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded<br><br>"; echo "Upload: " . $_FILES["uploadedfile"]["name"] . "<br />"; echo "Type: " . $_FILES["uploadedfile"]["type"] . "<br />"; echo "Size: " . ($_FILES["uploadedfile"]["size"] / 1024) . " Kb<br />"; } else{ echo "There was an error uploading the file, please try again!"; echo "If the error persists please contact Rogers ESC at 1-866-939-3282"; } } ?> Any ideas what is happening? Is it a server side problem? This is a windows server. Peace, JP
  9. Hi, I resolved it through a chdir ("D:/"); Peace, JP
  10. Hi, I had a similar problem and happened that I did not have the correct directort selected. You can use the realpath() function to help you: http://www.php.net/manual/en/function.realpath.php echo the directories you are using and you'll see You can try this code as well to echo all information: <?php $myDir = '../../dir/targetDir/'; if(chmod(realpath($myDir), 0777)) { echo 'Successfully changed dir to 0777 permissions!'; } echo '<br />Safe Mode is: ' . ini_get('safe_mode'); echo '<br />'; clearstatcache(); echo 'Permissions: ' . substr(sprintf('%o', fileperms('/tmp')), -4); echo '<br />'; if(chmod(realpath($myDir), 0755)) { echo 'Successfully changed dir to 0755 permissions!'; } echo '<br />'; clearstatcache(); echo 'Permissions: ' . substr(sprintf('%o', fileperms('/tmp')), -4); ?> Peace JP
  11. Hi, I would like to upload my files do another drive in my windows server but I do not know how to write the new path to the E drive: I tried but does not seem to be working $target_path = "../../../../../uploads/$ticket_number/"; I'm located righ now in: C:\Dir1\Dir2\Dir3\Website\logs Thanks for the help, JP
  12. Hi, Thanks PFMaBiSmAd. As you said, I did not have the file name to be write, So I added/changed the following 3 $target_path = "uploads/$ticket_number/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { Peace, JP
  13. Hi, I'm having issues uploading a file file to my server with a very small and simple script. It works when I do not create a new folder and leave everything in the Uploads folder but I would like to create an individual folder with the ticket number provided in the form and store all submited files there. <?php $ticket_number = $_POST['ticketnumber']; mkdir("uploads/$ticket_number", 0777); chmod("uploads/", 0777); chmod("uploads/$ticket_number", 0777); $mydir = "uploads/$ticket_number"; if(chmod(realpath($myDir), 0777)) { echo 'Successfully changed dir to 0777 permissions!'; } $target_path = "uploads"; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path .'/'. $ticket_number)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded<br>"; echo $ticket_number; } else{ echo "There was an error uploading the file, please try again!"; } clearstatcache(); echo 'Permissions: ' . substr(sprintf('%o', fileperms($mydir)), -4); // Result here is 0777 ?> The paths are all fine. Here are the errors I get: Warning: move_uploaded_file(uploads/ww) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\Documents and Settings\jack.ponte\Desktop\Website\logs\uploader.php on line 56 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'c:/wamp/tmp\php13E.tmp' to 'uploads/ww' in C:\Documents and Settings\jack.ponte\Desktop\Website\logs\uploader.php on line 56 Any help will be appreciated. Jack P
  14. Hi, I knew the code was good. The "connection" word I guess it is reserved so I changed the field name and voila. It works. Peace, JP
  15. Hi, I have looked at this code forever and I cannot see the fault. Let me know if anyone is able to. Thanks again, JP
  16. Hi, I have this script to insert a few radius and checkboxes into a few SET and ENUM fields in a table. I get a syntax error but the print out of the query seems to be fine. Let me know if another pair of eyes can see the error: Error: Table: [pre]company_id smallint(4) network_type set('GSM', 'GPRS', 'UMTS', 'HSPA') area set('East', 'West', 'Central') ggsn set('TO5', 'VA2', 'MO2') egress set('TO5', 'VA2', 'MO2') redundancy set('GGSN', 'Egress') connection set('FR', 'VPN', 'MPLS', 'GRE') radius enum('Y', 'N') roaming enum('Y', 'N') blackberry enum('Y', 'N') [/pre] Code: //Convert the GGSN array choices into a value to enter in SET MySQL field $ggsn_array = $_POST['ggsn']; foreach ($ggsn_array as $one_ggsn) { $srcggsn .= $one_ggsn.", "; } $setggsn = substr($srcggsn, 0, -2); //Convert the connection array choices into a value to enter in SET MySQL field $connection_array = $_POST['connection']; foreach ($connection_array as $one_connection) { $srcconnection .= $one_connection.", "; } $setconnection = substr($srcconnection, 0, -2); //Convert the Egress array choices into a value to enter in SET MySQL field $egress_array = $_POST['egress']; foreach ($egress_array as $one_egress) { $srcegress .= $one_egress.", "; } $setegress = substr($srcegress, 0, -2); //Convert the Redundancy array choices into a value to enter in SET MySQL field $redundancy_array = $_POST['redundancy']; foreach ($redundancy_array as $one_redundancy) { $srcredundancy .= $one_redundancy.", "; } $setredundancy = substr($srcredundancy, 0, -2); //Convert the Network type array choices into a value to enter in SET MySQL field $networktype_array = $_POST['networktype']; foreach ($networktype_array as $one_networktype) { $srcnetworktype .= $one_networktype.", "; } $setnetworktype = substr($srcnetworktype, 0, -2); //Convert the Coverage array choices into a value to enter in SET MySQL field $coverage_array = $_POST['coverage']; foreach ($coverage_array as $one_coverage) { $srccoverage .= $one_coverage.", "; } $setcoverage = substr($srccoverage, 0, -2); // now we insert the options into the network distribution list $insert_networkoptions = "INSERT INTO network_options (company_id, network_type, area, ggsn, egress, redundancy, connection, radius, roaming, blackberry) VALUES ('".$_POST['comp_id']."', '$setnetworktype', '$setcoverage', '$setggsn', '$setegress', '$setredundancy', '$setconnection', '".$_POST['radius']."', '".$_POST['roaming']."', '".$_POST['blackberry']."')"; echo $insert_networkoptions; $add_networkoptions = mysql_query($insert_networkoptions) or die(mysql_error()); Before executing the query the data looks OK on an echo: Thanks for all your help, JP
  17. Hi, Does anyone know whay the value is not passed to the included page ? Thanks, JP
  18. Hi, In addition....I have a form in the page were the errors are coming from. Whould this have an impact on my code? <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0" align="center"> <tr> <td width="144" align="center"><p>Username:</p></td> </tr> <tr> <td><input type="text" name="username" maxlength="15"></td> </tr> <tr> <td align="center">Password:</td> </tr> <tr> <td><input type="password" name="pass" maxlength="15"></td> </tr> <tr> <td align="right"><center> <input type="submit" name="submit" value="Login"> Thanks again, JP
  19. Exactly....It should be before ANY ANY HTML tag. Then it will work. Thanks...
  20. Hi, The syntax is good: index.php: //Gives error if user doesnt exist $check2 = mysql_num_rows($check); if ($check2 == 0) { //die('That user does not exist in our database.'); $no_file = "<center><br>Sorry that file could not be found</center>"; $message = $no_file; include("errorpage.php"); exit; } errorpage.php: <P><?php $no_access = "<center><br>Sorry could not connect to the Database</center>"; $no_file = "<center><br>Sorry that file could not be found</center>"; echo "Error: $message"; echo "<br>look for the error "; ?> The page redirects but the value is not printed Very strange. I tried changing the inlcude order in the index.php page but nothing. Can you see the error? JP
  21. Hi, I have the following code at the top of the page due to the errors I was getting with the Header () funtion. Now my errors display in a new white page and not within the formated page. How can I change were to display the DIE error? <?php ob_start(); // Connects to your Database mysql_connect("localhost", "rt", "es") or die(mysql_error()); mysql_select_db("rma_portal") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM cust_info WHERE Cust_Username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['Cust_Password']) { } else { ob_start(); header("Location: form0.php"); ob_end_flush(); } } } //if the login form is submitted if (isset($_POST['submit'])) { // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $check = mysql_query("SELECT * FROM cust_info WHERE Cust_Username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user doesnt exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database.'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['Cust_Password'] = stripslashes($info['Cust_Password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['Cust_Password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //Redirects to form page header("Location: form0.php"); //logged in, register the session.. session_register("username"); session_register("pass"); } } } else { // if they are not logged in ?>
  22. Hi, Validation is done in the php file you submit to. Peace, JP
  23. I was able to re-arrange and figure out the logic....Thanks
  24. Hi, I'm trying to learn and I could not find a good definition for this operator which I have seen a lot: if(!empty($row->LastName)) Thanks, J P
  25. Hi, I submita form to a page were I insert everything to the DB and also mail info to an email address. I do a couple of checks before inserting into the DB. At the end I mail the info no matter what due that is not within the IF statements. I would like to inlcude the code but the email portion is long and would not like to repeat the coed twice. How would I go about incorporating it? He is the code. This is the mail portion: // Mail PHP After Adding to DB require_once('class.phpmailer.php'); include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); $body = "<br><strong>RMA info</strong> <br> RMA Date: $RMADate <br> RMA Number: $RMANumber <br><br> <strong>Customer info </strong> <br> Customer ID: $CustomerID <br> Contact Name: $CustomerName <br> <strong>Device information </strong><br> Device CTN: $DevicePhone <br> Device IMEI: $DeviceIMEI <br> Device Make: $DeviceType <br> Device SIM: $SIMCard <br> Device Model: $DeviceModel <br> Defect Description: $DescDefect<br><br> <strong>Troubleshooting </strong><br> Reset Device? $ResetDevice <br> Software Reload? $SoftwareReload <br> Wipe Device? $WipeDevice <br> Other? $TroubNotes <br> Additional Troubleshooting: $TroubNotes <br><br> <strong>Shipping Information </strong><br> Attention: $ShipAttention <br> Contact CTN: $ShipPhone <br> Contact Email: $ShipEmail <br><br> Address: $ShipStreet <br> Additional info: $ShipAddinfo <br> City: $ShipCity <br> Province: $ShipProv <br> Postal Code: $ShipPCode <br> Additional Notes $ShipAddNotes <br><br> Error: $errorqry <br>(If blank no error has been reported wrting to DB)"; //$body = file_get_contents('contents.html'); //$body = eregi_replace("[\]",'',$body); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.com"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtp.com"; // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "@"; // SMTP account username $mail->Password = "i"; // SMTP account password $mail->SetFrom('@', 'ESC RMA Team'); //Possibility to CC the customer //$mail->Addcc ("$CustomerEmail "); $mail->AddReplyTo("@","First Last"); $mail->Subject = "New Submited RMA Form - $RMANumber"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "@ "; $mail->AddAddress($address, "John Doe"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "<center><br>Your information has been sent to ESC. You will shortly receive an email with the ESC ticket number that has been assigned to this RMA.<br> Please keep the RMA form number for your records: <br><br><h3><b>$RMANumber</b></center></h3>"; } ?> And here are the IF Statements: <?php //Set variables for database access $Host = "localhost"; $User = "root"; $PasswordDB = "escrma"; $DBName = "rma_portal"; //Connect to Database $Link = mysql_connect ($Host, $User, $PasswordDB); mysql_select_db("rma_portal") or die(mysql_error()); //RMA info Vars $RMADate = $_POST['RMADate']; $RMANumber = $_POST['RMANumber']; //Customer Info Vars $CustomerID = $_POST['CustomerID']; $CustomerName = $_POST['CustomerName']; //Device Info Vars $DevicePhone = $_POST['DevicePhone']; $DeviceType = $_POST['DeviceType']; $DeviceModel = $_POST['DeviceModel']; $DeviceColor = $_POST['DeviceColor']; $DeviceIMEI = $_POST['DeviceIMEI']; $DescDefect = $_POST['DescDefect']; //Troubleshooting Vars $ResetDevice = isset ($_POST['Troubleshooting']['ResetDevice']) ? 'Y' : 'N'; $SoftwareReload = isset ($_POST['Troubleshooting']['SoftwareReload']) ? 'Y' : 'N'; $WipeDevice = isset ($_POST['Troubleshooting']['WipeDevice']) ? 'Y' : 'N'; $TroubOther = isset ($_POST['Troubleshooting']['TroubOther']) ? 'Y' : 'N'; $TroubNotes = $_POST['TroubNotes']; //Shipping Info Vars $ShipAttention = $_POST['ShipAttention']; $ShipPhone = $_POST['ShipPhone']; $ShipEmail = $_POST['ShipEmail']; $ShipStreet = $_POST['ShipStreet']; $ShipAddinfo = $_POST['ShipAddinfo']; $ShipCity = $_POST['ShipCity']; $ShipProv = $_POST['ShipProv']; $ShipPCode = $_POST['ShipPCode']; $ShipAddNotes = $_POST['ShipAddNotes']; // Collects data from rma_contact table $contactqry = mysql_query("SELECT * FROM rma_contact WHERE Cont_Attention = '$ShipAttention' AND Cont_Email = '$ShipEmail'") or die('Could not run query: ' . mysql_error()); // puts the "rma_contact" info into the $contactinfo array if found $contactinfo = mysql_fetch_assoc($contactqry); $ContactIDVal = $contactinfo['Contact_ID']; if(!isset($ContactIDVal)){ $Query2 = "INSERT into rma_contact (Cont_Attention, Cont_Phone, Cont_Email, Cont_Address, Cont_Add_Address, Cont_City, Cont_Prov, Cont_Postal, Cont_Add_Info) values ('$ShipAttention', '$ShipPhone', '$ShipEmail', '$ShipStreet', '$ShipAddinfo', '$ShipCity', '$ShipProv', '$ShipPCode', '$ShipAddNotes')"; if (mysql_db_query ($DBName, $Query2, $Link)) { //Get the generated ID for Contact_ID $Gen_Contact_ID = mysql_insert_id(); $Query = "INSERT into rma_devices values ('$RMANumber', '$CustomerID', '$RMADate', '$DevicePhone', '$DeviceType', '$DeviceModel', '$DeviceIMEI', '$DeviceColor', '$DescDefect', '$ResetDevice', '$SoftwareReload', '$WipeDevice', '$TroubOther', '$TroubNotes', '$Gen_Contact_ID')"; } else {print ("<Center>There was a problem saving the RMA form to the database<br>Please contact ESC at 1-877-939-3282\n"); echo "<BR><BR>Error message = ".mysql_error(); echo "<br><br></center>"; $errorqry = mysql_error(); } if (mysql_db_query ($DBName, $Query, $Link)) { } else {print ("<Center>There was a problem saving the RMA form to the database<br>Please contact ESC at 1-877-939-3282\n"); echo "<BR><BR>Error message = ".mysql_error(); echo "<br><br></center>"; $errorqry = mysql_error(); } } else{ $Gen_Contact_ID = $contactinfo ['Contact_ID']; $Query3 = "INSERT into rma_devices values ('$RMANumber', '$CustomerID', '$RMADate', '$DevicePhone', '$DeviceType', '$DeviceModel', '$DeviceIMEI', '$DeviceColor', '$DescDefect', '$ResetDevice', '$SoftwareReload', '$WipeDevice', '$TroubOther', '$TroubNotes', '$Gen_Contact_ID')"; if (mysql_db_query ($DBName, $Query3, $Link)) { } else {print ("<Center>There was a problem saving the RMA form to the database<br>Please contact ESC at 1-877-939-3282\n"); echo "<BR><BR>Error message = ".mysql_error(); echo "<br><br></center>"; $errorqry = mysql_error(); } } if (!$link = mysql_connect('localhost', 'root', 'escrma')) { echo 'Could not connect to mysql'; exit; } if (!mysql_select_db('rma_portal', $link)) { echo 'Could not select database'; exit; } print_r ($_POST); //print ("<br>The Query2 is:<BR>$Query2<P>\n"); //print ("<br>The Query1 is:<BR>$Query<P>\n"); //print ("<br>The Query3 is:<BR>$Query3<P>\n"); mysql_close ($Link); Thanks, Peace
×
×
  • 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.