Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. This doesnt make much sense. You need to create a static page template displaying what you are trying to achieve dynamically.
  2. The page content is stored in a database table - correct? You would select the record from your URL id, then pass it to Smarty so: $query = mysql_query("SELECT field FROM table WHERE id='".$_GET['id']."' LIMIT 1"); $result = mysql_fetch_array($query); $smarty->assign('main', $result['field']);
  3. Fields that are empty should be NULL Then you can include WHERE !ISNULL(field) in your query
  4. No code errors on the screen? How many files are in this directory?
  5. Your other option is to use a flag field in your database table. You could use an ENUM(1,2) If the branch has a document, set the field value to 2 else have it default to 1. Then you can easily check this value in a condition to display an image link or not.
  6. You need to use the full path to the image rather than a relative path ie. /var/www/html/mywebsite.com/images/imagefile.jpg
  7. You maybe overloading the mail server. If PHPMailer is using the mail() function to send large volumes of email then this is bad as the server needs to open and close SMTP sockets each time it is called. For this reason it is best to use PEAR mail for large volumes. Using usleep() is time in microseconds which is not a great deal of time to pause. Maybe try sleep(2) which will sleep for 2 seconds each iteration.
  8. Can you show us the original array and how you would like it sorted
  9. Or use the file_exists() function to check for an image if(file_exists($pathToImageFile)) { // display the image echo "<img src=''>"; }
  10. This does not look correct. You have URL encoded values in the file path $filename = "//serverfile/general/Procedure%20Manual/1.0%20usefull%20information/branch%20directions/$dirname.doc"; Use proper directory naming conventions: $filename = "/var/www/html/manuals/procedures/mydocumentname.doc"; No spaces in directory names/filenames. No urlencoded string i.e. %20
  11. OK if you get the error This indicates that the loop does not contain an array as the first value. If the error is coming from the follwoing foreach foreach($_REQEUST as $key => $val) { $message .= $key.": ".$val."\n\n"; } Then this implies that there is no request data to the form processing page so $_REQUEST does not exist. Your form is submitting to sendmail.php and using the POST method. Not sure why you have used $_REQUEST instead of $_POST but anyway you should be able to check the values entered in the form on your sendmail.php file by using print_r($_POST); Here is an example for your sendmail.php file: <?php // process the form when submit is clicked if(isset($_POST['action']) && $_POST['action'] == 'post') { $msg = "Name: ".$_POST['name']."\n\n"; $msg .= "Email: ".$_POST['email']; mail ("joe@bloggs.com", "Quote Request", $msg, "me@mydomain.com"); header("Location:successpage.php"); } ?> <form method="POST" action="sendmail.php"> <input type="hidden" name="action" value="post" /> Name: <input type="text" name="name" /><br /> Email: <input type="text" name="email" /><br /> <input type="submit" name="submit" value="submit" /> </form> You should not use this code in a live environment as the form data has not been validated before being put into an email. This leaves the form wide open to spammers, especially if you are using the email address inputted in the form as a sending address. You should look at cleaning your data before it goes in an email function. This is also the case when saving user input into database tables.
  12. As long as the canvas size of the flash file is not empty then you can get its dimensions using getimagesize(). Had a feeling you wanted to get the image size of an image within the flash program.
  13. Im guessing this is supposed to say It is supposed to EMAIL everyone back the number, job name, etc and it is not You have not included enough code to diagnose the issue. There are many variables set prior to where you have copied and pasted the code that could affect the outcome. What do you mean by Where did you add this? Do you get any output on screen? Have you checked your server mail logs after this program runs to see if the messages are malformed or have any other errors? If you dont see anything on screen you may have errors turned off. Add this to the top of the script: ini_set('display_errors', 'On');
  14. What is it you want to get from the flash file? You could get the size (bytes) of the flash file using filesize(). You cannot use getimagesize() because flash is not an image. Images and text are embedded into flash files unlike a none flash website where the images are stored in a web directory.
  15. Because the variable you are using $message has not been assigned any data. Simple as that mail("name@website.ca", "Quote Request", $message, "From: $email"); You'll probably want it displayed different but heres a quick fix foreach($_REQEUST as $key => $val) { $message .= $key.": ".$val."\n\n"; } mail("name@website.ca", "Quote Request", $message, "From: $email");
  16. $x = 1; while(($row = mysql_fetch_row($result)) != false) { echo " <div class='menutitle' onclick=\"SwitchMenu('sub".$x."')\">".$row[1]."</div> <span class='submenu' id='sub".$x."'>"; populate_ordering_products(); $x++; "</span>"; }
  17. This is really simple. PHP does not send mail as a user on the mail server. Obviously you set the from address in your code but the email will be sent from nobody. Therefore any bounced messages will usually end up in the server admins email. You can define this address in your httpd.conf if using apache I think. If you want to find out if a message has not been sent correctly then you will need to write a program that can parse your servers mail logs (usually /var/log/maillog). This is usually the approach if lets say you were making a newsletter system that sends messages to your website members. You want to get rid of the members that messages do not get through to i.e. dead or non existent email addresses otherwise you may get blacklisted as a spammer for sending emails to non-existent email addresses all the time.
  18. Your not trying to break CAPTCHAS are you? Nice
  19. Have you included the resource handle in the function? $query = mysql_query("INSERT INTO tableName SET field='".mysql_real_escape_string($string, $resource)."' WHERE .......
  20. Your method of storing the image data is a bit funny. Why not store the actual image filename in the database? To sort the images why not just have a sort order field in the database table? You could also store the image size in a database field using the results of getimagesize(); and then sort the images using these values.
  21. From what your saying i'm guessing that you have a catchall mailbox for a domain name on your mail server and using mail forwarding to send messages from other domains (virtual as you call it) into it. Is this the case? Are you basically storing multiple users messages from your system in 1 email inbox and require a program to fish out just the email for a particluar user. If so this is one hell of job and a funny way of implementing such a system. To get php to login to a mailbox and read email is quite easy. You basically open a socket to the mail server and issue telnet commands. But to check if an email is for a particluar users email address requires opening each email and extracting the to address field. You could end up trawling through thousands of emails just to find 1 for a particular address. Why wouldnt these users have individual mailboxes to read their own email. You could do this easily with a WHM cPanel server. The API allows you to setup user accounts in the background. You would just give the user access to their webmail screen.
  22. mysql > Login to mysql on your server/PC, select your database and enter your query: Linux: mysql -u username -p mysql > use databaseName; mysql > SELECT * FROM tableName; How are you creating your tables? Do you use something like phpmyadmin? If so you can test your queries before you place them into your php code there. Unless its a really simple query you should test your queries through the mysql database server prior to using them in your code. This helps to get indexes correct before using the query. If your application needs to perform well then you may not have the most optimal query first time around.
  23. This is also a bad idea: <meta http-equiv='refresh' content='0;url=the url of the calling page'> You should use a 301 redirect with a header header("Location:calling-page.php");
  24. Probably because your query is not returning any data! Have you tested the query first from the mysql command line?
  25. You are better installing optimizers onto your web server such as the Zend PHP optimizer and if your string data is coming from a large database then using memcache may be an option
×
×
  • 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.