Jump to content

software4

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

software4's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have this script that sends an E-mail to my custoemr when an account is created and does a Bcc to me. Every email gets sent once, then about 2 min later another one is sent. So both the customer and myself get 2 emails. I did a test and just after the mail() function i write to a text file. What is odd is that it logs the sent mail 2 times. So somehow it is going through it a second time. The time difference between the first and the second seem to usually be about 2-3 min. For exampel this was only sent one time. My guess is there has to be something wrong with my headers, but i have been over them many times and tried different configurations. To: ben@....com Time 05/12/2011 12:18:30 am To: ben@...com Time 05/12/2011 12:21:09 am <?php $db_con = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database, $db_con); if((isset($_POST['password'])) && ($_POST['password'] == 'mandb108' )) { $install_date = date("Y-m-d"); $end = mktime(0, 0, 0, date("m"), date("d"), date("y")+1); $end_date = date("Y-m-d", $end); $folder = $_POST['folder']; $school_db = $_POST['school_db']; $school_name = $_POST['school_name']; // Check to see if school, db or folder exists if (mysql_num_rows(mysql_query("Select * FROM $select_table WHERE `school_name` = '$school_name'"))) { $message = 'School Name Already Exists in Database'; } elseif (mysql_num_rows(mysql_query("Select * FROM $select_table WHERE `school_db` = '$school_db'"))) { $message = 'Database Already Exists'; } elseif (mysql_num_rows(mysql_query("Select * FROM $select_table WHERE `school_folder` = '$folder'"))) { $message = 'School Folder Already Exists'; } else { ////////////////////id, school, db, folder, install, renew, end, contact, email, job, notes $insertSQL = sprintf("INSERT INTO $select_table VALUES (null, %s, %s, %s, %s, '$install_date', null, '$end_date', %s, %s, null, null)", GetSQLValueString($_POST['school_state'], "text"), GetSQLValueString($_POST['school_name'], "text"), GetSQLValueString($_POST['school_db'], "text"), GetSQLValueString($_POST['folder'], "text"), GetSQLValueString($_POST['contact'], "text"), GetSQLValueString($_POST['email'], "text")); mysql_select_db($database, $db_con); if($Result1 = mysql_query($insertSQL, $db_con) or die(mysql_error())) { $message = 'Added to Database - Successful<br>'; } else { $message = 'Added to Database - Failed<br>'; } // Funcatiobn to copy sampel folder to new directory for school full_copy("01_sample","$folder"); // Echo results $message .= 'Install Date - '.$install_date; $message .= '<br>'; $message .= 'Expire Date - '.$end_date.'<br>'; $message .= 'Copy of Folder - Successful<br>'; $message .= '<br><br>School - '; $message .= $_POST['school_name']; $message .= '<br>Database - '; $message .= $_POST['school_db']; $message .= '<br>Folder - '; $message .= $_POST['folder']; $message .= '<br>Contact - '; $message .= $_POST['contact']; $message .= '<br>Email - '; $message .= $_POST['email']; // Write to school_info file $open = fopen ("$folder/school_info.php", "at"); fwrite($open, "<?php\n$".$old); fwrite($open, "school_folder = '$folder';\n$".$old); fwrite($open, "school_db = '$school_db';\n$".$old); fwrite($open, "database = $".$old); fwrite($open, "school_db;\n?>".$old); fclose($open); // Link to create a database on voting site $message .= '<br><a href="http://www.anaheimartscouncil.com:2082/frontend/x3/sql/index.html" target="_blank">Cpanel</a><br>'; // link to setup Database tables on new site $message .= '<br><a href="'.$folder.'/index.php?install=yes&school='.$school_name.'" target="_blank">Database Setup</a><br>'; // link to send email to client $message .= '<br><a href="web_install.php?email=yes&school_db='.$school_db.'">Send E-mail</a><br><br>'; }// end if school name, databae or folder already exists } elseif ((isset($_GET['email'])) && ($_GET['email'] == 'yes')) { $school_db = $_GET['school_db']; $results = mysql_query("select * from tbl_schools_vote WHERE school_db = '$school_db' LIMIT 1"); // removed the while loop to get rid of duplicate emails. //while($row = mysql_fetch_array($results)){ $row = mysql_fetch_array($results); $school_contact = $row['school_contact']; $school_folder = $row['school_folder']; $school_contact_email = $row['school_contact_email']; //} // end while loop $email_message = 'Dear '; $email_message .= $school_contact; $email_message .= ',<br>'; $subject = "Voting 4 Schools - Account Activated"; $email_message .= 'Your Voting 4 Schools account has been setup. Below is all the information that you should need to get started.<br><br> Here is a link to your voting site. <a href="http://www.voting4schools.com/'.$school_folder.'">www.voting4schools.com/'.$school_folder.'</a><br><br>At the bottom of the page you will find an admin link. The user name and password are as follows<br><br>User Name: admin<br>Password: vote<br><br>When you log in please go to the control panel and create a new admin user and delete the default one that we have assigned you. At the top of the page you will find a link that says video tutorial. If you are unsure how to use the software, this is a great place to start. If you have any questions, or need help setting it up, please let us know.<br><br>Thank You,<br>Ben Star<br><br>Software 4 Schools<br>(866)757-7226<br><a href="http://www.software4schools.com">www.software4schools.com</a>'; // website link here //$to = $school_contact_email.', support@software4schools.com'; $to = $school_contact_email; //$email = 'support@software4schools.com'; //$headers = "To: ".$school_contact_email."\r\n"; //$headers .= "From: Software 4 Schools <support@software4schools.com>" . "\r\n"; //$headers .= "Bcc: Software 4 Schools <support@software4schools.com>" . "\r\n"; //$headers .= "MIME-Version: 1.0" . "\r\n"; //$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers = 'From: michael@anaheimartscouncil.com' . "\r\n" . 'Reply-To: anaheimartscouncil.com' . "\r\n" . 'Bcc: ben@software4schools.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1'; //. "\r\n"; //. 'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $email_message, $headers)) { $date = date('m/d/Y h:i:s a', time()); $myFile = "mail.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "To: ". $to."\n"; fwrite($fh, $stringData); $stringData = "Time ". $date."\n\n"; fwrite($fh, $stringData); fclose($fh); $message = 'E-mail was sent once'; }else { $message = 'Problem sending message'; } } elseif ((isset($_POST['password'])) && ($_POST['password'] != 'mandb108' )) { $message = 'Password is incorrect'; $folder = $_POST['folder']; $school_db = $_POST['school_db']; $school = $_POST['school']; $contact = $_POST['contact']; $email = $_POST['email']; } else { // not sure what to do here yet... } // end if password isset from post if (!isset($_POST['school_db'])) { $school_db = 'voting_'; } ?>
  2. Nope, same problem. Here is the full block of code in there if this helps. $showVoting = "SELECT poll.poll_title, voting_result.position, join2.join_candidate FROM ( `voting_result` LEFT JOIN `join2` ON voting_result.id = join2.join_id ) LEFT JOIN `poll` ON poll.poll_id = join2.join_event_id WHERE poll.poll_id ='$event_id'"; $resultVoting = mysql_query($showVoting); while(false !== ($rV = mysql_fetch_array($resultVoting))) { $election = $rV[0]; $position = $rV[1]; $person = $rV[2]; //Set array, can you tell I like array's? $count = 1; $db_connsCast["$election"]["$position"]["$person"] = $db_connsCast["$election"]["$position"]["$person"] + $count; } $usedKey = array(); if(is_array($db_connsCast)) { //build us a division for the voting results foreach($db_connsCast as $key => $value) { echo '<div>' . '<p align="center">' . '<span class="style2">' . $key . '</span>' . '</p>' ; echo '<div bgcolor="#CCCCCC";style="width:100%;text-align:center;"><table border="2" style="margin:0px auto;text-align:left;">'; foreach($value as $key2 => $value2) { echo '<tr class="SubHeaderMain"><td style="background-color:#E3EDEF;width:200px;text-align:left;"><strong>' . $key2 . '</strong></td><td style="background-color:#E3EDEF;width:75px;text-align:left;"><strong>Votes</td></tr>' ; $max = max($value2); for($i = $max; $i > 0; $i--) { foreach($value2 as $key3 => $value3) { if($value3 == $i) echo '<tr><td style="text-align:left;padding: 3px; ">' . '<span class="text">'. $key3 . '</span>' . '</td><td style="text-align:left;padding: 3px;">' . '<span class="text">'. $value3 . '</span>' . '</td></tr>'; } } } echo '</table></div>'; } } else echo '<center>No results for this poll!</center>';
  3. Error Message Notice: Uninitialized string offset: 0 in C:\wamp\www\vote\view_results.php on line 144 Fatal error: Cannot use string offset as an array in C:\wamp\www\vote\view_results.php on line 144 It works fine with no error reporting and on a server, but when i put this in WAMP, i am getting this error. Here is line 135-146 $resultVoting = mysql_query($showVoting); while($rV = mysql_fetch_array($resultVoting)) { $election = $rV[0]; $position = $rV[1]; $person = $rV[2]; //Set array, can you tell I like array's? $count = 1; $db_connsCast["$election"]["$position"]["$person"] = $db_connsCast["$election"]["$position"]["$person"] + $count; } $usedKey = array();
×
×
  • 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.