Jump to content

kev wood

Members
  • Posts

    456
  • Joined

  • Last visited

    Never

Everything posted by kev wood

  1. for a start i have never had to put all the head and html tags in to get it to display as an html page when sending emails from a php script. and secondly i have never had to put message at the beginning of every line concatenated or not. here is a script i am using at the minute which retrieves all the email address from a mysql db and sends out an email to each address when my web page is updated. $message .= '<body leftmargin="0" topmargin="0"> <table width="700" border="0" align="center" cellpadding="0" cellspacing="5"> <tr> <td>The ' . $table . ' section of the <a href="piponline.info"> PiPonline website</a> has been updated. Please follow the link to see the new content. </tr> </table> </body>'; $query = "SELECT * FROM emails WHERE page = '$table'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $contactemail = $row['email']; // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $replyName = "xxxxxx"; $replyEmail = "xxxxxxxx"; $contactname = ""; // Subject $subject = "Website Update"; // Headers $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL; $headers .= "From: ".$replyName." <".$replyEmail.">" . PHP_EOL; $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; mail($contactemail, $subject, $message, $headers); } where i have this $message .= ' in my script is the start of the email body you can put anything after this in html format and it will display as you like. to end the message body just simply end the last body tag a show in the script above and all should work fine anywhere you would like to have php variables showing up on the page you must format them as follows ' . $table . ' for them to show up correctly. also remember as it is an email if you want to have any images in there being pulled from your server they will need the absolute file reference for it show correctly so it would look some thing like http://www.yoursite.com/images/image_you_want.gif i know the html section of this is not very big but if you would like me to post one which has all the bells an whistles just ask and i will.
  2. this could easily be done with out the help of a wizard. how i would go about this would be to have your form filled out on one page then post all the date to a proccessing page which then takes all the information from the form and generates the email to be sent to you. can you post the code for the form.
  3. you could use javascript to check if all the form fields are filled in before the form is submitted but to check if the names have already been used you will have to run a mysql query on the db.
  4. you could put i dont know if that will work as your script is being generated for you by the wizard you are using. what is the need of this email being sent? if you tell us more about why you need this email sending out then we can better help find you a solution to your problem.
  5. the following code retrieves email address from a mysql db and sends out an email to each address in the db. the $message part of the script is what the recipient will see so just build that up like you would build a normal web page. remember to use absolute file references here though for any images that you want displayed. $message .= '<body leftmargin="0" topmargin="0"> <table width="700" border="0" align="center" cellpadding="0" cellspacing="5"> <tr> <td>The ' . $table . ' section of the <a href="piponline.info"> PiPonline website</a> has been updated. Please follow the link to see the new content. </tr> </table> </body>'; $query = "SELECT * FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $contactemail = $row['email']; // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $replyName = "PiPonliine"; $replyEmail = "info@piponline.info"; $contactname = ""; // Subject $subject = "Website Update"; // Headers $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL; $headers .= "From: ".$replyName." <".$replyEmail.">" . PHP_EOL; $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; mail($contactemail, $subject, $message, $headers); }
  6. i have just been doing some reading on this and i read that if you set in your .htaccess file the php_value max_execution_time to 0 then this implies unlimited script execution time. this may not be the fix but give it a try it wont hurt. if your server is running PHP 5 you cannot set the upload_max_filesize using a .htaccess file or the ini_set() method. if that is the case then you will need to install the php.ini master file in the directory that you want to change the upload_max_filesize. if your PHP handler is CGI, you must use php.ini.
  7. thanks for all your replies i will go through all the replies and try to work out which one will alienate the least amount of people. thank you all again for the enlightenment on stopping the bots as best possible. i will mark this solved. someone should put all the ideas together in one post and make it a sticky post so all can see the various ways of stopping the bots.
  8. no i no there is some great ideas on this page i put that post up while other people had posted i am grateful for the replies on here. just want to make sure der is no stone unturned so i have a full understanding of all the different ways this can be done. when i come to do this i will have to make sure that people who maybe blind, deaf, have learning difficulties, have bad eyesight or anything else you can thing off will be able to register. i am also not stupid and realise that the option i choose will more than likely alienate one group of people but i want to make sure that i have looked into all possible ways of doing this. i am not ignoring what is being posted just want to know more ways of doing this if there is any.
  9. the site that i am building may have issues using the captcha animated gif method as people with learning difficulties may use the site also and doing simple arithmetic may not be there strong point. i no this is now sounding almost impossible but i am open to suggestions.
  10. you didnt do to bad for your first post just put all your code inside code tags it makes it easier to read and you will find you get more replies (the code tags button is the # symbol). i have problems uploading large files to the server before, although it was not exactly the same as you have done here i found that putting the following code at the top of the php script for the upload allowed the larger files to be uploaded. set_time_limit(0); if i remember correctly this allows the code to continue running before the server connection is lost.
  11. what is the best way to stop bots filling in forms and registering on sites?
  12. got the code to work using the following code $query = "SELECT * FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $contactemail = $row['email']; // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $replyName = "PiPonliine"; $replyEmail = "info@piponline.info"; $contactname = ""; // Subject $subject = "Website Update"; // Headers $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL; $headers .= "From: ".$replyName." <".$replyEmail.">" . PHP_EOL; $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; mail($contactemail, $subject, $message, $headers); } echo "$contactemail"; echo "<h2>Email notification sent</h2>"; echo "<h2>1 record added</h2>"; mysql_close($con);
  13. i am trying to create an array of email address stored in a mysql db and store the result into a php variable to be used in the BCC section of an email. up to now the code i am using is only placing one email address into the php variable. here is the code $query = "SELECT email FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $contactemail = $row['email']; } arrays are not my strong point as you can prob tell from the code i have written.
  14. i have got it sending out one email now so i no all the code is working except for this part $query = "SELECT email FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $contactemail = $row[0]. ", "; } the results are not being stored in the array only one email address is stored. i have set the db up with three test email address so it should have more than one.
  15. i no the problem is with the array as it is not gettin populate i have tried a few different variants now an still get the same resulting error. here is what the array looks like now. $query = "SELECT email FROM emails"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while($row = mysql_fetch_array($result)){ $contactemail = $row['email']. ", "; }
  16. i am getting this error now Warning: implode(): Bad arguments. in /home/acmeart/public_html/pip/website3/cms/insert.php on line 122
  17. sorry for not stating the problem i have a bad headache today an am not functioning properly. the emails where not being sent. i will try your fix and get back to you.
  18. i am trying to write some code that will send an email to user's who are registered on a site i am building. up to now it is not working. here is my code up to now. $sql= "INSERT INTO $table (date, title, article) VALUES ('$a', '$b', '$c')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } $lastid = mysql_insert_id(); $message .= '<body leftmargin="0" topmargin="0"> <table width="700" border="0" align="center" cellpadding="0" cellspacing="5"> <tr> <td>The ' . $table . ' section of the <a href="piponline.info"> PiPonline website</a> has been updated. Please follow the link to see the new content. </tr> </table> </body>'; $query = "SELECT email FROM emails"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_assoc($result)) { $contactemail= "$row[address], "; } // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $replyName = "PiPonliine"; $replyEmail = "info@piponline.info"; $contactname = ""; // Subject $subject = "Website Update"; // Headers $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL; $headers .= "From: ".$replyName." <".$replyEmail.">\r\n" . PHP_EOL; $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; mail($contactemail, $subject, $message, $headers); echo "<h2>Email notification sent</h2>"; echo "<h2>1 record added</h2>"; any help would be much appreciated.
  19. thanks for the reply i didnt realise that it was a reserved word i was looking for missing semi colons. well it is done now thank you again
  20. i have this line of code which i cannot see a problem with but i keep getting an error. $sql= "INSERT INTO emails (Firstname, Lastname, email, table) VALUES ('$a', '$b', '$c', '$table')"; the error i keep getting is Error: You have an error in your SQL syntax near 'table) VALUES ('kevin', 'wood', 'kevin_wood@xxxxxxxx', 'news')' at line 1 the values are being passed to this page fine but it still gives me this error. any help would be much appreciated.
  21. there is no specific effect i am looking for just one that is eye catching. i have always liked my animated rollovers and have just always built either the entire websites in flash or just aspects of sites using flash such as the menu/buttons. i know some of the same effects can be achieved using javascript. so i guess the question is does anyone know where i can look at what other people have done with javascript to create nice rollover effects on the buttons or tutorials showing how to create eye catching effects on buttons using javascript.
  22. what are the diferent types of rollover effects you can have with javascript. i have found the image swap and the fade in and fade out rollover. is there any other types of effects you can have using javascript?
  23. i have got this working nearly how i wwould like but the it aint quite working exactly write. it should work by you enter text or numbers in the text fields and then submit the form and it puts all the text or numbers in the text box below the submit button. this worked originaly but i then added code to add a form field and to concat this data to the other data in the box below the submit. it does this but it wil not submit the original form until the new text field is displayed and had a number entered into it. here is the code <html> <head> <title> Javascript Excercise 2 </title> <script> function validate(){ var array = new Array(); //this is declaring the array array[0]=document.getElementById("text1").value; //this populating the array elements array[1]=document.getElementById("text2").value; array[2]=document.getElementById("text3").value; array[3]=document.getElementById("text4").value; array[4]=document.getElementById("text5").value; array[5]=document.getElementById("text6").value; array[6]=document.getElementById("text7").value; var ele = document.forms["form1"].elements["textresult"]; //this section of the code now declares a variable for looping through the array elements to print in the box ele.value = ""; var x, len = array.length; //this section of the code works out the length of the array and sets the var len and x to this for (x=0; x<len; ++x) //start of the for loop to print in the array elements into the form field { if (ele.value.length > 0) ele.value += "\n"; ele.value += array[x]; } } function newTextBox(element) { textField = document.createElement('INPUT'); textField.type = 'text'; textField.id ='text7'; form1.appendChild(textField); } </script> </head> <body> <form name="form1"> Text 1: <input type="text" id="text1"> <br> Text 2: <input type="text" id="text2"> <br> Text 3 <input type="text" id="text3"> <br> Text 4 <input type="text" id="text4"> <br> Text 5 <input type="text" id="text5"> <br> Text 6 <input type="text" id="text6"> <br> <br> Text Result <br> <br> <input type="button" value="submit" onclick="validate()"> <br> <br> <input type="text" id="textresult" name="Text Result"> <br> <br> <input type="button" id="btnAdd" value="New text box" onclick="newTextBox();" /> </form> </body> </html>
  24. i have got it working how i want for this section. here is the code i have now <html> <head> <title> Javascript Excercise 2 </title> <script> function formfield(){ } function validate(){ var array = new Array(); //this is declaring the array array[0]=document.getElementById("text1").value; //this populating the array elements array[1]=document.getElementById("text2").value; array[2]=document.getElementById("text3").value; array[3]=document.getElementById("text4").value; array[4]=document.getElementById("text5").value; array[5]=document.getElementById("text6").value; var ele = document.forms["form1"].elements["textresult"]; //this section of the code now declares a variable for looping through the array elements to print in the box ele.value = ""; var x, len = array.length; //this section of the code works out the length of the array and sets the var len and x to this for (x=0; x<len; ++x) //start of the for loop to print in the array elements into the form field { if (ele.value.length > 0) ele.value += "\n"; ele.value += array[x]; } } </script> </head> <body> <form name="form1"> Text 1: <input type="text" id="text1"> <br> Text 2: <input type="text" id="text2"> <br> Text 3 <input type="text" id="text3"> <br> Text 4 <input type="text" id="text4"> <br> Text 5 <input type="text" id="text5"> <br> Text 6 <input type="text" id="text6"> <br> Text Result <input type="button" value="submit" onclick="validate()"> <input type="text" id="textresult" name="Text Result"> <input type="button" value="New Field" onclick="formfield()"> </form> </body> </html> i am now trying to create a function that will now add a new text input to the form on the click of a button. for this to work will i need to create the whole form using javascript.
  25. this is what i have up to now bare in mind i am new <html> <title>JavaScript Exercise 2</title> <head> <script> <script language="javascript" type="text/javascript"> function= alertName(){ var array=new Array(); array[0]=document.getElementById.box1; array[1]=document.getElementById.box2; array[2]=document.getElementById.box3; array[3]=document.getElementById.box4; array[4]=document.getElementById.box5; array[5]=document.getElementById.box6; for(var i=0;i<array.length;i++){ document.write(array[i]+"<br>"); } document.write("Length of the array is: "+"<br>"); document.write("==================="+"<br>"); document.write(array.length+"<br>"); } </script> </head> <body> <form name="nameForm"> <input type="text" name="box1"> <input type="text" name="box2"> <input type="text" name="box3"> <input type="text" name="box4"> <input type="text" name="box5"> <input type="text" name="box6"> <input type="button" value="Submit" onclick="alertName()"> <input type="text" name="textResult" > </form> </body> </html>
×
×
  • 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.