Jump to content

njdubois

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by njdubois

  1. I remember reading up on this a few years back and determined that it was to much work to make worth while. My client is currently partnering with another service. They will have a link to our service on their site. The user logs in there, we don't want them to have to log in here. I'm pretty sure this can be done with cookies. Is there any other way to do this? I was thinking about passing something in the URL maybe www.oursite.com?user=md5($username . $password) And saving md5(username . password) in out database and using that to authenticate the user. Do I have any other options? Is there an easy way to do this? Thanks for the help! Nick
  2. $body = $email_message; worked perfectly! This Now Doc is completely new to me, and I am going to do some research cause I have seen this <<<EOT stuff before and it always confused me. Thanks everyone! Nick
  3. I have this code : $mail->addAddress("bob@gmail.com", "bob"); $mail->Subject = "subject(PHPMailer test using MAIL)"; $body = <<<'EOT' BODY OF EMAIL EOT; I have a variable $email_message How do I replace BODY OF EMAIL with the contents of that variable? I've tried $mail->addAddress("bob@gmail.com", "bob"); $mail->Subject = "subject(PHPMailer test using MAIL)"; $body = <<<'EOT' $email_message EOT; // AND $mail->addAddress("bob@gmail.com", "bob"); $mail->Subject = "subject(PHPMailer test using MAIL)"; $body = <<<'EOT'$email_messageEOT; //AND $mail->addAddress("bob@gmail.com", "bob"); $mail->Subject = "subject(PHPMailer test using MAIL)"; $body = <<<'EOT' ".$email_message." EOT; What one earth am I doing wrong? Many many Thanks!! Nick
  4. I have downloaded and setup phpmailer, and already it seems better. thanks! In one area I am sending a message with a from address/reply to containing a non existent domain! There is some awesome pointers in here, and as I setup this email library I am going to keep these things in mind. Thanks!
  5. We are on a shared host from godaddy. Part of our service is sending emails out with data from a phone call. Name, number, date and time. Sometimes we attach the audio file. We have suspicions that clients are not getting the emails. For the few that have reported not getting the messages, we have had check spam filters and so on and have come up with nothing. It seems they are just... not getting the message. If our system/code is working right (and 9 out of 10 it is), them not getting the email is something on their end. I was talking to godaddy today and the rep said that if the email relay has an issue it will bounce the email back. When I asked where it gets bounced back to, he confirmed that it was the from address. Using my email as the from address and sending an email to "bobthebuilder@somerandomwebsiteoutthere.com," using our webform, I get nothing about a bad email. In gmail itself, if I send an email to "bobthebuilder@somerandomwebsiteoutthere.com" I get an email right away saying the domain doesn't exist. This is the code that sends emails: if($file_name[0]=='') { $headers = 'From: ' . $MSG_row['from_email'] ."\r\n". 'Reply-To: ' . $MSG_row['from_email'] ."\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $mail_sent = @mail($to, $MSG_row['msg_subject'], $email_message, $headers); } else { $headers = "From: " . $MSG_row['from_email']; // boundary $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // multipart boundary $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n"; $message .= "--{$mime_boundary}\n"; // preparing attachments $main_path='email_upload/'; for($x=0;$x<count($file_name);$x++){ $file = fopen($main_path.$file_name[$x],"rb"); $data = fread($file,filesize($main_path.$file_name[$x])); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$file_name[$x]\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$file_name[$x]\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; $message .= "--{$mime_boundary}\n"; } // send $mail_sent = @mail($to, $MSG_row['msg_subject'], $message, $headers); } if they are not sending an attachment, $file_name[0] will = nothing. Please keep in mind that we send way more emails out without files attached. Those are typically the messages we are questioning. Thought it could be happening to the attachment part of the code as well, we have not heard anything about those emails. How would I format this code, so that problematic emails that the godaddy relay sends back, gets sent to someone? I thinking, if its me on the email form sending a message, the problematic message should be sent to my email address. $MSG_row['from_email'] would hold that email address. I have read up on a few different email plug ins. I am planning on looking into those in the future, I'm concerned that I wont be able to "install" it on a shared server and would prefer to find a way to make what I have work. Also, is there any other way to cause an email to be bounced back? For example sending to a bad domain, or sending with a very large attachment. Any advice is greatly appreciated! Thanks for your time! Nick
  6. sorry, I have to say it. LOLZ! But its perfect for this kind of thing. A quick app to print everything in a folder. No? What would you use?
  7. I would like to print the source code out for a webpage I'm working on. This webpage consists of php, html, htm, css and js file. Typical webpage. I have a LOT to print. And its in sub folders. I would like to print the source code out. IE, if I click print on an html file, I don't want to see the site, I want to see the code. I thought that visual studios had a feature, but it seems it will only let me print the current viewed document. I've tried dragging everything into the printer que, but it pops up "cannot print this file, open it in the right application and print from there" for all hundred plus files. That's rather annoying. Any quick fixes? A program I can download that will print all my source? I'm about to make a quick VB program to do it, but there has GOT to be a solution! Thanks in advance Nick
  8. njdubois

    HHEELLPP!

    On the page: http://www.cswea.org/NEW/index.shtml Ok, the question is about the slides. I want the slide menu to overlap the slide image just enough so space under the rounded corner is the slide and not white. Everything I do causes problems. Either the image is completely outside the slideshow frame, or it moves with the outter margins. In internet explorer is completely to big. <div id="slide_show_div" style="background:white;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:solid 1px #000000;height:360px;min-width:800px;max-width:900px;margin-top:30px;" > <!--Slides start here.--> <div style="display:inline-block;height:360px;position:relative;float:left;z-index:15;"> <table height="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="1" class="body_menu_table_td_top" align="center" valign="center" onMouseOver="show_slide(this.id);"> <span class="body_menu_table_td_label"><a href="" >Events</a></span> </td> </tr> <tr> <td id="2" class="body_menu_table_td" align="center" valign="center" onMouseOver="show_slide(this.id);"> <span class="body_menu_table_td_label">Officers & Roster</span> </td> </tr> <tr> <td id="3" class="body_menu_table_td" align="center" valign="center" onMouseOver="show_slide(this.id);"> <span class="body_menu_table_td_label">Central States Water Magazine</span> </td> </tr> <tr> <td id="4" class="body_menu_table_td" align="center" valign="center" onMouseOver="show_slide(this.id);"> <span class="body_menu_table_td_label">Membership</span> </td> </tr> <tr> <td id="5" class="body_menu_table_td_bottom" align="center" valign="center" onMouseOver="show_slide(this.id);"> <span class="body_menu_table_td_label">Job Postings</span> </td> </tr> </table> </div> <div style="float:right;width:623px;z-index:3;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px;-webkit-border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;"> <div id="body_slide_1" style="display:block;background-image:url('/images/slide_1.png');height:360px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;"> SLIDE 1 </div> <div id="body_slide_2" style="display:none;background-image:url('/images/slide_2.png');height:360px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;"> SLIDE 2 </div> <div id="body_slide_3" style="display:none;background-image:url('/images/slide_3.png');height:360px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;"> SLIDE 3 </div> <div id="body_slide_4" style="display:none;background-image:url('/images/slide_4.png');height:360px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;"> SLIDE 4 </div> <div id="body_slide_5" style="display:none;background-image:url('/images/slide_5.png');height:360px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;"> SLIDE 5 </div> </div> <!--Slides end here.--> </div> I've been trying to get this right for hours! I give up! Thank sooo much! Nick
  9. Let me start out by saying I do not think that the code is the problem. Here is the issue. I have comments box much like any other page. The comment box saves the comment to a database and sends the comment as email to the right person. This comments box is on a page that is sort of like a report card for a phone call. When filling out the comment box, you have the option to include the audio file for the phone call. This is where the problem starts. On both my Android Nexus 4 and my clients Iphone 5. Both of us using Gmail and the gmail apps on our individual phones. Sometimes we can just click the attached mp3 and it works. And sometimes it doesn't. It gets weirder. He sent one this morning that worked for me. When he sent the next about an hour ago neither the one he just sent me, or the new one would play? From then on, I have not been able to send myself one that I can play. I can long press it, or hit the more options button, save the file, browse to the file with a file explorer and open it. It then plays no problems. Not in the email app, but opening it like any other mp3 on my phone. I have not had much experience with the iphone, but because its happening to both of us, I'm thinking its Gmail, or the GoDaddy mail system. We have our page hosted on godaddy. Here is the chunk of code that is sending emails, the top half of the if is when the user has chosen to not attach the mp3. The bottom half is, you will see that the code stops getting indented, I wasn't sure what was what and didn't want to break something by adding a tab in there. if($audio_filename=='') { $headers = 'From: no-reply@marcomtech.com' ."\r\n". 'Reply-To: no-reply@marcomtech.com' ."\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $mail_sent = @mail($to, $email_subject, $email_message, $headers); } else { $path = '../audio_upload/' . $audio_filename; $path_name=$audio_filename; //$to = $email_to; $subject = $email_subject; //create 2 boundary strings. They must be unique $boundary1 = rand(0,9)."-".rand(10000000000,9999999999)."-".rand(10000000000,9999999999)."=:".rand(10000,99999); $boundary2 = rand(0,9)."-".rand(10000000000,9999999999)."-".rand(10000000000,9999999999)."=:".rand(10000,99999); $fileContent = chunk_split(base64_encode(file_get_contents($path))); $html_message = $email_message; $headers =<<<AKAM From: no-reply@marcomtech.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="$boundary1" AKAM; $attachment = <<<ATTA --$boundary1 Content-Type: application/octet-stream; name=$path Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=$path_name $fileContent ATTA; $body = <<<AKAM This is a multi-part message in MIME format. --$boundary1 Content-Type: multipart/alternative; boundary="$boundary2" --$boundary2 Content-Type: text/html; charset=ISO-8859-1; Content-Transfer-Encoding: 7bit $html_message --$boundary2-- $attachment --$boundary1-- AKAM; //send the email $mail_sent = @mail($to, $email_subject, $body, $headers); } if ($mail_sent) { echo $status.':'.$to.' '; } else { $EMAIL_OUTPUT_HTML.= "Message could not be sent to ".$to; echo $EMAIL_OUTPUT_HTML; } } If there is anything you can tell me about the above code that may be causing my issue I would be appreciative! If its not the code, what else could it be? Should I be troubleshooting with godaddy? Or Gmail? Thanks!! Nick
  10. nevermind, wrote the get next day function my self. it was easy! thanks anyways
  11. Hello! I've been working with code snippets I find here: http://stackoverflow.com/questions/9307878/get-next-date-and-day I'm currently using this one: var d=new Date(start_date); alert(d); d.setTime((d.getTime() + 86400 * 1000*1)); The problem is the same no matter what chunk of code I use. 8/31/2013 is always skipped. So if I select a range between 8/29/2013 and 8/31/2013, alert(d) pops up 8/29 8/30 and 9/1 I really need a working get next date function. Am not using jquery. This is my last ditch effort. After this I'm just going to write one myself that does it manually. Get total days in month, split todays date. Add one to day, is days over total days in month days=1, month++ if month >12.... and so on... But why re invent the wheel? Thanks for the help, Nick
  12. Thank you so much for your reply! Your help looks awesome and exactly what I was looking for! I'll be playing around with it later tonight! Thanks!!!!!
  13. This is the code I have : $start_month=5; $this_year=2013; $cur_day=10; $total_days=10; for ($i = 1; $i <= $total_days; $i++) { $current_date=$start_month.'/'.$cur_day.'/'.$this_year; $SELECT_SQL="SELECT * FROM Calls WHERE Dealership='".$_SESSION['dealership']."' AND Session_Date='".$current_date."'"; $data_results=mysql_query($SELECT_SQL); $sales_calls=0; if($data_results) { $sales_calls=mysql_num_rows($data_results); } $SELECT_SQL="SELECT * FROM Calls WHERE Dealership='".$_SESSION['dealership']."' AND Session_Date='".$current_date."' AND Appointment!='No'"; $data_results=mysql_query($SELECT_SQL); $days_appt=0; if($data_results) { $days_appt=mysql_num_rows($data_results); } $SELECT_SQL="SELECT * FROM Calls WHERE Dealership='".$_SESSION['dealership']."' AND Session_Date='".$current_date."' AND After_Hour='Yes'"; $data_results=mysql_query($SELECT_SQL); $days_after_hour=0; if($data_results) { $days_after_hour=mysql_num_rows($data_results); } $SELECT_SQL="SELECT * FROM Stats WHERE Stat_Type='Total_Dealer_Calls' AND Stat_Name='".$_SESSION['dealership']."' AND Stat_Date='".$current_date."'"; $data_results=mysql_query($SELECT_SQL); $days_dealer_calls=0; if($data_results) { $temp_row=mysql_fetch_assoc($data_results); $days_dealer_calls=$temp_row['Stat_Data']; } echo $sales_calls . ' - ' . $days_appt . ' - ' . $days_after_hour . ' - ' . $days_dealer_calls . '<br />'; } Is this the fastest way to do this? I have a feeling there is a faster mysql statement to pull all the data I want instead of the 3 selects from Calls. thanks for any of your thoughts, ideas and opinions! Nick
  14. I'm looking to pay someone to create a 3d model of a case for my smartphone that I can submit to a 3d printing service. Whats the best site to find a freelancer? Thanks
  15. While reading your reply I had one of those 'DOH!' moments. While I was aware that there was no way to prevent a user from leaving a page, I wasn't looking at it from the other direction. Why not mark is as incomplete, and then output those records differently allowing the user to finish it later. Thank you sooo much!! Nick
  16. var required_fields='true'; window.onbeforeunload = function(){ if(!required_fields){ // do something to check if all fields are filled var conf = confirm("You still have some required fields to fill out. Cancel?"); if(!confirm) return false; else { // add a function that sends something to your database } } }; does nothing? Whether is set it to true or false, it goes right to the chosen page, no prompts, nothing? Based on what I have read, this isn't an option because you don't have control over whats going on inside the onbeforeunload event. Thanks for the reply! Nick
  17. I have a data entry form that has required fields. I want to disable the ability for a user to browse away from this page until either these required fields are filled out, or they choose to cancel. I found this on the net : window.onbeforeunload = function() { return 'You have unsaved changes!'; } But it is not going to do what I need it to do. The user can still leave the page ignoring required fields, and not giving me the chance to delete the record. Thus filling our database with bad data. Ideally, The user starts filling out the form and for whatever reason needs to leave the page with the form, say they click the home link or maybe goes to google.com. If any of the required fields are not filled out, I would like the code to prevent the page from changing, and to prompt the user using html and NOT the onbeforeunload dialog. IE: Have some red text populate a div at the top of the page stating "A required field is missing, do you want to cancel this entry?" with a yes and no button. Using the onbeforeunload event, I have no way to change the dialog other than the text in the message. I also have no way of running code if they decide to leave the page. I understand that for security reasons it has to be this way. What are my options? What would you do to get around this? I'm really stuck against a wall with this, thanks for any help and thanks for even taking the time to read my post! Nick
  18. I'm looking for something like this: A B C C:\ Folder A Sub Folder 1 Sub Folder 2 File1.txt Folder B Sub Folder 1 Folder C filename1.txt If that makes any sense! I have a back up of the FTP sever on my windows system. My first plan was to create a vb program to do it for me, but before I take the time to do that I figured I'd look into an app that does it for me. Whats the best way to do this? I've been all over google and I can't find the just right solution for what I thought would be pretty easy. Thanks in advance! Nick
  19. Ha! Thank you so much, I didn't even realize I could still change the content type of the header containing the message. Thanks! Problem solved Nick
  20. Changing my headers to match yours causes the emails to come as garbage: This is a multi-part message in MIME format. --==Multipart_Boundary_xf13a8b110e950e9c7f180b3e5f277c4ex Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit tet to see if email is in html or formatted with attachment. --==Multipart_Boundary_xf13a8b110e950e9c7f180b3e5f277c4ex Content-Type: {"application/octet-stream"}; name="golf thing.txt.txt" Content-Disposition: attachment; filename="golf thing.txt.txt" Content-Transfer-Encoding: base64 NjMwMjk1NTIwNw0KbWF1cmVlbg== --==Multipart_Boundary_xf13a8b110e950e9c7f180b3e5f277c4ex This multiple attachment thing is tough! Thanks for the help though! Nick
  21. I have this code, Its working great! Perfect! Other than the emails are plain text and not HTML. What can I do to this code, to make it send HTML instead of plain text? $headers = "From: " . $MSG_row['from_email']; // boundary $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // multipart boundary $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n"; $message .= "--{$mime_boundary}\n"; // preparing attachments $main_path='email_upload/'; for($x=0;$x<count($file_name);$x++){ $file = fopen($main_path.$file_name[$x],"rb"); $data = fread($file,filesize($main_path.$file_name[$x])); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$file_name[$x]\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$file_name[$x]\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; $message .= "--{$mime_boundary}\n"; } // send $mail_sent = @mail($to, $MSG_row['msg_subject'], $message, $headers); I find many examples of sending emails, and sending html emails, and emails with attachments. I just can't find one with more than one attachment? Thanks in advance for any and all help! Nick
  22. Nevermind! Solved it! <a name="menu_1" href="javascript:;" onclick="change_menu(this.name);">Home</a> Thanks anyways!
  23. I'm trying to make an HTML menu using PHP, Javascript and AJAX, but I'm having problems formatting my code. The problem boils down to the use of single and double quotes. If I do it this way: $menu_item='<a href="javascript:change_menu(menu_1);">Home</a><br />'; Console says menu_1 is not defined, which makes since. This way, I am passing menu_1 like it is an object. If I try : $menu_item='<a href="javascript:change_menu("menu_1");">Home</a><br />'; The Console now says: Uncaught SyntaxError: Unexpected end of input And I can't use: $menu_item="<a href="javascript:change_menu('menu_1');">Home</a><br />"; OR $menu_item='<a href="javascript:change_menu('menu_1');">Home</a><br />'; Because then PHP thinks I'm breaking the string apart, and it gives me an error. And I know I can't use: $menu_item='<a name="menu_1" href="javascript:change_menu(this.name);">Home</a><br />'; You see what I am trying to do. What am I doing wrong? This is truly confusing me! Any guidance would be greatly appreciated! Thanks Nick
  24. *bump bump* Anyone know a way to solve this problem? Thanks Nick
  25. I am trying to upload a single file, and from this page https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications I was able to put together a sample script that works in Chrome and Firefox. One look at the script, and its clear why it doesn't work in IE. var selected_file = document.getElementById('input').files[0]; IE doesn't support uploading multiple files. My problem is that I search this problem on the net and I find questions pertaining to uploading multiple files, and the replies go all over the place and they are all talking about uploading many files. I just want to upload one file. Is there something I can do to that one line, that would make the below scripts work in Chrome, FF and IE? I was thinking something like var selected_file = document.getElementById('input').file; Of course that doesn't work. The main page script: <!DOCTYPE html> <html> <head> <script type="text/javascript"> function sendFile(file) { var uri = "/test_ajax_upload.php"; var xhr = new XMLHttpRequest(); var fd = new FormData(); xhr.open("POST", uri, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { // Handle response. alert(xhr.responseText); // handle response. } }; fd.append('myFile', file); // Initiate a multipart/form-data upload xhr.send(fd); } function start_upload_stuff() { var selected_file = document.getElementById('input').files[0]; sendFile(selected_file); } </script> </head> <body> <input type="file" id="input" name="input"> <br /> <input type="button" id="start_upload" name="start_upload" Value="Start Upload" onclick="start_upload_stuff();" /> </body> </html> And test_ajax_upload.php: <?php if (isset($_FILES['myFile'])) { // Example: move_uploaded_file($_FILES['myFile']['tmp_name'], "uploads/" . $_FILES['myFile']['name']); exit; } ?> You can see this code live at http://www.marcomtechnologies.com/test_upload.php Any assistance is greatly appreciated! What I really like about the above script is it is not using any additional plug ins, its clean and just does what I need it to do, minus not working in IE of course! Thanks!!! Nick
×
×
  • 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.