-
Posts
1,033 -
Joined
-
Last visited
-
Days Won
17
Everything posted by gw1500se
-
Yes, for Linux use cron and for Windows use task scheduler.
-
Did you look at the httpd error log?
-
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
That means there is something in the array. See what it there with this: echo "<pre>"; print_r($_FILES['userfile']); echo "</pre>"; -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
My bad. The first error is a warning/notice. You did not specify the Content-type correctly but it assumed the correct value. As for the 2nd error it looks like you are running PHP version 5.1 or earlier. Version 5.2 or better has json built in. Your version does not and you will need to install php-pecl-json. -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
The 2nd error is because the first failed. You don't show what '$context' contains but I'm guessing you only need 1 parameter, the file path. -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
if (is_array($_FILES['userfile'])) { foreach($_FILES['userfile']['name'] as $name) { $type = pathinfo($name, PATHINFO_EXTENSION); if(!in_array($type, $allowed)) die("Error: Only jpg, jpeg, gif and png files are allowed.-".$type); } } } -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
I mean do the other $msg errors work? -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
A good IDE will help you with your indents which are still messed up making it difficult to read. I don't see where you initialize '$msg' to an empty string and I am not sure what happens when you concatenate to a variable that does not yet exist. Poor programming practice even if that works. Do the other errors show up? -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
It looks like you are missing one 'if' and have an extra 'else'. Where are you checking the file type? You need to practice good programming practice by properly indenting your code. if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) { if ($mail->addAttachment($uploadfile, $filename)) { /* You need to check for the desired file types here berfore you add it to the attach array */ $attachmentNames[] = $_FILES['userfile']['name'][$ct]; } else { $msg .= 'Failed to attach file ' . $_FILES['userfile']['name'][$ct]; } } else { $msg .= 'Failed to move file to ' . $uploadfile; } /* Where is the if for the next else, which doesn't belong here anyway? */ -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
??? You do it with PHP. Check the file type and if is it unacceptable do not attach it. -
only allow jpg and png file extensions phpmailer
gw1500se replied to ianhaney's topic in PHP Coding Help
Use explode with '.' on the file path, then look at the last array element and that is the file type. -
First please use the code icon (<>) for your code and specify PHP and HTML as appropriate. What you omitted from your post is what error are you getting or what are you getting that is different from what you expect?
-
You don't show any code or error. Is the slash stored in the database as the string '/' or as '/'? If you are using regex as the search string you need to escape the slash (i.e. \/).
-
You needed to escape the " as I said in my correction.
-
Correction: Add \ in front of the " that do not start or end the echo.
-
Your 'if' makes no sense. 'if' is a PHP statement yet you are starting PHP after the if. Also you are testing the result of 'echo' not the value of $chk. I am guessing but I think you want: <?php if ($chk == 0) { ?> . . . <?php } else { ?> . . . <?php } ?> That having been said, it is a poor way to program. You should do something more like: <?php if ($chk} == 0) { echo " <div class="container"> <div class="row" style="color:red"> <br><br><br><br><br><br> <center>Database Update Failed</center> </div> </div>" } else { echo " <div class="container"> <div class="row"> <br><br><br><br><br><br> <center>Database Updated</center> </div> </div>" } ?>
-
Detect codepage to use, read it from system? (for ZIP files)
gw1500se replied to Sonnich's topic in PHP Coding Help
Will utf8-decode help? -
No, as far as I know they are system wide and need to be enabled in php.ini. Enabling extensions will have minimal effect as opposed to actually using them in a script.
-
The keys are the items within the []
-
Assuming your swap space is sufficient, I guess you are stuck with trying to reinstall PHP and maybe Apache.
-
Its possible but you might try going to 512K on your memory first. Magento is a separate thing so it would not effect PHP max memory. It would only effect total memory and I assume you have at least 8G. How big is your swap? Although I doubt that would cause a memory fault.
-
Fault 11 is memory. You probably need to change memory_limit in your php.ini. I think it is 128M by default so you might try 256M.
-
oci_fetch_assoc returns an array of all the rows returned by the query. Call it once then put $value in a 'for' loop to process each row. $rows=oci_fetch_assoc($stid); foreach ($rows as $row) { . . . }