Some programs I wrote

Some PHP programs I have written

email_newsletter_39.php

TOC

<html><head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<h1 align="center">E-mail Newsletter</h1>
<?php
   include 'save_stinking_data.php';
#
# this program will work according to the
# customer services reps at 100webspace.net
# if pat upgrades to a $3/month account.
#
# although he MIGHT have to use a sending
# email address which is a valid email
# address from this site. as opposed to
# using a email addresss like this
#
#    bogus@email-addresss-that-doesnt-exist.com
# but
#    realaddress@100webspace.net
#











   $testsubject=$_POST['testsubject'];
   $newslettersubject=$_POST['newslettersubject'];
   $pressreleasesubject=$_POST['pressreleasesubject'];
   #$test_send_or_real_send == 'test'
   #$test_send_or_real_send == 'sendit'
   #$test_send_or_real_send == 'pressrelease'
   #$pressreleasesubject
   #$newslettersubject
   #$testsubject
   if ($testsubject == "" ) {
      $testsubject=file_get_contents('subject_test.txt');
   }
   else {
      #echo "hi........<p>";
      save_stinking_data($testsubject,'subject_test.txt');
   }


   if ($newslettersubject == "" ) {
      $newslettersubject=file_get_contents('subject_newsletter.txt');
   }
   else {
      #echo "hi........2<p>";
      save_stinking_data($newslettersubject,'subject_newsletter.txt');
   }
   if ($pressreleasesubject == "" ) {
      $pressreleasesubject=file_get_contents('subject_pressreleases.txt');
   }
   else {
      #echo "hi........3<p>";
      save_stinking_data($pressreleasesubject,'subject_pressreleases.txt');
   }





function build_bcc_list($test, $limit, $offset) {
   $sqllimit="";
   if ($offset == '' ) {
      $offset=0;
   }
   #if ($limit != '' ) {
   #   $sqllimit=" limit $offset , $limit ";
   #}
   if ($test == 'sendit') {
      $sqltable=" junk_emails ";
   }
   else {
      if ($test == 'pressrelease') {
         $sqltable=" press_releases ";
      }
      else {
         $sqltable=" junk_emails_test ";
      }
   }
   $bcc="";
   #require('sql_passwords.php');
   include 'sql_passwords.php';
   # 
   # connect to SQL 
   #  
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to grab all the data entered so far
   #
   #$query = "select email  from $sqltable limit 1500 ";
   $query = "select email  from $sqltable $sqllimit ";

   #
   # display the select
   # 
   echo "query=$query<p>";
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $email=$line['email'];
      #echo "email=$email<br>";
      if ($bcc == '' ) {
         $bcc=$email;
      }
      else {
         #$bcc.=','.$email;
         $bcc.=" \n , ".$email;
      }
   } 
   # 
   # close the SQL connection 
   # 
   mysql_close($link);









   return $bcc;
}







function dump_file_length_header($data) {
   #
   # this function is used to build the 
   #  Content-Length: nnn
   # header where nnn is the size of the file
   # note all of our files are encoded into
   # mime or base64 so the size will be larger
   # then the orginal file size
   #
   # the file has been read into memory
   # get the size of it
   #
   $bytes=strlen($data);
   #
   # build the content-length header
   #
   $length_header="Content-Length: $bytes\r\n";
   #
   # return to the caller
   #
   return $length_header;
}
function tell_em_about_attached_file($fname,$attachment,$name) {
   #
   # if the file name is not blank
   # this function generates a message
   # telling them
   #    1) file name
   #    2) is it an attachment or not YES/NO
   #    3) the name used
   #
   $message="";
   #
   # if the name is not blank do our stuff
   #
   if ($_FILES[$fname]['name'] != '') {
     #
     # assume it isn't an attachment
     #
     $isitanattachment="NO";
     if ($attachment == 'a') {
        #
        # well gosh it IS an attachment
        #
        $isitanattachment="YES";
     }
     #
     # build the message
     #
     $pc_name=$_FILES[$fname]['name'];
     $message="$pc_name, a=$isitanattachment n='$name'\n";
   }  
   #
   # return the message to the caller
   #
   return $message;
}
function build_tr_for_file($file) {
   if ($_FILES[$file]['name'] != "" ) {
      echo "<tr><td>Filename</td><td>{$_FILES[$file]['name']}</td></tr>";
      echo "<tr><td>File type</td><td>{$_FILES[$file]['type']}</td></tr>";
      echo "<tr><td>File size</td><td>{$_FILES[$file]['size']}</td></tr>";
      echo "<tr><td>File error</td><td>{$_FILES[$file]['error']}</td></tr>";
      echo "<tr><td>File on server</td><td>{$_FILES[$file]['tmp_name']}</td></tr>";
      echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
     }
   return;
}


function get_blank_lines($count) {
   #
   # i dont know how many blank lines i need
   # before and after the file so this function
   # will let me enter between 0 and 9 which
   # one of the values will work
   #
   for($i=0;$i<10;$i++) {
      $selected="";
      if ($i == $count) {
         $selected=" selected ";
      }
      echo "<option value=\"$i\" $selected>$i</option>";
   }
   return;
}

function tell_about_file_uploaded_to_us ($file) {
   # 
   # for debugging tell them some info about
   # the file they have uploaded
   #
   # blank the message
   #
   $status_messages="";
   #
   # if the file has been uploaded get the details
   #
   if ($_FILES[$file]['name'] != "" ) {
       #
       # tell them the files name
       #      
       $status_messages.=$_FILES[$file]['name'];
       $status_messages.=" contains ";
       #
       # tell them the files size in bytes
       #  
       $status_messages.=$_FILES[$file]['size'];
       #
       # tell them where the file was uploaded to
       # which is usually a randomly made name in
       #      /tmp
       #  
       $status_messages.=" bytes is attached to this email as ";
       $status_messages.=$_FILES[$file]['tmp_name'];
       $status_messages.=" with ";
       #
       # tell them how many errors the file had as it was uploaded
       # at least that is what i think this is.
       # I dont know for sure.
       #  
       $status_messages.=$_FILES[$file]['error'];
       $status_messages.=" errors\n";
   }
   #
   # return the message to the caller
   #
   return $status_messages;
}

function setup_call_to_attach_file ($zname, $attachment, $attachmentname, $cr_before, $cr_after, $dump_flength, $dont_use_imap) {
   #
   # make the output null
   #
   $header="";
   #
   # create an array to make a copy of the file info
   #
   $filex=array();
   #
   # if the file was entered then add it to the header info
   #
   if ($_FILES[$zname]['name'] != "" ) {
      #
      # copy the file array
      #
      $filex=$_FILES[$zname];
      #
      # get the files name
      #
      $filexname=$_FILES[$zname]['name'];
      #
      # put the files data to the header
      #
      $header=attach_a_file_to_headers($filex, 
                                        $attachment, 
                                        $attachmentname,
                                        $filexname,
                                        $cr_before,
                                        $cr_after,
                                        $dump_flength,
                                        $dont_use_imap);
        }
   #
   # all done return the data to the caller
   #
   return $header;
}



function attach_a_file_to_headers($file, $attachment, $name, $filename, $cr_before, $cr_after, $dump_flength, $dont_use_imap) {
   #
   # this function will build the header records
   # that are used to attach a file to an email
   # and send the file as an attachment
   #   $file       - the file array with file informaion
   #   $attachment - is this file going to be an attachment
   #               - as opposed to a file that will be say
   #               - an image in html displayed
   #   $name       - the name of this file, not the filename
   #               - this is the name used in an <a or <img tag
   #               - like   <img src="foo">
   #               - as opposed to the files name like
   #               - resume.doc which is part of the $file array
   #
   # zero out the data we want to return
   #
   $data="";
   #
   # debug the puppy
   #
   if (0) {
      echo "attachment=$attachment<br>";
      echo "attachment name=$name<br>";
      echo "file array=$file<br>"; 
      foreach ($file as $f) {
         echo "&nbsp;&nbsp;&nbsp;$f<br>";
      }
   }
   #
   # are we supposed to attache it as an  attachment
   # as opposed to an inline file which could be used
   # as an image when we display the email as HTML
   #
   if ( $attachment != '' ) {
      $data.="Content-Disposition: attachment;\r\n";
   }
   #
   # should we add the file name?
   #
   if ($filename != '') {
      $data.="filename=\"$filename\"\r\n";
   }
   #
   # add the content-type
   #  
   $data.="Content-type: ".$file['type'];
   #
   # if we have a "name" put it after the content type
   if ($name != '' ) {
      $data.=" name=\"$name\"";
   }
   #
   # either way put a \n at the end of the content-type
   #
   $data.="\r\n";
   #
   # tell it that the text that follows is mime or base64
   # which are two ways to say the same thing
   #






   #
   # read the file into memory
   #
   $file_data=file_get_contents($file['tmp_name']);
   #
   # convert the file data into mime text or base64 text
   # 
   #
   # for useless information this is how the file is encoded
   # see this URL for more info
   #   
   #         http://www.freesoft.org/CIE/RFC/1521/7.htm
   #
   #   Value Encoding  Value Encoding  Value Encoding  Value Encoding
   #        0 A            17 R            34 i            51 z
   #        1 B            18 S            35 j            52 0
   #        2 C            19 T            36 k            53 1
   #        3 D            20 U            37 l            54 2
   #        4 E            21 V            38 m            55 3
   #        5 F            22 W            39 n            56 4
   #        6 G            23 X            40 o            57 5
   #        7 H            24 Y            41 p            58 6
   #        8 I            25 Z            42 q            59 7
   #        9 J            26 a            43 r            60 8
   #       10 K            27 b            44 s            61 9
   #       11 L            28 c            45 t            62 +
   #       12 M            29 d            46 u            63 /
   #       13 N            30 e            47 v
   #       14 O            31 f            48 w         (pad) =
   #       15 P            32 g            49 x
   #       16 Q            33 h            50 y
   #
   # do the encoding
   #


   #$dont_use_imap
   if (! function_exists('imap_binary') || $dont_use_imap == 'y') {
      #
      # imap_binary() function does not exist
      # or we are testing and want to use my function
      # use my code to convert to mime or base64
      #
      if (! function_exists('imap_binary')) {
         echo "imap_binary() function does not exist<br>";
      }
      if ($dont_use_imap == 'y') {
         #echo "who cares about imap_binary() we ain't using it<br>";
      }
      #echo "using mikes IMAP function<br>";
      #
      # convert the string to a monster string
      # which is encoded in base64 or mime format
      #
      $base64data0=base64_encode($file_data);
      #
      # split it into lines that are 60 bytes long
      #
      $base64data=chunk_split($base64data0,60);
   }
   else {
      #
      # imap_binary function exists!
      # use it
      #
      #echo "imap_binary() function EXISTS<br>";
      $base64data=imap_binary($file_data);
   }







   #
   # dump the header that tells the length of the data
   # before the base64 header
   #
   if ( $dump_flength == 'before' ) {
      $data.=dump_file_length_header($base64data);
   }
   $data.="Content-transfer-encoding: base64\r\n";
   #
   # dump the header that tells the length of the data
   # after the base64 header
   #
   if ( $dump_flength == 'after' ) {
      $data.=dump_file_length_header($base64data);
   }
   #
   # should we add extra blank lines before the file?
   #
   if ($cr_before > 0 ) {
      $extra_blank_lines=0;
      while($extra_blank_lines < $cr_before) {
         $data.="\r\n";
         $extra_blank_lines++;
      }
   }
   #echo "like this<br>Content-Type: text/plain; charset=US-ASCII; name=mud<br>";
   #
   # add the mime or base64 data to the header
   #
   $data.=$base64data;
   #
   # should we add extra blank lines after the file?
   #
   if ($cr_after > 0 ) {
      $extra_blank_lines=0;
      while($extra_blank_lines < $cr_after) {
         $data.="\r\n";
         $extra_blank_lines++;
      }
   } 
   #
   # debug and dump the data
   #
   if (0) {
      echo "header=<pre>$data\"</pre>end header<p>";
   }
   #
   # return the data
   #
   return $data;
}
?>
<html>
<?php
#
# print our ip address
#
if (0) {
   echo "IP Address=";
   echo ${REMOTE_ADDR};
   echo "<p>";
}
#
# if we are at the lycos site print
# a few blank lines at the top to
# get around their annoying headers
#
#if (${REMOTE_ADDR} == '156.42.68.5' || ${REMOTE_ADDR} == '212.78.204.20') {
if (${REMOTE_ADDR} == '212.78.204.20') {
   for ($i=0;$i<3;$i++) {
      echo "&nbsp;<p>";
   }
}


?>
<?php
#
# include this function to clean up the
# data returned from PHP forms
# those annoying forms return
#    ", ', and \
# as
#    \",  \', and \\
#
#
# since i am giving this to grey DONT
# include the function. hard code it
#
#include "clean_php_form_data.php";
function clean_php_form_data($data) {
   #
   # for some reason when you enter the characters
   #     ", ', and \
   # into a PHP form they are returned as
   #     \", \', and \\
   #
   # well this function cleans up the data
   # and removes the annoying backslashes
   #
   # oddly data is NOT returned this way in PERL
   #
   $data=preg_replace('/\\\\\'/',"'",$data);
   $data=preg_replace('/\\\\\"/','"',$data);
   $data=preg_replace('/\\\\\\\\/',"\\",$data);
   return $data;
}
#
function sum_total_errors($data, $total_errors) {
   if ($data != '' ) {
      $total_errors++;
   }
   return $total_errors;
}
function clean_up_to_lines($data) {
    #
    # remove leading and trailing spaces
    #
    $data=preg_replace("/^ */","",$data);
    $data=preg_replace("/ *\$/","",$data);
    #
    # remove extra spaces
    #
    $data=preg_replace("/  */"," ",$data);
    #
    # remove leading and trail spaces from
    #       < frog@dog.com   >
    $data=preg_replace("/ *< */","<",$data);
    $data=preg_replace("/ *> */",">",$data); 
    #
    # remove leading and trail spaces from commas that
    # seperate email addresses
    #      frog@god.com     ,   me@superman.gov
    #
    $data=preg_replace("/ *, */",",",$data);
    return $data;
}
function get_address_errors($data) {
    $errors="";
    if ($data != '' ) {
       $names=explode(",",$data);
       foreach ($names as $n) {
          #
          # remove leading and trailing spaces
          #
          $n=preg_replace("/^ */","",$n);
          $n=preg_replace("/ *\$/","",$n);
          #
          # if you have
          #        tom jones <you@email.com>
          # we have to validate the stuff enclosed in <>
          # as the email address and ignore the other stuff
          # this code should do that
          #
          $nn=$n;
          if (preg_match("/<.*>/",$nn)) {
             $nn=preg_replace("/^.*</","",$nn);
             $nn=preg_replace("/>.*\$/","",$nn);  
          }
          #
          # now validate the email address
          # if the email address contains spaces
          # it is invalid
          #
          if (preg_match("/ /",$nn)) {
             if ($errors == '' ) {
                $errors=$n;
             }
             else {
                $errors.=" $n";
             }
          }
          else {
             #
             # if the email address is not in the form
             #     something@somewhere.xxx
             # it is invalid
             #
             if (! preg_match("/[^@]+@[^@]+\.[^@]+/",$nn)) {
                if ($errors == '' ) {
                   $errors=$n;
                }
                else {
                   $errors.=" $n";
                }
             }
             else {
                #
                # and it cant end or begin with
                # these letters
                # nor can it have @....@ in it
                # nor can it have .. or 2 dots next to each other
                #
                $nonos="\.@";
                if (preg_match("/^[$nonos]/",$nn)  || 
                    preg_match("/[$nonos]\$/",$nn) || 
                    preg_match("/\.\./",$nn) || 
                    preg_match("/@.*@/",$nn)) {
                   #
                   # we have either
                   #    illegal begining or ending characters
                   #    multiple @ signs
                   #
                   if ($errors == '' ) {
                      $errors=$n;
                   }
                   else {
                      $errors.=" $n";
                   }
                }
             }
          }
       }
    }
    #
    # if email addresses have stuff like
    #        tom & bob <thoseguyes@email.com>
    # convert it so it is displayable
    #
    $errors=htmlentities($errors);
    #
    # make it red and tell them it is an error
    if ($errors != '' ) {
    $errors="<span style=\"background=#ff0000\">ERROR $errors</span>";
    }
    return $errors;
}

   #
   # set the default values for this program
   #
   $total_errors=0;
   $size=250;
   $rows=50;
   #
   # the program DID NOT TIME OUT!!!!!
   # their censor filters caused the 
   # script to die. two email addresses
   # had the word l*l*ta as part of their address
   # when mySQL read either of those records
   # their filter caused the script to die
   # with a 35 error.
   #
   # sql offset and sql_limit values
   # we need these because SQL causes 
   # the program to time out
   #
   $sql_limit=10000;
   #
   # the size of attachment names
   # used like
   #           <img src="attachment name">
   #
   $anamesize=10;
   #
   # grab the data the user typed into the HTML form
   #

   #
   # use this to figure out the first time we are called
   # so we can initialize stuff
   #
   $hidden_post_variable=$_POST['hidden_post_variable'];
   $test_send_or_real_send=$_POST['test_send_or_real_send'];



   $sql_offset=$_POST['sql_offset'];


   #
   # if we are in test mode make the SQL offset null
   # that way we always start with an offset of zero or 0
   # in test mode
   #
   if ($test_send_or_real_send == 'test' ) {
      $sql_offset='';
   }


   if ($sql_offset == '' ) {
      $sql_offset=0;
      $sql_offset_hidden=0;
   }
   else {
      $sql_offset_hidden=$sql_offset+$sql_limit;
   }


   #
   # make the default from to be
   #    newsletter@StrategicEdgeBusinessAlliance.com
   #
   $submit_button=$_POST['submit'];
   #echo "submit_button=xxxxxxxx $submit_button xxxxxxxxxxx<p>";
   $from=$_POST['from'];
   if (preg_match("/^ *\$/",$from)) {
      include '0_email_addresses.php';
      #$from='newsletter@StrategicEdge.com';
      $from=$newsletter_email_address;
      #$mike_email_address='mike'.$seba_email_address_domain;
      #$newsletter_email_address='newsletter'.$seba_email_address_domain;
   }
   $to=$from;
   #$to=$_POST['to'];
   $cc='';
   $bcc='';
   $rto='';



   #Load last NEWSLETTER sent

   $text=$_POST['text'];

   #
   # if we are in TEST mode
   #             Load last NEWSLETTER sent BUTTON
   # or the
   #             Load last PRESS RELEASE sent BUTTON
   # then reload either the last NEWSLETTER text
   # or the last PRESSRELEASE text they sent
   #
   # and they click on either the 
   if ($test_send_or_real_send == 'test') {
      #$subject=$testsubject;
      $stinkingsubmitbutton=$_POST['submit'];
      if ($stinkingsubmitbutton == 'Load last NEWSLETTER sent') {
         #
         # load the last NEWSLETTER sent
         #
         $text=file_get_contents('subject_newslettertext.txt');
      }
      if ($stinkingsubmitbutton == 'Load last PRESS RELEASE sent') {
         #
         # load the last PRESS RELEASE sent
         #
         $text=file_get_contents('subject_pressreleasetext.txt');
      }


      
   }



   $cr_before=$_POST['cr_before'];
   $cr_after=$_POST['cr_after'];
   #
   # we no longer have a $subject
   # we now use 3 subjects. one for TEST, one for NEWSLETTERS and one for PRESSRELEASES
   # and remember the subjects from session to session 
   # by saving them in a file.
   #
   #$subject=$_POST['subject'];
   $subject='';
   #if (preg_match("/^ *\$/",$subject)) {
   #   $subject='Strategic Edge Newsletter';
   #}
   #
   # if this is a TEST email then
   # use the last subject they entered for 
   # test emails as the subject
   #
   #if ($test_send_or_real_send == 'test') {
   if ($test_send_or_real_send == 'test' || $test_send_or_real_send == '') {
      $subject=$testsubject;
   }
   #
   # if this is a NEWSLETTER email then
   # use the last subject they entered for 
   # newsletter emails as the subject
   #
   if ($test_send_or_real_send == 'sendit' ) {
      $subject=$newslettersubject;
   }
   #
   # if this is a PRESSRELEASE email then
   # use the last subject they entered for 
   # pressrelease emails as the subject
   #
   if ($test_send_or_real_send == 'pressrelease') {
      $subject=$pressreleasesubject;
   }
   #
   # if the text is null or empty then
   # load in the text from the last email
   # they sent which could have been either
   # a test email, a newsletter email or a pressrelease email
   #
   if ($text == '' ) {
      $text=file_get_contents('subject_last.txt');
   }
   else {
      #
      # if the text is not null then save in in the
      # last email sent out file which is
      # 'subject_last.txt'
      #
      save_stinking_data($text,'subject_last.txt');

      #
      # if this is a real email, ie not test
      # then save it to the last press release file
      # or to the last newsletter file
      # depending on what it is
      #
      if ($test_send_or_real_send == 'sendit' ) {
         #
         # save last newsletter
         #
         save_stinking_data($text,'subject_newsletter.txt');
      }
      if ($test_send_or_real_send == 'pressrelease') {
         #
         # save last press release
         #
         save_stinking_data($text,'subject_pressrelease.txt');
      }



   }





   $how_to_attach=$_POST['how_to_attach'];
   $send_as_html=$_POST['send_as_html'];
   $dump_header_in_debug_window=$_POST['dump_header_in_debug_window'];
   $dont_use_imap=$_POST['dont_use_imap'];
   $put_debug_info_in_email=$_POST['put_debug_info_in_email'];




   $dump_flength=$_POST['dump_flength'];
   #echo "\$dump_flength='$dump_flength'<br>";



   #
   # if first time set the date to current time
   #
   if ($hidden_post_variable == '' ) {
      #
      # get unix time ie: base January 1 1970 00:00:00 GMT
      #
      $ztime=time();
      #
      # convert to Phoenix time
      #
      $ztime-=(60*60*10);
      #
      # 1st time use date and time in Phoenix Arizona
      # the -9000 i think it says we are 9 hours
      # before London time.
      #
      $zdate=date("D, d M Y H:i:s -0900", $ztime);
      $zdate.=" (MST)";
      #
      # also set the flag to dump the 
      # debug info into the body of the email
      #
      #$put_debug_info_in_email='y';
      $put_debug_info_in_email='n';
   }
   else {
      #
      # 2nd time use date they entered on form
      #
      $zdate=$_POST['zdate'];
   }

   $attachment1=$_POST['attachment1'];
   $attachmentname1=$_POST['attachmentname1'];
   $attachment2=$_POST['attachment2'];
   $attachmentname2=$_POST['attachmentname2'];
   $attachment3=$_POST['attachment3'];
   $attachmentname3=$_POST['attachmentname3'];
   $attachmentname2=$_POST['attachmentname2'];
   $attachment4=$_POST['attachment4'];
   $attachmentname4=$_POST['attachmentname4'];
   $attachment5=$_POST['attachment5'];
   $attachmentname5=$_POST['attachmentname5'];
   $attachment6=$_POST['attachment6'];
   $attachmentname6=$_POST['attachmentname6'];

   #
   # clean up the data returned from the form
   # ', ", and \ 
   # are returned as 
   # \', \" and \\
   #
   $text=clean_php_form_data($text);
   $from=clean_php_form_data($from);
   $to=clean_php_form_data($to);
   $cc=clean_php_form_data($cc);
   $bcc=clean_php_form_data($bcc);
   $rto=clean_php_form_data($rto);
   $subject=clean_php_form_data($subject);
   #
   # verify all the FROM: email addresses are valid
   #
   $from=clean_up_to_lines($from);
   $from_errors=get_address_errors($from);
   $total_errors=sum_total_errors($from_errors, $total_errors);
   #
   # verify all the TO: email addresses are valie
   #
   $to=clean_up_to_lines($to);
   $to_errors=get_address_errors($to);
   $total_errors=sum_total_errors($to_errors, $total_errors);
   #
   # a to field is required,
   # if other data was entered
   #
   if ( $from != '' || $cc != '' || $bcc != '' || $text != '' || $subject != '' ) {
      if ($to == '' ) {
         $total_errors++;
         $to_errors.=" a TO address is required";
      }
   }
   else {
      $total_errors=-1;
   }
   #
   # verify all the CC: email addresses are valid
   #
   $cc=clean_up_to_lines($cc);
   $cc_errors=get_address_errors($cc);
   $total_errors=sum_total_errors($cc_errors, $total_errors);
   #
   # verify all the BCC: email addresses are valid
   #
   $bcc=clean_up_to_lines($bcc);
   $bcc_errors=get_address_errors($bcc);
   $total_errors=sum_total_errors($bcc_errors, $total_errors);
   #
   # verify all the Reply To: email addresses are valid
   #
   $rto=clean_up_to_lines($rto);
   $rto_errors=get_address_errors($rto);
   $total_errors=sum_total_errors($rto_errors, $total_errors);
   #
   # if errors dont send the stinking email
   #
   if ($total_errors > 0 ) {
      echo "ERROR(s) E-MAIL NOT SENT!  total errors=$total_errors<br>";
   }
   #
   # here get the bcc addresses to send
   #$bcc=build_bcc_list($test_send_or_real_send);

?>
<!-- table style="background-color:#dddddd" -->
<table>
<tr valign="top">
<td>
<!-- form action="send_an_email.php" method="post" -->
<!-- make it a miltipart/form so we can upload files -->
<form action="email_newsletter.php"  
      method="post" 
      enctype="multipart/form-data"> 
<input type="submit" name=submit value="Send">

     <span style="font-size:150%;">
     <input type="radio" name="test_send_or_real_send"  value="test"
     <?php if ($test_send_or_real_send == 'test' || $test_send_or_real_send == '' ) {echo "checked"; } ?> > TESTING


     &nbsp;&nbsp;&nbsp;&nbsp;
     <input type="radio" name="test_send_or_real_send"  value="sendit"
     <?php if ($test_send_or_real_send == 'sendit' ) {echo "checked"; } ?> > NEWSLETTER


     &nbsp;&nbsp;&nbsp;&nbsp;
     <input type="radio" name="test_send_or_real_send"  value="pressrelease"
     <?php if ($test_send_or_real_send == 'pressrelease' ) {echo "checked"; } ?> > PRESS RELEASE
     </span>




     <br>
<input type="submit" name=submit value="Load last NEWSLETTER sent">
<input type="submit" name=submit value="Load last PRESS RELEASE sent">
     <br>






     <input type="checkbox" name="dump_header_in_debug_window"  value="y"
     <?php if ($dump_header_in_debug_window == 'y'  ){echo "checked"; } ?>>
     dump headers
     dump length 
     <input type="radio" name="dump_flength"  value="after"
     <?php if ($dump_flength == 'after' ) {echo "checked"; } ?> > After
     <input type="radio" name="dump_flength"  value="before"
     <?php if ($dump_flength == 'before' ) {echo "checked"; } ?> > Before
     <input type="radio" name="dump_flength"  value="never"
     <?php if ($dump_flength == 'never'  || $dump_flength == '' ) {echo "checked"; } ?> > Don't


   




<table>
<tr>
   <td align="right">From:</td>
   <td align="left"><input type="text" name="from"  
       <?php echo " size=\"$size\" value=\"$from\""; ?> >
       <?php echo "$from_errors"; ?>
   </td>
</tr>




<tr>
   <td align="right">
      Date :
   </td>
   <td align="left"><input type="text" name="zdate"  
       <?php echo " size=\"$size\" value=\"$zdate\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Test Subject:</td>
   <td align="left"><input type="text" name="testsubject"  
       <?php echo " size=\"$size\" value=\"$testsubject\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Newsletter Subject:</td>
   <td align="left"><input type="text" name="newslettersubject"  
       <?php echo " size=\"$size\" value=\"$newslettersubject\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Press Release Subject:</td>
   <td align="left"><input type="text" name="pressreleasesubject"  
       <?php echo " size=\"$size\" value=\"$pressreleasesubject\""; ?> >
   </td>
</tr>







<tr>
   <td align="right">&nbsp;</td>
   <td align="left">
        Send as TEXT
        <input type="radio" name="send_as_html"  value="text"
        <?php if ($send_as_html == 'text' || $send_as_html == '' ) {echo "checked"; } ?> >,
       HTML
        <input type="radio" name="send_as_html"  value="html"
        <?php if ($send_as_html == 'html' ) { echo "checked";}       ?> >



       &nbsp;&nbsp;&nbsp;Put debug info in E-mail
     <input type="checkbox" name="put_debug_info_in_email"  value="y"
     <?php if ($put_debug_info_in_email == 'y'  ){echo "checked"; } ?>>

       <input type="hidden" name="how_to_attach"  value="after">




       <input type="hidden" name="sql_offset"  value="<?php echo $sql_offset_hidden; ?>">


   </td>
</tr>












<tr>
   <td colspan="2">
       <textarea name="text" 
       <?php echo "cols=\"$size\" rows=\"$rows\" "; ?>><?php echo "$text"; ?></textarea>  
   </td>
</tr>
</table>
<p>
<input type="hidden" name="hidden_post_variable" value="hidden post data">
<input type="reset" name=reset value="RESET">
</form>
<p>
<a href="control-panel.php">Control Panel</a>
</td>


<td>
&nbsp; <!-- move debug window DOWN -->
</td>
</tr>


<td style="background-color:#ffff00">
<h2>Debug Window</h2>
<?php
  #
  # dont send any email
  # we have errors
  #
  if ($total_errors != 0 ) {
      
  }
  else {
     if ( $submit_button == 'Send') {
        #echo "get bcc list here from SQL tables<p>";
        $bcc=build_bcc_list($test_send_or_real_send, $sql_limit, $sql_offset);
     }
     #echo "sending email!!!!! Default from:<br>";
     #
     # play with some of the php.ini values
     # and see if we can get the mail to be sent 
     #
     #$ini_value=ini_set('sendmail_from',$from);
     #$ini_value=ini_set('SMTP','on');
     #$ini_value=ini_set('SMTP','ON');

     # i did this as a wild *ass guess
     # and it doesn't work at all
     # so never let it execute
     #
     #
     # send mail with DEFAULT from:
     # which at greys site is
     #   anonymous@ hosting2.fastq.com
     #
     # this is the default on my server
     # which doesnt even send the mail
     #   me@localhost.com
     #
     # we know this works so stop sending the stinking email
     #
     #
     # modify the DEFAULT from to this $from
     # and send the email again
     #
     # again this works so stop sending the
     # email each time i test new stuff
     #
     #
     # now build a header record to use as the from:
     # and send the email with it
     #
     #
     # save $text and later restore it
     #
     $oldtext=$text;
     $status_messages="";
     #
     # for debugging tell them if we generated a
     #     content-length 
     # header and if we did where we generated it
     #
     if ($dump_flength == 'before') {
       #$status_messages.="Content-Length:xxx is BEFORE base64 header \n";
     }
     if ($dump_flength == 'after') {
       #$status_messages.="Content-Length:xxx is AFTER base64 header \n";
     }
     if ($dump_flength == 'never') {
       #$status_messages.="Content-Length:xxx NOT used\n";
     }
     #
     # for debugging tell them how many blank lines
     # we printed before and after the file
     #
     #$status_messages.="$cr_before blank lines placed BEFORE file\n";
     #$status_messages.="$cr_after blank lines placed AFTER file\n";
     #
     # tell them about the files they have uploaded
     # what the file name is, how it is attached and the use name
     #
     $status_messages.=tell_em_about_attached_file('file_to_upload',
                                                   $attachment1,
                                                   $attachmentname1);
     $status_messages.=tell_em_about_attached_file('file_to_upload2',
                                                   $attachment2,
                                                   $attachmentname2);
     $status_messages.=tell_em_about_attached_file('file_to_upload3',
                                                   $attachment3,
                                                   $attachmentname3);
     $status_messages.=tell_em_about_attached_file('file_to_upload4',
                                                   $attachment4,
                                                   $attachmentname4);
     $status_messages.=tell_em_about_attached_file('file_to_upload5',
                                                   $attachment5,
                                                   $attachmentname5);
     $status_messages.=tell_em_about_attached_file('file_to_upload6',
                                                   $attachment6,
                                                   $attachmentname6);
     #
     # for debugging tell them if the file was
     # attached before or after the HTML header
     #
     if ($how_to_attach == 'before') {
       #$status_messages.="File attached before HTML\n";
     }
     if ($how_to_attach == 'after') {
       #$status_messages.="File attached after HTML\n";
     }
     #
     # some PHP sites dont have the function
     #   imap_binary()
     # so this code is to tell us about that
     # and let us test the function either way
     #


     if ($dont_use_imap == 'y') {
       #$status_messages.="Dont use imap_binary flag set to Y\n";
     }
     else {
       #$status_messages.="Dont use imap_binary flag NOT set\n";
     }
     if (function_exists('imap_binary')) {
       #$status_messages.="imap_binary() EXISTS\n";
     }
     else {
       #$status_messages.="imap_binary() DOESNT exist\n";
     }





     #
     # for debugging for each file uploaded tell them
     #        filename, file size, unix filename, errors
     # this message is listed in the body of the email
     #
     $stinking_files_uploaded=0;
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload2');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload3');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload4');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload5');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload6');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     #
     # if no files were uploaded tell them
     #
     if ($stinking_files_uploaded == 0 ) {
        #$status_messages.="No files attached to this email\n";
     }
     if ($send_as_html == 'html' ) {
       #$status_messages.="Sending as HTML\n";
       $status_messages=preg_replace("/\n/","<br>\n",$status_messages);
     }
     else {
       #$status_messages.="NOT sending as HTML\n";
     }


     #
     # if this variable is set to a y then
     # put the debug information into the
     # body of the email.
     # this way I can turn off the debugging
     # and use it to send homeland security 
     # messages to cartoonists like benson :)
     #
     if ($put_debug_info_in_email == 'y') {
        $text=$status_messages.$text;
     }
     $header="";
     #
     # build the from: header
     #
     if ($from != "" ) {
        $header.="From: $from\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the CC: header
     #
     if ($cc != "" ) {
        $header.="CC: $cc\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";
     }
     #
     # build the BCC: header
     #
     #$bcc=build_bcc_list($test_send_or_real_send);




     if ($bcc != "" ) {
        $header.="BCC: $bcc\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the Reply To: header
     #
     if ($rto != "" ) {
        #
        # "reply to:" doesnt work
        # try using
        # "reply-to:"
        #
        if (0) {
           $header.="Reply To: $rto\r\n";
        }
        else {
           $header.="Reply-To: $rto\r\n";
        }
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the Date: header
     #
     if ($zdate != "" ) {
        $header.="Date: $zdate\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }





     #we may have to flip the order we add the HTML and attached files
     # which is why i put the
     # if ($how_to_attach == "after" ) {
     # }
     # and
     # if ($how_to_attach == "before" ) {
     # }
     # logic
     #
     # i probably have to give the file i attach a name
     # look at my manuals for that. I remember they gave
     # a jpg file they used in an email in one example
     # a name
     #
     #
     # here we will first add the HTML header
     # then we will attach the file and its header
     # 
     # i am guessing the existing php mail software
     # will pull the first html header and use it
     # for the text in the body of the message
     # but i could be wrong on that
     #
     if ($how_to_attach == "after" ) {
        #
        # if we are sending it as HTML 
        # build the html header before the FILES
        #
        if ($send_as_html == 'html' ) {
           $header.="Content-type: text/html\r\n";
        }
        #
        # add the file they uploaded as an attachment to the e-mail
        #
        #echo "<p>make sure the header has been attached AFTER this<p>";
        #
        # add each file entered to the header information
        #
        $header.=setup_call_to_attach_file ('file_to_upload', $attachment1, $attachmentname1, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload2', $attachment2, $attachmentname2, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload3', $attachment3, $attachmentname3, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload4', $attachment4, $attachmentname4, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload5', $attachment5, $attachmentname5, $cr_before, $cr_after, $dump_flength, $dont_use_imap);
        $header.=setup_call_to_attach_file ('file_to_upload6', $attachment6, $attachmentname6, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 



 
        

     }
     if ($how_to_attach == "before" ) {
        #
        # add the file they uploaded as an attachment to the e-mail
        #
        #echo "<p>make sure the header has been attached BEFORE this<p>";



        #
        # add each file entered to the header information
        #
        $header.=setup_call_to_attach_file ('file_to_upload', $attachment1, $attachmentname1, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload2', $attachment2, $attachmentname2, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload3', $attachment3, $attachmentname3, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload4', $attachment4, $attachmentname4, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload5', $attachment5, $attachmentname5, $cr_before, $cr_after, $dump_flength, $dont_use_imap);
        $header.=setup_call_to_attach_file ('file_to_upload6', $attachment6, $attachmentname6, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 




        #
        # if we are sending it as HTML 
        # build the html header after the FILES
        #
        if ($send_as_html == 'html' ) {
           $header.="Content-type: text/html\r\n";
        }
     }






     if ( $submit_button == 'Send') {
        #
        # dump the headers ?
        #
        if ($dump_header_in_debug_window == 'y') {
           echo "<b>dumping headers</b>";
           echo "<pre>";
           echo $header;
           echo "</pre>";
        }
        #
        # only send the email ONCE and send it here
        # before I was sending it after I built
        # each and every header
        #


        #if ( $submit_button == 'Send') {
        #$bcc="frogs snakes@dogs.com";
        echo "SENDING the E-MAIL now!<br>";
        $rc=mail($to,$subject,$text,$header);
     
        #
        # we have sent the email but
        # print some information in the debug window
        # about how we sent the email
        #
        echo "<table border=1>";
        $x=htmlentities($to);
        echo "<tr><td align=\"right\">To:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($cc);
        echo "<tr><td align=\"right\">CC:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($bcc);
        echo "<tr><td align=\"right\">BCC:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($rto);
        echo "<tr><td align=\"right\">Reply To:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($from);
        echo "<tr><td align=\"right\">From:</td><td>$x &nbsp;</td></tr>";



        #
        # list the data about each of the files
        # that were uploaded in table format
        # for debugging
        #
        build_tr_for_file('file_to_upload');
        build_tr_for_file('file_to_upload2');
        build_tr_for_file('file_to_upload3');
        build_tr_for_file('file_to_upload4');
        build_tr_for_file('file_to_upload5');
        build_tr_for_file('file_to_upload6');



        $x=htmlentities($subject);
        echo "<tr><td align=\"right\">Subject:</td><td>$x &nbsp;</td></tr>";
        $x=$text;
        #
        # if they are sending it as text
        # convert the krud in the message
        # to html stuff so we can view
        # it in netscape
        # ie 
        #     > becomes &gt;
        #     < becomes &lt;
        #     .....
        #
        if ( $send_as_html == 'text' ) {
           $x=htmlentities($text);
           #
           # make the spaces display correctly with &nbsp;
           #
           $x=preg_replace("/ /","&nbsp;",$x);
           #
           # make line breaks display correctly with <br>
           #
           $x=preg_replace("/\n/","<br>",$x);
        }
        echo "<tr><td colspan=2>$x&nbsp;</td></tr>";
        echo "<tr><td align=\"right\">RC</td><td>$rc&nbsp;</td></tr>";

        if ($rc != 1 ) {
           echo "<tr><td colspan=\"2\">Hmmm... Something has changed. The rc used to be set to one</td></tr>";
        }
        echo "</table>";
     }
  }   
?>
</td>
</tr>
</table>




<?php
   #include 'save_stinking_data.php';


?>

.htaccess

TOC

AuthName "Restricted Area"
AuthType Basic 
AuthUserFile www/strategic-edge.org/.htpasswd
AuthGroupFile /dev/null
AddHandler cgi-script .html 
<Files test.html>
require valid-user
</Files>
<Files list.php>
require valid-user
</Files>
<Files list_fax.php>
require valid-user
</Files>
<Files change_it_fax.php>
require valid-user
</Files>
<Files change_it.php>
require valid-user
</Files>
<Files control-panel.php>
require valid-user
</Files>
<Files control-panel.html>
require valid-user
</Files>
<Files list_email.php>
require valid-user
</Files>
<Files list_deleted_email.php>
require valid-user
</Files>
<Files friends_add_delete.php>
require valid-user
</Files>

<Files add_ceweekly_email.php>
require valid-user
</Files>

<Files mikes_stuff>
require valid-user
</Files>
<Files delete_minutes.php>
require valid-user
</Files>

.htaccess_old

TOC

AuthName "Restricted Area"
AuthType Basic 
AuthUserFile www/seba.100webspace.net/.htpasswd
AuthGroupFile /dev/null
AddHandler cgi-script .html 
<Files test.html>
require valid-user
</Files>
<Files list.php>
require valid-user
</Files>
<Files list_fax.php>
require valid-user
</Files>
<Files change_it_fax.php>
require valid-user
</Files>
<Files change_it.php>
require valid-user
</Files>
<Files control-panel.php>
require valid-user
</Files>
<Files control-panel.html>
require valid-user
</Files>
<Files list_email.php>
require valid-user
</Files>
<Files list_deleted_email.php>
require valid-user
</Files>
<Files email_newsletter.php>
require valid-user
</Files>
<Files friends_add_delete.php>
require valid-user
</Files>

<Files add_ceweekly_email.php>
require valid-user
</Files>

<Files mikes_stuff>
require valid-user
</Files>


<Files create_minutes.php>
require valid-user
</Files>


<Files delete_minutes.php>
require valid-user
</Files>

0_____model.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2 align="center"> xxxx </h2>

xxxx


<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

0____css.css

TOC

body {
  /* color: black !important;                         */ 
  /*   color: green;                                  */
  /* background: white !important;                    */ 
  /* background-image: url(my_background_image.jpg);  */
  /* background-image: url(http://norml.org/images/mall/gear_potculture.gif);*/
  /* background-image: url(http://tbn0.google.com/images?q=tbn:fgFXSeza5lkiyM:http://cloudsofgreen.com/images); */  

  background-image:

url(http://strategic-edge.org/background_12s.jpg);


/* .col_middle {background-image: url(https://members.tripod.com/tempe-town-toilet/background_11.jpg);} */

  
}
/* h1 { color: red } */
.col_left  {
            /* background-color : yellow; */
            width:25%;
           }
.col_right {
            /* background-color : blue; */
            width:25%;
           }
/* .col_middle {background-image: url(https://members.tripod.com/tempe-town-toilet/background_11.jpg);} */

.col_middle {

  /* background-image: url(http://tbn0.google.com/images?q=tbn:fgFXSeza5lkiyM:http://cloudsofgreen.com/images); */
  width:50%;

}
                                                         */
.email {

 
  background-image: url(home.jpg)

}

0____css_white.css

TOC

body {
       background-image: url(background_11.jpg);
     }
/* h1 { color: red } */
.col_left  {
   
            width:25%;
           }
.col_right {
            width:25%;
           }

.col_middle {



  /* background-image: url(http://www.alpinelakes.com/blog/wp-content/uploads/2007/07/money.jpg); */
  background-image: url(money3s.jpg); 

  /* background-color: white; */
  color: black;
  font-weight: bold;
  /* font-style: italic; */



  width:50%;

}
                                                         */


0____stuff_to_delete

TOC

0_php_function_dup_email.php

TOC

<?php
 function duplicate_deleted_email_add($email,$name,$phone,$ip) {
   #
   # so we have a record of all emails
   # which are deleted we copy all the
   # the data about the email record
   # that will be deleted along with
   # the ip address, alleged name and
   # alleged phone of the person that
   # deleted the email record into
   # the junk_email_deleted table
   #
   #echo "<p>DUPING E-MAIL ADDRESS $email name='$name' phone='$phone' ip='$ip'<p>";
   $query = "INSERT into junk_emails_deleted (name,                
                                              email,                   
                                              phone,                    
                                              ip,                 
                                              date_created,                
                                              date_deleted,                
                                              id_that_deleted_this,                   
                                              name_that_deleted_this,                   
                                              phone_that_deleted_this ) 
                      select name, 
                             email, 
                             phone, 
                             ip, 
                             date_created, 
                             now(), 
                             '$ip',
                             '$name',
                             '$phone'
                             from junk_emails 
                             where email='$email' ";
   #
   # display the insert
   #
   #echo "Query=$query<p>";
   $result = mysql_query($query); 
   if ($result) { 
      #echo "insert worked"; 
      #echo  $it_worked_message;
   } 
   else { 
      echo "Something is SCREWED UP!!!!!!!!  insert backup failed!!!!!!!!!!!!!!!!!"; 
   }
   #echo "returning from DUP<br>";
   return;
 }
?>

0_php_functions.php

TOC

<?php

   #
   # this function prints the begining of each web page
   #
   function dump_head($title,$css, $mortgage_info, $bio_info) {
      $rc=0;
     $keywords=array(
           "Strategic", 
           "Edge",
           "Business",
           "Alliance",
           "'Strategic Edge Business Alliance'", 
           "'Strategic Edge'",
           "'Strategic Edge Business'", 
           "Pat",
           "Schwind",
           "'Pat Schwind MBA'",
           "'Pat Schwind, MBA'",
           "'Pat Schwind'"
      ); 
      echo '<html>';
      echo "<head>\n";
      #
      # if not title was give then use the default title of
      #     'Strategic Edge Business Alliance'
      #
      if (preg_match("/^ *$/",$title)) {
         $title='Strategic Edge Business Alliance';
      }
      if (preg_match("/^ *$/",$css)) {
         $css='/0____css.css';
      }
      echo '<title>';
      echo $title;
      echo '</title>';
      echo "\n";
      echo '<LINK rel="stylesheet" href="';
      echo $css;
      echo '" type="text/css">';
      echo "\n";

 

      echo '<META name="resource-type" content="Strategic Edge">'; 
      echo "\n";
      echo '<META name="description" content="Strategic Edge">';
      echo "\n";
      echo '<META name="distribution" content="global"> ';
      echo "\n";
      # 
      # print the default keywords
      #
      echo '<META name="keywords" content="';
      $i=0;
      foreach ($keywords as $slot) {
         #
         # for the 2nd thru last keywords print a comma before
         # the word. well i lied. print a space comma space
         # before the word
         #
         if ($i > 0 ) {
            echo " , ";
         } 
         $i++;
         echo "$slot"; 
      }
      echo '">';
      echo "\n";
      echo "</head>";
      echo "\n";
      echo "<body>";
      echo "\n";
      echo '<h1 align="center">Strategic Edge Business Alliance</h1>';
      echo "\n";




      echo '<h2 align="center">Sponsored by Pat Schwind, MBA';
      echo '<br>';
      echo 'I Do Mortgages';
      echo '<br>';
      echo '480-250-8182';


      if (! preg_match("/^ *$/",$mortgage_info) ||
          ! preg_match("/^ *$/",$bio_info)) {
         echo '<br>';
      }


      if (! preg_match("/^ *$/",$mortgage_info)) {


         echo '<i><a href="http://strategic-edge.org/mortgage_info.php">For Mortgage Info, click here;</a></i>';
      }
      if (! preg_match("/^ *$/",$mortgage_info) &&
          ! preg_match("/^ *$/",$bio_info)) {
         echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
      }
      if (! preg_match("/^ *$/",$bio_info)) {
         echo '<i><a href="http://strategic-edge.org/patsbio.php">For Pat\'s "Bio", click here</a></i>';
      }
      echo '</h2>';
      #
      # set up a table.
      # the right and left rows in the table are NEVER used
      # the middle of the table has all the text in it
      #
      echo '<table width="100%" cellspacing="0" CELLPADDING="0" border="0">';
      echo "\n";
      echo '<tr>';
      echo '<td class="col_left">&nbsp;</td>';
      echo '<td class="col_middle">';
      #
      # the middle row of the table is now ready to accept data
      # pat enters the data following this
      return($rc);
   }

  

   #
   # this function prints the end of each web page
   #
   function  dump_tail() {
      #
      # close out the middle row of the table
      # which has the data in it
      #
      echo '</td>';
      echo "\n";
      #
      # create the last row of the table
      # which will be blank
      #
      echo '<td class="col_right">&nbsp;</td>';
      echo "\n";
      #
      # close the last row of the table
      #
      echo '</tr>';
      echo "\n";
      #
      # close the table
      #
      echo '</table>';
      echo "\n";
      echo '<p>';
      echo "\n";
      echo '<center>';
      echo "\n";
      echo '<a href="http://strategic-edge.org/index.php">Strategic Edge Business  Alliance</a>';
      echo '<br>';
      echo 'Sponsored by Pat Schwind, MBA<br>';
      echo 'America\'s Homefunders, Inc.<br>';
      echo 'Non-Conforming Specialist<br>';
      echo 'MB#0903354<br>';
      echo 'I Do Morgtages: Remodel, Build, Buy &amp; Refi !!!';
      echo '<br>';
      echo 'cell 480-250-8182';
      echo "<br>";
      echo 'fax 480-655-0219';
      echo "<br>";
      echo 'pager 602-401-6506';
      echo '<p>';
      echo "\n";
      #
      # for a counter image at the bottom make this true
      #
      if (0) {
         echo '<img src="http://miksup.100webspace.net/counter_any_web_site_gif.php">';
         echo "\n";
      }
      echo "<p>\n";
      echo "<br>\n";
      echo "<p>\n";
      echo "<br>\n";
      echo '<div style="font-size:75%;">';
      echo '<a href="http://strategic-edge.org/mike.php">Mike</a> ';
      echo ' created this web page for the Strategic Edge';
      echo "</div>";
      





      echo '</center>';
      echo "\n";
      echo '</html>';
      echo "\n";
      return(0);
   }
?>

0_php_functions_minutes.php

TOC

<?php
 function clean_slashes($in) {
    #
    # in a input box if you type
    #      Sammy "Frog" O'Brien
    # it will return
    #      Sammy \"Frog\" O\'Brien
    #
    # remove the slash from the string so it is
    #      Sammy "Frog" O'Brien
    $rc=$in;
    $rc=preg_replace("/\\\(.)/","$1",$rc);
    return $rc;
 }

 function rename_file_if_it_exists($file_in) {
    $rc=0;
    #
    # if the fil exists rename it
    #
    if (file_exists($file_in)) {
      #
      # ok file exists.
      # find a number we can add to the end of the file name
      # and use to rename the file with
      # ie:
      #      minutes/m2008_10_21.php 
      # will become over time
      #      minutes/m2008_10_21.php_00
      #      minutes/m2008_10_21.php_01
      #      minutes/m2008_10_21.php_02
      #      minutes/m2008_10_21.php_03
      #
      #echo "file exists<br>";
      # 
      # a return code of 1 indicates we renamed the file
      #
      $rc=1;
      #
      # start the counter to rename the file at zero
      #
      $i=0;
      $k="00";
      # 
      # get the front part of the file name
      #
      $file_out=$file_in;
      # 
      # while the file to rename exists
      # bump up the counter by one each time
      # till we find a file name that doesnt exist
      #
      while(file_exists($file_out."_".$k)) {
         #echo $file_out."_".$k." exists<br>";
         #
         # bump up the number/name by 1
         #
         $i++;
         $k=$i;
         #
         # if the number is less then 2 digits 
         # make it 2 digits long
         #
         if ($k < 10 ) {
            $k="0$k";
         }
      }
      #
      # rename the stinking file
      #
      rename($file_out,$file_out."_".$k);
    }
    return $rc;
 }
?>

add.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           '',        # for mortgage info click here 
           ''         # for pat's bio click here
           )

?>

<?php #include "sbd_head.php"; ?>

<table width="100%" border="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>
<?php

#
# get the ip address so we can tell where people came from
#
$my_ip_address=${REMOTE_ADDR};
#echo "$my_ip_address";




function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}


#
# get the input data and clean it up
#
$name=clean_for_html($_POST["name"]);
#$name=preg_replace("/^ */","",$name);
#$name=remove_leading_trailing_spaces($name);


$best_time=clean_for_html($_POST["best_time"]);
$phone_work=clean_for_html($_POST["phone_work"]);
$phone_other=clean_for_html($_POST["phone_other"]);
$phone_home=clean_for_html($_POST["phone_home"]);
$phone_cell=clean_for_html($_POST["phone_cell"]);
$comments=clean_for_sql($_POST["comments"]);
#
# any errors
#
$errors=0;
#
$name_error="";
$subject_error="";
$comment_error="";
$best_time_error="";
$phone_error="";


#
# if anything was entered then check for errors
#
if ($name != '' || 
    $phone_home != '' || 
    $phone_work != '' || 
    $phone_cell != ''  || 
    $phone_other != ''  ||
    $best_time != '' ||
    $comments != ''  ) {
   #
   # they must enter a persons name
   # so pat can call and say
   # i want to talk to xxx
   #
   if ($name == '' ) {
      $errors++;
      $name_error="You must enter a name";
   }
   #
   # they must enter at least one phone number
   #
   if ($phone_home == '' && $phone_work == '' && $phone_cell == ''  && $phone_other == '') {
      $errors++;
      $phone_error="You must enter at least one phone number";
   }
   #
   # if no errors and
   # both the required fields are entered
   # insert the data as a new sql record
   $comments_minus_blank_lines=$comments;
   $comments_minus_blank_lines=preg_replace("/\n/","",$comments_minus_blank_lines);
   $comments_minus_blank_lines=preg_replace("/\r/","",$comments_minus_blank_lines);
}

if ($errors == 0 && $name != '') {
   #
   # insert the sql data
   #
   #echo "insert SQL here<p>";
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql insert statement
   #
   $query = 'INSERT into messages set ';
   #
   # is this record to be displayed on the web
   #
   # put a time stamp when the record was created
   #
   #$query.= " created_on=now(), ";
   #
   # add in comments or text
   #
   $query.= " comments='$comments' ";
   #
   # get their name
   #
   if ($name != '' ) {
      $query.= " , name='$name' ";
   }
   #
   # add in their telephone if they gave one
   #
   if ($phone_home != '' ) {
       $query.= " , phone_home='$phone_home' ";
   }
   if ($phone_cell != '' ) {
       $query.= " , phone_cell='$phone_cell' ";
   }
   if ($phone_work != '' ) {
       $query.= " , phone_work='$phone_work' ";
   }
   if ($phone_other != '' ) {
       $query.= " , phone_other='$phone_other' ";
   }
   if ($best_time != '' ) {
       $query.= " , best_time='$best_time' ";
   }
   #
   # put a time stamp when the record was created
   #
   $query.= " , date_created=now() ";
   #
   # save the IP address of the person that created this record
   #
   $query.= " , ip='${REMOTE_ADDR}' ";



   #
   # display the insert
   #
   echo "Query=$query<p>";
   $result = mysql_query($query); 
   if ($result) { 
      #echo "insert worked"; 
   } 
   else { 
      echo "Something is SCREWED UP!!!!!!!!  insert failed!!!!!!!!!!!!!!!!!"; 
   }







   # 
   # close the SQL connection 
   # 
   mysql_close($link); 


   echo "<h1>Your comments have been saved</h1>";
}

#if ( $comments_minus_blank_lines == '' ) {
#   $comment_error="You must enter some text explaining your problems with xxx";
#}




function form_line($name, $data, $value, $required, $errors) {
?>
<tr valign="top">
<td align="right">
<?php
   echo $name;
   echo ":";
   if ($required == "y" || $required == "Y") {
      echo "<br>";
      echo "<span style=\"color:red\">";
      echo "(required)";
      echo "</span>";
   }
?>
</td>
<td align="left">
<input type="text"
       size="50" 
       name="<?php echo $data;?>"
       value="<?php echo $value;?>"
       >
</td>
<td>
<?php
   if ($errors != '' ) {
      echo "<span style=\"color:red\">ERROR(s)!<br>";
      echo "$errors";
      echo "</span>";
   }
   else {
      echo "&nbsp;";
   }
?>
</td>
</tr>
<?php
   return;
}



function private_button($name, $value, $text) {
?>
<tr valign="top">
<td align="right">
   &nbsp;
</td>
<td>
<input type="checkbox" 
       name="<?php echo $name;?>"
       <?php
          if ($value == "on") {
             echo " checked ";
          }
       ?>  
       >
<?php
 echo $text;
?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php
 return;
}



?>









<!-- table border="1" -->
<table border="0">
<form action="add.php" method="post">
<tr>
<td align="right">

<input type="submit" name=submit value="SUBMIT">
</td>
<td colspan="2">
&nbsp;
Pat please call me about a loan
as soon as possible
</td>
</tr>



<tr>
<td align="right">
&nbsp;
</td>
<td colspan="2">
&nbsp;
</td>
</tr>
<?php
   #form_line('Subject', 'subject', $subject, 'y', $subject_error);
   form_line('Name', 'name', $name, 'y', $name_error);
   #form_line('E-mail', 'email', $email, 'n', $email_error);
   form_line('Home Phone', 'phone_home', $phone_home, 'n', $phone_error);
   form_line('Work Phone', 'phone_work', $phone_work, 'n', $phone_error);
   form_line('Cell Phone', 'phone_cell', $phone_cell, 'n', $phone_error);
   form_line('Other Phone', 'phone_other', $phone_other, 'n', $phone_error);
   form_line('Best time to call', 'best_time', $best_time, 'n', $best_time_error);
   #private_button('private_email', $private_email, 'x');
   #form_line('Telephone', 'phone', $phone, 'n', '');
   #private_button('private_phone', $private_phone, 'y');
   #form_line('URL', 'url', $url, 'n', '');
   #form_line('Address 1', 'address1', $address1, 'n', '');
   #form_line('Address 2', 'address2', $address2, 'n', '');
   #form_line('City', 'city', $city, 'n', '');
   #form_line('State<br>Provence', 'state', $state, 'n', '');
   #form_line('Zip code<br>Postal Code', 'zip', $zip ,'n', '');
   #form_line('Country', 'country',$country, 'n', '');

?>


<tr valign="top">
<td>
Pat please tell me about this stuff
</td>
<td colspan="2">
<?php
   if ($comment_error != '') {
      echo "<span style=\"color:red\">";
      echo "ERRORS: ";
      echo "$comment_error";
      echo "</span>";
      echo "<br>";
   }
?>
<textarea name="comments" cols="50" rows="10">
<?php echo $comments;?>
</textarea>
</td>
</tr>






</form>
</table>




</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</html>
























<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

add_ceweekly_email.php

TOC

<?php
 include "0_php_functions.php";
 $invalid_email_addresses="";
 #$invalid_email_addresses="kruddyemail@address.
 #         xx.xx
 #'xxx@xxx.com'
 #\"xxx@xxx2.com\"
 #,xxx@xxx3.com,
 #xxx@xxx4.com,
 #,xxx@xxx5.com
 #@xxxxxxxxxxxxx.xxx
 #@xxxxxxxxxxxxx.xxx.com
 #@xxxxxxxxxxxxx
 #         @xxxxxxxxxxxxx
 #xxxxx.xxx@
 #              xxxx.xxxxx@xxxxx@xx               
 #xxxxxxxxxxxxxx.xxxx
 #                 yyyyyyy.yyyyyyyyyyyyyyyy                
 #             xxxx.xxxx
 #             xxxx.xxxx.
 #             .xxxx.xxxx
 #             .xxxx.xxxx
 #             .xxxx.@xxxx
 #             .xxxx@.xxxx
 #xx..xx
 #xx.xx.xx.x..xxxx.com
 # 
 #frog.cat@badline  
 #       
 #xxxxxxx.xxxx
 #zzzzzzzzzzzzzzzzzzzzzzzzzzz";
 #
 # end of list of bad email addresses
 #




 #
 # get the ip address so we can tell where people came from
 #
 $my_ip_address=${REMOTE_ADDR};
 $emails=$_POST["emails"];
 $email_array=array();
?>





<?php






function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}



function validate_email_address ($email) {
   $rc="";
   #
   # the email address must contain at least one period or dot
   #
   if (!preg_match("/\./",$email)) {
      echo "error doesnt have a period<br>";
      $rc.="error does not contain a period (.)<br>";
   }
   #
   # the email address must not contain any spaces
   #
   if (preg_match("/ /",$email)) {
      echo "error contains spaces<br>";
      $rc.="error contains one or more spaces<br>";
   }
   #
   # the email address must not begin or end with an @
   #
   if (preg_match("/^@/",$email)) {
      echo "error begins with an @<br>";
      $rc.="error begins with @<br>";
   }
   if (preg_match("/@$/",$email)) {
      echo "error ends with an @<br>";
      $rc.="error ends with @<br>";
   }
   #
   # the email address must contain only one @
   #
   if (preg_match("/@.*@/",$email)) {
      echo "error ends contains more then one @<br>";
      $rc.="error contains more then one @<br>";
   }
   #
   # the .@ or @. is illegal
   #
   if (preg_match("/\.@/",$email)) {
      echo "error .@ is invalid<br>";
      $rc.="error .@ is invalid<br>";
   }
   if (preg_match("/@\./",$email)) {
      echo "error @. is invalid<br>";
      $rc.="error @. is invalid<br>";
   }



   #
   # the email address must not begin or end with a '.' or a period
   #
   if (preg_match("/^\./",$email)) {
      echo "error begins with a period (.)<br>";
      $rc.="error begins with period (.)<br>";
   }
   if (preg_match("/\.$/",$email)) {
      echo "error ends with an period (.)<br>";
      $rc.="error ends with period (.)<br>";
   }
   #
   # the email address must not contain two periods in a row like ..
   #
   if (preg_match("/\.\./",$email)) {
      echo "error .. is invalid (.)<br>";
      $rc.="error .. or two periods next to each other is invalid<br>";
   }
   #
   # after the @ there must be one dot like
   #       xxxx@frog.com
   # so therefor
   #       xxx@frog
   # is invalid
   if (!preg_match("/@[^@\.]+\./",$email)) {
      echo "error .. is dot must follow @ like @xxx.com<br>";
      $rc.="error (.) dot must follow @ like @xxx.com<br>";
   }








   if ($rc != '') {
      $rc="'".$email."'<br>".$rc;
   }
   return $rc;
}
#
# if anything was entered then check for errors
#
$good_email_address=array();
$good_emails=0;
$bad_emails=0;
#
# if the person enteres one or more
# email addresses in the textarea 
# then process the email addresses
# and verify that they are good or bad 
# email addresses at least the syntax
# of the email address is good
#
if ($emails != ''  ) {
   #
   # split the input date into an array
   #
   $email_array= split ("\r" , $emails );
   #
   # process each email address in the array
   #
   $invalid_email_addresses='';
   foreach ($email_array as $slot) {
      #echo "processing $slot<br>";

      #
      # change commas to spaces
      # this is because i seperate email addresses with a comma
      # then if the comma is on the begining of the email address
      # or if the comma is at the end of the email address the
      # email address will be valid after leading and trailing
      # commas are removed.
      # but if the comma is in the MIDDLE of the email address
      # then it will be converted to a space and the email adress
      # will be invalid.
      # and of course that is good because since the comma key
      # is next to the period key i suspect a lot of times a
      # comma is typed instead of a period.
      #
      $slot=preg_replace("/,/"," ",$slot);
      #
      # remove ' from the email address
      # the textarea makes them \'
      #
      $slot=preg_replace("/\\\'/"," ",$slot);
      #
      # remove " from the email address
      # the textarea makes them \"
      #
      $slot=preg_replace('/\\\"/'," ",$slot);
      $slot=remove_leading_trailing_spaces($slot);
      $slot=preg_replace("/\r/","",$slot);
      $slot=preg_replace("/\n/","",$slot);
      $slot=preg_replace("/^ */","",$slot);
      $slot=preg_replace("/ *$/","",$slot);
      if ($slot != '' ) {
         $rc=validate_email_address ($slot);
         if ($rc == '' ) {
            #echo "Good Email<br>";
            #echo "push the good email address on to this array<br>";
            $good_email_address[$good_emails]=$slot;
            $good_emails++;
         }
         else {
            #echo "BAD EMAIL<br>";
            #echo "$rc<br>";
            $invalid_email_addresses.="\n".$slot;
            $bad_emails++;
         }
      }
   } 
   echo "good emails $good_emails<br>";
   echo "bad emails $bad_emails<br>";
   #
   # if we have one or more good email address
   # then try to insert them into the sql table
   #
   if ($good_emails > 0) {
      #echo "<h1>Good Emails</h1>";
      #foreach ($good_email_address as $x) {
      #   echo "&nbsp;$x<br>";
      #}
      #
      # get all the passwords we need
      #
      require('sql_passwords.php');
      # 
      # connect to SQL 
      # 
      $link = mysql_connect($z_hardcoded_sqlurl,  
                            $z_hardcoded_database,  
                            $z_hardcoded_password ) 
                            or die('Could not connect: ' . mysql_error()); 
      # 
      # select the database I want to use 
      # 
      mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
      #
      # insert each email address the person
      # typed into the text area
      # well try to insert each email address
      # the person type in. some inserts may
      # fail if that email address alread exists
      # in the sql file
      #
      $good_insert=0;
      $bad_insert=0;
      foreach ($good_email_address as $x) {
         #
         # build the insert statement
         #
         $query = "insert into body_shops 
                          set email='$x',
                              date_created=now() ";
         #echo "query=$query<br>";
         #
         # try to insert the email address
         #
         $result = mysql_query($query);  
         if ($result) {  
            #
            # if the insert worked do this
            #
            echo "$x<br>";  
            $good_insert++;
         }  
         else {  
            #
            # if the insert failed it means
            # that email address is already
            # in the file
            # do this for failuers
            #
            #echo "insert failed $x<br>";  
            $bad_insert++;
         }
      }
      echo "$good_insert records inserted<br>";
      echo "$bad_insert records already existed";
      # 
      # close the SQL connection 
      # 
      mysql_close($link); 
   }
}
?>
<h2 align="center">Add CEWEEKLY E-mail addresses</h2>
<form action="add_ceweekly_email.php" method="post">
<input type="submit" name=submit value="SUBMIT">
<br>
<textarea rows="10" cols="50" name="emails">
<?php
   echo $invalid_email_addresses;
?>
</textarea>
</form>

add_ceweekly_email_15_base.php

TOC

<?php
 include "0_php_functions.php";
 $invalid_email_addresses="kruddyemail@address.
          xx.xx
'xxx@xxx.com'
\"xxx@xxx2.com\"
,xxx@xxx3.com,
xxx@xxx4.com,
,xxx@xxx5.com
@xxxxxxxxxxxxx.xxx
@xxxxxxxxxxxxx.xxx.com
@xxxxxxxxxxxxx
         @xxxxxxxxxxxxx
xxxxx.xxx@
              xxxx.xxxxx@xxxxx@xx               
xxxxxxxxxxxxxx.xxxx
                 yyyyyyy.yyyyyyyyyyyyyyyy                
             xxxx.xxxx
             xxxx.xxxx.
             .xxxx.xxxx
             .xxxx.xxxx
             .xxxx.@xxxx
             .xxxx@.xxxx
xx..xx
xx.xx.xx.x..xxxx.com
 
frog.cat@badline  
       
xxxxxxx.xxxx
zzzzzzzzzzzzzzzzzzzzzzzzzzz";
 #
 # get the ip address so we can tell where people came from
 #
 $my_ip_address=${REMOTE_ADDR};
 $emails=$_POST["emails"];
 $email_array=array();
?>





<?php






function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}



function validate_email_address ($email) {
   $rc="";
   #
   # the email address must contain at least one period or dot
   #
   if (!preg_match("/\./",$email)) {
      echo "error doesnt have a period<br>";
      $rc.="error does not contain a period (.)<br>";
   }
   #
   # the email address must not contain any spaces
   #
   if (preg_match("/ /",$email)) {
      echo "error contains spaces<br>";
      $rc.="error contains one or more spaces<br>";
   }
   #
   # the email address must not begin or end with an @
   #
   if (preg_match("/^@/",$email)) {
      echo "error begins with an @<br>";
      $rc.="error begins with @<br>";
   }
   if (preg_match("/@$/",$email)) {
      echo "error ends with an @<br>";
      $rc.="error ends with @<br>";
   }
   #
   # the email address must contain only one @
   #
   if (preg_match("/@.*@/",$email)) {
      echo "error ends contains more then one @<br>";
      $rc.="error contains more then one @<br>";
   }
   #
   # the .@ or @. is illegal
   #
   if (preg_match("/\.@/",$email)) {
      echo "error .@ is invalid<br>";
      $rc.="error .@ is invalid<br>";
   }
   if (preg_match("/@\./",$email)) {
      echo "error @. is invalid<br>";
      $rc.="error @. is invalid<br>";
   }



   #
   # the email address must not begin or end with a '.' or a period
   #
   if (preg_match("/^\./",$email)) {
      echo "error begins with a period (.)<br>";
      $rc.="error begins with period (.)<br>";
   }
   if (preg_match("/\.$/",$email)) {
      echo "error ends with an period (.)<br>";
      $rc.="error ends with period (.)<br>";
   }
   #
   # the email address must not contain two periods in a row like ..
   #
   if (preg_match("/\.\./",$email)) {
      echo "error .. is invalid (.)<br>";
      $rc.="error .. or two periods next to each other is invalid<br>";
   }
   #
   # after the @ there must be one dot like
   #       xxxx@frog.com
   # so therefor
   #       xxx@frog
   # is invalid
   if (!preg_match("/@[^@\.]+\./",$email)) {
      echo "error .. is dot must follow @ like @xxx.com<br>";
      $rc.="error (.) dot must follow @ like @xxx.com<br>";
   }








   if ($rc != '') {
      $rc="'".$email."'<br>".$rc;
   }
   return $rc;
}
#
# if anything was entered then check for errors
#
$good_email_address=array();
$good_emails=0;
$bad_emails=0;
#
# if the person enteres one or more
# email addresses in the textarea 
# then process the email addresses
# and verify that they are good or bad 
# email addresses at least the syntax
# of the email address is good
#
if ($emails != ''  ) {
   #
   # split the input date into an array
   #
   $email_array= split ("\r" , $emails );
   #
   # process each email address in the array
   #
   $invalid_email_addresses='';
   foreach ($email_array as $slot) {
      #echo "processing $slot<br>";

      #
      # change commas to spaces
      # this is because i seperate email addresses with a comma
      # then if the comma is on the begining of the email address
      # or if the comma is at the end of the email address the
      # email address will be valid after leading and trailing
      # commas are removed.
      # but if the comma is in the MIDDLE of the email address
      # then it will be converted to a space and the email adress
      # will be invalid.
      # and of course that is good because since the comma key
      # is next to the period key i suspect a lot of times a
      # comma is typed instead of a period.
      #
      $slot=preg_replace("/,/"," ",$slot);
      #
      # remove ' from the email address
      # the textarea makes them \'
      #
      $slot=preg_replace("/\\\'/"," ",$slot);
      #
      # remove " from the email address
      # the textarea makes them \"
      #
      $slot=preg_replace('/\\\"/'," ",$slot);
      $slot=remove_leading_trailing_spaces($slot);
      $slot=preg_replace("/\r/","",$slot);
      $slot=preg_replace("/\n/","",$slot);
      $slot=preg_replace("/^ */","",$slot);
      $slot=preg_replace("/ *$/","",$slot);
      if ($slot != '' ) {
         $rc=validate_email_address ($slot);
         if ($rc == '' ) {
            #echo "Good Email<br>";
            #echo "push the good email address on to this array<br>";
            $good_email_address[$good_emails]=$slot;
            $good_emails++;
         }
         else {
            #echo "BAD EMAIL<br>";
            #echo "$rc<br>";
            $invalid_email_addresses.="\n".$slot;
            $bad_emails++;
         }
      }
   } 
   echo "good emails $good_emails<br>";
   echo "bad emails $bad_emails<br>";
   #
   # if we have one or more good email address
   # then try to insert them into the sql table
   #
   if ($good_emails > 0) {
      #echo "<h1>Good Emails</h1>";
      #foreach ($good_email_address as $x) {
      #   echo "&nbsp;$x<br>";
      #}
      #
      # get all the passwords we need
      #
      require('sql_passwords.php');
      # 
      # connect to SQL 
      # 
      $link = mysql_connect($z_hardcoded_sqlurl,  
                            $z_hardcoded_database,  
                            $z_hardcoded_password ) 
                            or die('Could not connect: ' . mysql_error()); 
      # 
      # select the database I want to use 
      # 
      mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
      #
      # insert each email address the person
      # typed into the text area
      # well try to insert each email address
      # the person type in. some inserts may
      # fail if that email address alread exists
      # in the sql file
      #
      $good_insert=0;
      $bad_insert=0;
      foreach ($good_email_address as $x) {
         #
         # build the insert statement
         #
         $query = "insert into body_shops 
                          set email='$x',
                              date_created=now() ";
         #echo "query=$query<br>";
         #
         # try to insert the email address
         #
         $result = mysql_query($query);  
         if ($result) {  
            #
            # if the insert worked do this
            #
            echo "$x<br>";  
            $good_insert++;
         }  
         else {  
            #
            # if the insert failed it means
            # that email address is already
            # in the file
            # do this for failuers
            #
            #echo "insert failed $x<br>";  
            $bad_insert++;
         }
      }
      echo "$good_insert records inserted<br>";
      echo "$bad_insert records already existed";
      # 
      # close the SQL connection 
      # 
      mysql_close($link); 
   }
}
?>
<h2 align="center">Add CEWEEKLY E-mail addresses</h2>
<form action="add_ceweekly_email.php" method="post">
<input type="submit" name=submit value="SUBMIT">
<br>
<textarea rows="10" cols="50" name="emails">
<?php
   echo $invalid_email_addresses;
?>
</textarea>
</form>

add_email.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',         # for mortgage info click here 
           'x'          # for pat's bio click here
           );

 #
 # this function is used to copy the deleted
 # email record into a backup sql file so
 # we have a copy of who deleted it when
 # and from what ip address
 #
 include "0_php_function_dup_email.php";
 $type=$_GET["type"];
 if ($type == '' ) {
    $type=$_POST["type"];
 }
 if ($type == '' ) {
    $type='email_add';
 }
 if ($type == 'email_add' ) {
    $what_we_are_doing='Pat please send me an email every 2 weeks
                        to remind me of the next 
                        <a href="index.php">Strategic Edge Business Alliance</a>
                        meeting';
    $it_worked_message="Your e-mail address has been added to our mailing list";
    $h2="Add me to your e-mail list";
 }
 if ($type == 'email_delete' ) {
    $what_we_are_doing='Pat please stop sending me e-mail about your
                        <a href="index.php">Strategic Edge Business Alliance</a>
                        meetings';
    $it_worked_message="Your e-mail address has been removed.";
    $h2="Remove me from your e-mail list";
 }
?>

<?php #include "sbd_head.php"; ?>



<?php

#
# get the ip address so we can tell where people came from
#
$my_ip_address=${REMOTE_ADDR};
#echo "$my_ip_address";
#$it_worked_message="";



function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}


#
# get the input data and clean it up
#
$name=clean_for_html($_POST["name"]);
#$name=preg_replace("/^ */","",$name);
#$name=remove_leading_trailing_spaces($name);


$best_time=clean_for_html($_POST["best_time"]);
$phone_work=clean_for_html($_POST["phone_work"]);
$phone_other=clean_for_html($_POST["phone_other"]);
$phone_home=clean_for_html($_POST["phone_home"]);
$phone_cell=clean_for_html($_POST["phone_cell"]);
$comments=clean_for_sql($_POST["comments"]);
#
# any errors
#
$errors=0;
#
$name_error="";
$subject_error="";
$comment_error="";
$best_time_error="";
$phone_error="";


#
# if anything was entered then check for errors
#
if ($name != '' || 
    $phone_home != '' || 
    $phone_work != '' || 
    $phone_cell != ''  || 
    $phone_other != ''  ||
    $best_time != '' ||
    $comments != ''  ) {
   #
   # they must enter a persons name
   # so pat can call and say
   # i want to talk to xxx
   #
   if ($name == '' ) {
      #
      # you must enter a name to add an email address
      # you dont need a name to delete an email addreess
      #
      if ($type == 'email_add' ) {
         $errors++;
         $name_error="You must enter a name";
      }
   }
   #
   # they must enter an e-mail address
   #
   if ($phone_home == '' ) {
      $errors++;
      $phone_error="You must enter an email address";
   }


   #
   # they must enter a valid email address
   #
   if ($phone_home != '' ) {
      #
      # cant begin with an @
      # must have 1 or more characters before the @
      # must have 1 or more characters after the @
      # must have @x. or @xx. or @xxx. ...
      # must have one . followed by anything but an @
      # before the end like
      #       x.com or y.com
      #
      if (!preg_match("/^[^@].*@[^@].*\.[^@]/",$phone_home)) {
         $errors++;
         $phone_error="Invalid email address";
      }
      else {
         #
         # cant have more then one @
         # cant have 2 dots next to each other like ..
         # cant have .@ or @.
         #
         if (preg_match("/@.*@/",$phone_home) ||
             preg_match("/\.\./",$phone_home) ||
             preg_match("/\.@/",$phone_home)  ||
             preg_match("/@\./",$phone_home)



) {
            $errors++;
            $phone_error="Invalid email address";
         }


      }
 
   }
   #
   # if no errors and
   # both the required fields are entered
   # insert the data as a new sql record
   $comments_minus_blank_lines=$comments;
   $comments_minus_blank_lines=preg_replace("/\n/","",$comments_minus_blank_lines);
   $comments_minus_blank_lines=preg_replace("/\r/","",$comments_minus_blank_lines);
}


#
# if they entered a name and email address
#      we can add them
# if they entered just an email address
#      we can delete them
#
#if ($errors == 0 && $name != '') {
if ($errors == 0 && $phone_home != '') {
   #
   # get the passwords and stuff
   #
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #
   # here we add their email address to the sql table
   #
   if ($type == 'email_delete' ) {
      #
      # check to see if that email address exists
      #
      $query = "select count(*) as hits from junk_emails where email='$phone_home' ";
      #echo "Query=$query<p>";


      #
      # display the select
      # 
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         # 
         # how to read like PERL does in PHP 
         # the name of each selected value is used as a subscript or hash value 
         # 
         $hits=$line['hits'];
         #echo "Hits=$hits<br>";
      }
      #
      # are they already in our email list?
      #
      #echo "Hits=$hits<br>";
      if ($hits == 0 ) {
         #
         # this email address isnt in our database
         # and therefore can NOT be deleted
         #
         $it_worked_message="<span style=\"color:red; font-size:200%;\">Error! This email address $phone_home is not in our database and thus can't be removed!</span> ";
         echo  $it_worked_message;
      }
      else {
         #
         # make a copy of the deleted email address for our records
         #
         duplicate_deleted_email_add($phone_home,$name,$phone_work,$my_ip_address);
         #
         # build the query to delete it
         #
         $query = "delete from junk_emails where email='$phone_home' ";
         #echo "query=$query<br>";

         $result = mysql_query($query); 
         if ($result) { 
            echo  $it_worked_message;
         } 
         else { 
            echo "Something is SCREWED UP!!!!!!!!  delete failed!!<br>". mysql_error(); 
         }
      }
   }







   #
   # here we add their email address to the sql table
   #
   if ($type == 'email_add' ) {





      #
      # check to see if that email address exists
      #
      $query = "select count(*) as hits from junk_emails where email='$phone_home' ";
      #echo "Query=$query<p>";


      #
      # display the select
      # 
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         # 
         # how to read like PERL does in PHP 
         # the name of each selected value is used as a subscript or hash value 
         # 
         $hits=$line['hits'];
         #echo "Hits=$hits<br>";
      }
      #
      # are they already in our email list?
      #
      #echo "Hits=$hits<br>";
      if ($hits > 0 ) {
         #
         # they are already in our email list
         # dont add them
         #
         $it_worked_message="You are already in our e-mail list sd $phone_home ";
         echo  $it_worked_message;
      }
      else {
         #
         # they aint on our email list
         # add them
         #
         #  
         # build sql insert statement
         #
         $query = 'INSERT into junk_emails set ';
         #
         # is this record to be displayed on the web
         #
         # put a time stamp when the record was created
         #
         #$query.= " created_on=now(), ";
         #
         # get their name
         #
         if ($name != '' ) {
            $query.= " name='$name' ";
         }
         #
         # add in their telephone if they gave one
         #
         if ($phone_home != '' ) {
             $query.= " , email='$phone_home' ";
         }
         if ($phone_work != '' ) {
             $query.= " , phone='$phone_work' ";
         }
         #
         # put a time stamp when the record was created
         #
         $query.= " , date_created=now() ";
         #
         # save the IP address of the person that created this record
         #
         $query.= " , ip='${REMOTE_ADDR}' ";
         #
         # say we want to add them to the fax list
         #
         #$query.= " , status='$type' ";
         #
         # display the insert
         #
         #echo "Query=$query<p>";
         $result = mysql_query($query); 
         if ($result) { 
            #echo "insert worked"; 
            echo  $it_worked_message;
         } 
         else { 
            echo "Something is SCREWED UP!!!!!!!!  insert failed!!!!!!!!!!!!!!!!!"; 
         }




      }

   }





   # 
   # close the SQL connection 
   # 
   mysql_close($link); 
   dump_tail();
   exit;
}

#if ( $comments_minus_blank_lines == '' ) {
#   $comment_error="You must enter some text explaining your problems with xxx";
#}




function form_line($name, $data, $value, $required, $errors) {
?>
<tr valign="top">
<td align="right">
<?php
   echo $name;
   echo ":";
   if ($required == "y" || $required == "Y") {
      #echo "<br>";
      #echo "<span style=\"color:red\">";
      #echo "(required)";
      #echo "</span>";
   }
?>
</td>
<td align="left">
<input type="text"
       size="50" 
       name="<?php echo $data;?>"
       value="<?php echo $value;?>"
       >
</td>
<td>
<?php
   if ($errors != '' ) {
      echo "<span style=\"color:red\">ERROR(s)!<br>";
      echo "$errors";
      echo "</span>";
   }
   else {
      echo "&nbsp;";
   }
?>
</td>
</tr>
<?php
   return;
}



function private_button($name, $value, $text) {
?>
<tr valign="top">
<td align="right">
   &nbsp;
</td>
<td>
<input type="checkbox" 
       name="<?php echo $name;?>"
       <?php
          if ($value == "on") {
             echo " checked ";
          }
       ?>  
       >
<?php
 echo $text;
?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php
 return;
}



?>





<?php
 echo "<h2 align=\"center\">$h2</h2>";
?>


<form action="add_email.php" method="post">
<table border="0">
<input type="hidden" name=type value="<?php echo $type;?>">
<tr>
<td colspan="3">
<?php
   echo $what_we_are_doing
?>
</td>
</tr>


<?php
   form_line('Name', 'name', $name, 'y', $name_error);
   form_line('<nobr>E-Mail</nobr>', 'phone_home', $phone_home, 'n', $phone_error);
   form_line('Phone', 'phone_work', $phone_work, 'n', '');
?>







<tr>
<td>
&nbsp;
</td>
<td colspan="2">
<input type="submit" name=submit value="SUBMIT">
</form>
</td>
</tr>
</table>







<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

add_fax.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',         # for mortgage info click here 
           'x'          # for pat's bio click here
           );
 $type=$_GET["type"];
 if ($type == '' ) {
    $type=$_POST["type"];
 }
 if ($type == '' ) {
    $type='fax_add';
 }
 if ($type == 'fax_add' ) {
    $what_we_are_doing='Pat please send me a fax every 2 weeks
                        to remind me of the next 
                        <a href="index.php">Strategic Edge Business Alliance</a>
                        meeting';
    $it_worked_message="Your info has been saved.
                        However Pat will have to manually
                        add your number to the fax mailing list";
    $h2="Add me to your fax mailing list";
 }
 if ($type == 'fax_delete' ) {
    $what_we_are_doing='Pat please stop sending me faxs about your
                        <a href="index.php">Strategic Edge Business Alliance</a>
                        meetings';
    $it_worked_message="Your info has been saved.
                        However Pat will have to manually
                        delete your number from the fax mailing list";
    $h2="Remove me from your fax mailing list";
 }
?>

<?php #include "sbd_head.php"; ?>



<?php

#
# get the ip address so we can tell where people came from
#
$my_ip_address=${REMOTE_ADDR};
#echo "$my_ip_address";
#$it_worked_message="";



function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}


#
# get the input data and clean it up
#
$name=clean_for_html($_POST["name"]);
#$name=preg_replace("/^ */","",$name);
#$name=remove_leading_trailing_spaces($name);


$best_time=clean_for_html($_POST["best_time"]);
$phone_work=clean_for_html($_POST["phone_work"]);
$phone_other=clean_for_html($_POST["phone_other"]);
$phone_home=clean_for_html($_POST["phone_home"]);
$phone_cell=clean_for_html($_POST["phone_cell"]);
$comments=clean_for_sql($_POST["comments"]);
#
# any errors
#
$errors=0;
#
$name_error="";
$subject_error="";
$comment_error="";
$best_time_error="";
$phone_error="";


#
# if anything was entered then check for errors
#
if ($name != '' || 
    $phone_home != '' || 
    $phone_work != '' || 
    $phone_cell != ''  || 
    $phone_other != ''  ||
    $best_time != '' ||
    $comments != ''  ) {
   #
   # they must enter a persons name
   # so pat can call and say
   # i want to talk to xxx
   #
   if ($name == '' ) {
      $errors++;
      $name_error="You must enter a name";
   }
   #
   # they must enter at least one phone number
   #
   if ($phone_home == '' ) {
   #if ($phone_home == '' && $phone_work == '' && $phone_cell == ''  && $phone_other == '') {
      $errors++;
      $phone_error="You must enter at least one phone number";
   }
   #
   # if no errors and
   # both the required fields are entered
   # insert the data as a new sql record
   $comments_minus_blank_lines=$comments;
   $comments_minus_blank_lines=preg_replace("/\n/","",$comments_minus_blank_lines);
   $comments_minus_blank_lines=preg_replace("/\r/","",$comments_minus_blank_lines);
}

if ($errors == 0 && $name != '') {
   #echo "no errors adding<p>";  
   #
   # insert the sql data
   #
   #echo "insert SQL here<p>";
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql insert statement
   #
   $query = 'INSERT into messages set ';
   #
   # is this record to be displayed on the web
   #
   # put a time stamp when the record was created
   #
   #$query.= " created_on=now(), ";
   #
   # add in comments or text
   #
   $query.= " comments='$comments' ";
   #
   # get their name
   #
   if ($name != '' ) {
      $query.= " , name='$name' ";
   }
   #
   # add in their telephone if they gave one
   #
   if ($phone_home != '' ) {
       $query.= " , phone_home='$phone_home' ";
   }
   if ($phone_cell != '' ) {
       $query.= " , phone_cell='$phone_cell' ";
   }
   if ($phone_work != '' ) {
       $query.= " , phone_work='$phone_work' ";
   }
   if ($phone_other != '' ) {
       $query.= " , phone_other='$phone_other' ";
   }
   if ($best_time != '' ) {
       $query.= " , best_time='$best_time' ";
   }
   #
   # put a time stamp when the record was created
   #
   $query.= " , date_created=now() ";
   #
   # save the IP address of the person that created this record
   #
   $query.= " , ip='${REMOTE_ADDR}' ";
   #
   # say we want to add them to the fax list
   #
   $query.= " , status='$type' ";



   #
   # display the insert
   #
   #echo "Query=$query<p>";
   $result = mysql_query($query); 
   if ($result) { 
      #echo "insert worked"; 
      echo  $it_worked_message;
   } 
   else { 
      echo "Something is SCREWED UP!!!!!!!!  insert failed!!!!!!!!!!!!!!!!!"; 
   }







   # 
   # close the SQL connection 
   # 
   mysql_close($link); 
   dump_tail();
   exit;
}

#if ( $comments_minus_blank_lines == '' ) {
#   $comment_error="You must enter some text explaining your problems with xxx";
#}




function form_line($name, $data, $value, $required, $errors) {
?>
<tr valign="top">
<td align="right">
<?php
   echo $name;
   echo ":";
   if ($required == "y" || $required == "Y") {
      #echo "<br>";
      #echo "<span style=\"color:red\">";
      #echo "(required)";
      #echo "</span>";
   }
?>
</td>
<td align="left">
<input type="text"
       size="50" 
       name="<?php echo $data;?>"
       value="<?php echo $value;?>"
       >
</td>
<td>
<?php
   if ($errors != '' ) {
      echo "<span style=\"color:red\">ERROR(s)!<br>";
      echo "$errors";
      echo "</span>";
   }
   else {
      echo "&nbsp;";
   }
?>
</td>
</tr>
<?php
   return;
}



function private_button($name, $value, $text) {
?>
<tr valign="top">
<td align="right">
   &nbsp;
</td>
<td>
<input type="checkbox" 
       name="<?php echo $name;?>"
       <?php
          if ($value == "on") {
             echo " checked ";
          }
       ?>  
       >
<?php
 echo $text;
?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php
 return;
}



?>





<?php
 echo "<h2 align=\"center\">$h2</h2>";
?>


<form action="add_fax.php" method="post">
<table border="0">
<input type="hidden" name=type value="<?php echo $type;?>">
<tr>
<td colspan="3">
<?php
   echo $what_we_are_doing
?>
</td>
</tr>


<?php
   form_line('Name', 'name', $name, 'y', $name_error);
   form_line('<nobr>Fax Number</nobr>', 'phone_home', $phone_home, 'n', $phone_error);
   form_line('Phone', 'phone_work', $phone_work, 'n', '');
?>







<tr>
<td>
&nbsp;
</td>
<td colspan="2">
<input type="submit" name=submit value="SUBMIT">
</form>
</td>
</tr>
</table>







<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

add_new_member_email.php

TOC

<html>
<head>
<title>Strategic Edge Business Alliance</title>
<!-- LINK rel="stylesheet" href="/0____css.css" type="text/css" -->
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<?php
  $dogs=array(#'sginger1.jpg',
              #'sginger2.jpg',
              #'sotis1.jpg',
              #'sotis2.jpg',
              'background_12s.jpg'
              #'both_background.jpg'
              );
  $ahorrita=time()%sizeof($dogs);
  #echo $ahorrita;
  echo '<body background="';
  echo $dogs[$ahorrita];
  echo '">';
?>
<h1 align="center">Strategic Edge Business Alliance</h1>
<h2 align="center">Add e-mail addresses of new members</h2>












<?php
 include "0_php_functions.php";
 #
 # this function is used to copy the deleted
 # email record into a backup sql file so
 # we have a copy of who deleted it when
 # and from what ip address
 #
 include "0_php_function_dup_email.php";
 $type=$_GET["type"];
 if ($type == '' ) {
    $type=$_POST["type"];
 }
 if ($type == '' ) {
    $type='email_add';
 }
 if ($type == 'email_add' ) {
    #$what_we_are_doing='Pat please send me an email every 2 weeks
    #                    to remind me of the next 
    #                    <a href="index.php">Strategic Edge Business Alliance</a>
    #                    meeting';
    $it_worked_message="$phone_home has been added to junk e-mail list";
    #$h2="Add me to your e-mail list";
 }
?>

<?php #include "sbd_head.php"; ?>



<?php

#
# get the ip address so we can tell where people came from
#
$my_ip_address=${REMOTE_ADDR};




function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}


#
# get the input data and clean it up
#
$name=clean_for_html($_POST["name"]);
$stinking_notes=clean_for_html($_POST["stinking_notes"]);



$best_time=clean_for_html($_POST["best_time"]);
$phone_work=clean_for_html($_POST["phone_work"]);
$phone_other=clean_for_html($_POST["phone_other"]);
$phone_home=clean_for_html($_POST["phone_home"]);
$phone_cell=clean_for_html($_POST["phone_cell"]);
$comments=clean_for_sql($_POST["comments"]);
#
# any errors
#
$errors=0;
#
$name_error="";
$subject_error="";
$comment_error="";
$best_time_error="";
$phone_error="";


#
# if anything was entered then check for errors
#
if ($name != '' || 
    $phone_home != '' || 
    $phone_work != '' || 
    $phone_cell != ''  || 
    $phone_other != ''  ||
    $best_time != '' ||
    $comments != ''  ) {
   #
   # they must enter a persons name
   # so pat can call and say
   # i want to talk to xxx
   #
   #if ($name == '' ) {
   #   #
   #   # you must enter a name to add an email address
   #   # you dont need a name to delete an email addreess
   #   #
   #   #if ($type == 'email_add' ) {
   #   #   $errors++;
   #   #   $name_error="You must enter a name";
   #   #}
   #}
   #
   # they must enter an e-mail address
   #
   if ($phone_home == '' ) {
      $errors++;
      $phone_error="You must enter an email address";
   }


   #
   # they must enter a valid email address
   #
   if ($phone_home != '' ) {
      #
      # cant begin with an @
      # must have 1 or more characters before the @
      # must have 1 or more characters after the @
      # must have @x. or @xx. or @xxx. ...
      # must have one . followed by anything but an @
      # before the end like
      #       x.com or y.com
      #
      if (!preg_match("/^[^@].*@[^@].*\.[^@]/",$phone_home)) {
         $errors++;
         $phone_error="Invalid email address";
      }
      else {
         #
         # cant have more then one @
         # cant have 2 dots next to each other like ..
         # cant have .@ or @.
         #
         if (preg_match("/@.*@/",$phone_home) ||
             preg_match("/\.\./",$phone_home) ||
             preg_match("/\.@/",$phone_home)  ||
             preg_match("/@\./",$phone_home)



) {
            $errors++;
            $phone_error="Invalid email address";
         }
         else {
            #
            # cant have spaces in email address
            #
            if (preg_match("/ /",$phone_home)) {
               $errors++;
               $phone_error="Invalid email address";
            }


         }


      }
 
   }
   #
   # if no errors and
   # both the required fields are entered
   # insert the data as a new sql record
   $comments_minus_blank_lines=$comments;
   $comments_minus_blank_lines=preg_replace("/\n/","",$comments_minus_blank_lines);
   $comments_minus_blank_lines=preg_replace("/\r/","",$comments_minus_blank_lines);
}


#
# if they entered a name and email address
#      we can add them
# if they entered just an email address
#      we can delete them
#
#if ($errors == 0 && $name != '') {
if ($errors == 0 && $phone_home != '') {
   #
   # get the passwords and stuff
   #
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #
   # here we add their email address to the sql table
   #
   if ($type == 'email_delete' ) {
      #
      # check to see if that email address exists
      #
      $query = "select count(*) as hits from junk_emails where email='$phone_home' ";
      #echo "Query=$query<p>";


      #
      # display the select
      # 
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         # 
         # how to read like PERL does in PHP 
         # the name of each selected value is used as a subscript or hash value 
         # 
         $hits=$line['hits'];
         #echo "Hits=$hits<br>";
      }
      #
      # are they already in our email list?
      #
      #echo "Hits=$hits<br>";
      if ($hits == 0 ) {
         #
         # this email address isnt in our database
         # and therefore can NOT be deleted
         #
         $it_worked_message="<span style=\"color:red; font-size:200%;\">Error! This email address $phone_home is not in our database and thus can't be removed!</span> ";
         echo  $it_worked_message;
      }
      else {
         #
         # make a copy of the deleted email address for our records
         #
         duplicate_deleted_email_add($phone_home,$name,$phone_work,$my_ip_address);
         #
         # build the query to delete it
         #
         $query = "delete from junk_emails where email='$phone_home' ";
         #echo "query=$query<br>";

         $result = mysql_query($query); 
         if ($result) { 
            echo  $it_worked_message;
         } 
         else { 
            echo "Something is SCREWED UP!!!!!!!!  delete failed!!<br>". mysql_error(); 
         }
      }
   }







   #
   # here we add their email address to the sql table
   #
   if ($type == 'email_add' ) {





      #
      # check to see if that email address exists
      #
      $query = "select count(*) as hits from junk_emails where email='$phone_home' ";
      #echo "Query=$query<p>";


      #
      # display the select
      # 
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         # 
         # how to read like PERL does in PHP 
         # the name of each selected value is used as a subscript or hash value 
         # 
         $hits=$line['hits'];
         #echo "Hits=$hits<br>";
      }
      #
      # are they already in our email list?
      #
      #echo "Hits=$hits<br>";
      if ($hits > 0 ) {
         #
         # they are already in our email list
         # dont add them
         #
         $it_worked_message="<span style=\"color:red;\">$phone_home is aready in the junk email list</span>";
         echo  $it_worked_message;
      }
      else {
         #
         # they aint on our email list
         # add them
         #
         #  
         # build sql insert statement
         #
         $query = 'INSERT into junk_emails set ';
         #
         # is this record to be displayed on the web
         #
         # put a time stamp when the record was created
         #
         #$query.= " created_on=now(), ";
         #
         # get their name
         #
         if ($name != '' ) {
            $query.= " name='$name' , ";
         }
         #
         # add in their telephone if they gave one
         #
         if ($phone_home != '' ) {
             $query.= "  email='$phone_home' , ";
         }
         if ($phone_work != '' ) {
             $query.= "  phone='$phone_work' , ";
         }



         if ($stinking_notes != '' ) {
             $query.= "  notes='$stinking_notes' , ";
         }



         #
         # put a time stamp when the record was created
         #
         $query.= "  date_created=now() , ";
         #
         # save the IP address of the person that created this record
         #
         $query.= "  ip='${REMOTE_ADDR}'  ";
         #
         # say we want to add them to the fax list
         #
         #$query.= "  status='$type' ";
         #
         # display the insert
         #
         #echo "Query=$query<p>";
         $result = mysql_query($query); 
         if ($result) { 
            #echo "insert worked"; 
            echo  $it_worked_message;
         } 
         else { 
            echo "Something is SCREWED UP!!!!!!!!  insert failed!!!!!!!!!!!!!!!!!"; 
         }




      }

   }





   # 
   # close the SQL connection 
   # 
   mysql_close($link); 
   #echo "write a function to build the form here and use it in both places";
   #dump_tail();
   #exit;
}

#if ( $comments_minus_blank_lines == '' ) {
#   $comment_error="You must enter some text explaining your problems with xxx";
#}




function form_line($name, $data, $value, $required, $errors) {
?>
<tr valign="top">
<td align="right">
<?php
   echo $name;
   echo ":";
   if ($required == "y" || $required == "Y") {
      #echo "<br>";
      #echo "<span style=\"color:red\">";
      #echo "(required)";
      #echo "</span>";
   }
?>
</td>
<td align="left">
<input type="text"
       size="50" 
       name="<?php echo $data;?>"
       value="<?php echo $value;?>"
       >
</td>
<td>
<?php
   if ($errors != '' ) {
      echo "<span style=\"color:red\">ERROR(s)!<br>";
      echo "$errors";
      echo "</span>";
   }
   else {
      echo "&nbsp;";
   }
?>
</td>
</tr>
<?php
   return;
}



function private_button($name, $value, $text) {
?>
<tr valign="top">
<td align="right">
   &nbsp;
</td>
<td>
<input type="checkbox" 
       name="<?php echo $name;?>"
       <?php
          if ($value == "on") {
             echo " checked ";
          }
       ?>  
       >
<?php
 echo $text;
?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php
 return;
}



?>





<?php
 echo "<h2 align=\"center\">$h2</h2>";
?>


<form action="add_new_member_email.php" method="post">
<table border="0">
<input type="hidden" name=type value="<?php echo $type;?>">
<tr>
<td colspan="3">
<?php
   echo $what_we_are_doing
?>
</td>
</tr>


<?php
   form_line('Name', 'name', $name, 'y', $name_error);
   form_line('<nobr>E-Mail</nobr>', 'phone_home', $phone_home, 'n', $phone_error);
   form_line('Phone', 'phone_work', $phone_work, 'n', '');
?>


<tr>
<td>
Comments
</td>
<td>
<textarea name="stinking_notes" cols=70 rows=6>
<?php
   echo $stinking_notes; 
?>


</textarea>
</td>
</tr>




<tr>
<td>
&nbsp;
</td>
<td colspan="2">
<input type="submit" name=submit value="SUBMIT">
</form>
</td>
</tr>
</table>
<p>
<a href="control-panel.php">Control Panel</a>

add_press_release_email.php

TOC

<html>
<head>
<title>Strategic Edge Business Alliance</title>
<!-- LINK rel="stylesheet" href="/0____css.css" type="text/css" -->
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<?php
  $dogs=array(#'sginger1.jpg',
              #'sginger2.jpg',
              #'sotis1.jpg',
              #'sotis2.jpg',
              'background_12s.jpg'
              #'both_background.jpg'
              );
  $ahorrita=time()%sizeof($dogs);
  #echo $ahorrita;
  echo '<body background="';
  echo $dogs[$ahorrita];
  echo '">';
?>
<h1 align="center">Strategic Edge Business Alliance</h1>
<h2 align="center">Add e-mail addresses to Press Release list</h2>












<?php
 include "0_php_functions.php";
 #
 # this function is used to copy the deleted
 # email record into a backup sql file so
 # we have a copy of who deleted it when
 # and from what ip address
 #
 include "0_php_function_dup_email.php";
 $type=$_GET["type"];
 if ($type == '' ) {
    $type=$_POST["type"];
 }
 if ($type == '' ) {
    $type='email_add';
 }
 if ($type == 'email_add' ) {
    #$what_we_are_doing='Pat please send me an email every 2 weeks
    #                    to remind me of the next 
    #                    <a href="index.php">Strategic Edge Business Alliance</a>
    #                    meeting';
    $it_worked_message="$phone_home has been added to press release e-mail list";
    #$h2="Add me to your e-mail list";
 }
?>

<?php #include "sbd_head.php"; ?>



<?php

#
# get the ip address so we can tell where people came from
#
$my_ip_address=${REMOTE_ADDR};




function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}


#
# get the input data and clean it up
#
$name=clean_for_html($_POST["name"]);



$best_time=clean_for_html($_POST["best_time"]);
$phone_work=clean_for_html($_POST["phone_work"]);
$phone_other=clean_for_html($_POST["phone_other"]);
$phone_home=clean_for_html($_POST["phone_home"]);
$phone_cell=clean_for_html($_POST["phone_cell"]);
$comments=clean_for_sql($_POST["comments"]);
#
# any errors
#
$errors=0;
#
$name_error="";
$subject_error="";
$comment_error="";
$best_time_error="";
$phone_error="";


#
# if anything was entered then check for errors
#
if ($name != '' || 
    $phone_home != '' || 
    $phone_work != '' || 
    $phone_cell != ''  || 
    $phone_other != ''  ||
    $best_time != '' ||
    $comments != ''  ) {
   #
   # they must enter a persons name
   # so pat can call and say
   # i want to talk to xxx
   #
   #if ($name == '' ) {
   #   #
   #   # you must enter a name to add an email address
   #   # you dont need a name to delete an email addreess
   #   #
   #   #if ($type == 'email_add' ) {
   #   #   $errors++;
   #   #   $name_error="You must enter a name";
   #   #}
   #}
   #
   # they must enter an e-mail address
   #
   if ($phone_home == '' ) {
      $errors++;
      $phone_error="You must enter an email address";
   }


   #
   # they must enter a valid email address
   #
   if ($phone_home != '' ) {
      #
      # cant begin with an @
      # must have 1 or more characters before the @
      # must have 1 or more characters after the @
      # must have @x. or @xx. or @xxx. ...
      # must have one . followed by anything but an @
      # before the end like
      #       x.com or y.com
      #
      if (!preg_match("/^[^@].*@[^@].*\.[^@]/",$phone_home)) {
         $errors++;
         $phone_error="Invalid email address";
      }
      else {
         #
         # cant have more then one @
         # cant have 2 dots next to each other like ..
         # cant have .@ or @.
         #
         if (preg_match("/@.*@/",$phone_home) ||
             preg_match("/\.\./",$phone_home) ||
             preg_match("/\.@/",$phone_home)  ||
             preg_match("/@\./",$phone_home)



) {
            $errors++;
            $phone_error="Invalid email address";
         }
         else {
            #
            # cant have spaces in email address
            #
            if (preg_match("/ /",$phone_home)) {
               $errors++;
               $phone_error="Invalid email address";
            }


         }


      }
 
   }
   #
   # if no errors and
   # both the required fields are entered
   # insert the data as a new sql record
   $comments_minus_blank_lines=$comments;
   $comments_minus_blank_lines=preg_replace("/\n/","",$comments_minus_blank_lines);
   $comments_minus_blank_lines=preg_replace("/\r/","",$comments_minus_blank_lines);
}


#
# if they entered a name and email address
#      we can add them
# if they entered just an email address
#      we can delete them
#
#if ($errors == 0 && $name != '') {
if ($errors == 0 && $phone_home != '') {
   #
   # get the passwords and stuff
   #
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #
   # here we add their email address to the sql table
   #
   if ($type == 'email_delete' ) {
      #
      # check to see if that email address exists
      #
      $query = "select count(*) as hits from press_releases where email='$phone_home' ";
      #echo "Query=$query<p>";


      #
      # display the select
      # 
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         # 
         # how to read like PERL does in PHP 
         # the name of each selected value is used as a subscript or hash value 
         # 
         $hits=$line['hits'];
         #echo "Hits=$hits<br>";
      }
      #
      # are they already in our email list?
      #
      #echo "Hits=$hits<br>";
      if ($hits == 0 ) {
         #
         # this email address isnt in our database
         # and therefore can NOT be deleted
         #
         $it_worked_message="<span style=\"color:red; font-size:200%;\">Error! This email address $phone_home is not in our database and thus can't be removed!</span> ";
         echo  $it_worked_message;
      }
      else {
         #
         # make a copy of the deleted email address for our records
         #
         duplicate_deleted_email_add($phone_home,$name,$phone_work,$my_ip_address);
         #
         # build the query to delete it
         #
         $query = "delete from press_releases where email='$phone_home' ";
         #echo "query=$query<br>";

         $result = mysql_query($query); 
         if ($result) { 
            echo  $it_worked_message;
         } 
         else { 
            echo "Something is SCREWED UP!!!!!!!!  delete failed!!<br>". mysql_error(); 
         }
      }
   }







   #
   # here we add their email address to the sql table
   #
   if ($type == 'email_add' ) {





      #
      # check to see if that email address exists
      #
      $query = "select count(*) as hits from press_releases where email='$phone_home' ";
      #echo "Query=$query<p>";


      #
      # display the select
      # 
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
      while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
         # 
         # how to read like PERL does in PHP 
         # the name of each selected value is used as a subscript or hash value 
         # 
         $hits=$line['hits'];
         #echo "Hits=$hits<br>";
      }
      #
      # are they already in our email list?
      #
      #echo "Hits=$hits<br>";
      if ($hits > 0 ) {
         #
         # they are already in our email list
         # dont add them
         #
         $it_worked_message="<span style=\"color:red;\">$phone_home is aready in the press release email list</span>";
         echo  $it_worked_message;
      }
      else {
         #
         # they aint on our email list
         # add them
         #
         #  
         # build sql insert statement
         #
         $query = 'INSERT into press_releases set ';
         #
         # is this record to be displayed on the web
         #
         # put a time stamp when the record was created
         #
         #$query.= " created_on=now(), ";
         #
         # get their name
         #
         if ($name != '' ) {
            $query.= " name='$name' , ";
         }
         #
         # add in their telephone if they gave one
         #
         if ($phone_home != '' ) {
             $query.= "  email='$phone_home' , ";
         }
         if ($phone_work != '' ) {
             $query.= "  phone='$phone_work' , ";
         }
         #
         # put a time stamp when the record was created
         #
         $query.= "  date_created=now() , ";
         #
         # save the IP address of the person that created this record
         #
         $query.= "  ip='${REMOTE_ADDR}'  ";
         #
         # say we want to add them to the fax list
         #
         #$query.= "  status='$type' ";
         #
         # display the insert
         #
         #echo "Query=$query<p>";
         $result = mysql_query($query); 
         if ($result) { 
            #echo "insert worked"; 
            echo  $it_worked_message;
         } 
         else { 
            echo "Something is SCREWED UP!!!!!!!!  insert failed!!!!!!!!!!!!!!!!!"; 
         }




      }

   }





   # 
   # close the SQL connection 
   # 
   mysql_close($link); 
   #echo "write a function to build the form here and use it in both places";
   #dump_tail();
   #exit;
}

#if ( $comments_minus_blank_lines == '' ) {
#   $comment_error="You must enter some text explaining your problems with xxx";
#}




function form_line($name, $data, $value, $required, $errors) {
?>
<tr valign="top">
<td align="right">
<?php
   echo $name;
   echo ":";
   if ($required == "y" || $required == "Y") {
      #echo "<br>";
      #echo "<span style=\"color:red\">";
      #echo "(required)";
      #echo "</span>";
   }
?>
</td>
<td align="left">
<input type="text"
       size="50" 
       name="<?php echo $data;?>"
       value="<?php echo $value;?>"
       >
</td>
<td>
<?php
   if ($errors != '' ) {
      echo "<span style=\"color:red\">ERROR(s)!<br>";
      echo "$errors";
      echo "</span>";
   }
   else {
      echo "&nbsp;";
   }
?>
</td>
</tr>
<?php
   return;
}



function private_button($name, $value, $text) {
?>
<tr valign="top">
<td align="right">
   &nbsp;
</td>
<td>
<input type="checkbox" 
       name="<?php echo $name;?>"
       <?php
          if ($value == "on") {
             echo " checked ";
          }
       ?>  
       >
<?php
 echo $text;
?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php
 return;
}



?>





<?php
 echo "<h2 align=\"center\">$h2</h2>";
?>


<form action="add_press_release_email.php" method="post">
<table border="0">
<input type="hidden" name=type value="<?php echo $type;?>">
<tr>
<td colspan="3">
<?php
   echo $what_we_are_doing
?>
</td>
</tr>


<?php
   form_line('Name', 'name', $name, 'y', $name_error);
   form_line('<nobr>E-Mail</nobr>', 'phone_home', $phone_home, 'n', $phone_error);
   form_line('Phone', 'phone_work', $phone_work, 'n', '');
?>







<tr>
<td>
&nbsp;
</td>
<td colspan="2">
<input type="submit" name=submit value="SUBMIT">
</form>
</td>
</tr>
</table>
<p>
<a href="control-panel.php">Control Panel</a>

add_resumes_emailed_faxed.php

TOC

<h1>Resumes emailed, faxed or called</h1>
<?php
 include "0_php_functions.php";
 $invalid_email_addresses="";
 #$invalid_email_addresses="kruddyemail@address.
 #         xx.xx
 #'xxx@xxx.com'
 #\"xxx@xxx2.com\"
 #,xxx@xxx3.com,
 #xxx@xxx4.com,
 #,xxx@xxx5.com
 #@xxxxxxxxxxxxx.xxx
 #@xxxxxxxxxxxxx.xxx.com
 #@xxxxxxxxxxxxx
 #         @xxxxxxxxxxxxx
 #xxxxx.xxx@
 #              xxxx.xxxxx@xxxxx@xx               
 #xxxxxxxxxxxxxx.xxxx
 #                 yyyyyyy.yyyyyyyyyyyyyyyy                
 #             xxxx.xxxx
 #             xxxx.xxxx.
 #             .xxxx.xxxx
 #             .xxxx.xxxx
 #             .xxxx.@xxxx
 #             .xxxx@.xxxx
 #xx..xx
 #xx.xx.xx.x..xxxx.com
 # 
 #frog.cat@badline  
 #       
 #xxxxxxx.xxxx
 #zzzzzzzzzzzzzzzzzzzzzzzzzzz";
 #
 # end of list of bad email addresses
 #




 #
 # get the ip address so we can tell where people came from
 #
 $my_ip_address=${REMOTE_ADDR};
 $emails=$_POST["emails"];
 $email_array=array();
?>





<?php






function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}



function validate_email_address ($email) {
   $rc="";
   #
   # the email address must contain at least one period or dot
   #
   if (!preg_match("/\./",$email)) {
      echo "error doesnt have a period<br>";
      $rc.="error does not contain a period (.)<br>";
   }
   #
   # the email address must not contain any spaces
   #
   if (preg_match("/ /",$email)) {
      echo "error contains spaces<br>";
      $rc.="error contains one or more spaces<br>";
   }
   #
   # the email address must not begin or end with an @
   #
   if (preg_match("/^@/",$email)) {
      echo "error begins with an @<br>";
      $rc.="error begins with @<br>";
   }
   if (preg_match("/@$/",$email)) {
      echo "error ends with an @<br>";
      $rc.="error ends with @<br>";
   }
   #
   # the email address must contain only one @
   #
   if (preg_match("/@.*@/",$email)) {
      echo "error ends contains more then one @<br>";
      $rc.="error contains more then one @<br>";
   }
   #
   # the .@ or @. is illegal
   #
   if (preg_match("/\.@/",$email)) {
      echo "error .@ is invalid<br>";
      $rc.="error .@ is invalid<br>";
   }
   if (preg_match("/@\./",$email)) {
      echo "error @. is invalid<br>";
      $rc.="error @. is invalid<br>";
   }



   #
   # the email address must not begin or end with a '.' or a period
   #
   if (preg_match("/^\./",$email)) {
      echo "error begins with a period (.)<br>";
      $rc.="error begins with period (.)<br>";
   }
   if (preg_match("/\.$/",$email)) {
      echo "error ends with an period (.)<br>";
      $rc.="error ends with period (.)<br>";
   }
   #
   # the email address must not contain two periods in a row like ..
   #
   if (preg_match("/\.\./",$email)) {
      echo "error .. is invalid (.)<br>";
      $rc.="error .. or two periods next to each other is invalid<br>";
   }
   #
   # after the @ there must be one dot like
   #       xxxx@frog.com
   # so therefor
   #       xxx@frog
   # is invalid
   if (!preg_match("/@[^@\.]+\./",$email)) {
      echo "error .. is dot must follow @ like @xxx.com<br>";
      $rc.="error (.) dot must follow @ like @xxx.com<br>";
   }








   if ($rc != '') {
      $rc="'".$email."'<br>".$rc;
   }
   return $rc;
}
#
# if anything was entered then check for errors
#
$good_email_address=array();
$good_emails=0;
$bad_emails=0;
#
# if the person enteres one or more
# email addresses in the textarea 
# then process the email addresses
# and verify that they are good or bad 
# email addresses at least the syntax
# of the email address is good
#
if ($emails != ''  ) {
   #
   # split the input date into an array
   #
   $email_array= split ("\r" , $emails );
   #
   # process each email address in the array
   #
   $invalid_email_addresses='';
   foreach ($email_array as $slot) {
      #echo "processing $slot<br>";

      #
      # change commas to spaces
      # this is because i seperate email addresses with a comma
      # then if the comma is on the begining of the email address
      # or if the comma is at the end of the email address the
      # email address will be valid after leading and trailing
      # commas are removed.
      # but if the comma is in the MIDDLE of the email address
      # then it will be converted to a space and the email adress
      # will be invalid.
      # and of course that is good because since the comma key
      # is next to the period key i suspect a lot of times a
      # comma is typed instead of a period.
      #
      $slot=preg_replace("/,/"," ",$slot);
      #
      # remove ' from the email address
      # the textarea makes them \'
      #
      $slot=preg_replace("/\\\'/"," ",$slot);
      #
      # remove " from the email address
      # the textarea makes them \"
      #
      $slot=preg_replace('/\\\"/'," ",$slot);
      $slot=remove_leading_trailing_spaces($slot);
      $slot=preg_replace("/\r/","",$slot);
      $slot=preg_replace("/\n/","",$slot);
      $slot=preg_replace("/^ */","",$slot);
      $slot=preg_replace("/ *$/","",$slot);
      if ($slot != '' ) {
         $rc=validate_email_address ($slot);
         if ($rc == '' ) {
            #echo "Good Email<br>";
            #echo "push the good email address on to this array<br>";
            $good_email_address[$good_emails]=$slot;
            $good_emails++;
         }
         else {
            #echo "BAD EMAIL<br>";
            #echo "$rc<br>";
            $invalid_email_addresses.="\n".$slot;
            $bad_emails++;
         }
      }
   } 
   echo "good emails $good_emails<br>";
   echo "bad emails $bad_emails<br>";
   #
   # if we have one or more good email address
   # then try to insert them into the sql table
   #
   if ($good_emails > 0) {
      #echo "<h1>Good Emails</h1>";
      #foreach ($good_email_address as $x) {
      #   echo "&nbsp;$x<br>";
      #}
      #
      # get all the passwords we need
      #
      require('sql_passwords.php');
      # 
      # connect to SQL 
      # 
      $link = mysql_connect($z_hardcoded_sqlurl,  
                            $z_hardcoded_database,  
                            $z_hardcoded_password ) 
                            or die('Could not connect: ' . mysql_error()); 
      # 
      # select the database I want to use 
      # 
      mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
      #
      # insert each email address the person
      # typed into the text area
      # well try to insert each email address
      # the person type in. some inserts may
      # fail if that email address alread exists
      # in the sql file
      #
      $good_insert=0;
      $bad_insert=0;
      foreach ($good_email_address as $x) {
         #
         # build the insert statement
         #
         $craigs_list="no";
         if (preg_match("/@craigslist.org\$/",$x)) {
            $craigs_list="yes";
         }
         #$query = "insert into body_shops 
         #                 set email='$x',
         #                     date_created=now() ";
         $query = "insert into resumes_mailed
                          set email='$x',
                              craigslist='$craigs_list',
                              date_emailed=now() ";
         #echo "query=$query<br>";
         #
         # try to insert the email address
         #
         $result = mysql_query($query);  
         if ($result) {  
            #
            # if the insert worked do this
            #
            echo "$x<br>";  
            $good_insert++;
         }  
         else {  
            #
            # if the insert failed it means
            # that email address is already
            # in the file
            # do this for failuers
            #
            #echo "insert failed $x<br>";  
            $bad_insert++;
         }
      }
      echo "$good_insert records inserted<br>";
      echo "$bad_insert records already existed";
      # 
      # close the SQL connection 
      # 
      mysql_close($link); 
   }
}
?>
<h2 align="center">Add to resumes mailed or faxed</h2>
<form action="add_resumes_emailed_faxed.php" method="post">
<input type="submit" name=submit value="SUBMIT">
<br>
<textarea rows="10" cols="50" name="emails">
<?php
   echo $invalid_email_addresses;
?>
</textarea>
</form>

add_snip.php

TOC

<?php
 #include "0_php_functions.php";
 #dump_head('',         # set the title - default is Strategic Edge Business Alliance
 #          '',         # set default CSS to 
 #          '',        # for mortgage info click here 
 #          ''         # for pat's bio click here
 #          )

?>

<?php #include "sbd_head.php"; ?>



<?php

#
# get the ip address so we can tell where people came from
#
$my_ip_address=${REMOTE_ADDR};
#echo "$my_ip_address";
$it_worked_message="";



function remove_leading_trailing_spaces($name) {
  #
  # remove leading spaces
  #
  $name=preg_replace("/^ */","",$name);
  #
  # remove trailing spaces
  #
  $name=preg_replace("/ *\$/","",$name);
  return $name;
}


function clean_for_html($data) {
   #
   # remove < > because they can screw up HTML
   #
   $data=preg_replace("/[<>]/","",$data);
   #
   # remove junk that annoys mySQL
   #
   $data=clean_for_sql($data);
   return $data;
}

function clean_for_sql($data) {
   #
   # remove '"\ - they screw up SQL
   #
   $data=preg_replace("/['\"]/","",$data);
   $data=preg_replace("/\\\/","",$data);
   #
   # remove leading spaces
   #
   $data=preg_replace("/^ */","",$data);
   #
   # remove trailing spaces
   #
   $data=preg_replace("/ *$/","",$data);
   #
   # remove extra spaces
   #
   $data=preg_replace("/  */"," ",$data);
   $data=preg_replace("/ *$/","",$data);



   return $data;
}


#
# get the input data and clean it up
#
$name=clean_for_html($_POST["name"]);
#$name=preg_replace("/^ */","",$name);
#$name=remove_leading_trailing_spaces($name);


$best_time=clean_for_html($_POST["best_time"]);
$phone_work=clean_for_html($_POST["phone_work"]);
$phone_other=clean_for_html($_POST["phone_other"]);
$phone_home=clean_for_html($_POST["phone_home"]);
$phone_cell=clean_for_html($_POST["phone_cell"]);
$comments=clean_for_sql($_POST["comments"]);
#
# any errors
#
$errors=0;
#
$name_error="";
$subject_error="";
$comment_error="";
$best_time_error="";
$phone_error="";


#
# if anything was entered then check for errors
#
if ($name != '' || 
    $phone_home != '' || 
    $phone_work != '' || 
    $phone_cell != ''  || 
    $phone_other != ''  ||
    $best_time != '' ||
    $comments != ''  ) {
   #
   # they must enter a persons name
   # so pat can call and say
   # i want to talk to xxx
   #
   if ($name == '' ) {
      $errors++;
      $name_error="You must enter a name";
   }
   #
   # they must enter at least one phone number
   #
   if ($phone_home == '' && $phone_work == '' && $phone_cell == ''  && $phone_other == '') {
      $errors++;
      $phone_error="You must enter at least one phone number";
   }
   #
   # if no errors and
   # both the required fields are entered
   # insert the data as a new sql record
   $comments_minus_blank_lines=$comments;
   $comments_minus_blank_lines=preg_replace("/\n/","",$comments_minus_blank_lines);
   $comments_minus_blank_lines=preg_replace("/\r/","",$comments_minus_blank_lines);
}

if ($errors == 0 && $name != '') {
   #
   # insert the sql data
   #
   #echo "insert SQL here<p>";
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql insert statement
   #
   $query = 'INSERT into messages set ';
   #
   # is this record to be displayed on the web
   #
   # put a time stamp when the record was created
   #
   #$query.= " created_on=now(), ";
   #
   # add in comments or text
   #
   $query.= " comments='$comments' ";
   #
   # get their name
   #
   if ($name != '' ) {
      $query.= " , name='$name' ";
   }
   #
   # add in their telephone if they gave one
   #
   if ($phone_home != '' ) {
       $query.= " , phone_home='$phone_home' ";
   }
   if ($phone_cell != '' ) {
       $query.= " , phone_cell='$phone_cell' ";
   }
   if ($phone_work != '' ) {
       $query.= " , phone_work='$phone_work' ";
   }
   if ($phone_other != '' ) {
       $query.= " , phone_other='$phone_other' ";
   }
   if ($best_time != '' ) {
       $query.= " , best_time='$best_time' ";
   }
   #
   # put a time stamp when the record was created
   #
   $query.= " , date_created=now() ";
   #
   # save the IP address of the person that created this record
   #
   $query.= " , ip='${REMOTE_ADDR}' ";



   #
   # display the insert
   #
   #echo "Query=$query<p>";
   $result = mysql_query($query); 
   if ($result) { 
      #echo "insert worked"; 
   } 
   else { 
      echo "Something is SCREWED UP!!!!!!!!  insert failed!!!!!!!!!!!!!!!!!"; 
   }







   # 
   # close the SQL connection 
   # 
   mysql_close($link); 


   #echo "Your info has been saved.   However, Pat's really not a 'web guy', & it may be a day or two before Pat sees it.  So if you need quick action on a real estate loan, use the pager: 602-401-6506;  you'll have 60 seconds to leave a message.  But DO NOT 'punch-in' your phone #;  that doesn't work.  Just leave a message.";
   $it_worked_message="Your info has been saved.   However, Pat's really not a 'web guy', & it may be a day or two before Pat sees it.  So if you need quick action on a real estate loan, use the pager: 602-401-6506;  you'll have 60 seconds to leave a message.  But DO NOT 'punch-in' your phone #;  that doesn't work.  Just leave a message.";
   #echo  $it_worked_message;
}

#if ( $comments_minus_blank_lines == '' ) {
#   $comment_error="You must enter some text explaining your problems with xxx";
#}




function form_line($name, $data, $value, $required, $errors) {
?>
<tr valign="top">
<td align="right">
<?php
   echo $name;
   echo ":";
   if ($required == "y" || $required == "Y") {
      #echo "<br>";
      #echo "<span style=\"color:red\">";
      #echo "(required)";
      #echo "</span>";
   }
?>
</td>
<td align="left">
<input type="text"
       size="50" 
       name="<?php echo $data;?>"
       value="<?php echo $value;?>"
       >
</td>
<td>
<?php
   if ($errors != '' ) {
      echo "<span style=\"color:red\">ERROR(s)!<br>";
      echo "$errors";
      echo "</span>";
   }
   else {
      echo "&nbsp;";
   }
?>
</td>
</tr>
<?php
   return;
}



function private_button($name, $value, $text) {
?>
<tr valign="top">
<td align="right">
   &nbsp;
</td>
<td>
<input type="checkbox" 
       name="<?php echo $name;?>"
       <?php
          if ($value == "on") {
             echo " checked ";
          }
       ?>  
       >
<?php
 echo $text;
?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php
 return;
}



?>









<!-- table border="1" -->
<table border="0">
<tr>
<td colspan="3">
   <?php
      echo  $it_worked_message;
   ?>
</td>
</tr>
<form action="mortgage_info.php" method="post">
<tr>
<!-- td align="right">
</td -->
<td colspan="3">
<span style="font-size:200%;">
<b>
Pat please call me about a loan
as soon as possible.
</b>
</span>
</td>
</tr>



<tr>
<td align="right">
&nbsp;
</td>
<td colspan="2">
&nbsp;
</td>
</tr>
<?php
   #form_line('Subject', 'subject', $subject, 'y', $subject_error);
   form_line('Name', 'name', $name, 'y', $name_error);
   #form_line('E-mail', 'email', $email, 'n', $email_error);
   form_line('Home Phone', 'phone_home', $phone_home, 'n', $phone_error);
   form_line('Work Phone', 'phone_work', $phone_work, 'n', $phone_error);
   form_line('Cell Phone', 'phone_cell', $phone_cell, 'n', $phone_error);
   form_line('Other Phone', 'phone_other', $phone_other, 'n', $phone_error);
   form_line('<nobr>Best time and number to call</nobr>', 'best_time', $best_time, 'n', $best_time_error);
   #private_button('private_email', $private_email, 'x');
   #form_line('Telephone', 'phone', $phone, 'n', '');
   #private_button('private_phone', $private_phone, 'y');
   #form_line('URL', 'url', $url, 'n', '');
   #form_line('Address 1', 'address1', $address1, 'n', '');
   #form_line('Address 2', 'address2', $address2, 'n', '');
   #form_line('City', 'city', $city, 'n', '');
   #form_line('State<br>Provence', 'state', $state, 'n', '');
   #form_line('Zip code<br>Postal Code', 'zip', $zip ,'n', '');
   #form_line('Country', 'country',$country, 'n', '');

?>


<tr valign="top">
<td>
<!-- Pat please tell me about this stuff -->
</td>
<td colspan="2">
<?php
   #if ($comment_error != '') {
   #   echo "<span style=\"color:red\">";
   #   echo "ERRORS: ";
   #   echo "$comment_error";
   #   echo "</span>";
   #   echo "<br>";
   #}
?>
<!-- textarea name="comments" cols="50" rows="10" -->
<!-- ?php echo $comments;? -->
<!-- /textarea -->
</td>
</tr>




<tr>
<td align="right">
&nbsp;

</td>
<td colspan="2">
<input type="submit" name=submit value="SUBMIT">
</td>
</tr>







</form>
</table>







<?php
 #
 # print the end of each web page
 #
 #dump_tail()
?>

cartoons

TOC

change_it.php

TOC

<?php

   $id=$_GET["id"];
   $type=$_GET["type"];
   $what_to_list=$_GET["what_to_list"];
   $how_to_sort=$_GET["how_to_sort"];
   #echo "List=$what_to_list<p>";
   #echo "Sort=$how_to_sort<p>";
   #echo "id=$id type=$type<p>";
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   #echo "url= $z_hardcoded_sqlurl<br>";  
   #echo "database =$z_hardcoded_database<br>";  
   #echo "pass= $z_hardcoded_password<br>"; 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to do the update
   #
   $query = "update messages set status='$type', date_closed=now() where id='$id'"; 
   #echo "query=$query <p>";
   #
   # display the select
   #
   #echo "Query=$query<p>";

   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   #echo "query worked<br>";
   # 
   # close the SQL connection 
   # 
   mysql_close($link);
   include 'list.php'; 
   exit;
?>

change_it_fax.php

TOC

<?php

   $id=$_GET["id"];
   $type=$_GET["type"];
   $what_to_list=$_GET["what_to_list"];
   $how_to_sort=$_GET["how_to_sort"];
   #echo "List=$what_to_list<p>";
   #echo "Sort=$how_to_sort<p>";
   #echo "id=$id type=$type<p>";
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   #echo "url= $z_hardcoded_sqlurl<br>";  
   #echo "database =$z_hardcoded_database<br>";  
   #echo "pass= $z_hardcoded_password<br>"; 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to do the update
   #
   $query = "update messages set status='$type', date_closed=now() where id='$id'"; 
   #echo "query=$query <p>";
   #
   # display the select
   #
   #echo "Query=$query<p>";

   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   #echo "query worked<br>";
   # 
   # close the SQL connection 
   # 
   mysql_close($link);
   include 'list_fax.php'; 
   exit;
?>

clean_ceweekly_email.php

TOC

<?php
 include "0_php_functions.php";
 $invalid_email_addresses="";
 #
 # get the ip address so we can tell where people came from
 #
 $my_ip_address=${REMOTE_ADDR};
 $emails=$_POST["emails"];
 #
 # get rid of the \ before \', \" \\
 # which gets added on text input forms
 #
 $emails=preg_replace("/\\\(.)/","$1",$emails); 
 #
 # remove <, >, :, and  ' and change to new lines
 # : is used in mailto:email@address.com
 #
 $emails=preg_replace("/[<>:']/","\n",$emails);
 #
 # remove " and change to new lines
 #
 $emails=preg_replace('/"/',"\n",$emails);
 $email_array=array();
 #$email_array= split ("\r" , $emails );
 $email_array=split("\n",$emails);
 $email_out="";
 foreach ($email_array as $slot) {
    if (preg_match("/@/",$slot)) { 
       $email_out.=$slot."\n";
    } 
 }
 $emails=$email_out;
?>
<h2 align="center">Remove E-mail addresses from HTML</h2>
<form action="clean_ceweekly_email.php" method="post">
<input type="submit" name=submit value="SUBMIT">
<br>
<textarea rows="10" cols="50" name="emails">
<?php

   echo $emails;
   #echo $invalid_email_addresses;
?>
</textarea>
</form>

clean_ceweekly_email.pl

TOC

#!/usr/bin/perl
require CGI;
use CGI;
my $cgi = new CGI;
my $passno=$cgi->param('passno');
my $emails=$cgi->param('emails');
my $last;
my @datalist=();
$emails=~s/[ <>:'"]/\r/gim;
$emails=~s/\n/\r/gim;
@datalist=split('\r',$emails);
$emails="";
$last="";
foreach(@datalist) {
  if ($_ =~ /@/) {
     if ($_ ne $last ) {
         if ($emails eq "" ) {
            $emails=$_;
            $emails.="\n";
         }
         else {
            $emails.=$_;
            $emails.="\n";
         }
         $last=$_;
     }
  }
}
print "Content-type: text/html", "\n\n";
print "<html>\n";
print "<h2 align=\"center\">Remove E-mail addresses from HTML</h2>";
print "<form action=\"clean_ceweekly_email.pl\" method=\"post\">";
print "<input type=\"submit\" name=submit value=\"SUBMIT\">";
&pass_number(0, $passno); 
&pass_number(1, $passno);
&pass_number(2, $passno);
&pass_number(3, $passno);
&pass_number(4, $passno);
&pass_number(5, $passno);
&pass_number(6, $passno); 
print "<br>";
print "<textarea rows=\"10\" cols=\"50\" name=\"emails\">";
print "$emails";
print "</textarea>";
print "</form>";
#my @datalist=split('\r',$filenames);
#my @datalist=split(/[\r\n]/,$filenames);
#foreach(@datalist) {
#   print "$_<br>";
#}
#
exit;

sub is_it_checked {
   my $rc="";
   my $button=@_[0];
   my $value=@_[1];
   #print "button=$button<br>";
   #print "value=$value<br>";
   if ($button eq $value ) {
      $rc=" checked ";
   }
   return $rc;
}


sub pass_number {
   my $rc="";
   my $pass=@_[0];
   my $value=@_[1];
   print "<input type=\"radio\" name=\"passno\" ";
   print " value=\"$pass\" ";
   if ($pass == $value ) {
      print " checked ";
   }
   print " >\n"; 
   return $rc;
}





#<?php
# include "0_php_functions.php";
# $invalid_email_addresses="";
 #
 # get the ip address so we can tell where people came from
 #
# $my_ip_address=${REMOTE_ADDR};
# $emails=$_POST["emails"];
 #
 # get rid of the \ before \', \" \\
 # which gets added on text input forms
 #
# $emails=preg_replace("/\\\(.)/","$1",$emails); 
# $passno=$_POST["passno"];
# if ($passno == '') {
#    $passno=0;
# }
# else { 
#    if ($passno == 0) {
#       $passno++;
#       #
#       # remove <, >, :, and  ' and change to new lines
#       # : is used in mailto:email@address.com
#       #
#       $emails=preg_replace("/[<>:']/","\n",$emails);
#    }
#    else {
#       if ($passno == 1) {
#          $passno++;
#          #
#          # remove " and change to new lines
#          #
#          $emails=preg_replace('/"/',"\n",$emails);
#       }
#       else {#
#          if ($passno == 2) {
#             $passno++;
#             #
#             # remove mutiple spaces
#             #
#             $emails=preg_replace("/  */"," ",$emails);
#          }
#          else {
#
#             if ($passno == 3) {
#                $passno++;
#                #
#                # remove " and change to new lines
#                #
#                $emails=preg_replace("/^ */","",$emails);
#                #$emails=preg_replace("/\r\r* /","\r",$emails);#
#                #$emails=preg_replace("/\n\n */","\n",$emails);
#                #$emails=preg_replace("/\\n\\n */","\n",$emails);
#                #$emails=preg_replace("/\\r\\r */","\r",$emails);
#             }
#             else {#
#
#                if ($passno == 4) {
#                   $passno++;
#                   #
#                   # remove " and change to new lines
#                   #
#                   $email_array=array();
#                   ##$email_array= split ("\r" , $emails );
#                   $email_array=split("\n",$emails);
#                   #$email_out="";
#                   #$emails=preg_replace("/^ *$/","",$email_array,1);
#                   #foreach ($email_array as $slot) {
#                   #   #if (preg_match("/@/",$slot)) { 
#                   #   if (!preg_match("/^ *$/",$slot)) { 
#                   #      $email_out.=$slot."\n";
#                   #   } 
#                   #}
#                   #$emails=$email_out;
#                   #$emails=preg_replace("/^ */","",$emails);
#                }#
#
#
#
#
#
#             }
#
#
#          }
#
#
#
#
#       }
#
#
#
#    }
# }
#
# #$email_array=array();
# ##$email_array= split ("\r" , $emails );
# #$email_array=split("\n",$emails);
# #$email_out="";
# #foreach ($email_array as $slot) {
# #   if (preg_match("/@/",$slot)) { 
# #      $email_out.=$slot."\n";
# #   } 
# #}
# #$emails=$email_out;
#?>
#<h2 align="center">Remove E-mail addresses from HTML</h2>
#<form action="clean_ceweekly_n_pass.php" method="post">
#<input type="submit" name=submit value="SUBMIT">
#<input type="radio" name="passno"  value="0" 
#     <?php if ($passno == '0' || $passno == '' ) {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="1" 
#     <?php if ($passno == '1') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="2" 
#     <?php if ($passno == '2') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="3" 
#     <?php if ($passno == '3') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="4" 
#     <?php if ($passno == '4') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="5" 
#     <?php if ($passno == '5') {echo "checked"; } ?> > 
#<br>
#<textarea rows="10" cols="50" name="emails">
#<?php
#
#   echo $emails;
#   #echo $invalid_email_addresses;
#?>
#</textarea>
#</form>

clean_ceweekly_email_00.pl

TOC

#!/usr/bin/perl
require CGI;
use CGI;
my $cgi = new CGI;
#my $filenames=$cgi->param('filenames');
my $passno=$cgi->param('passno');
my $emails=$cgi->param('emails');
my $last;





if ($passno eq '') {
    $passno=0;
}
else { 
    if ($passno == 0) {
       $passno++;
       #
       # remove <, >, :, and  ' and change to new lines
       # : is used in mailto:email@address.com
       #
       $emails=~s/[<>:'"]/\n/gim;
    }
    else {
       if ($passno == 1) {
          $passno++;
          #
          # remove <, >, :, and  ' and change to new lines
          # : is used in mailto:email@address.com
          #
          $emails=~s/^ *$//gim;
       }
       else {
          if ($passno == 2) {
             $passno++;
             #
             # remove <, >, :, and  ' and change to new lines
             # : is used in mailto:email@address.com
             #
             #$emails=~s/\r\r/\r/gim;
             #$emails=~s/\n\n/\n/gim;
             my @datalist=split('\r',$emails);
             $emails="";
             $last="";
             foreach(@datalist) {
                if ($_ =~ /@/) {
                   if ($_ ne $last ) {
                      $emails.=$_;
                      $last=$_;
                   }
                }
             }

          }
       }
    }
}







print "Content-type: text/html", "\n\n";
print "<html>\n";
print "<h2 align=\"center\">Remove E-mail addresses from HTML</h2>";
print "<form action=\"clean_ceweekly_email.pl\" method=\"post\">";
print "<input type=\"submit\" name=submit value=\"SUBMIT\">";
#print "<input type=\"radio\" name=\"passno\"  value=\"0\" ";
#if ($passno == 0 || $passno eq '' ) {
#   print " checked ";
#}
#print ">";
&pass_number(0, $passno); 
&pass_number(1, $passno);
&pass_number(2, $passno);
&pass_number(3, $passno);
&pass_number(4, $passno);
&pass_number(5, $passno);
&pass_number(6, $passno);



#<input type="radio" name="passno"  value="1" 
#     <?php if ($passno == '1') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="2" 
#     <?php if ($passno == '2') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="3" 
#     <?php if ($passno == '3') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="4" 
#     <?php if ($passno == '4') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="5" 
#     <?php if ($passno == '5') {echo "checked"; } ?> > 
print "<br>";
print "<textarea rows=\"10\" cols=\"50\" name=\"emails\">    ";
print "$emails";
print "</textarea>";
print "</form>";
#my @datalist=split('\r',$filenames);
#my @datalist=split(/[\r\n]/,$filenames);
#foreach(@datalist) {
#   print "$_<br>";
#}
#
exit;

sub is_it_checked {
   my $rc="";
   my $button=@_[0];
   my $value=@_[1];
   #print "button=$button<br>";
   #print "value=$value<br>";
   if ($button eq $value ) {
      $rc=" checked ";
   }
   return $rc;
}


sub pass_number {
   my $rc="";
   my $pass=@_[0];
   my $value=@_[1];
   print "<input type=\"radio\" name=\"passno\" ";
   print " value=\"$pass\" ";
   if ($pass == $value ) {
      print " checked ";
   }
   print " >\n"; 
   return $rc;
}





#<?php
# include "0_php_functions.php";
# $invalid_email_addresses="";
 #
 # get the ip address so we can tell where people came from
 #
# $my_ip_address=${REMOTE_ADDR};
# $emails=$_POST["emails"];
 #
 # get rid of the \ before \', \" \\
 # which gets added on text input forms
 #
# $emails=preg_replace("/\\\(.)/","$1",$emails); 
# $passno=$_POST["passno"];
# if ($passno == '') {
#    $passno=0;
# }
# else { 
#    if ($passno == 0) {
#       $passno++;
#       #
#       # remove <, >, :, and  ' and change to new lines
#       # : is used in mailto:email@address.com
#       #
#       $emails=preg_replace("/[<>:']/","\n",$emails);
#    }
#    else {
#       if ($passno == 1) {
#          $passno++;
#          #
#          # remove " and change to new lines
#          #
#          $emails=preg_replace('/"/',"\n",$emails);
#       }
#       else {#
#          if ($passno == 2) {
#             $passno++;
#             #
#             # remove mutiple spaces
#             #
#             $emails=preg_replace("/  */"," ",$emails);
#          }
#          else {
#
#             if ($passno == 3) {
#                $passno++;
#                #
#                # remove " and change to new lines
#                #
#                $emails=preg_replace("/^ */","",$emails);
#                #$emails=preg_replace("/\r\r* /","\r",$emails);#
#                #$emails=preg_replace("/\n\n */","\n",$emails);
#                #$emails=preg_replace("/\\n\\n */","\n",$emails);
#                #$emails=preg_replace("/\\r\\r */","\r",$emails);
#             }
#             else {#
#
#                if ($passno == 4) {
#                   $passno++;
#                   #
#                   # remove " and change to new lines
#                   #
#                   $email_array=array();
#                   ##$email_array= split ("\r" , $emails );
#                   $email_array=split("\n",$emails);
#                   #$email_out="";
#                   #$emails=preg_replace("/^ *$/","",$email_array,1);
#                   #foreach ($email_array as $slot) {
#                   #   #if (preg_match("/@/",$slot)) { 
#                   #   if (!preg_match("/^ *$/",$slot)) { 
#                   #      $email_out.=$slot."\n";
#                   #   } 
#                   #}
#                   #$emails=$email_out;
#                   #$emails=preg_replace("/^ */","",$emails);
#                }#
#
#
#
#
#
#             }
#
#
#          }
#
#
#
#
#       }
#
#
#
#    }
# }
#
# #$email_array=array();
# ##$email_array= split ("\r" , $emails );
# #$email_array=split("\n",$emails);
# #$email_out="";
# #foreach ($email_array as $slot) {
# #   if (preg_match("/@/",$slot)) { 
# #      $email_out.=$slot."\n";
# #   } 
# #}
# #$emails=$email_out;
#?>
#<h2 align="center">Remove E-mail addresses from HTML</h2>
#<form action="clean_ceweekly_n_pass.php" method="post">
#<input type="submit" name=submit value="SUBMIT">
#<input type="radio" name="passno"  value="0" 
#     <?php if ($passno == '0' || $passno == '' ) {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="1" 
#     <?php if ($passno == '1') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="2" 
#     <?php if ($passno == '2') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="3" 
#     <?php if ($passno == '3') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="4" 
#     <?php if ($passno == '4') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="5" 
#     <?php if ($passno == '5') {echo "checked"; } ?> > 
#<br>
#<textarea rows="10" cols="50" name="emails">
#<?php
#
#   echo $emails;
#   #echo $invalid_email_addresses;
#?>
#</textarea>
#</form>

clean_ceweekly_email_01.pl

TOC

#!/usr/bin/perl
require CGI;
use CGI;
my $cgi = new CGI;
my $passno=$cgi->param('passno');
my $emails=$cgi->param('emails');
my $last;
my @datalist=();
$emails=~s/[ <>:'"]/\r/gim;
$emails=~s/\n/\r/gim;
@datalist=split('\r',$emails);
$emails="";
$last="";
foreach(@datalist) {
  if ($_ =~ /@/) {
     if ($_ ne $last ) {
         if ($emails eq "" ) {
            $emails=$_;
            $emails.="\n";
         }
         else {
            $emails.=$_;
            $emails.="\n";
         }
         $last=$_;
     }
  }
}
print "Content-type: text/html", "\n\n";
print "<html>\n";
print "<h2 align=\"center\">Remove E-mail addresses from HTML</h2>";
print "<form action=\"clean_ceweekly_email.pl\" method=\"post\">";
print "<input type=\"submit\" name=submit value=\"SUBMIT\">";
&pass_number(0, $passno); 
&pass_number(1, $passno);
&pass_number(2, $passno);
&pass_number(3, $passno);
&pass_number(4, $passno);
&pass_number(5, $passno);
&pass_number(6, $passno); 
print "<br>";
print "<textarea rows=\"10\" cols=\"50\" name=\"emails\">";
print "$emails";
print "</textarea>";
print "</form>";
#my @datalist=split('\r',$filenames);
#my @datalist=split(/[\r\n]/,$filenames);
#foreach(@datalist) {
#   print "$_<br>";
#}
#
exit;

sub is_it_checked {
   my $rc="";
   my $button=@_[0];
   my $value=@_[1];
   #print "button=$button<br>";
   #print "value=$value<br>";
   if ($button eq $value ) {
      $rc=" checked ";
   }
   return $rc;
}


sub pass_number {
   my $rc="";
   my $pass=@_[0];
   my $value=@_[1];
   print "<input type=\"radio\" name=\"passno\" ";
   print " value=\"$pass\" ";
   if ($pass == $value ) {
      print " checked ";
   }
   print " >\n"; 
   return $rc;
}





#<?php
# include "0_php_functions.php";
# $invalid_email_addresses="";
 #
 # get the ip address so we can tell where people came from
 #
# $my_ip_address=${REMOTE_ADDR};
# $emails=$_POST["emails"];
 #
 # get rid of the \ before \', \" \\
 # which gets added on text input forms
 #
# $emails=preg_replace("/\\\(.)/","$1",$emails); 
# $passno=$_POST["passno"];
# if ($passno == '') {
#    $passno=0;
# }
# else { 
#    if ($passno == 0) {
#       $passno++;
#       #
#       # remove <, >, :, and  ' and change to new lines
#       # : is used in mailto:email@address.com
#       #
#       $emails=preg_replace("/[<>:']/","\n",$emails);
#    }
#    else {
#       if ($passno == 1) {
#          $passno++;
#          #
#          # remove " and change to new lines
#          #
#          $emails=preg_replace('/"/',"\n",$emails);
#       }
#       else {#
#          if ($passno == 2) {
#             $passno++;
#             #
#             # remove mutiple spaces
#             #
#             $emails=preg_replace("/  */"," ",$emails);
#          }
#          else {
#
#             if ($passno == 3) {
#                $passno++;
#                #
#                # remove " and change to new lines
#                #
#                $emails=preg_replace("/^ */","",$emails);
#                #$emails=preg_replace("/\r\r* /","\r",$emails);#
#                #$emails=preg_replace("/\n\n */","\n",$emails);
#                #$emails=preg_replace("/\\n\\n */","\n",$emails);
#                #$emails=preg_replace("/\\r\\r */","\r",$emails);
#             }
#             else {#
#
#                if ($passno == 4) {
#                   $passno++;
#                   #
#                   # remove " and change to new lines
#                   #
#                   $email_array=array();
#                   ##$email_array= split ("\r" , $emails );
#                   $email_array=split("\n",$emails);
#                   #$email_out="";
#                   #$emails=preg_replace("/^ *$/","",$email_array,1);
#                   #foreach ($email_array as $slot) {
#                   #   #if (preg_match("/@/",$slot)) { 
#                   #   if (!preg_match("/^ *$/",$slot)) { 
#                   #      $email_out.=$slot."\n";
#                   #   } 
#                   #}
#                   #$emails=$email_out;
#                   #$emails=preg_replace("/^ */","",$emails);
#                }#
#
#
#
#
#
#             }
#
#
#          }
#
#
#
#
#       }
#
#
#
#    }
# }
#
# #$email_array=array();
# ##$email_array= split ("\r" , $emails );
# #$email_array=split("\n",$emails);
# #$email_out="";
# #foreach ($email_array as $slot) {
# #   if (preg_match("/@/",$slot)) { 
# #      $email_out.=$slot."\n";
# #   } 
# #}
# #$emails=$email_out;
#?>
#<h2 align="center">Remove E-mail addresses from HTML</h2>
#<form action="clean_ceweekly_n_pass.php" method="post">
#<input type="submit" name=submit value="SUBMIT">
#<input type="radio" name="passno"  value="0" 
#     <?php if ($passno == '0' || $passno == '' ) {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="1" 
#     <?php if ($passno == '1') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="2" 
#     <?php if ($passno == '2') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="3" 
#     <?php if ($passno == '3') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="4" 
#     <?php if ($passno == '4') {echo "checked"; } ?> > 
#<input type="radio" name="passno"  value="5" 
#     <?php if ($passno == '5') {echo "checked"; } ?> > 
#<br>
#<textarea rows="10" cols="50" name="emails">
#<?php
#
#   echo $emails;
#   #echo $invalid_email_addresses;
#?>
#</textarea>
#</form>

clean_ceweekly_n_pass.php

TOC

<?php
 include "0_php_functions.php";
 $invalid_email_addresses="";
 #
 # get the ip address so we can tell where people came from
 #
 $my_ip_address=${REMOTE_ADDR};
 $emails=$_POST["emails"];
 #
 # get rid of the \ before \', \" \\
 # which gets added on text input forms
 #
 $emails=preg_replace("/\\\(.)/","$1",$emails); 
 $passno=$_POST["passno"];
 if ($passno == '') {
    $passno=0;
 }
 else { 
    if ($passno == 0) {
       $passno++;
       #
       # remove <, >, :, and  ' and change to new lines
       # : is used in mailto:email@address.com
       #
       $emails=preg_replace("/[<>:']/","\n",$emails);
    }
    else {
       if ($passno == 1) {
          $passno++;
          #
          # remove " and change to new lines
          #
          $emails=preg_replace('/"/',"\n",$emails);
       }
       else {
          if ($passno == 2) {
             $passno++;
             #
             # remove mutiple spaces
             #
             $emails=preg_replace("/  */"," ",$emails);
          }
          else {

             if ($passno == 3) {
                $passno++;
                #
                # remove " and change to new lines
                #
                $emails=preg_replace("/^ */","",$emails);
                #$emails=preg_replace("/\r\r* /","\r",$emails);
                #$emails=preg_replace("/\n\n */","\n",$emails);
                #$emails=preg_replace("/\\n\\n */","\n",$emails);
                #$emails=preg_replace("/\\r\\r */","\r",$emails);
             }
             else {

                if ($passno == 4) {
                   $passno++;
                   #
                   # remove " and change to new lines
                   #
                   $email_array=array();
                   ##$email_array= split ("\r" , $emails );
                   $email_array=split("\n",$emails);
                   #$email_out="";
                   #$emails=preg_replace("/^ *$/","",$email_array,1);
                   #foreach ($email_array as $slot) {
                   #   #if (preg_match("/@/",$slot)) { 
                   #   if (!preg_match("/^ *$/",$slot)) { 
                   #      $email_out.=$slot."\n";
                   #   } 
                   #}
                   #$emails=$email_out;
                   #$emails=preg_replace("/^ */","",$emails);
                }





             }


          }




       }



    }
 }

 #$email_array=array();
 ##$email_array= split ("\r" , $emails );
 #$email_array=split("\n",$emails);
 #$email_out="";
 #foreach ($email_array as $slot) {
 #   if (preg_match("/@/",$slot)) { 
 #      $email_out.=$slot."\n";
 #   } 
 #}
 #$emails=$email_out;
?>
<h2 align="center">Remove E-mail addresses from HTML</h2>
<form action="clean_ceweekly_n_pass.php" method="post">
<input type="submit" name=submit value="SUBMIT">
<input type="radio" name="passno"  value="0" 
     <?php if ($passno == '0' || $passno == '' ) {echo "checked"; } ?> > 
<input type="radio" name="passno"  value="1" 
     <?php if ($passno == '1') {echo "checked"; } ?> > 
<input type="radio" name="passno"  value="2" 
     <?php if ($passno == '2') {echo "checked"; } ?> > 
<input type="radio" name="passno"  value="3" 
     <?php if ($passno == '3') {echo "checked"; } ?> > 
<input type="radio" name="passno"  value="4" 
     <?php if ($passno == '4') {echo "checked"; } ?> > 
<input type="radio" name="passno"  value="5" 
     <?php if ($passno == '5') {echo "checked"; } ?> > 
<br>
<textarea rows="10" cols="50" name="emails">
<?php

   echo $emails;
   #echo $invalid_email_addresses;
?>
</textarea>
</form>

control-panel

TOC

control-panel.html

TOC

<html>
<head>
<meta http-equiv="REFRESH" content="0;url=control-panel.php"></HEAD>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
<BODY>
This page is now at <a href="control-panel.php">control-panel.php</a>
</BODY>
</HTML>



control-panel.php

TOC

<html>
<head>
<title>Strategic Edge Business Alliance</title>
<!-- LINK rel="stylesheet" href="/0____css.css" type="text/css" -->
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<!-- body background="ginger_background2.jpg" -->
<!-- body background="both_background.jpg" -->
<!-- body background="new-otis-background.jpg" -->
<!-- body background="new-otis-background2.jpg" -->
<?php
  $dogs=array('ginger_background2.jpg',
              'ginger_background.jpg',
              'sginger1.jpg',
              'sginger2.jpg',
              'sotis1.jpg',
              'sotis2.jpg',
              'background_12s.jpg',
              'new-otis-background.jpg',
              'new-otis-background2.jpg',
              'both_background.jpg');


  #$ahorrita=time()%10;
  $ahorrita=time()%sizeof($dogs);
  #echo $ahorrita;
  echo '<body background="';
  echo $dogs[$ahorrita];
  echo '">';
?>



<h1 align="center">Strategic Edge Business Alliance</h1>
<h2 align="center">Control Panel</h2>
<ol>
<li><a href="http://cp.100ws.com/members/login.php">Log in to patsch196 to edit web pages</a>
    <ul>
        <li>Edit next meeting on <a href="index.php" target="index.php">home page</a><br>path is:<br>
            &nbsp;&nbsp;&nbsp;www<br>
            &nbsp;&nbsp;&nbsp;strategic-edge.org<br>
            File is<br>
            &nbsp;&nbsp;&nbsp;index.php
    </ul>


<li><a href="create_minutes.php">Create the next minutes web page</a>
<li><a href="delete_minutes.php">Delete minutes</a> I screwed up and created a minutes page for the wrong date and want to delete it!

<li><a href="list.php">prospects from website</a>
<li>This is your <a href="friends.php">friends</a> web page.
    <br>You can add or delete friends by clicking here
    <a href="friends_add_delete.php">here</a>
<li><a href="email_newsletter.php">E-mail Newsletter, E-mail Press Releases, E-mail ASBA members</a>
<li><a href="list_fax.php?what_to_list=fax_add">fax # capture page</a>
<li><a href="list_fax.php?what_to_list=fax_delete">Remove faxes</a>
<li><a href="list_email.php">List/Delete e-mail ASBA and other subscribers</a>
<li><a href="http://strategic-edge.org/add_email.php?type=email_delete">Delete ASBA members from newsletter email list</a>
<li><a href="add_new_member_email.php">Add e-mail addresses for new members</a>

<li><a href="list_deleted_email.php">List deleted e-mail addresses of  subscribers</a>
<li><a href="list_press_releases.php">List/Delete e-mail addresses used for press releases</a>
<li><a href="add_press_release_email.php">Add e-mail addresses for press releases</a>





<li><a href="quotes.php">Quotes</a>
<li><a href="http://www.e2.u-net.com/htaccess/make.htm">Create userid/password for .htaccess file</a>


<li>&nbsp;<table width="100%" border=0><tr><td width="33%">
    <a href="play-pen.php">play-pen.php</a> if you have 
    some HTML you want to test and see how it works you 
    can use this file to test it. that way if you screw 
    something up it wont hurt anything.
    </td><td width="67%">&nbsp;</td></tr></table>




<li>Send an e-mail to 
<a href="http://miksup.100webspace.net/class/email_rulers.php">E-mail government rulers</a>
   (won't work till you become a paying customer)


<li><a href="create_minutes.php">Create a new minutes web page</a>


</ol>
</body>
</html>

create_minutes.php

TOC

<?php
 include "0_php_functions.php";
 include "0_php_functions_minutes.php";

 function save_stinking_data($data,$file) {
    #
    # set the return code to zero
    #
    $rc=0;
    #
    # if they entered something save it!
    # if they didn't enter anything then DONT save it
    #
    if ($data != "" ) {
       #
       # open the file for writting
       #
       $handle=fopen($file,'wb');  
       #
       # write the data to the stinking file
       #
       $rc=fwrite($handle,$data);
       #
       # close the stinking file
       #  
       fclose($handle);
    }
    #
    # return the number of bytes written
    #
    return $rc;
 }





 #$programs=array();
 $height_iframe=5000;
 $rows=20;
 $cols=80;
 $start_year=date("y");
 $start_year*=1;
 if( $start_year > 8 ) {
    $start_year--;
 }
 #if (preg_match("/^[0-9]$/i",$start_year)) {
 #   $start_year="0$start_year";
 #} 
 $end_year=$start_year+30;
 $nextspeaker=$_POST['nextspeaker'];
 #
 # if the nextspeaker is null then
 # get the one from the file
 #
 if ($nextspeaker == "" ) {
    $nextspeaker=file_get_contents('next_speaker.txt');
 }
 $month=$_POST['month'];
 $day=$_POST['day'];
 $year=$_POST['year'];
 $roman1=$_POST['roman1'];
 #
 # if the names of the people that attended 
 # the last meeting is null then
 # get the names of the people that attended from the file
 # $roman1 is the names of the people that attended the last meeting
 #
 if ($roman1 == "" ) {
    $roman1=file_get_contents('next_last_attended.txt');
 }
 $roman2=$_POST['roman2'];
 #
 # if minutes are null then 
 # get the minutes of the last meeting from the file
 # $roman2 is the minutes of the last meeting
 #
 if ($roman2 == "" ) {
    $roman2=file_get_contents('next_minutes_text.txt');
 }
 $roman4=$_POST['roman4'];
 #
 # if the nextspeakers are null then
 # get the nextspeakers from the file
 # $roman4 is the nextspeakers in this program
 #
 if ($roman4 == "" ) {
    $roman4=file_get_contents('next_speakers.txt');
 }





 $roman5=$_POST['roman5'];
 $roman1=clean_slashes($roman1);
 $roman2=clean_slashes($roman2);
 $roman4=clean_slashes($roman4);
 $roman5=clean_slashes($roman5);
 $nextspeaker=clean_slashes($nextspeaker);

 $nextmonth=$_POST['nextmonth'];
 $nextday=$_POST['nextday'];
 $nextweekday=$_POST['nextweekday'];
 if ($nextweekday == '') {
    $nextweekday='Thursday';
 }
 $nextyear=$_POST['nextyear'];
 $days=array('Monday', 
             'Tuesday', 
             'Wednesday', 
             'Thursday', 
             'Friday', 
             'Saturday', 
             'Sunday');


  
  #next_day_of_week.txt  
  #next_speaker.txt   
  #next_speakers.txt 

  #$nextmonth
  #$nextday
  #$nextspeaker
  #$nextyear
  #$nextweekday
  if ($nextmonth != "" && $nextday != "" && $nextyear != "") {
     save_stinking_data("$nextmonth/$nextday/$nextyear",'next_date_of_year.txt');
  }
  save_stinking_data($nextweekday,'next_day_of_week.txt');
  save_stinking_data($nextspeaker,'next_speaker.txt');
  save_stinking_data($roman4,'next_speakers.txt');


  save_stinking_data($roman1,'next_last_attended.txt');
  save_stinking_data($roman2,'next_minutes_text.txt');





 function am_i_selected($value, $name) {
    $rc="";
    if ($value == $name) {
       $rc=" selected ";
    }
    return $rc;
 }



?>
<html>
<head>
<title> Create a new Strategic Edge Business Alliance minutes web page </title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>

<h2 align="center">Send out Press Releases or Junk E-mails</h2>
<a href="email_newsletter.php">Send Press Releases or Junk E-mail</a>
<br>
<a href="list.php">Customer Capture</a>
<br>
<a href="add_new_member_email.php">New add's to email list</a>
<br>
<a href="add_email.php?type=email_delete">Delete ASBA members from newsletter email list </a>
<br>
<a href="control-panel.php">Control Panel</a>
<br>
<a href="list_email.php">Member Info</a>
<br>
Statistics on hits <a href="stuff_to_delete/1.mht">1</a>
                   <a href="stuff_to_delete/2.mht">2</a>
                   Mike this is MIME - uncompress it!!!!














<h2 align="center">Create a new Strategic Edge Business Alliance minutes web page</h2>
<form action="create_minutes.php" method="post"> 
<input type="submit" name=submit value="Create Minutes Web Page"><br>
Create minutes for
<select name="month">
<option value="01" <?php echo am_i_selected("01", $month); ?>>Jan</option>
<option value="02" <?php echo am_i_selected("02", $month); ?>>Feb</option>
<option value="03" <?php echo am_i_selected("03", $month); ?>>Mar</option>
<option value="04" <?php echo am_i_selected("04", $month); ?>>Apr</option>
<option value="05" <?php echo am_i_selected("05", $month); ?>>May</option>
<option value="06" <?php echo am_i_selected("06", $month); ?>>Jun</option>
<option value="07" <?php echo am_i_selected("07", $month); ?>>July</option>
<option value="08" <?php echo am_i_selected("08", $month); ?>>Aug</option>
<option value="09" <?php echo am_i_selected("09", $month); ?>>Sep</option>
<option value="10" <?php echo am_i_selected("10", $month); ?>>Oct</option>
<option value="11" <?php echo am_i_selected("11", $month); ?>>Nov</option>
<option value="12" <?php echo am_i_selected("12", $month); ?>>Dec</option>
</select>
<select name="day">
<?php

   for ($i=1;$i<=31;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $day); 
      echo ">";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>
<?php #echo "start year=$start_year end_year=$end_year<br>"; ?>
<select name="year">
<?php
   #for ($i=8;$i<=20;$i++) {
   for ($i=$start_year;$i<=$end_year;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $year); 
      echo ">";
      echo "20";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>

Next Meeting 
<select name="nextweekday">
<?php
   foreach($days as $hoydia) {
      echo '<option value="';
      echo $hoydia;
      echo '" ';
      echo am_i_selected("$hoydia", $nextweekday);
      echo ' >';
      echo $hoydia;
      echo '</option>';

   }
?>
</select>




<select name="nextmonth">
<option value="01" <?php echo am_i_selected("01", $nextmonth); ?>>Jan</option>
<option value="02" <?php echo am_i_selected("02", $nextmonth); ?>>Feb</option>
<option value="03" <?php echo am_i_selected("03", $nextmonth); ?>>Mar</option>
<option value="04" <?php echo am_i_selected("04", $nextmonth); ?>>Apr</option>
<option value="05" <?php echo am_i_selected("05", $nextmonth); ?>>May</option>
<option value="06" <?php echo am_i_selected("06", $nextmonth); ?>>Jun</option>
<option value="07" <?php echo am_i_selected("07", $nextmonth); ?>>July</option>
<option value="08" <?php echo am_i_selected("08", $nextmonth); ?>>Aug</option>
<option value="09" <?php echo am_i_selected("09", $nextmonth); ?>>Sep</option>
<option value="10" <?php echo am_i_selected("10", $nextmonth); ?>>Oct</option>
<option value="11" <?php echo am_i_selected("11", $nextmonth); ?>>Nov</option>
<option value="12" <?php echo am_i_selected("12", $nextmonth); ?>>Dec</option>
</select>
<select name="nextday">
<?php

   for ($i=1;$i<=31;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $nextday); 
      echo ">";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>
<select name="nextyear">
<?php
   #for ($i=8;$i<=20;$i++) {
   for ($i=$start_year;$i<=$end_year;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $nextyear); 
      echo ">";
      echo "20";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>
<p>
Next Speaker:
<input type="text" name="nextspeaker"   size="160" maxlength="10000" value="<?php echo $nextspeaker;?>"> 
<p>
I: Attended
<blockquote>
<textarea name="roman1" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman1; ?>
</textarea>
</blockquote>

II: Minutes text
<blockquote>
<textarea name="roman2" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman2; ?>
</textarea>
</blockquote>

IV: Future speakers. Remember put a &lt;li&gt; tag before each speaker
<blockquote>
<textarea name="roman4" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman4; ?>
</textarea>
</blockquote>

V: A extra box for special stuff
<blockquote>
<textarea name="roman5" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman5; ?>
</textarea>
</blockquote>
</form> 
<p>


<?php

 if ($month != '' &&  $day!= '' &&  $year!= '' ) {

    # 
    # read in the minutes model files so
    # we can write out a new minutes file
    #
    #$file_data=file_get_contents($_FILES['file_to_upload']['tmp_name']);
    $part1=file_get_contents('minutes_form_part_1.txt');
    $part2=file_get_contents('minutes_form_part_2.txt');
    $part3=file_get_contents('minutes_form_part_3.txt');
    $part4=file_get_contents('minutes_form_part_4.txt');
    $part5=file_get_contents('minutes_form_part_5.txt');
    $part6=file_get_contents('minutes_form_part_6.txt');
    $part7=file_get_contents('minutes_form_part_7.txt');
    $part8=file_get_contents('minutes_form_part_8.txt');
    $part9=file_get_contents('minutes_form_part_9.txt');
    $part10=file_get_contents('minutes_form_part_10.txt');
    #echo "<hr>";
    #echo $part1;
    #echo " $nextweekday, ";
    #echo " $nextmonth/$nextday/20$nextyear ";
    #echo $part2;
    #echo $nextspeaker;
    #echo $part3;
    #echo " $month/$day/20$year ";
    #echo $part4;
    #echo " $month/$day/20$year ";
    #echo " : ";
    #echo $roman1;
    #echo $part5;
    #echo $roman2;
    #echo $part6;
    #echo " $nextweekday, ";
    #echo " $nextmonth/$nextday/20$nextyear ";
    #echo $part7;
    #echo $nextspeaker;
    #echo $part8;
    #echo $roman4;
    #echo $part9;
    #if ($roman5 != '' ) {
    #   echo "<p><li>$roman5";
    #}
    #echo $part10;

    $minutes_page=$part1
                  ." $nextweekday, "
                  ." $nextmonth/$nextday/20$nextyear "
                  .$part2
                  .$nextspeaker
                  .$part3
                  ." $month/$day/20$year "
                  .$part4
                  ." $month/$day/20$year "
                  ." : "
                  .$roman1
                  .$part5
                  .$roman2
                  .$part6
                  ." $nextweekday, "
                  ." $nextmonth/$nextday/20$nextyear "
                  .$part7
                  .$nextspeaker
                  .$part8
                  .$roman4
                  .$part9;
    if ($roman5 != '' ) {
       $minutes_page.="<p><li>$roman5";
    }
    $minutes_page.=$part10;
    #echo $minutes_page;

    $minutes_file_name="minutes/m20$year-$month-$day.php";
    #
    # rename the file if it exists
    #
    rename_file_if_it_exists($minutes_file_name);
    #$handle=fopen("minutes/m20$year-$mo-$day.php",'wb');  
    $handle=fopen($minutes_file_name,'wb');  
    $byteswritten=fwrite($handle,$minutes_page);  
    fclose($handle);  





    echo "<h1>Minutes page follows</h1>";
    echo "<iframe "; 
    echo " src =\"minutes/m20$year-$month-$day.php\"";
    echo " width=\"100%\" height=\"$height_iframe\">";
    echo "</iframe>";
}
else {


    echo "<h1>Minutes from last meeting</h1>\n";
    #echo "<p><b>GET LAST MINUTES CREATED</b><p>";
    $the_last_minutes="";
    $hd=opendir("minutes");   
    while ($the_file_name=readdir($hd)) { 
        # 
        # is it a "ce" file? 
        # 
        #if (preg_match("/^ce.*\.(php|html|htm)$/i",$the_file_name)  ||  
        #    $the_file_name == 'comingevents.php' ) { 
        #if (preg_match("/^ce.*\.(php|html|htm)$/i",$the_file_name)) { 
        if (preg_match("/^m20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.php$/i",$the_file_name)) { 
            #echo "$the_file_name<br>";
            if ( $the_last_minutes == "" ) {
               $the_last_minutes=$the_file_name;
            }
            else {
               if ( $the_last_minutes < $the_file_name ) {
                  $the_last_minutes=$the_file_name;
               }
            }


            # 
            # use the file name 
            # 
            #array_push($programs, $the_file_name); 
        } 
    }  
    closedir($hd); 
    #echo "the last minutes are $the_last_minutes<br>";
    echo "<iframe "; 
    echo " src =\"minutes/$the_last_minutes\"";
    #echo " width=\"100%\" height=\"100%\">";
    echo " width=\"100%\" height=\"$height_iframe\">";
    echo "</iframe>\n";



}
?>











<center>
<a href="control-panel.php">Control Panel</a>
</center>

create_minutes_21_base.php

TOC

<?php
 include "0_php_functions.php";
 include "0_php_functions_minutes.php";

 function save_stinking_data($data,$file) {
    #
    # set the return code to zero
    #
    $rc=0;
    #
    # if they entered something save it!
    # if they didn't enter anything then DONT save it
    #
    if ($data != "" ) {
       #
       # open the file for writting
       #
       $handle=fopen($file,'wb');  
       #
       # write the data to the stinking file
       #
       $rc=fwrite($handle,$data);
       #
       # close the stinking file
       #  
       fclose($handle);
    }
    #
    # return the number of bytes written
    #
    return $rc;
 }





 #$programs=array();
 $height_iframe=5000;
 $rows=10;
 $cols=80;
 $nextspeaker=$_POST['nextspeaker'];
 #
 # if the nextspeaker is null then
 # get the one from the file
 #
 if ($nextspeaker == "" ) {
    $nextspeaker=file_get_contents('next_speaker.txt');
 }
 $month=$_POST['month'];
 $day=$_POST['day'];
 $year=$_POST['year'];
 $roman1=$_POST['roman1'];
 #
 # if the names of the people that attended 
 # the last meeting is null then
 # get the names of the people that attended from the file
 # $roman1 is the names of the people that attended the last meeting
 #
 if ($roman1 == "" ) {
    $roman1=file_get_contents('next_last_attended.txt');
 }
 $roman2=$_POST['roman2'];
 #
 # if minutes are null then 
 # get the minutes of the last meeting from the file
 # $roman2 is the minutes of the last meeting
 #
 if ($roman2 == "" ) {
    $roman2=file_get_contents('next_minutes_text.txt');
 }
 $roman4=$_POST['roman4'];
 #
 # if the nextspeakers are null then
 # get the nextspeakers from the file
 # $roman4 is the nextspeakers in this program
 #
 if ($roman4 == "" ) {
    $roman4=file_get_contents('next_speakers.txt');
 }





 $roman5=$_POST['roman5'];
 $roman1=clean_slashes($roman1);
 $roman2=clean_slashes($roman2);
 $roman4=clean_slashes($roman4);
 $roman5=clean_slashes($roman5);
 $nextspeaker=clean_slashes($nextspeaker);

 $nextmonth=$_POST['nextmonth'];
 $nextday=$_POST['nextday'];
 $nextweekday=$_POST['nextweekday'];
 if ($nextweekday == '') {
    $nextweekday='Thursday';
 }
 $nextyear=$_POST['nextyear'];
 $days=array('Monday', 
             'Tuesday', 
             'Wednesday', 
             'Thursday', 
             'Friday', 
             'Saturday', 
             'Sunday');


  
  #next_day_of_week.txt  
  #next_speaker.txt   
  #next_speakers.txt 

  #$nextmonth
  #$nextday
  #$nextspeaker
  #$nextyear
  #$nextweekday
  if ($nextmonth != "" && $nextday != "" && $nextyear != "") {
     save_stinking_data("$nextmonth/$nextday/$nextyear",'next_date_of_year.txt');
  }
  save_stinking_data($nextweekday,'next_day_of_week.txt');
  save_stinking_data($nextspeaker,'next_speaker.txt');
  save_stinking_data($roman4,'next_speakers.txt');


  save_stinking_data($roman1,'next_last_attended.txt');
  save_stinking_data($roman2,'next_minutes_text.txt');





 function am_i_selected($value, $name) {
    $rc="";
    if ($value == $name) {
       $rc=" selected ";
    }
    return $rc;
 }



?>
<html>
<head>
<title> Create a new Strategic Edge Business Alliance minutes web page </title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>

<h2 align="center">Send out Press Releases or Junk E-mails</h2>
<a href="email_newsletter.php">Send Press Releases or Junk E-mail</a>
<h2 align="center">Create a new Strategic Edge Business Alliance minutes web page</h2>
<form action="create_minutes.php" method="post"> 
<input type="submit" name=submit value="Create Minutes Web Page"><br>
Create minutes for
<select name="month">
<option value="01" <?php echo am_i_selected("01", $month); ?>>Jan</option>
<option value="02" <?php echo am_i_selected("02", $month); ?>>Feb</option>
<option value="03" <?php echo am_i_selected("03", $month); ?>>Mar</option>
<option value="04" <?php echo am_i_selected("04", $month); ?>>Apr</option>
<option value="05" <?php echo am_i_selected("05", $month); ?>>May</option>
<option value="06" <?php echo am_i_selected("06", $month); ?>>Jun</option>
<option value="07" <?php echo am_i_selected("07", $month); ?>>July</option>
<option value="08" <?php echo am_i_selected("08", $month); ?>>Aug</option>
<option value="09" <?php echo am_i_selected("09", $month); ?>>Sep</option>
<option value="10" <?php echo am_i_selected("10", $month); ?>>Oct</option>
<option value="11" <?php echo am_i_selected("11", $month); ?>>Nov</option>
<option value="12" <?php echo am_i_selected("12", $month); ?>>Dec</option>
</select>
<select name="day">
<?php

   for ($i=1;$i<=31;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $day); 
      echo ">";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>
<select name="year">
<?php
   for ($i=8;$i<=20;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $year); 
      echo ">";
      echo "20";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>

Next Meeting 
<select name="nextweekday">
<?php
   foreach($days as $hoydia) {
      echo '<option value="';
      echo $hoydia;
      echo '" ';
      echo am_i_selected("$hoydia", $nextweekday);
      echo ' >';
      echo $hoydia;
      echo '</option>';

   }
?>
</select>




<select name="nextmonth">
<option value="01" <?php echo am_i_selected("01", $nextmonth); ?>>Jan</option>
<option value="02" <?php echo am_i_selected("02", $nextmonth); ?>>Feb</option>
<option value="03" <?php echo am_i_selected("03", $nextmonth); ?>>Mar</option>
<option value="04" <?php echo am_i_selected("04", $nextmonth); ?>>Apr</option>
<option value="05" <?php echo am_i_selected("05", $nextmonth); ?>>May</option>
<option value="06" <?php echo am_i_selected("06", $nextmonth); ?>>Jun</option>
<option value="07" <?php echo am_i_selected("07", $nextmonth); ?>>July</option>
<option value="08" <?php echo am_i_selected("08", $nextmonth); ?>>Aug</option>
<option value="09" <?php echo am_i_selected("09", $nextmonth); ?>>Sep</option>
<option value="10" <?php echo am_i_selected("10", $nextmonth); ?>>Oct</option>
<option value="11" <?php echo am_i_selected("11", $nextmonth); ?>>Nov</option>
<option value="12" <?php echo am_i_selected("12", $nextmonth); ?>>Dec</option>
</select>
<select name="nextday">
<?php

   for ($i=1;$i<=31;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $nextday); 
      echo ">";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>
<select name="nextyear">
<?php
   for ($i=8;$i<=20;$i++) {
      $leadingzero="";
      if ($i < 10 ) {
         $leadingzero=0;
      }
      echo '<option value="';
      echo "$leadingzero$i";
      echo '"';
      echo am_i_selected("$leadingzero$i", $nextyear); 
      echo ">";
      echo "20";
      echo "$leadingzero$i";
      echo '</option>';
   }
?>
</select>
<p>
Next Speaker:
<input type="text" name="nextspeaker"   size="160" maxlength="10000" value="<?php echo $nextspeaker;?>"> 
<p>
I: Attended
<blockquote>
<textarea name="roman1" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman1; ?>
</textarea>
</blockquote>

II: Minutes text
<blockquote>
<textarea name="roman2" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman2; ?>
</textarea>
</blockquote>

IV: Future speakers. Remember put a &lt;li&gt; tag before each speaker
<blockquote>
<textarea name="roman4" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman4; ?>
</textarea>
</blockquote>

V: A extra box for special stuff
<blockquote>
<textarea name="roman5" <?php echo " rows=\"$rows\" "; echo " cols=\"$cols\" ";?> >
<?php echo $roman5; ?>
</textarea>
</blockquote>
</form> 
<p>


<?php

 if ($month != '' &&  $day!= '' &&  $year!= '' ) {

    # 
    # read in the minutes model files so
    # we can write out a new minutes file
    #
    #$file_data=file_get_contents($_FILES['file_to_upload']['tmp_name']);
    $part1=file_get_contents('minutes_form_part_1.txt');
    $part2=file_get_contents('minutes_form_part_2.txt');
    $part3=file_get_contents('minutes_form_part_3.txt');
    $part4=file_get_contents('minutes_form_part_4.txt');
    $part5=file_get_contents('minutes_form_part_5.txt');
    $part6=file_get_contents('minutes_form_part_6.txt');
    $part7=file_get_contents('minutes_form_part_7.txt');
    $part8=file_get_contents('minutes_form_part_8.txt');
    $part9=file_get_contents('minutes_form_part_9.txt');
    $part10=file_get_contents('minutes_form_part_10.txt');
    #echo "<hr>";
    #echo $part1;
    #echo " $nextweekday, ";
    #echo " $nextmonth/$nextday/20$nextyear ";
    #echo $part2;
    #echo $nextspeaker;
    #echo $part3;
    #echo " $month/$day/20$year ";
    #echo $part4;
    #echo " $month/$day/20$year ";
    #echo " : ";
    #echo $roman1;
    #echo $part5;
    #echo $roman2;
    #echo $part6;
    #echo " $nextweekday, ";
    #echo " $nextmonth/$nextday/20$nextyear ";
    #echo $part7;
    #echo $nextspeaker;
    #echo $part8;
    #echo $roman4;
    #echo $part9;
    #if ($roman5 != '' ) {
    #   echo "<p><li>$roman5";
    #}
    #echo $part10;

    $minutes_page=$part1
                  ." $nextweekday, "
                  ." $nextmonth/$nextday/20$nextyear "
                  .$part2
                  .$nextspeaker
                  .$part3
                  ." $month/$day/20$year "
                  .$part4
                  ." $month/$day/20$year "
                  ." : "
                  .$roman1
                  .$part5
                  .$roman2
                  .$part6
                  ." $nextweekday, "
                  ." $nextmonth/$nextday/20$nextyear "
                  .$part7
                  .$nextspeaker
                  .$part8
                  .$roman4
                  .$part9;
    if ($roman5 != '' ) {
       $minutes_page.="<p><li>$roman5";
    }
    $minutes_page.=$part10;
    #echo $minutes_page;

    $minutes_file_name="minutes/m20$year-$month-$day.php";
    #
    # rename the file if it exists
    #
    rename_file_if_it_exists($minutes_file_name);
    #$handle=fopen("minutes/m20$year-$mo-$day.php",'wb');  
    $handle=fopen($minutes_file_name,'wb');  
    $byteswritten=fwrite($handle,$minutes_page);  
    fclose($handle);  





    echo "<h1>Minutes page follows</h1>";
    echo "<iframe "; 
    echo " src =\"minutes/m20$year-$month-$day.php\"";
    echo " width=\"100%\" height=\"$height_iframe\">";
    echo "</iframe>";
}
else {


    echo "<h1>Minutes from last meeting</h1>\n";
    #echo "<p><b>GET LAST MINUTES CREATED</b><p>";
    $the_last_minutes="";
    $hd=opendir("minutes");   
    while ($the_file_name=readdir($hd)) { 
        # 
        # is it a "ce" file? 
        # 
        #if (preg_match("/^ce.*\.(php|html|htm)$/i",$the_file_name)  ||  
        #    $the_file_name == 'comingevents.php' ) { 
        #if (preg_match("/^ce.*\.(php|html|htm)$/i",$the_file_name)) { 
        if (preg_match("/^m20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.php$/i",$the_file_name)) { 
            #echo "$the_file_name<br>";
            if ( $the_last_minutes == "" ) {
               $the_last_minutes=$the_file_name;
            }
            else {
               if ( $the_last_minutes < $the_file_name ) {
                  $the_last_minutes=$the_file_name;
               }
            }


            # 
            # use the file name 
            # 
            #array_push($programs, $the_file_name); 
        } 
    }  
    closedir($hd); 
    #echo "the last minutes are $the_last_minutes<br>";
    echo "<iframe "; 
    echo " src =\"minutes/$the_last_minutes\"";
    #echo " width=\"100%\" height=\"100%\">";
    echo " width=\"100%\" height=\"$height_iframe\">";
    echo "</iframe>\n";



}
?>











<center>
<a href="control-panel.php">Control Panel</a>
</center>

delete-press-email.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',         # for mortgage info click here 
           'x'          # for pat's bio click here
           );

 #
 # this function is used to copy the deleted
 # email record into a backup sql file so
 # we have a copy of who deleted it when
 # and from what ip address
 #
 include "0_php_function_dup_email.php";
 $email=$_POST["email"];

 $email=preg_replace("/ *\$/","",$email);
 $email=preg_replace("/^ */","",$email);
 if ($email != '' ) {
   #echo "Delete stinking $email<p>";
   #
   # get the passwords and stuff
   #
   require('sql_passwords.php');
   # 
   # connect to SQL 
   # 
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #
   # check to see if that email address exists
   #
   #$query = "select count(*) as hits from junk_emails where email='$email' ";
   $query = "select count(*) as hits from press_releases  
                                          where email='$email' and 
                                                delete_flag='no' ";
   #echo "Query=$query<p>";

   #
   # display the select
   # 
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $hits=$line['hits'];
      #echo "Hits=$hits<br>";
   }
   #
   # are they already in our email list?
   #
   #echo "Hits=$hits<br>";
   if ($hits == 0 ) {
      #
      # this email address isnt in our database
      # and therefore can NOT be deleted
      #
      $it_worked_message="<span style=\"color:red; font-size:200%;\">$email is not in our database and thus can't be removed!</span> ";
   }
   else {
       echo "Add code here to delete the email address";
       $query = "update press_releases  set delete_flag='yes'
                                          where email='$email' ";
       #echo "Query=$query<p>";
       $result = mysql_query($query); 
       if ($result) { 
          #echo "insert worked"; 
          $it_worked_message="<span style=\"color:green; font-size:200%;\">$email has been removed!</span> ";
          #echo  $it_worked_message;
       } 
       else { 
          echo "Something is SCREWED UP!!!!!!!!  update failed!!!!!!!!!!!!!!!!!"; 
       }
   # 
   # close the SQL connection 
   # 
   mysql_close($link); 







   }


























 }
?>


<h1>Remove me from the Press Release Email List</h1>
<?php echo $it_worked_message; ?>
<p>
<form action="delete-press-email.php" method="post">
<p>
<input type="text" name=email size="100"  value="<?php echo $email;?>">
<p>
<input type="submit" name=submit value="SUBMIT">
</form>

Mike still has to modify the code that
sends the press releases so that it
doesnt send them if 
delete_flag='yes'






<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

delete_minutes.php

TOC

<?php
 include "0_php_functions.php";
 include "0_php_functions_minutes.php";



 $delete=$_GET['delete'];
 #$day=$_POST['day'];
 #$year=$_POST['year'];
 #$roman1=$_POST['roman1'];
 #$roman2=$_POST['roman2'];
 #$roman4=$_POST['roman4'];
 #$roman5=$_POST['roman5'];
 #$roman1=clean_slashes($roman1);
 #$roman2=clean_slashes($roman2);
 #$roman4=clean_slashes($roman4);
 #$roman5=clean_slashes($roman5);
 #$nextspeaker=clean_slashes($nextspeaker);
 #$nextmonth=$_POST['nextmonth'];
 #$nextday=$_POST['nextday'];
 #$nextweekday=$_POST['nextweekday'];
 #if ($nextweekday == '') {
 #   $nextweekday='Thursday';
 #}
 #$nextyear=$_POST['nextyear'];
 if ($delete !="" ) {
   #echo "DELETING $delete<br>";
   rename_file_if_it_exists($delete);
   $delete="";
 }





?>
<html>
<head>
<title> Delete an existing Strategic Edge Business Alliance minutes web page </title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<h2 align="center">Delete a minutes web page</h2>
<h4 align="center">OK Mike lied! It is not deleted, but renamed so it doesn't show up on the minutes table of contents page</h4>
<?php
    $programs=array(); 
    $hd=opendir("minutes");   
    while ($the_file_name=readdir($hd)) { 
        if (preg_match("/^m20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.php$/i",$the_file_name)) { 
            #echo "$the_file_name<br>";
            array_push($programs, $the_file_name);  
        } 
    }  
    closedir($hd);
    #
    # sort the stinking files
    # they probably are in order
    # but they COULD be out of order
    #
    asort($programs);
    # 
    # display each of the stinking files
    #
    echo "<ul>";
    foreach ($programs as $x) {
       $xx="minutes/$x";
       echo "<li>";
       echo "<a href=\"delete_minutes.php?delete=$xx\">delete $x</a>";
       echo " View minutes for ";
       echo "<a href=\"$xx\">$x</a>";
    }
    echo "</ul>";
?>
<center>
<a href="control-panel.php">Control Panel</a>
</center>

display_coming_events.php

TOC

<html>
<head>
<title>Strategic Edge Business Alliance Coming Events</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind', coming, events, 'coming events'">
</head>
<?php
  #
  # get the file prefix to display
  # all files that begin with it
  #
  $file_prefix=$_GET["file_prefix"]; 
  $title=$_GET["title"]; 
  #
  # if not file prefix given exit
  #
  if (preg_match("/^ *$/i",$file_prefix) ){
     echo '<div style="font-size:150%;">No File Prefix Given</div>';
     exit;
  }

  #
  # create an array to store all the file names
  # that exist for comming events
  #
  $programs=array();
  #
  # read the minutes subdirectory file
  # for all the files that begin with ce
  # ce stands for coming events
  #
  $hd=opendir("minutes");  
  while ($the_file_name=readdir($hd)) {
      #
      # is it a "ce" file?
      #
      #if (preg_match("/^ce.*\.(php|html|htm)$/i",$the_file_name)  || 
      #    $the_file_name == 'comingevents.php' ) {
      #if (preg_match("/^ce.*\.(php|html|htm)$/i",$the_file_name)) {
      if (preg_match("/^$file_prefix.*\.(php|html|htm)$/i",$the_file_name)) {


          #
          # use the file name
          #
          array_push($programs, $the_file_name);
      }
  } 
  closedir($hd); 
  #
  # sort the programs before listing them
  # by file name, then path name
  #
  asort($programs);
  #
  # use this to reverse the order of the array
  # we want the events that occured last to
  # be listed first
  #
  $programs=array_reverse($programs);
  #
  # list the coming events
  #
  #echo '<h1 align="center">Coming Events</h1>';
  echo "<h1 align=\"center\">$title</h1>";
  echo "<ul>";
  foreach ($programs as $foo) {
     echo "<li>";
     echo "<a href=\"minutes/$foo\">$foo</a>";
  }
  echo "</ul>";
?>





































<?php
 #
 # print the end of each web page
 #
 #dump_tail()
?>

display_functions.php

TOC

<?php
#
# include the function
#        html_to_displayable_html()
# which converts HTML to HTML a human
# can read when the browser displays it
#
include "html_to_displayable_html.php";
function display_code($file) {
  #
  # read in a php or PERL program and display it on a web page
  #
  echo "<a name=\"$file\">";
  echo "<h2>$file</h2>";
  echo "<a href=\"#toc-$file\">TOC</a><p>";
  echo "<tt>";
  #
  # read the file into an array
  #
  $array=file($file);
  foreach ($array as $line) {
     #
     # convert the HTML to HTML that a browser can display
     # ie:
     #       <html>
     # becomes
     #       &lt;html&gt;
     #
     # so a human can see what the html looks like
     #
     $line=html_to_displayable_html($line);
     echo "$line<br>";
  }
  echo "</tt>";
  return;
}
?>

display_images.php

TOC

<?php
include "display_functions.php";
setcookie("a_class.php","a_class.php",time()+333333);
setcookie("class","everybody loves class",time()+333333);
setcookie("notenoughclasses","and nobody gets enough education",time()+333333);
$set_cookie="si";
#
# this session id stuff is for people who refuse to use cookies
# it keeps track of them on the server side instead of with
# cookies on their PC.
# the session lasts until they close their browser window
#
$mysessionid=session_start();
if ( $_SESSION['displaycode'] == '') {
   $_SESSION['displaycode']=1;
}
else {
   $_SESSION['displaycode']++;
}
?>
<html>
<head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<?php
   function get_image_files($dir) {
      $filelist=array();
      $hd=opendir($dir);  
      while ($the_file_name=readdir($hd)) {
           #
           # only process gif's, jpgs, png or other images files
           #
           if ($dir != '.' ) {
           $the_file_name="$dir/$the_file_name";
           }
           if (preg_match("/.(gif|jpg|png)$/i",$the_file_name)) { 
              array_push($filelist, $the_file_name);
           } 
      } 
      closedir($hd); 
      return $filelist;
   }
   #
   # list these programs
   #
   $x=array();
   $programss=array();
   $program=array();
   $file=$_GET["file"];
   if ($file == '' ) {
      $file=".";
   }
   $programs=get_image_files($file);
   #foreach ($programs as $foo) {
   #   echo "foo=$foo<br>";
   #}

 









 #print "<ul>\n"; 
 #opendir(DIR,".");
 #$hd=opendir(".");  
 #while ($the_file_name=readdir($hd)) {
 #     #
 #     # only process gif's, jpgs, png or other images files
 #     #
 #     if (preg_match("/.(gif|jpg|png)$/i",$the_file_name)) { 
 #        array_push($programs, $the_file_name);
 #     } 
 #} 
 #closedir($hd); 
 #print "</ul>\n"; 


  #
  # fix so they sort by program name, then path name
  # not as they are entered above by path name, program name
  #
  foreach($programs as $i) {
     if (preg_match("/\//",$i)) {
        $i=preg_replace("/^(.*\/)(.*)\$/","\$2 \$1",$i); 
        array_push($programss, $i);
     }
     else {
        array_push($programss, $i);
     }
  }
  #
  # sort the programs before listing them
  # by file name, then path name
  #
  asort($programss);
  #
  # delete the orginal array and reload it
  #
  $programs=array();
  #
  # now we have to reverse the path name again
  # so the file can be read
  #
  foreach($programss as $i) {
     if (preg_match("/\//",$i)) {
        $i=preg_replace("/^(.*) (.*)\$/","\$2\$1",$i); 
        array_push($programs, $i);
     }
     else {
        array_push($programs, $i);
     }
  }
  #
  # generate a table of contents of the programs
  #
  echo '<h1 align="center">My Images</h1>';
  echo "<ul>";
  foreach ($programs as $foo) {
     echo "<h2>$foo</h2>";
     echo "<img src=\"$foo\" alt=\"$foo\">";
     echo "<a name=\"toc-{$foo}\">";
     echo "<a href=\"#$foo\">$foo</a>";
  }
  echo "</ul>";
?>

display_programs.php

TOC

<?php
include "display_functions.php";
setcookie("a_class.php","a_class.php",time()+333333);
setcookie("class","everybody loves class",time()+333333);
setcookie("notenoughclasses","and nobody gets enough education",time()+333333);
$set_cookie="si";
#
# this session id stuff is for people who refuse to use cookies
# it keeps track of them on the server side instead of with
# cookies on their PC.
# the session lasts until they close their browser window
#
$mysessionid=session_start();
if ( $_SESSION['displaycode'] == '') {
   $_SESSION['displaycode']=1;
}
else {
   $_SESSION['displaycode']++;
}
?>
<html>
<head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>










<?php
  #
  # list these programs
  #
  $programss=array();
  $programs=array();

 #print "<ul>\n"; 
 #opendir(DIR,".");
 $hd=opendir(".");  
 while ($the_file_name=readdir($hd)) {
      #
      # dont list these files
      #
      if ($the_file_name == '.' || 
          $the_file_name == '..' ||
          $the_file_name == 'minutes' ||
          $the_file_name == '.htpasswd' || 
          $the_file_name == 'email.txt' || 
          $the_file_name == 'email_all.txt' ||
          $the_file_name == 'email_read_and_load.php' ||
          $the_file_name == 'email_read_and_load2.php' ||
          $the_file_name == 'insert_load_press_release.php' ||

          $the_file_name == '0_email_addresses.php' || 
          $the_file_name == 'sql_passwords.php'
        ) {
         continue;
      }
      #
      # dont mess with gif's, jpgs, png or other images files
      #
      if (preg_match("/.(gif|jpg|png|mp3)$/i",$the_file_name)) { 
         continue;  
      }


      #
      # dont mess with backed up files like _vnn.php or _nn.php
      #
      if (preg_match("/_v{0,1}[0-9][0-9]\.php$/i",$the_file_name)) { 
         continue;  
      } 


      #
      # process these files
      #
      #print "<li>$the_file_name";
      array_push($programs, $the_file_name);
 } 
 closedir($hd); 
 #print "</ul>\n"; 


  #
  # fix so they sort by program name, then path name
  # not as they are entered above by path name, program name
  #
  foreach($programs as $i) {
     if (preg_match("/\//",$i)) {
        $i=preg_replace("/^(.*\/)(.*)\$/","\$2 \$1",$i); 
        array_push($programss, $i);
     }
     else {
        array_push($programss, $i);
     }
  }
  #
  # sort the programs before listing them
  # by file name, then path name
  #
  asort($programss);
  #
  # delete the orginal array and reload it
  #
  $programs=array();
  #
  # now we have to reverse the path name again
  # so the file can be read
  #
  foreach($programss as $i) {
     if (preg_match("/\//",$i)) {
        $i=preg_replace("/^(.*) (.*)\$/","\$2\$1",$i); 
        array_push($programs, $i);
     }
     else {
        array_push($programs, $i);
     }
  }
  #
  # generate a table of contents of the programs
  #
  echo '<h1 align="center">Some PHP programs I have written</h1>';
  echo "<ul>";
  foreach ($programs as $foo) {
     echo "<li>";
     echo "<a name=\"toc-{$foo}\">";
     echo "<a href=\"#$foo\">$foo</a>";
  }
  echo "</ul>";
  #
  # dump out each of the programs
  #
  foreach ($programs as $foo) {
     display_code($foo);
  }
?>





































<?php
 #
 # print the end of each web page
 #
 #dump_tail()
?>

dog_photos

TOC

dogs.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2 align="center">Pat & Marie dogs</h2>
<ol>
<li><a href="dogs1.php">Dogs 1</a>
<li><a href="dogs2.php">Dogs 2</a>
</ol>
<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

dogs1.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2 align="center">Pat & Marie dogs</h2>

<div style="font-size:400%;">
<center>Arf!!! Arf!!!</center>
</div>

<img src="dog_photos/P1040546.JPG">
<p>
    
  <img src="dog_photos/P1040548.JPG">
<p>     
  <img src="dog_photos/P1040550.JPG">
<p>     
  <img src="dog_photos/P1040551.JPG">
<p>   
  <img src="dog_photos/P1040552.JPG">
<p>
    
  <img src="dog_photos/P1040553.JPG">
<p>
 
  <img src="dog_photos/P1040554.JPG">
<p>
      
  <img src="dog_photos/P1040555.JPG">
<p>
     
  <img src="dog_photos/P1040559.JPG">
<p>

  <img src="dog_photos/P1040560.JPG">
<p>
      
  <img src="dog_photos/P1040561.JPG">
<p>
     
  <img src="dog_photos/P1040562.JPG">
<p>
 
  <img src="dog_photos/P1040563.JPG">
<p>

  <img src="dog_photos/P1040564.JPG">
<p>

  <img src="dog_photos/P1040565.JPG">
<p>

  <img src="dog_photos/P1040566.JPG">
<p>
      
  <img src="dog_photos/P1040567.JPG">
<p>
  




<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

dogs2.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2 align="center">Pat & Marie dogs</h2>
<div style="font-size:400%;">
<center>Arf!!! Arf!!!</center>
</div>
<?php
  function doit_toit($subdirectory) {

  #
  # list these programs
  #
  $programs=array();
  #$hd=opendir("."); 
  $hd=opendir($subdirectory);  
  while ($the_file_name=readdir($hd)) {
      #
      # dont list these files
      #
      if ($the_file_name == '.' || 
          $the_file_name == '..'
        ) {
         continue;
      }
      #
      # process these files
      #


     if (preg_match("/\./",$the_file_name)) {
        $the_file_name="<img src=\"$subdirectory/$the_file_name\" alt=\"filename is $the_file_name \"><p>";
        #$the_file_name="$the_file_name<br><img src=\"$subdirectory/$the_file_name\" alt=\"filename is $the_file_name \"><p>";
     }


      array_push($programs, $the_file_name);
  } 
  closedir($hd); 

  #
  # sort the programs before listing them
  # by file name, then path name
  #
  asort($programs);

  foreach ($programs as $foo) {
     #echo "$foo<br>";
     echo "$foo";

  }
     return;
  }

  doit_toit('dogs2_photos');
?>




<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

dogs2_photos

TOC

email_newsletter.php

TOC

<html><head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<h1 align="center">E-mail Newsletter</h1>
<?php
   include 'save_stinking_data.php';
#
# this program will work according to the
# customer services reps at 100webspace.net
# if pat upgrades to a $3/month account.
#
# although he MIGHT have to use a sending
# email address which is a valid email
# address from this site. as opposed to
# using a email addresss like this
#
#    bogus@email-addresss-that-doesnt-exist.com
# but
#    realaddress@100webspace.net
#











   $testsubject=$_POST['testsubject'];
   $newslettersubject=$_POST['newslettersubject'];
   $pressreleasesubject=$_POST['pressreleasesubject'];
   $testsubject=preg_replace("/\\\(.)/","$1",$testsubject);
   $newslettersubject=preg_replace("/\\\(.)/","$1",$newslettersubject);
   $pressreleasesubject=preg_replace("/\\\(.)/","$1",$pressreleasesubject);


   #$testsubject=preg_replace('/"/',"",$testsubject);
   #$newslettersubject=preg_replace('/"/',"",$newslettersubject);
   #$pressreleasesubject=preg_replace('/"/',"",$pressreleasesubject);
   $testsubject=preg_replace('/"/',"&quot;",$testsubject);
   $newslettersubject=preg_replace('/"/',"&quot;",$newslettersubject);
   $pressreleasesubject=preg_replace('/"/',"&quot;",$pressreleasesubject);


   #$test_send_or_real_send == 'test'
   #$test_send_or_real_send == 'sendit'
   #$test_send_or_real_send == 'pressrelease'
   #$pressreleasesubject
   #$newslettersubject
   #$testsubject
   if ($testsubject == "" ) {
      $testsubject=file_get_contents('subject_test.txt');
   }
   else {
      #echo "hi........<p>";
      save_stinking_data($testsubject,'subject_test.txt');
   }


   if ($newslettersubject == "" ) {
      $newslettersubject=file_get_contents('subject_newsletter.txt');
   }
   else {
      #echo "hi........2<p>";
      save_stinking_data($newslettersubject,'subject_newsletter.txt');
   }
   if ($pressreleasesubject == "" ) {
      $pressreleasesubject=file_get_contents('subject_pressreleases.txt');
   }
   else {
      #echo "hi........3<p>";
      save_stinking_data($pressreleasesubject,'subject_pressreleases.txt');
   }





function build_bcc_list($test, $limit, $offset) {
   $sqllimit="";
   if ($offset == '' ) {
      $offset=0;
   }
   #if ($limit != '' ) {
   #   $sqllimit=" limit $offset , $limit ";
   #}
   if ($test == 'sendit') {
      $sqltable=" junk_emails ";
   }
   else {
      if ($test == 'pressrelease') {
         $sqltable=" press_releases ";
      }
      else {
         $sqltable=" junk_emails_test ";
      }
   }
   $bcc="";
   #require('sql_passwords.php');
   include 'sql_passwords.php';
   # 
   # connect to SQL 
   #  
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to grab all the data entered so far
   #
   #$query = "select email  from $sqltable limit 1500 ";
   #$query = "select email  from $sqltable $sqllimit ";
   $query = "select email  from $sqltable where delete_flag='no' $sqllimit ";

   #
   # display the select
   # 
   echo "query=$query<p>";
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $email=$line['email'];
      #echo "email=$email<br>";
      if ($bcc == '' ) {
         $bcc=$email;
      }
      else {
         #$bcc.=','.$email;
         $bcc.=" \n , ".$email;
      }
   } 
   # 
   # close the SQL connection 
   # 
   mysql_close($link);









   return $bcc;
}







function dump_file_length_header($data) {
   #
   # this function is used to build the 
   #  Content-Length: nnn
   # header where nnn is the size of the file
   # note all of our files are encoded into
   # mime or base64 so the size will be larger
   # then the orginal file size
   #
   # the file has been read into memory
   # get the size of it
   #
   $bytes=strlen($data);
   #
   # build the content-length header
   #
   $length_header="Content-Length: $bytes\r\n";
   #
   # return to the caller
   #
   return $length_header;
}
function tell_em_about_attached_file($fname,$attachment,$name) {
   #
   # if the file name is not blank
   # this function generates a message
   # telling them
   #    1) file name
   #    2) is it an attachment or not YES/NO
   #    3) the name used
   #
   $message="";
   #
   # if the name is not blank do our stuff
   #
   if ($_FILES[$fname]['name'] != '') {
     #
     # assume it isn't an attachment
     #
     $isitanattachment="NO";
     if ($attachment == 'a') {
        #
        # well gosh it IS an attachment
        #
        $isitanattachment="YES";
     }
     #
     # build the message
     #
     $pc_name=$_FILES[$fname]['name'];
     $message="$pc_name, a=$isitanattachment n='$name'\n";
   }  
   #
   # return the message to the caller
   #
   return $message;
}
function build_tr_for_file($file) {
   if ($_FILES[$file]['name'] != "" ) {
      echo "<tr><td>Filename</td><td>{$_FILES[$file]['name']}</td></tr>";
      echo "<tr><td>File type</td><td>{$_FILES[$file]['type']}</td></tr>";
      echo "<tr><td>File size</td><td>{$_FILES[$file]['size']}</td></tr>";
      echo "<tr><td>File error</td><td>{$_FILES[$file]['error']}</td></tr>";
      echo "<tr><td>File on server</td><td>{$_FILES[$file]['tmp_name']}</td></tr>";
      echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
     }
   return;
}


function get_blank_lines($count) {
   #
   # i dont know how many blank lines i need
   # before and after the file so this function
   # will let me enter between 0 and 9 which
   # one of the values will work
   #
   for($i=0;$i<10;$i++) {
      $selected="";
      if ($i == $count) {
         $selected=" selected ";
      }
      echo "<option value=\"$i\" $selected>$i</option>";
   }
   return;
}

function tell_about_file_uploaded_to_us ($file) {
   # 
   # for debugging tell them some info about
   # the file they have uploaded
   #
   # blank the message
   #
   $status_messages="";
   #
   # if the file has been uploaded get the details
   #
   if ($_FILES[$file]['name'] != "" ) {
       #
       # tell them the files name
       #      
       $status_messages.=$_FILES[$file]['name'];
       $status_messages.=" contains ";
       #
       # tell them the files size in bytes
       #  
       $status_messages.=$_FILES[$file]['size'];
       #
       # tell them where the file was uploaded to
       # which is usually a randomly made name in
       #      /tmp
       #  
       $status_messages.=" bytes is attached to this email as ";
       $status_messages.=$_FILES[$file]['tmp_name'];
       $status_messages.=" with ";
       #
       # tell them how many errors the file had as it was uploaded
       # at least that is what i think this is.
       # I dont know for sure.
       #  
       $status_messages.=$_FILES[$file]['error'];
       $status_messages.=" errors\n";
   }
   #
   # return the message to the caller
   #
   return $status_messages;
}

function setup_call_to_attach_file ($zname, $attachment, $attachmentname, $cr_before, $cr_after, $dump_flength, $dont_use_imap) {
   #
   # make the output null
   #
   $header="";
   #
   # create an array to make a copy of the file info
   #
   $filex=array();
   #
   # if the file was entered then add it to the header info
   #
   if ($_FILES[$zname]['name'] != "" ) {
      #
      # copy the file array
      #
      $filex=$_FILES[$zname];
      #
      # get the files name
      #
      $filexname=$_FILES[$zname]['name'];
      #
      # put the files data to the header
      #
      $header=attach_a_file_to_headers($filex, 
                                        $attachment, 
                                        $attachmentname,
                                        $filexname,
                                        $cr_before,
                                        $cr_after,
                                        $dump_flength,
                                        $dont_use_imap);
        }
   #
   # all done return the data to the caller
   #
   return $header;
}



function attach_a_file_to_headers($file, $attachment, $name, $filename, $cr_before, $cr_after, $dump_flength, $dont_use_imap) {
   #
   # this function will build the header records
   # that are used to attach a file to an email
   # and send the file as an attachment
   #   $file       - the file array with file informaion
   #   $attachment - is this file going to be an attachment
   #               - as opposed to a file that will be say
   #               - an image in html displayed
   #   $name       - the name of this file, not the filename
   #               - this is the name used in an <a or <img tag
   #               - like   <img src="foo">
   #               - as opposed to the files name like
   #               - resume.doc which is part of the $file array
   #
   # zero out the data we want to return
   #
   $data="";
   #
   # debug the puppy
   #
   if (0) {
      echo "attachment=$attachment<br>";
      echo "attachment name=$name<br>";
      echo "file array=$file<br>"; 
      foreach ($file as $f) {
         echo "&nbsp;&nbsp;&nbsp;$f<br>";
      }
   }
   #
   # are we supposed to attache it as an  attachment
   # as opposed to an inline file which could be used
   # as an image when we display the email as HTML
   #
   if ( $attachment != '' ) {
      $data.="Content-Disposition: attachment;\r\n";
   }
   #
   # should we add the file name?
   #
   if ($filename != '') {
      $data.="filename=\"$filename\"\r\n";
   }
   #
   # add the content-type
   #  
   $data.="Content-type: ".$file['type'];
   #
   # if we have a "name" put it after the content type
   if ($name != '' ) {
      $data.=" name=\"$name\"";
   }
   #
   # either way put a \n at the end of the content-type
   #
   $data.="\r\n";
   #
   # tell it that the text that follows is mime or base64
   # which are two ways to say the same thing
   #






   #
   # read the file into memory
   #
   $file_data=file_get_contents($file['tmp_name']);
   #
   # convert the file data into mime text or base64 text
   # 
   #
   # for useless information this is how the file is encoded
   # see this URL for more info
   #   
   #         http://www.freesoft.org/CIE/RFC/1521/7.htm
   #
   #   Value Encoding  Value Encoding  Value Encoding  Value Encoding
   #        0 A            17 R            34 i            51 z
   #        1 B            18 S            35 j            52 0
   #        2 C            19 T            36 k            53 1
   #        3 D            20 U            37 l            54 2
   #        4 E            21 V            38 m            55 3
   #        5 F            22 W            39 n            56 4
   #        6 G            23 X            40 o            57 5
   #        7 H            24 Y            41 p            58 6
   #        8 I            25 Z            42 q            59 7
   #        9 J            26 a            43 r            60 8
   #       10 K            27 b            44 s            61 9
   #       11 L            28 c            45 t            62 +
   #       12 M            29 d            46 u            63 /
   #       13 N            30 e            47 v
   #       14 O            31 f            48 w         (pad) =
   #       15 P            32 g            49 x
   #       16 Q            33 h            50 y
   #
   # do the encoding
   #


   #$dont_use_imap
   if (! function_exists('imap_binary') || $dont_use_imap == 'y') {
      #
      # imap_binary() function does not exist
      # or we are testing and want to use my function
      # use my code to convert to mime or base64
      #
      if (! function_exists('imap_binary')) {
         echo "imap_binary() function does not exist<br>";
      }
      if ($dont_use_imap == 'y') {
         #echo "who cares about imap_binary() we ain't using it<br>";
      }
      #echo "using mikes IMAP function<br>";
      #
      # convert the string to a monster string
      # which is encoded in base64 or mime format
      #
      $base64data0=base64_encode($file_data);
      #
      # split it into lines that are 60 bytes long
      #
      $base64data=chunk_split($base64data0,60);
   }
   else {
      #
      # imap_binary function exists!
      # use it
      #
      #echo "imap_binary() function EXISTS<br>";
      $base64data=imap_binary($file_data);
   }







   #
   # dump the header that tells the length of the data
   # before the base64 header
   #
   if ( $dump_flength == 'before' ) {
      $data.=dump_file_length_header($base64data);
   }
   $data.="Content-transfer-encoding: base64\r\n";
   #
   # dump the header that tells the length of the data
   # after the base64 header
   #
   if ( $dump_flength == 'after' ) {
      $data.=dump_file_length_header($base64data);
   }
   #
   # should we add extra blank lines before the file?
   #
   if ($cr_before > 0 ) {
      $extra_blank_lines=0;
      while($extra_blank_lines < $cr_before) {
         $data.="\r\n";
         $extra_blank_lines++;
      }
   }
   #echo "like this<br>Content-Type: text/plain; charset=US-ASCII; name=mud<br>";
   #
   # add the mime or base64 data to the header
   #
   $data.=$base64data;
   #
   # should we add extra blank lines after the file?
   #
   if ($cr_after > 0 ) {
      $extra_blank_lines=0;
      while($extra_blank_lines < $cr_after) {
         $data.="\r\n";
         $extra_blank_lines++;
      }
   } 
   #
   # debug and dump the data
   #
   if (0) {
      echo "header=<pre>$data\"</pre>end header<p>";
   }
   #
   # return the data
   #
   return $data;
}
?>
<html>
<?php
#
# print our ip address
#
if (0) {
   echo "IP Address=";
   echo ${REMOTE_ADDR};
   echo "<p>";
}
#
# if we are at the lycos site print
# a few blank lines at the top to
# get around their annoying headers
#
#if (${REMOTE_ADDR} == '156.42.68.5' || ${REMOTE_ADDR} == '212.78.204.20') {
if (${REMOTE_ADDR} == '212.78.204.20') {
   for ($i=0;$i<3;$i++) {
      echo "&nbsp;<p>";
   }
}


?>
<?php
#
# include this function to clean up the
# data returned from PHP forms
# those annoying forms return
#    ", ', and \
# as
#    \",  \', and \\
#
#
# since i am giving this to grey DONT
# include the function. hard code it
#
#include "clean_php_form_data.php";
function clean_php_form_data($data) {
   #
   # for some reason when you enter the characters
   #     ", ', and \
   # into a PHP form they are returned as
   #     \", \', and \\
   #
   # well this function cleans up the data
   # and removes the annoying backslashes
   #
   # oddly data is NOT returned this way in PERL
   #
   $data=preg_replace('/\\\\\'/',"'",$data);
   $data=preg_replace('/\\\\\"/','"',$data);
   $data=preg_replace('/\\\\\\\\/',"\\",$data);
   return $data;
}
#
function sum_total_errors($data, $total_errors) {
   if ($data != '' ) {
      $total_errors++;
   }
   return $total_errors;
}
function clean_up_to_lines($data) {
    #
    # remove leading and trailing spaces
    #
    $data=preg_replace("/^ */","",$data);
    $data=preg_replace("/ *\$/","",$data);
    #
    # remove extra spaces
    #
    $data=preg_replace("/  */"," ",$data);
    #
    # remove leading and trail spaces from
    #       < frog@dog.com   >
    $data=preg_replace("/ *< */","<",$data);
    $data=preg_replace("/ *> */",">",$data); 
    #
    # remove leading and trail spaces from commas that
    # seperate email addresses
    #      frog@god.com     ,   me@superman.gov
    #
    $data=preg_replace("/ *, */",",",$data);
    return $data;
}
function get_address_errors($data) {
    $errors="";
    if ($data != '' ) {
       $names=explode(",",$data);
       foreach ($names as $n) {
          #
          # remove leading and trailing spaces
          #
          $n=preg_replace("/^ */","",$n);
          $n=preg_replace("/ *\$/","",$n);
          #
          # if you have
          #        tom jones <you@email.com>
          # we have to validate the stuff enclosed in <>
          # as the email address and ignore the other stuff
          # this code should do that
          #
          $nn=$n;
          if (preg_match("/<.*>/",$nn)) {
             $nn=preg_replace("/^.*</","",$nn);
             $nn=preg_replace("/>.*\$/","",$nn);  
          }
          #
          # now validate the email address
          # if the email address contains spaces
          # it is invalid
          #
          if (preg_match("/ /",$nn)) {
             if ($errors == '' ) {
                $errors=$n;
             }
             else {
                $errors.=" $n";
             }
          }
          else {
             #
             # if the email address is not in the form
             #     something@somewhere.xxx
             # it is invalid
             #
             if (! preg_match("/[^@]+@[^@]+\.[^@]+/",$nn)) {
                if ($errors == '' ) {
                   $errors=$n;
                }
                else {
                   $errors.=" $n";
                }
             }
             else {
                #
                # and it cant end or begin with
                # these letters
                # nor can it have @....@ in it
                # nor can it have .. or 2 dots next to each other
                #
                $nonos="\.@";
                if (preg_match("/^[$nonos]/",$nn)  || 
                    preg_match("/[$nonos]\$/",$nn) || 
                    preg_match("/\.\./",$nn) || 
                    preg_match("/@.*@/",$nn)) {
                   #
                   # we have either
                   #    illegal begining or ending characters
                   #    multiple @ signs
                   #
                   if ($errors == '' ) {
                      $errors=$n;
                   }
                   else {
                      $errors.=" $n";
                   }
                }
             }
          }
       }
    }
    #
    # if email addresses have stuff like
    #        tom & bob <thoseguyes@email.com>
    # convert it so it is displayable
    #
    $errors=htmlentities($errors);
    #
    # make it red and tell them it is an error
    if ($errors != '' ) {
    $errors="<span style=\"background=#ff0000\">ERROR $errors</span>";
    }
    return $errors;
}

   #
   # set the default values for this program
   #
   $total_errors=0;
   $size=80;
   $rows=50;
   #
   # the program DID NOT TIME OUT!!!!!
   # their censor filters caused the 
   # script to die. two email addresses
   # had the word l*l*ta as part of their address
   # when mySQL read either of those records
   # their filter caused the script to die
   # with a 35 error.
   #
   # sql offset and sql_limit values
   # we need these because SQL causes 
   # the program to time out
   #
   $sql_limit=10000;
   #
   # the size of attachment names
   # used like
   #           <img src="attachment name">
   #
   $anamesize=10;
   #
   # grab the data the user typed into the HTML form
   #

   #
   # use this to figure out the first time we are called
   # so we can initialize stuff
   #
   $hidden_post_variable=$_POST['hidden_post_variable'];
   $test_send_or_real_send=$_POST['test_send_or_real_send'];



   $sql_offset=$_POST['sql_offset'];


   #
   # if we are in test mode make the SQL offset null
   # that way we always start with an offset of zero or 0
   # in test mode
   #
   if ($test_send_or_real_send == 'test' ) {
      $sql_offset='';
   }


   if ($sql_offset == '' ) {
      $sql_offset=0;
      $sql_offset_hidden=0;
   }
   else {
      $sql_offset_hidden=$sql_offset+$sql_limit;
   }


   #
   # make the default from to be
   #    newsletter@StrategicEdgeBusinessAlliance.com
   #
   $submit_button=$_POST['submit'];
   #echo "submit_button=xxxxxxxx $submit_button xxxxxxxxxxx<p>";
   $from=$_POST['from'];
   if (preg_match("/^ *\$/",$from)) {
      include '0_email_addresses.php';
      #$from='newsletter@StrategicEdge.com';
      $from=$newsletter_email_address;
      #$mike_email_address='mike'.$seba_email_address_domain;
      #$newsletter_email_address='newsletter'.$seba_email_address_domain;
   }
   $to=$from;
   #$to=$_POST['to'];
   $cc='';
   $bcc='';
   $rto='';



   #Load last NEWSLETTER sent

   $text=$_POST['text'];

   #
   # if we are in TEST mode
   #             Load last NEWSLETTER sent BUTTON
   # or the
   #             Load last PRESS RELEASE sent BUTTON
   # then reload either the last NEWSLETTER text
   # or the last PRESSRELEASE text they sent
   #
   # and they click on either the 
   if ($test_send_or_real_send == 'test') {
      #$subject=$testsubject;
      $stinkingsubmitbutton=$_POST['submit'];
      if ($stinkingsubmitbutton == 'Load last NEWSLETTER sent') {
         #
         # load the last NEWSLETTER sent
         #
         $text=file_get_contents('subject_newslettertext.txt');
      }
      if ($stinkingsubmitbutton == 'Load last PRESS RELEASE sent') {
         #
         # load the last PRESS RELEASE sent
         #
         $text=file_get_contents('subject_pressreleasetext.txt');
      }


      
   }



   $cr_before=$_POST['cr_before'];
   $cr_after=$_POST['cr_after'];
   #
   # we no longer have a $subject
   # we now use 3 subjects. one for TEST, one for NEWSLETTERS and one for PRESSRELEASES
   # and remember the subjects from session to session 
   # by saving them in a file.
   #
   #$subject=$_POST['subject'];
   $subject='';
   #if (preg_match("/^ *\$/",$subject)) {
   #   $subject='Strategic Edge Newsletter';
   #}
   #
   # if this is a TEST email then
   # use the last subject they entered for 
   # test emails as the subject
   #
   #if ($test_send_or_real_send == 'test') {
   if ($test_send_or_real_send == 'test' || $test_send_or_real_send == '') {
      $subject=$testsubject;
   }
   #
   # if this is a NEWSLETTER email then
   # use the last subject they entered for 
   # newsletter emails as the subject
   #
   if ($test_send_or_real_send == 'sendit' ) {
      $subject=$newslettersubject;
   }
   #
   # if this is a PRESSRELEASE email then
   # use the last subject they entered for 
   # pressrelease emails as the subject
   #
   if ($test_send_or_real_send == 'pressrelease') {
      $subject=$pressreleasesubject;
   }
   #
   # if the text is null or empty then
   # load in the text from the last email
   # they sent which could have been either
   # a test email, a newsletter email or a pressrelease email
   #
   if ($text == '' ) {
      $text=file_get_contents('subject_last.txt');
   }
   else {
      #
      # if the text is not null then save in in the
      # last email sent out file which is
      # 'subject_last.txt'
      #
      save_stinking_data($text,'subject_last.txt');

      #
      # if this is a real email, ie not test
      # then save it to the last press release file
      # or to the last newsletter file
      # depending on what it is
      #
      if ($test_send_or_real_send == 'sendit' ) {
         #
         # save last newsletter
         #
         #save_stinking_data($text,'subject_newsletter.txt');
         save_stinking_data($text,'subject_newslettertext.txt');
      }
      if ($test_send_or_real_send == 'pressrelease') {
         #
         # save last press release
         #
         #save_stinking_data($text,'subject_pressrelease.txt');
         save_stinking_data($text,'subject_pressreleasetext.txt');
      }



   }





   $how_to_attach=$_POST['how_to_attach'];
   $send_as_html=$_POST['send_as_html'];
   $dump_header_in_debug_window=$_POST['dump_header_in_debug_window'];
   $dont_use_imap=$_POST['dont_use_imap'];
   $put_debug_info_in_email=$_POST['put_debug_info_in_email'];




   $dump_flength=$_POST['dump_flength'];
   #echo "\$dump_flength='$dump_flength'<br>";



   #
   # if first time set the date to current time
   #
   if ($hidden_post_variable == '' ) {
      #
      # get unix time ie: base January 1 1970 00:00:00 GMT
      #
      $ztime=time();
      #
      # convert to Phoenix time
      #
      $ztime-=(60*60*10);
      #
      # 1st time use date and time in Phoenix Arizona
      # the -9000 i think it says we are 9 hours
      # before London time.
      #
      $zdate=date("D, d M Y H:i:s -0900", $ztime);
      $zdate.=" (MST)";
      #
      # also set the flag to dump the 
      # debug info into the body of the email
      #
      #$put_debug_info_in_email='y';
      $put_debug_info_in_email='n';
   }
   else {
      #
      # 2nd time use date they entered on form
      #
      $zdate=$_POST['zdate'];
   }

   $attachment1=$_POST['attachment1'];
   $attachmentname1=$_POST['attachmentname1'];
   $attachment2=$_POST['attachment2'];
   $attachmentname2=$_POST['attachmentname2'];
   $attachment3=$_POST['attachment3'];
   $attachmentname3=$_POST['attachmentname3'];
   $attachmentname2=$_POST['attachmentname2'];
   $attachment4=$_POST['attachment4'];
   $attachmentname4=$_POST['attachmentname4'];
   $attachment5=$_POST['attachment5'];
   $attachmentname5=$_POST['attachmentname5'];
   $attachment6=$_POST['attachment6'];
   $attachmentname6=$_POST['attachmentname6'];

   #
   # clean up the data returned from the form
   # ', ", and \ 
   # are returned as 
   # \', \" and \\
   #
   $text=clean_php_form_data($text);
   $from=clean_php_form_data($from);
   $to=clean_php_form_data($to);
   $cc=clean_php_form_data($cc);
   $bcc=clean_php_form_data($bcc);
   $rto=clean_php_form_data($rto);
   $subject=clean_php_form_data($subject);
   #
   # verify all the FROM: email addresses are valid
   #
   $from=clean_up_to_lines($from);
   $from_errors=get_address_errors($from);
   $total_errors=sum_total_errors($from_errors, $total_errors);
   #
   # verify all the TO: email addresses are valie
   #
   $to=clean_up_to_lines($to);
   $to_errors=get_address_errors($to);
   $total_errors=sum_total_errors($to_errors, $total_errors);
   #
   # a to field is required,
   # if other data was entered
   #
   if ( $from != '' || $cc != '' || $bcc != '' || $text != '' || $subject != '' ) {
      if ($to == '' ) {
         $total_errors++;
         $to_errors.=" a TO address is required";
      }
   }
   else {
      $total_errors=-1;
   }
   #
   # verify all the CC: email addresses are valid
   #
   $cc=clean_up_to_lines($cc);
   $cc_errors=get_address_errors($cc);
   $total_errors=sum_total_errors($cc_errors, $total_errors);
   #
   # verify all the BCC: email addresses are valid
   #
   $bcc=clean_up_to_lines($bcc);
   $bcc_errors=get_address_errors($bcc);
   $total_errors=sum_total_errors($bcc_errors, $total_errors);
   #
   # verify all the Reply To: email addresses are valid
   #
   $rto=clean_up_to_lines($rto);
   $rto_errors=get_address_errors($rto);
   $total_errors=sum_total_errors($rto_errors, $total_errors);
   #
   # if errors dont send the stinking email
   #
   if ($total_errors > 0 ) {
      echo "ERROR(s) E-MAIL NOT SENT!  total errors=$total_errors<br>";
   }
   #
   # here get the bcc addresses to send
   #$bcc=build_bcc_list($test_send_or_real_send);

?>
<!-- table style="background-color:#dddddd" -->
<table>
<tr valign="top">
<td>
<!-- form action="send_an_email.php" method="post" -->
<!-- make it a miltipart/form so we can upload files -->
<form action="email_newsletter.php"  
      method="post" 
      enctype="multipart/form-data"> 
<input type="submit" name=submit value="Send">

     <span style="font-size:150%;">
     <input type="radio" name="test_send_or_real_send"  value="test"
     <?php if ($test_send_or_real_send == 'test' || $test_send_or_real_send == '' ) {echo "checked"; } ?> > TESTING


     &nbsp;&nbsp;&nbsp;&nbsp;
     <input type="radio" name="test_send_or_real_send"  value="sendit"
     <?php if ($test_send_or_real_send == 'sendit' ) {echo "checked"; } ?> > NEWSLETTER


     &nbsp;&nbsp;&nbsp;&nbsp;
     <input type="radio" name="test_send_or_real_send"  value="pressrelease"
     <?php if ($test_send_or_real_send == 'pressrelease' ) {echo "checked"; } ?> > PRESS RELEASE
     </span>




     <br>
<input type="submit" name=submit value="Load last NEWSLETTER sent">
<input type="submit" name=submit value="Load last PRESS RELEASE sent">
     <br>






     <input type="checkbox" name="dump_header_in_debug_window"  value="y"
     <?php if ($dump_header_in_debug_window == 'y'  ){echo "checked"; } ?>>
     dump headers
     dump length 
     <input type="radio" name="dump_flength"  value="after"
     <?php if ($dump_flength == 'after' ) {echo "checked"; } ?> > After
     <input type="radio" name="dump_flength"  value="before"
     <?php if ($dump_flength == 'before' ) {echo "checked"; } ?> > Before
     <input type="radio" name="dump_flength"  value="never"
     <?php if ($dump_flength == 'never'  || $dump_flength == '' ) {echo "checked"; } ?> > Don't


   




<table>
<tr>
   <td align="right">From:</td>
   <td align="left"><input type="text" name="from"  
       <?php echo " size=\"$size\" value=\"$from\""; ?> >
       <?php echo "$from_errors"; ?>
   </td>
</tr>




<tr>
   <td align="right">
      Date :
   </td>
   <td align="left"><input type="text" name="zdate"  
       <?php echo " size=\"$size\" value=\"$zdate\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Test Subject:</td>
   <td align="left"><input type="text" name="testsubject"  
       <?php echo " size=\"$size\" value=\"$testsubject\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Newsletter Subject:</td>
   <td align="left"><input type="text" name="newslettersubject"  
       <?php echo " size=\"$size\" value=\"$newslettersubject\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Press Release Subject:</td>
   <td align="left"><input type="text" name="pressreleasesubject"  
       <?php echo " size=\"$size\" value=\"$pressreleasesubject\""; ?> >
   </td>
</tr>







<tr>
   <td align="right">&nbsp;</td>
   <td align="left">
        Send as TEXT
        <input type="radio" name="send_as_html"  value="text"
        <?php if ($send_as_html == 'text' || $send_as_html == '' ) {echo "checked"; } ?> >,
       HTML
        <input type="radio" name="send_as_html"  value="html"
        <?php if ($send_as_html == 'html' ) { echo "checked";}       ?> >



       &nbsp;&nbsp;&nbsp;Put debug info in E-mail
     <input type="checkbox" name="put_debug_info_in_email"  value="y"
     <?php if ($put_debug_info_in_email == 'y'  ){echo "checked"; } ?>>

       <input type="hidden" name="how_to_attach"  value="after">




       <input type="hidden" name="sql_offset"  value="<?php echo $sql_offset_hidden; ?>">


   </td>
</tr>












<tr>
   <td colspan="2">
       <textarea name="text" 
       <?php echo "cols=\"$size\" rows=\"$rows\" "; ?>><?php echo "$text"; ?></textarea>  
   </td>
</tr>
</table>
<p>
<input type="hidden" name="hidden_post_variable" value="hidden post data">
<input type="reset" name=reset value="RESET">
</form>
<p>
<a href="control-panel.php">Control Panel</a>
</td>


<td>
&nbsp; <!-- move debug window DOWN -->
</td>
</tr>


<td style="background-color:#ffff00">
<h2>Debug Window</h2>
<?php
  #
  # dont send any email
  # we have errors
  #
  if ($total_errors != 0 ) {
      
  }
  else {
     if ( $submit_button == 'Send') {
        #echo "get bcc list here from SQL tables<p>";
        $bcc=build_bcc_list($test_send_or_real_send, $sql_limit, $sql_offset);
     }
     #echo "sending email!!!!! Default from:<br>";
     #
     # play with some of the php.ini values
     # and see if we can get the mail to be sent 
     #
     #$ini_value=ini_set('sendmail_from',$from);
     #$ini_value=ini_set('SMTP','on');
     #$ini_value=ini_set('SMTP','ON');

     # i did this as a wild *ass guess
     # and it doesn't work at all
     # so never let it execute
     #
     #
     # send mail with DEFAULT from:
     # which at greys site is
     #   anonymous@ hosting2.fastq.com
     #
     # this is the default on my server
     # which doesnt even send the mail
     #   me@localhost.com
     #
     # we know this works so stop sending the stinking email
     #
     #
     # modify the DEFAULT from to this $from
     # and send the email again
     #
     # again this works so stop sending the
     # email each time i test new stuff
     #
     #
     # now build a header record to use as the from:
     # and send the email with it
     #
     #
     # save $text and later restore it
     #
     $oldtext=$text;
     $status_messages="";
     #
     # for debugging tell them if we generated a
     #     content-length 
     # header and if we did where we generated it
     #
     if ($dump_flength == 'before') {
       #$status_messages.="Content-Length:xxx is BEFORE base64 header \n";
     }
     if ($dump_flength == 'after') {
       #$status_messages.="Content-Length:xxx is AFTER base64 header \n";
     }
     if ($dump_flength == 'never') {
       #$status_messages.="Content-Length:xxx NOT used\n";
     }
     #
     # for debugging tell them how many blank lines
     # we printed before and after the file
     #
     #$status_messages.="$cr_before blank lines placed BEFORE file\n";
     #$status_messages.="$cr_after blank lines placed AFTER file\n";
     #
     # tell them about the files they have uploaded
     # what the file name is, how it is attached and the use name
     #
     $status_messages.=tell_em_about_attached_file('file_to_upload',
                                                   $attachment1,
                                                   $attachmentname1);
     $status_messages.=tell_em_about_attached_file('file_to_upload2',
                                                   $attachment2,
                                                   $attachmentname2);
     $status_messages.=tell_em_about_attached_file('file_to_upload3',
                                                   $attachment3,
                                                   $attachmentname3);
     $status_messages.=tell_em_about_attached_file('file_to_upload4',
                                                   $attachment4,
                                                   $attachmentname4);
     $status_messages.=tell_em_about_attached_file('file_to_upload5',
                                                   $attachment5,
                                                   $attachmentname5);
     $status_messages.=tell_em_about_attached_file('file_to_upload6',
                                                   $attachment6,
                                                   $attachmentname6);
     #
     # for debugging tell them if the file was
     # attached before or after the HTML header
     #
     if ($how_to_attach == 'before') {
       #$status_messages.="File attached before HTML\n";
     }
     if ($how_to_attach == 'after') {
       #$status_messages.="File attached after HTML\n";
     }
     #
     # some PHP sites dont have the function
     #   imap_binary()
     # so this code is to tell us about that
     # and let us test the function either way
     #


     if ($dont_use_imap == 'y') {
       #$status_messages.="Dont use imap_binary flag set to Y\n";
     }
     else {
       #$status_messages.="Dont use imap_binary flag NOT set\n";
     }
     if (function_exists('imap_binary')) {
       #$status_messages.="imap_binary() EXISTS\n";
     }
     else {
       #$status_messages.="imap_binary() DOESNT exist\n";
     }





     #
     # for debugging for each file uploaded tell them
     #        filename, file size, unix filename, errors
     # this message is listed in the body of the email
     #
     $stinking_files_uploaded=0;
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload2');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload3');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload4');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload5');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload6');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     #
     # if no files were uploaded tell them
     #
     if ($stinking_files_uploaded == 0 ) {
        #$status_messages.="No files attached to this email\n";
     }
     if ($send_as_html == 'html' ) {
       #$status_messages.="Sending as HTML\n";
       $status_messages=preg_replace("/\n/","<br>\n",$status_messages);
     }
     else {
       #$status_messages.="NOT sending as HTML\n";
     }


     #
     # if this variable is set to a y then
     # put the debug information into the
     # body of the email.
     # this way I can turn off the debugging
     # and use it to send homeland security 
     # messages to cartoonists like benson :)
     #
     if ($put_debug_info_in_email == 'y') {
        $text=$status_messages.$text;
     }
     $header="";
     #
     # build the from: header
     #
     if ($from != "" ) {
        $header.="From: $from\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the CC: header
     #
     if ($cc != "" ) {
        $header.="CC: $cc\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";
     }
     #
     # build the BCC: header
     #
     #$bcc=build_bcc_list($test_send_or_real_send);




     if ($bcc != "" ) {
        $header.="BCC: $bcc\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the Reply To: header
     #
     if ($rto != "" ) {
        #
        # "reply to:" doesnt work
        # try using
        # "reply-to:"
        #
        if (0) {
           $header.="Reply To: $rto\r\n";
        }
        else {
           $header.="Reply-To: $rto\r\n";
        }
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the Date: header
     #
     if ($zdate != "" ) {
        $header.="Date: $zdate\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }





     #we may have to flip the order we add the HTML and attached files
     # which is why i put the
     # if ($how_to_attach == "after" ) {
     # }
     # and
     # if ($how_to_attach == "before" ) {
     # }
     # logic
     #
     # i probably have to give the file i attach a name
     # look at my manuals for that. I remember they gave
     # a jpg file they used in an email in one example
     # a name
     #
     #
     # here we will first add the HTML header
     # then we will attach the file and its header
     # 
     # i am guessing the existing php mail software
     # will pull the first html header and use it
     # for the text in the body of the message
     # but i could be wrong on that
     #
     if ($how_to_attach == "after" ) {
        #
        # if we are sending it as HTML 
        # build the html header before the FILES
        #
        if ($send_as_html == 'html' ) {
           $header.="Content-type: text/html\r\n";
        }
        #
        # add the file they uploaded as an attachment to the e-mail
        #
        #echo "<p>make sure the header has been attached AFTER this<p>";
        #
        # add each file entered to the header information
        #
        $header.=setup_call_to_attach_file ('file_to_upload', $attachment1, $attachmentname1, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload2', $attachment2, $attachmentname2, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload3', $attachment3, $attachmentname3, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload4', $attachment4, $attachmentname4, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload5', $attachment5, $attachmentname5, $cr_before, $cr_after, $dump_flength, $dont_use_imap);
        $header.=setup_call_to_attach_file ('file_to_upload6', $attachment6, $attachmentname6, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 



 
        

     }
     if ($how_to_attach == "before" ) {
        #
        # add the file they uploaded as an attachment to the e-mail
        #
        #echo "<p>make sure the header has been attached BEFORE this<p>";



        #
        # add each file entered to the header information
        #
        $header.=setup_call_to_attach_file ('file_to_upload', $attachment1, $attachmentname1, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload2', $attachment2, $attachmentname2, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload3', $attachment3, $attachmentname3, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload4', $attachment4, $attachmentname4, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload5', $attachment5, $attachmentname5, $cr_before, $cr_after, $dump_flength, $dont_use_imap);
        $header.=setup_call_to_attach_file ('file_to_upload6', $attachment6, $attachmentname6, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 




        #
        # if we are sending it as HTML 
        # build the html header after the FILES
        #
        if ($send_as_html == 'html' ) {
           $header.="Content-type: text/html\r\n";
        }
     }






     if ( $submit_button == 'Send') {
        #
        # dump the headers ?
        #
        if ($dump_header_in_debug_window == 'y') {
           echo "<b>dumping headers</b>";
           echo "<pre>";
           echo $header;
           echo "</pre>";
        }
        #
        # only send the email ONCE and send it here
        # before I was sending it after I built
        # each and every header
        #


        #if ( $submit_button == 'Send') {
        #$bcc="frogs snakes@dogs.com";
        echo "SENDING the E-MAIL now!<br>";
        $rc=mail($to,$subject,$text,$header);
     
        #
        # we have sent the email but
        # print some information in the debug window
        # about how we sent the email
        #
        echo "<table border=1>";
        $x=htmlentities($to);
        echo "<tr><td align=\"right\">To:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($cc);
        echo "<tr><td align=\"right\">CC:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($bcc);
        echo "<tr><td align=\"right\">BCC:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($rto);
        echo "<tr><td align=\"right\">Reply To:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($from);
        echo "<tr><td align=\"right\">From:</td><td>$x &nbsp;</td></tr>";



        #
        # list the data about each of the files
        # that were uploaded in table format
        # for debugging
        #
        build_tr_for_file('file_to_upload');
        build_tr_for_file('file_to_upload2');
        build_tr_for_file('file_to_upload3');
        build_tr_for_file('file_to_upload4');
        build_tr_for_file('file_to_upload5');
        build_tr_for_file('file_to_upload6');



        $x=htmlentities($subject);
        echo "<tr><td align=\"right\">Subject:</td><td>$x &nbsp;</td></tr>";
        $x=$text;
        #
        # if they are sending it as text
        # convert the krud in the message
        # to html stuff so we can view
        # it in netscape
        # ie 
        #     > becomes &gt;
        #     < becomes &lt;
        #     .....
        #
        if ( $send_as_html == 'text' ) {
           $x=htmlentities($text);
           #
           # make the spaces display correctly with &nbsp;
           #
           $x=preg_replace("/ /","&nbsp;",$x);
           #
           # make line breaks display correctly with <br>
           #
           $x=preg_replace("/\n/","<br>",$x);
        }
        echo "<tr><td colspan=2>$x&nbsp;</td></tr>";
        echo "<tr><td align=\"right\">RC</td><td>$rc&nbsp;</td></tr>";

        if ($rc != 1 ) {
           echo "<tr><td colspan=\"2\">Hmmm... Something has changed. The rc used to be set to one</td></tr>";
        }
        echo "</table>";
     }
  }   
?>
</td>
</tr>
</table>




<?php
   #include 'save_stinking_data.php';


?>

email_newsletter_45_base.php

TOC

<html><head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<h1 align="center">E-mail Newsletter</h1>
<?php
   include 'save_stinking_data.php';
#
# this program will work according to the
# customer services reps at 100webspace.net
# if pat upgrades to a $3/month account.
#
# although he MIGHT have to use a sending
# email address which is a valid email
# address from this site. as opposed to
# using a email addresss like this
#
#    bogus@email-addresss-that-doesnt-exist.com
# but
#    realaddress@100webspace.net
#











   $testsubject=$_POST['testsubject'];
   $newslettersubject=$_POST['newslettersubject'];
   $pressreleasesubject=$_POST['pressreleasesubject'];
   $testsubject=preg_replace("/\\\(.)/","$1",$testsubject);
   $newslettersubject=preg_replace("/\\\(.)/","$1",$newslettersubject);
   $pressreleasesubject=preg_replace("/\\\(.)/","$1",$pressreleasesubject);


   #$testsubject=preg_replace('/"/',"",$testsubject);
   #$newslettersubject=preg_replace('/"/',"",$newslettersubject);
   #$pressreleasesubject=preg_replace('/"/',"",$pressreleasesubject);
   $testsubject=preg_replace('/"/',"&quot;",$testsubject);
   $newslettersubject=preg_replace('/"/',"&quot;",$newslettersubject);
   $pressreleasesubject=preg_replace('/"/',"&quot;",$pressreleasesubject);


   #$test_send_or_real_send == 'test'
   #$test_send_or_real_send == 'sendit'
   #$test_send_or_real_send == 'pressrelease'
   #$pressreleasesubject
   #$newslettersubject
   #$testsubject
   if ($testsubject == "" ) {
      $testsubject=file_get_contents('subject_test.txt');
   }
   else {
      #echo "hi........<p>";
      save_stinking_data($testsubject,'subject_test.txt');
   }


   if ($newslettersubject == "" ) {
      $newslettersubject=file_get_contents('subject_newsletter.txt');
   }
   else {
      #echo "hi........2<p>";
      save_stinking_data($newslettersubject,'subject_newsletter.txt');
   }
   if ($pressreleasesubject == "" ) {
      $pressreleasesubject=file_get_contents('subject_pressreleases.txt');
   }
   else {
      #echo "hi........3<p>";
      save_stinking_data($pressreleasesubject,'subject_pressreleases.txt');
   }





function build_bcc_list($test, $limit, $offset) {
   $sqllimit="";
   if ($offset == '' ) {
      $offset=0;
   }
   #if ($limit != '' ) {
   #   $sqllimit=" limit $offset , $limit ";
   #}
   if ($test == 'sendit') {
      $sqltable=" junk_emails ";
   }
   else {
      if ($test == 'pressrelease') {
         $sqltable=" press_releases ";
      }
      else {
         $sqltable=" junk_emails_test ";
      }
   }
   $bcc="";
   #require('sql_passwords.php');
   include 'sql_passwords.php';
   # 
   # connect to SQL 
   #  
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to grab all the data entered so far
   #
   #$query = "select email  from $sqltable limit 1500 ";
   #$query = "select email  from $sqltable $sqllimit ";
   $query = "select email  from $sqltable where delete_flag='no' $sqllimit ";

   #
   # display the select
   # 
   echo "query=$query<p>";
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $email=$line['email'];
      #echo "email=$email<br>";
      if ($bcc == '' ) {
         $bcc=$email;
      }
      else {
         #$bcc.=','.$email;
         $bcc.=" \n , ".$email;
      }
   } 
   # 
   # close the SQL connection 
   # 
   mysql_close($link);









   return $bcc;
}







function dump_file_length_header($data) {
   #
   # this function is used to build the 
   #  Content-Length: nnn
   # header where nnn is the size of the file
   # note all of our files are encoded into
   # mime or base64 so the size will be larger
   # then the orginal file size
   #
   # the file has been read into memory
   # get the size of it
   #
   $bytes=strlen($data);
   #
   # build the content-length header
   #
   $length_header="Content-Length: $bytes\r\n";
   #
   # return to the caller
   #
   return $length_header;
}
function tell_em_about_attached_file($fname,$attachment,$name) {
   #
   # if the file name is not blank
   # this function generates a message
   # telling them
   #    1) file name
   #    2) is it an attachment or not YES/NO
   #    3) the name used
   #
   $message="";
   #
   # if the name is not blank do our stuff
   #
   if ($_FILES[$fname]['name'] != '') {
     #
     # assume it isn't an attachment
     #
     $isitanattachment="NO";
     if ($attachment == 'a') {
        #
        # well gosh it IS an attachment
        #
        $isitanattachment="YES";
     }
     #
     # build the message
     #
     $pc_name=$_FILES[$fname]['name'];
     $message="$pc_name, a=$isitanattachment n='$name'\n";
   }  
   #
   # return the message to the caller
   #
   return $message;
}
function build_tr_for_file($file) {
   if ($_FILES[$file]['name'] != "" ) {
      echo "<tr><td>Filename</td><td>{$_FILES[$file]['name']}</td></tr>";
      echo "<tr><td>File type</td><td>{$_FILES[$file]['type']}</td></tr>";
      echo "<tr><td>File size</td><td>{$_FILES[$file]['size']}</td></tr>";
      echo "<tr><td>File error</td><td>{$_FILES[$file]['error']}</td></tr>";
      echo "<tr><td>File on server</td><td>{$_FILES[$file]['tmp_name']}</td></tr>";
      echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
     }
   return;
}


function get_blank_lines($count) {
   #
   # i dont know how many blank lines i need
   # before and after the file so this function
   # will let me enter between 0 and 9 which
   # one of the values will work
   #
   for($i=0;$i<10;$i++) {
      $selected="";
      if ($i == $count) {
         $selected=" selected ";
      }
      echo "<option value=\"$i\" $selected>$i</option>";
   }
   return;
}

function tell_about_file_uploaded_to_us ($file) {
   # 
   # for debugging tell them some info about
   # the file they have uploaded
   #
   # blank the message
   #
   $status_messages="";
   #
   # if the file has been uploaded get the details
   #
   if ($_FILES[$file]['name'] != "" ) {
       #
       # tell them the files name
       #      
       $status_messages.=$_FILES[$file]['name'];
       $status_messages.=" contains ";
       #
       # tell them the files size in bytes
       #  
       $status_messages.=$_FILES[$file]['size'];
       #
       # tell them where the file was uploaded to
       # which is usually a randomly made name in
       #      /tmp
       #  
       $status_messages.=" bytes is attached to this email as ";
       $status_messages.=$_FILES[$file]['tmp_name'];
       $status_messages.=" with ";
       #
       # tell them how many errors the file had as it was uploaded
       # at least that is what i think this is.
       # I dont know for sure.
       #  
       $status_messages.=$_FILES[$file]['error'];
       $status_messages.=" errors\n";
   }
   #
   # return the message to the caller
   #
   return $status_messages;
}

function setup_call_to_attach_file ($zname, $attachment, $attachmentname, $cr_before, $cr_after, $dump_flength, $dont_use_imap) {
   #
   # make the output null
   #
   $header="";
   #
   # create an array to make a copy of the file info
   #
   $filex=array();
   #
   # if the file was entered then add it to the header info
   #
   if ($_FILES[$zname]['name'] != "" ) {
      #
      # copy the file array
      #
      $filex=$_FILES[$zname];
      #
      # get the files name
      #
      $filexname=$_FILES[$zname]['name'];
      #
      # put the files data to the header
      #
      $header=attach_a_file_to_headers($filex, 
                                        $attachment, 
                                        $attachmentname,
                                        $filexname,
                                        $cr_before,
                                        $cr_after,
                                        $dump_flength,
                                        $dont_use_imap);
        }
   #
   # all done return the data to the caller
   #
   return $header;
}



function attach_a_file_to_headers($file, $attachment, $name, $filename, $cr_before, $cr_after, $dump_flength, $dont_use_imap) {
   #
   # this function will build the header records
   # that are used to attach a file to an email
   # and send the file as an attachment
   #   $file       - the file array with file informaion
   #   $attachment - is this file going to be an attachment
   #               - as opposed to a file that will be say
   #               - an image in html displayed
   #   $name       - the name of this file, not the filename
   #               - this is the name used in an <a or <img tag
   #               - like   <img src="foo">
   #               - as opposed to the files name like
   #               - resume.doc which is part of the $file array
   #
   # zero out the data we want to return
   #
   $data="";
   #
   # debug the puppy
   #
   if (0) {
      echo "attachment=$attachment<br>";
      echo "attachment name=$name<br>";
      echo "file array=$file<br>"; 
      foreach ($file as $f) {
         echo "&nbsp;&nbsp;&nbsp;$f<br>";
      }
   }
   #
   # are we supposed to attache it as an  attachment
   # as opposed to an inline file which could be used
   # as an image when we display the email as HTML
   #
   if ( $attachment != '' ) {
      $data.="Content-Disposition: attachment;\r\n";
   }
   #
   # should we add the file name?
   #
   if ($filename != '') {
      $data.="filename=\"$filename\"\r\n";
   }
   #
   # add the content-type
   #  
   $data.="Content-type: ".$file['type'];
   #
   # if we have a "name" put it after the content type
   if ($name != '' ) {
      $data.=" name=\"$name\"";
   }
   #
   # either way put a \n at the end of the content-type
   #
   $data.="\r\n";
   #
   # tell it that the text that follows is mime or base64
   # which are two ways to say the same thing
   #






   #
   # read the file into memory
   #
   $file_data=file_get_contents($file['tmp_name']);
   #
   # convert the file data into mime text or base64 text
   # 
   #
   # for useless information this is how the file is encoded
   # see this URL for more info
   #   
   #         http://www.freesoft.org/CIE/RFC/1521/7.htm
   #
   #   Value Encoding  Value Encoding  Value Encoding  Value Encoding
   #        0 A            17 R            34 i            51 z
   #        1 B            18 S            35 j            52 0
   #        2 C            19 T            36 k            53 1
   #        3 D            20 U            37 l            54 2
   #        4 E            21 V            38 m            55 3
   #        5 F            22 W            39 n            56 4
   #        6 G            23 X            40 o            57 5
   #        7 H            24 Y            41 p            58 6
   #        8 I            25 Z            42 q            59 7
   #        9 J            26 a            43 r            60 8
   #       10 K            27 b            44 s            61 9
   #       11 L            28 c            45 t            62 +
   #       12 M            29 d            46 u            63 /
   #       13 N            30 e            47 v
   #       14 O            31 f            48 w         (pad) =
   #       15 P            32 g            49 x
   #       16 Q            33 h            50 y
   #
   # do the encoding
   #


   #$dont_use_imap
   if (! function_exists('imap_binary') || $dont_use_imap == 'y') {
      #
      # imap_binary() function does not exist
      # or we are testing and want to use my function
      # use my code to convert to mime or base64
      #
      if (! function_exists('imap_binary')) {
         echo "imap_binary() function does not exist<br>";
      }
      if ($dont_use_imap == 'y') {
         #echo "who cares about imap_binary() we ain't using it<br>";
      }
      #echo "using mikes IMAP function<br>";
      #
      # convert the string to a monster string
      # which is encoded in base64 or mime format
      #
      $base64data0=base64_encode($file_data);
      #
      # split it into lines that are 60 bytes long
      #
      $base64data=chunk_split($base64data0,60);
   }
   else {
      #
      # imap_binary function exists!
      # use it
      #
      #echo "imap_binary() function EXISTS<br>";
      $base64data=imap_binary($file_data);
   }







   #
   # dump the header that tells the length of the data
   # before the base64 header
   #
   if ( $dump_flength == 'before' ) {
      $data.=dump_file_length_header($base64data);
   }
   $data.="Content-transfer-encoding: base64\r\n";
   #
   # dump the header that tells the length of the data
   # after the base64 header
   #
   if ( $dump_flength == 'after' ) {
      $data.=dump_file_length_header($base64data);
   }
   #
   # should we add extra blank lines before the file?
   #
   if ($cr_before > 0 ) {
      $extra_blank_lines=0;
      while($extra_blank_lines < $cr_before) {
         $data.="\r\n";
         $extra_blank_lines++;
      }
   }
   #echo "like this<br>Content-Type: text/plain; charset=US-ASCII; name=mud<br>";
   #
   # add the mime or base64 data to the header
   #
   $data.=$base64data;
   #
   # should we add extra blank lines after the file?
   #
   if ($cr_after > 0 ) {
      $extra_blank_lines=0;
      while($extra_blank_lines < $cr_after) {
         $data.="\r\n";
         $extra_blank_lines++;
      }
   } 
   #
   # debug and dump the data
   #
   if (0) {
      echo "header=<pre>$data\"</pre>end header<p>";
   }
   #
   # return the data
   #
   return $data;
}
?>
<html>
<?php
#
# print our ip address
#
if (0) {
   echo "IP Address=";
   echo ${REMOTE_ADDR};
   echo "<p>";
}
#
# if we are at the lycos site print
# a few blank lines at the top to
# get around their annoying headers
#
#if (${REMOTE_ADDR} == '156.42.68.5' || ${REMOTE_ADDR} == '212.78.204.20') {
if (${REMOTE_ADDR} == '212.78.204.20') {
   for ($i=0;$i<3;$i++) {
      echo "&nbsp;<p>";
   }
}


?>
<?php
#
# include this function to clean up the
# data returned from PHP forms
# those annoying forms return
#    ", ', and \
# as
#    \",  \', and \\
#
#
# since i am giving this to grey DONT
# include the function. hard code it
#
#include "clean_php_form_data.php";
function clean_php_form_data($data) {
   #
   # for some reason when you enter the characters
   #     ", ', and \
   # into a PHP form they are returned as
   #     \", \', and \\
   #
   # well this function cleans up the data
   # and removes the annoying backslashes
   #
   # oddly data is NOT returned this way in PERL
   #
   $data=preg_replace('/\\\\\'/',"'",$data);
   $data=preg_replace('/\\\\\"/','"',$data);
   $data=preg_replace('/\\\\\\\\/',"\\",$data);
   return $data;
}
#
function sum_total_errors($data, $total_errors) {
   if ($data != '' ) {
      $total_errors++;
   }
   return $total_errors;
}
function clean_up_to_lines($data) {
    #
    # remove leading and trailing spaces
    #
    $data=preg_replace("/^ */","",$data);
    $data=preg_replace("/ *\$/","",$data);
    #
    # remove extra spaces
    #
    $data=preg_replace("/  */"," ",$data);
    #
    # remove leading and trail spaces from
    #       < frog@dog.com   >
    $data=preg_replace("/ *< */","<",$data);
    $data=preg_replace("/ *> */",">",$data); 
    #
    # remove leading and trail spaces from commas that
    # seperate email addresses
    #      frog@god.com     ,   me@superman.gov
    #
    $data=preg_replace("/ *, */",",",$data);
    return $data;
}
function get_address_errors($data) {
    $errors="";
    if ($data != '' ) {
       $names=explode(",",$data);
       foreach ($names as $n) {
          #
          # remove leading and trailing spaces
          #
          $n=preg_replace("/^ */","",$n);
          $n=preg_replace("/ *\$/","",$n);
          #
          # if you have
          #        tom jones <you@email.com>
          # we have to validate the stuff enclosed in <>
          # as the email address and ignore the other stuff
          # this code should do that
          #
          $nn=$n;
          if (preg_match("/<.*>/",$nn)) {
             $nn=preg_replace("/^.*</","",$nn);
             $nn=preg_replace("/>.*\$/","",$nn);  
          }
          #
          # now validate the email address
          # if the email address contains spaces
          # it is invalid
          #
          if (preg_match("/ /",$nn)) {
             if ($errors == '' ) {
                $errors=$n;
             }
             else {
                $errors.=" $n";
             }
          }
          else {
             #
             # if the email address is not in the form
             #     something@somewhere.xxx
             # it is invalid
             #
             if (! preg_match("/[^@]+@[^@]+\.[^@]+/",$nn)) {
                if ($errors == '' ) {
                   $errors=$n;
                }
                else {
                   $errors.=" $n";
                }
             }
             else {
                #
                # and it cant end or begin with
                # these letters
                # nor can it have @....@ in it
                # nor can it have .. or 2 dots next to each other
                #
                $nonos="\.@";
                if (preg_match("/^[$nonos]/",$nn)  || 
                    preg_match("/[$nonos]\$/",$nn) || 
                    preg_match("/\.\./",$nn) || 
                    preg_match("/@.*@/",$nn)) {
                   #
                   # we have either
                   #    illegal begining or ending characters
                   #    multiple @ signs
                   #
                   if ($errors == '' ) {
                      $errors=$n;
                   }
                   else {
                      $errors.=" $n";
                   }
                }
             }
          }
       }
    }
    #
    # if email addresses have stuff like
    #        tom & bob <thoseguyes@email.com>
    # convert it so it is displayable
    #
    $errors=htmlentities($errors);
    #
    # make it red and tell them it is an error
    if ($errors != '' ) {
    $errors="<span style=\"background=#ff0000\">ERROR $errors</span>";
    }
    return $errors;
}

   #
   # set the default values for this program
   #
   $total_errors=0;
   $size=80;
   $rows=50;
   #
   # the program DID NOT TIME OUT!!!!!
   # their censor filters caused the 
   # script to die. two email addresses
   # had the word l*l*ta as part of their address
   # when mySQL read either of those records
   # their filter caused the script to die
   # with a 35 error.
   #
   # sql offset and sql_limit values
   # we need these because SQL causes 
   # the program to time out
   #
   $sql_limit=10000;
   #
   # the size of attachment names
   # used like
   #           <img src="attachment name">
   #
   $anamesize=10;
   #
   # grab the data the user typed into the HTML form
   #

   #
   # use this to figure out the first time we are called
   # so we can initialize stuff
   #
   $hidden_post_variable=$_POST['hidden_post_variable'];
   $test_send_or_real_send=$_POST['test_send_or_real_send'];



   $sql_offset=$_POST['sql_offset'];


   #
   # if we are in test mode make the SQL offset null
   # that way we always start with an offset of zero or 0
   # in test mode
   #
   if ($test_send_or_real_send == 'test' ) {
      $sql_offset='';
   }


   if ($sql_offset == '' ) {
      $sql_offset=0;
      $sql_offset_hidden=0;
   }
   else {
      $sql_offset_hidden=$sql_offset+$sql_limit;
   }


   #
   # make the default from to be
   #    newsletter@StrategicEdgeBusinessAlliance.com
   #
   $submit_button=$_POST['submit'];
   #echo "submit_button=xxxxxxxx $submit_button xxxxxxxxxxx<p>";
   $from=$_POST['from'];
   if (preg_match("/^ *\$/",$from)) {
      include '0_email_addresses.php';
      #$from='newsletter@StrategicEdge.com';
      $from=$newsletter_email_address;
      #$mike_email_address='mike'.$seba_email_address_domain;
      #$newsletter_email_address='newsletter'.$seba_email_address_domain;
   }
   $to=$from;
   #$to=$_POST['to'];
   $cc='';
   $bcc='';
   $rto='';



   #Load last NEWSLETTER sent

   $text=$_POST['text'];

   #
   # if we are in TEST mode
   #             Load last NEWSLETTER sent BUTTON
   # or the
   #             Load last PRESS RELEASE sent BUTTON
   # then reload either the last NEWSLETTER text
   # or the last PRESSRELEASE text they sent
   #
   # and they click on either the 
   if ($test_send_or_real_send == 'test') {
      #$subject=$testsubject;
      $stinkingsubmitbutton=$_POST['submit'];
      if ($stinkingsubmitbutton == 'Load last NEWSLETTER sent') {
         #
         # load the last NEWSLETTER sent
         #
         $text=file_get_contents('subject_newslettertext.txt');
      }
      if ($stinkingsubmitbutton == 'Load last PRESS RELEASE sent') {
         #
         # load the last PRESS RELEASE sent
         #
         $text=file_get_contents('subject_pressreleasetext.txt');
      }


      
   }



   $cr_before=$_POST['cr_before'];
   $cr_after=$_POST['cr_after'];
   #
   # we no longer have a $subject
   # we now use 3 subjects. one for TEST, one for NEWSLETTERS and one for PRESSRELEASES
   # and remember the subjects from session to session 
   # by saving them in a file.
   #
   #$subject=$_POST['subject'];
   $subject='';
   #if (preg_match("/^ *\$/",$subject)) {
   #   $subject='Strategic Edge Newsletter';
   #}
   #
   # if this is a TEST email then
   # use the last subject they entered for 
   # test emails as the subject
   #
   #if ($test_send_or_real_send == 'test') {
   if ($test_send_or_real_send == 'test' || $test_send_or_real_send == '') {
      $subject=$testsubject;
   }
   #
   # if this is a NEWSLETTER email then
   # use the last subject they entered for 
   # newsletter emails as the subject
   #
   if ($test_send_or_real_send == 'sendit' ) {
      $subject=$newslettersubject;
   }
   #
   # if this is a PRESSRELEASE email then
   # use the last subject they entered for 
   # pressrelease emails as the subject
   #
   if ($test_send_or_real_send == 'pressrelease') {
      $subject=$pressreleasesubject;
   }
   #
   # if the text is null or empty then
   # load in the text from the last email
   # they sent which could have been either
   # a test email, a newsletter email or a pressrelease email
   #
   if ($text == '' ) {
      $text=file_get_contents('subject_last.txt');
   }
   else {
      #
      # if the text is not null then save in in the
      # last email sent out file which is
      # 'subject_last.txt'
      #
      save_stinking_data($text,'subject_last.txt');

      #
      # if this is a real email, ie not test
      # then save it to the last press release file
      # or to the last newsletter file
      # depending on what it is
      #
      if ($test_send_or_real_send == 'sendit' ) {
         #
         # save last newsletter
         #
         #save_stinking_data($text,'subject_newsletter.txt');
         save_stinking_data($text,'subject_newslettertext.txt');
      }
      if ($test_send_or_real_send == 'pressrelease') {
         #
         # save last press release
         #
         #save_stinking_data($text,'subject_pressrelease.txt');
         save_stinking_data($text,'subject_pressreleasetext.txt');
      }



   }





   $how_to_attach=$_POST['how_to_attach'];
   $send_as_html=$_POST['send_as_html'];
   $dump_header_in_debug_window=$_POST['dump_header_in_debug_window'];
   $dont_use_imap=$_POST['dont_use_imap'];
   $put_debug_info_in_email=$_POST['put_debug_info_in_email'];




   $dump_flength=$_POST['dump_flength'];
   #echo "\$dump_flength='$dump_flength'<br>";



   #
   # if first time set the date to current time
   #
   if ($hidden_post_variable == '' ) {
      #
      # get unix time ie: base January 1 1970 00:00:00 GMT
      #
      $ztime=time();
      #
      # convert to Phoenix time
      #
      $ztime-=(60*60*10);
      #
      # 1st time use date and time in Phoenix Arizona
      # the -9000 i think it says we are 9 hours
      # before London time.
      #
      $zdate=date("D, d M Y H:i:s -0900", $ztime);
      $zdate.=" (MST)";
      #
      # also set the flag to dump the 
      # debug info into the body of the email
      #
      #$put_debug_info_in_email='y';
      $put_debug_info_in_email='n';
   }
   else {
      #
      # 2nd time use date they entered on form
      #
      $zdate=$_POST['zdate'];
   }

   $attachment1=$_POST['attachment1'];
   $attachmentname1=$_POST['attachmentname1'];
   $attachment2=$_POST['attachment2'];
   $attachmentname2=$_POST['attachmentname2'];
   $attachment3=$_POST['attachment3'];
   $attachmentname3=$_POST['attachmentname3'];
   $attachmentname2=$_POST['attachmentname2'];
   $attachment4=$_POST['attachment4'];
   $attachmentname4=$_POST['attachmentname4'];
   $attachment5=$_POST['attachment5'];
   $attachmentname5=$_POST['attachmentname5'];
   $attachment6=$_POST['attachment6'];
   $attachmentname6=$_POST['attachmentname6'];

   #
   # clean up the data returned from the form
   # ', ", and \ 
   # are returned as 
   # \', \" and \\
   #
   $text=clean_php_form_data($text);
   $from=clean_php_form_data($from);
   $to=clean_php_form_data($to);
   $cc=clean_php_form_data($cc);
   $bcc=clean_php_form_data($bcc);
   $rto=clean_php_form_data($rto);
   $subject=clean_php_form_data($subject);
   #
   # verify all the FROM: email addresses are valid
   #
   $from=clean_up_to_lines($from);
   $from_errors=get_address_errors($from);
   $total_errors=sum_total_errors($from_errors, $total_errors);
   #
   # verify all the TO: email addresses are valie
   #
   $to=clean_up_to_lines($to);
   $to_errors=get_address_errors($to);
   $total_errors=sum_total_errors($to_errors, $total_errors);
   #
   # a to field is required,
   # if other data was entered
   #
   if ( $from != '' || $cc != '' || $bcc != '' || $text != '' || $subject != '' ) {
      if ($to == '' ) {
         $total_errors++;
         $to_errors.=" a TO address is required";
      }
   }
   else {
      $total_errors=-1;
   }
   #
   # verify all the CC: email addresses are valid
   #
   $cc=clean_up_to_lines($cc);
   $cc_errors=get_address_errors($cc);
   $total_errors=sum_total_errors($cc_errors, $total_errors);
   #
   # verify all the BCC: email addresses are valid
   #
   $bcc=clean_up_to_lines($bcc);
   $bcc_errors=get_address_errors($bcc);
   $total_errors=sum_total_errors($bcc_errors, $total_errors);
   #
   # verify all the Reply To: email addresses are valid
   #
   $rto=clean_up_to_lines($rto);
   $rto_errors=get_address_errors($rto);
   $total_errors=sum_total_errors($rto_errors, $total_errors);
   #
   # if errors dont send the stinking email
   #
   if ($total_errors > 0 ) {
      echo "ERROR(s) E-MAIL NOT SENT!  total errors=$total_errors<br>";
   }
   #
   # here get the bcc addresses to send
   #$bcc=build_bcc_list($test_send_or_real_send);

?>
<!-- table style="background-color:#dddddd" -->
<table>
<tr valign="top">
<td>
<!-- form action="send_an_email.php" method="post" -->
<!-- make it a miltipart/form so we can upload files -->
<form action="email_newsletter.php"  
      method="post" 
      enctype="multipart/form-data"> 
<input type="submit" name=submit value="Send">

     <span style="font-size:150%;">
     <input type="radio" name="test_send_or_real_send"  value="test"
     <?php if ($test_send_or_real_send == 'test' || $test_send_or_real_send == '' ) {echo "checked"; } ?> > TESTING


     &nbsp;&nbsp;&nbsp;&nbsp;
     <input type="radio" name="test_send_or_real_send"  value="sendit"
     <?php if ($test_send_or_real_send == 'sendit' ) {echo "checked"; } ?> > NEWSLETTER


     &nbsp;&nbsp;&nbsp;&nbsp;
     <input type="radio" name="test_send_or_real_send"  value="pressrelease"
     <?php if ($test_send_or_real_send == 'pressrelease' ) {echo "checked"; } ?> > PRESS RELEASE
     </span>




     <br>
<input type="submit" name=submit value="Load last NEWSLETTER sent">
<input type="submit" name=submit value="Load last PRESS RELEASE sent">
     <br>






     <input type="checkbox" name="dump_header_in_debug_window"  value="y"
     <?php if ($dump_header_in_debug_window == 'y'  ){echo "checked"; } ?>>
     dump headers
     dump length 
     <input type="radio" name="dump_flength"  value="after"
     <?php if ($dump_flength == 'after' ) {echo "checked"; } ?> > After
     <input type="radio" name="dump_flength"  value="before"
     <?php if ($dump_flength == 'before' ) {echo "checked"; } ?> > Before
     <input type="radio" name="dump_flength"  value="never"
     <?php if ($dump_flength == 'never'  || $dump_flength == '' ) {echo "checked"; } ?> > Don't


   




<table>
<tr>
   <td align="right">From:</td>
   <td align="left"><input type="text" name="from"  
       <?php echo " size=\"$size\" value=\"$from\""; ?> >
       <?php echo "$from_errors"; ?>
   </td>
</tr>




<tr>
   <td align="right">
      Date :
   </td>
   <td align="left"><input type="text" name="zdate"  
       <?php echo " size=\"$size\" value=\"$zdate\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Test Subject:</td>
   <td align="left"><input type="text" name="testsubject"  
       <?php echo " size=\"$size\" value=\"$testsubject\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Newsletter Subject:</td>
   <td align="left"><input type="text" name="newslettersubject"  
       <?php echo " size=\"$size\" value=\"$newslettersubject\""; ?> >
   </td>
</tr>

<tr>
   <td align="right">Press Release Subject:</td>
   <td align="left"><input type="text" name="pressreleasesubject"  
       <?php echo " size=\"$size\" value=\"$pressreleasesubject\""; ?> >
   </td>
</tr>







<tr>
   <td align="right">&nbsp;</td>
   <td align="left">
        Send as TEXT
        <input type="radio" name="send_as_html"  value="text"
        <?php if ($send_as_html == 'text' || $send_as_html == '' ) {echo "checked"; } ?> >,
       HTML
        <input type="radio" name="send_as_html"  value="html"
        <?php if ($send_as_html == 'html' ) { echo "checked";}       ?> >



       &nbsp;&nbsp;&nbsp;Put debug info in E-mail
     <input type="checkbox" name="put_debug_info_in_email"  value="y"
     <?php if ($put_debug_info_in_email == 'y'  ){echo "checked"; } ?>>

       <input type="hidden" name="how_to_attach"  value="after">




       <input type="hidden" name="sql_offset"  value="<?php echo $sql_offset_hidden; ?>">


   </td>
</tr>












<tr>
   <td colspan="2">
       <textarea name="text" 
       <?php echo "cols=\"$size\" rows=\"$rows\" "; ?>><?php echo "$text"; ?></textarea>  
   </td>
</tr>
</table>
<p>
<input type="hidden" name="hidden_post_variable" value="hidden post data">
<input type="reset" name=reset value="RESET">
</form>
<p>
<a href="control-panel.php">Control Panel</a>
</td>


<td>
&nbsp; <!-- move debug window DOWN -->
</td>
</tr>


<td style="background-color:#ffff00">
<h2>Debug Window</h2>
<?php
  #
  # dont send any email
  # we have errors
  #
  if ($total_errors != 0 ) {
      
  }
  else {
     if ( $submit_button == 'Send') {
        #echo "get bcc list here from SQL tables<p>";
        $bcc=build_bcc_list($test_send_or_real_send, $sql_limit, $sql_offset);
     }
     #echo "sending email!!!!! Default from:<br>";
     #
     # play with some of the php.ini values
     # and see if we can get the mail to be sent 
     #
     #$ini_value=ini_set('sendmail_from',$from);
     #$ini_value=ini_set('SMTP','on');
     #$ini_value=ini_set('SMTP','ON');

     # i did this as a wild *ass guess
     # and it doesn't work at all
     # so never let it execute
     #
     #
     # send mail with DEFAULT from:
     # which at greys site is
     #   anonymous@ hosting2.fastq.com
     #
     # this is the default on my server
     # which doesnt even send the mail
     #   me@localhost.com
     #
     # we know this works so stop sending the stinking email
     #
     #
     # modify the DEFAULT from to this $from
     # and send the email again
     #
     # again this works so stop sending the
     # email each time i test new stuff
     #
     #
     # now build a header record to use as the from:
     # and send the email with it
     #
     #
     # save $text and later restore it
     #
     $oldtext=$text;
     $status_messages="";
     #
     # for debugging tell them if we generated a
     #     content-length 
     # header and if we did where we generated it
     #
     if ($dump_flength == 'before') {
       #$status_messages.="Content-Length:xxx is BEFORE base64 header \n";
     }
     if ($dump_flength == 'after') {
       #$status_messages.="Content-Length:xxx is AFTER base64 header \n";
     }
     if ($dump_flength == 'never') {
       #$status_messages.="Content-Length:xxx NOT used\n";
     }
     #
     # for debugging tell them how many blank lines
     # we printed before and after the file
     #
     #$status_messages.="$cr_before blank lines placed BEFORE file\n";
     #$status_messages.="$cr_after blank lines placed AFTER file\n";
     #
     # tell them about the files they have uploaded
     # what the file name is, how it is attached and the use name
     #
     $status_messages.=tell_em_about_attached_file('file_to_upload',
                                                   $attachment1,
                                                   $attachmentname1);
     $status_messages.=tell_em_about_attached_file('file_to_upload2',
                                                   $attachment2,
                                                   $attachmentname2);
     $status_messages.=tell_em_about_attached_file('file_to_upload3',
                                                   $attachment3,
                                                   $attachmentname3);
     $status_messages.=tell_em_about_attached_file('file_to_upload4',
                                                   $attachment4,
                                                   $attachmentname4);
     $status_messages.=tell_em_about_attached_file('file_to_upload5',
                                                   $attachment5,
                                                   $attachmentname5);
     $status_messages.=tell_em_about_attached_file('file_to_upload6',
                                                   $attachment6,
                                                   $attachmentname6);
     #
     # for debugging tell them if the file was
     # attached before or after the HTML header
     #
     if ($how_to_attach == 'before') {
       #$status_messages.="File attached before HTML\n";
     }
     if ($how_to_attach == 'after') {
       #$status_messages.="File attached after HTML\n";
     }
     #
     # some PHP sites dont have the function
     #   imap_binary()
     # so this code is to tell us about that
     # and let us test the function either way
     #


     if ($dont_use_imap == 'y') {
       #$status_messages.="Dont use imap_binary flag set to Y\n";
     }
     else {
       #$status_messages.="Dont use imap_binary flag NOT set\n";
     }
     if (function_exists('imap_binary')) {
       #$status_messages.="imap_binary() EXISTS\n";
     }
     else {
       #$status_messages.="imap_binary() DOESNT exist\n";
     }





     #
     # for debugging for each file uploaded tell them
     #        filename, file size, unix filename, errors
     # this message is listed in the body of the email
     #
     $stinking_files_uploaded=0;
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload2');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload3');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload4');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload5');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     $status_messagesx=tell_about_file_uploaded_to_us ('file_to_upload6');
     if ($status_messagesx != '' ) {
        $stinking_files_uploaded++;
        $status_messages.=$status_messagesx;
     }
     #
     # if no files were uploaded tell them
     #
     if ($stinking_files_uploaded == 0 ) {
        #$status_messages.="No files attached to this email\n";
     }
     if ($send_as_html == 'html' ) {
       #$status_messages.="Sending as HTML\n";
       $status_messages=preg_replace("/\n/","<br>\n",$status_messages);
     }
     else {
       #$status_messages.="NOT sending as HTML\n";
     }


     #
     # if this variable is set to a y then
     # put the debug information into the
     # body of the email.
     # this way I can turn off the debugging
     # and use it to send homeland security 
     # messages to cartoonists like benson :)
     #
     if ($put_debug_info_in_email == 'y') {
        $text=$status_messages.$text;
     }
     $header="";
     #
     # build the from: header
     #
     if ($from != "" ) {
        $header.="From: $from\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the CC: header
     #
     if ($cc != "" ) {
        $header.="CC: $cc\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";
     }
     #
     # build the BCC: header
     #
     #$bcc=build_bcc_list($test_send_or_real_send);




     if ($bcc != "" ) {
        $header.="BCC: $bcc\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the Reply To: header
     #
     if ($rto != "" ) {
        #
        # "reply to:" doesnt work
        # try using
        # "reply-to:"
        #
        if (0) {
           $header.="Reply To: $rto\r\n";
        }
        else {
           $header.="Reply-To: $rto\r\n";
        }
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }
     #
     # build the Date: header
     #
     if ($zdate != "" ) {
        $header.="Date: $zdate\r\n";
        #echo "Sending with headers<blockquote><pre>";
        #echo "$header";
        #echo "</pre></blockquote>";  
     }





     #we may have to flip the order we add the HTML and attached files
     # which is why i put the
     # if ($how_to_attach == "after" ) {
     # }
     # and
     # if ($how_to_attach == "before" ) {
     # }
     # logic
     #
     # i probably have to give the file i attach a name
     # look at my manuals for that. I remember they gave
     # a jpg file they used in an email in one example
     # a name
     #
     #
     # here we will first add the HTML header
     # then we will attach the file and its header
     # 
     # i am guessing the existing php mail software
     # will pull the first html header and use it
     # for the text in the body of the message
     # but i could be wrong on that
     #
     if ($how_to_attach == "after" ) {
        #
        # if we are sending it as HTML 
        # build the html header before the FILES
        #
        if ($send_as_html == 'html' ) {
           $header.="Content-type: text/html\r\n";
        }
        #
        # add the file they uploaded as an attachment to the e-mail
        #
        #echo "<p>make sure the header has been attached AFTER this<p>";
        #
        # add each file entered to the header information
        #
        $header.=setup_call_to_attach_file ('file_to_upload', $attachment1, $attachmentname1, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload2', $attachment2, $attachmentname2, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload3', $attachment3, $attachmentname3, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload4', $attachment4, $attachmentname4, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload5', $attachment5, $attachmentname5, $cr_before, $cr_after, $dump_flength, $dont_use_imap);
        $header.=setup_call_to_attach_file ('file_to_upload6', $attachment6, $attachmentname6, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 



 
        

     }
     if ($how_to_attach == "before" ) {
        #
        # add the file they uploaded as an attachment to the e-mail
        #
        #echo "<p>make sure the header has been attached BEFORE this<p>";



        #
        # add each file entered to the header information
        #
        $header.=setup_call_to_attach_file ('file_to_upload', $attachment1, $attachmentname1, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload2', $attachment2, $attachmentname2, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload3', $attachment3, $attachmentname3, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload4', $attachment4, $attachmentname4, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 
        $header.=setup_call_to_attach_file ('file_to_upload5', $attachment5, $attachmentname5, $cr_before, $cr_after, $dump_flength, $dont_use_imap);
        $header.=setup_call_to_attach_file ('file_to_upload6', $attachment6, $attachmentname6, $cr_before, $cr_after, $dump_flength, $dont_use_imap); 




        #
        # if we are sending it as HTML 
        # build the html header after the FILES
        #
        if ($send_as_html == 'html' ) {
           $header.="Content-type: text/html\r\n";
        }
     }






     if ( $submit_button == 'Send') {
        #
        # dump the headers ?
        #
        if ($dump_header_in_debug_window == 'y') {
           echo "<b>dumping headers</b>";
           echo "<pre>";
           echo $header;
           echo "</pre>";
        }
        #
        # only send the email ONCE and send it here
        # before I was sending it after I built
        # each and every header
        #


        #if ( $submit_button == 'Send') {
        #$bcc="frogs snakes@dogs.com";
        echo "SENDING the E-MAIL now!<br>";
        $rc=mail($to,$subject,$text,$header);
     
        #
        # we have sent the email but
        # print some information in the debug window
        # about how we sent the email
        #
        echo "<table border=1>";
        $x=htmlentities($to);
        echo "<tr><td align=\"right\">To:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($cc);
        echo "<tr><td align=\"right\">CC:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($bcc);
        echo "<tr><td align=\"right\">BCC:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($rto);
        echo "<tr><td align=\"right\">Reply To:</td><td>$x &nbsp;</td></tr>";
        $x=htmlentities($from);
        echo "<tr><td align=\"right\">From:</td><td>$x &nbsp;</td></tr>";



        #
        # list the data about each of the files
        # that were uploaded in table format
        # for debugging
        #
        build_tr_for_file('file_to_upload');
        build_tr_for_file('file_to_upload2');
        build_tr_for_file('file_to_upload3');
        build_tr_for_file('file_to_upload4');
        build_tr_for_file('file_to_upload5');
        build_tr_for_file('file_to_upload6');



        $x=htmlentities($subject);
        echo "<tr><td align=\"right\">Subject:</td><td>$x &nbsp;</td></tr>";
        $x=$text;
        #
        # if they are sending it as text
        # convert the krud in the message
        # to html stuff so we can view
        # it in netscape
        # ie 
        #     > becomes &gt;
        #     < becomes &lt;
        #     .....
        #
        if ( $send_as_html == 'text' ) {
           $x=htmlentities($text);
           #
           # make the spaces display correctly with &nbsp;
           #
           $x=preg_replace("/ /","&nbsp;",$x);
           #
           # make line breaks display correctly with <br>
           #
           $x=preg_replace("/\n/","<br>",$x);
        }
        echo "<tr><td colspan=2>$x&nbsp;</td></tr>";
        echo "<tr><td align=\"right\">RC</td><td>$rc&nbsp;</td></tr>";

        if ($rc != 1 ) {
           echo "<tr><td colspan=\"2\">Hmmm... Something has changed. The rc used to be set to one</td></tr>";
        }
        echo "</table>";
     }
  }   
?>
</td>
</tr>
</table>




<?php
   #include 'save_stinking_data.php';


?>

friends.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2 align="center">Friends of the Strategic Edge</h2>
<?php
require('sql_passwords.php');
   # 
   # connect to SQL 
   #  
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to grab all the data entered so far
   #
   $query = "select url, name  
                 from friends order by name, url";
   #  
   # run the query
   #
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   #  
   # get the data from the query back one item at a time
   #
   echo "<ul>";
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $name=$line['name'];
      $url=$line['url'];
      $html_tag="";
      if ($url == '' ) {
         $html_tag="<li>$name";
      }
      else {
         $html_tag="<li><a href=\"$url\">$name</a>";
      }

      echo "$html_tag";
   } 
   echo "</ul>";
   # 
   # close the SQL connection 
   # 
   mysql_close($link); 
?>
<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

friends_add_delete.php

TOC

<?php
 include "0_php_functions.php";
 $text=$_POST['text'];
 $url=$_POST['url'];
?>
<html>
<head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<h2 align="center">Add or Delete Friends of the Strategic Edge</h2>



<?php
   require('sql_passwords.php');


   function add_a_friend($text,$url) {
      $rc=0;


      #
      # remove leading and trailing spaces
      #
      $text=preg_replace("/^ */","",$text);
      $text=preg_replace('/ *$/',"",$text);
      $url=preg_replace("/^ */","",$url);
      $url=preg_replace('/ *$/',"",$url);
      #
      # remove line feeds and stuff
      #
      #$url=preg_replace("/\n/","",$url);
      #$url=preg_replace("/\r/","",$url);
      #
      # urls cant have spaces - remove them
      #
      $url=preg_replace("/ /","",$url);




      #
      # if they didnt enter any text 
      # then use the URL
      #
      if ($text == '' ) {
         $text=$url;
      }

      #
      # convert & to &amp;
      # convert < to &lt;
      # convert > to &gt;
      #$text=preg_replace("/&/","&amp;",$text);

      $text=preg_replace("/>/","&gt;",$text);
      $text=preg_replace("/</","&lt;",$text);
      #echo "text=$text<br>";



      $query = "insert into friends set url='$url', name='$text', date_created=now()  ";
      $result = mysql_query($query);  
      if ($result) {  
      }  
      else {  
         echo "Something is SCREWED UP!!!!!!!!  insert failed!!<br>". mysql_error();
      }  
      








      return $rc;
   }


   function delete_the_friend($id_to_delete) {
     
      $rc=0;
      $query = "delete from friends where id='$id_to_delete' ";
      $result = mysql_query($query);  
      if ($result) {  
      }  
      else {  
         echo "Something is SCREWED UP!!!!!!!!  delete failed!!<br>". mysql_error();  
      } 
      return $rc;
   }





   # 
   # connect to SQL 
   #  
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to grab all the data entered so far
   #
   $query = "select url, name, date_created , id  
                 from friends order by name, url";
   #
   # did they click on a name to delete?
   # 
   $id_to_delete=$_GET['id'];
   #echo "id to delete=$id_to_delete<br>";
   if ($id_to_delete != '' ) {
         #
         # delete the stinking name
         #
         #echo "delete=$id_to_delete<br>";
         delete_the_friend($id_to_delete);
   }
   #
   # do they want to add a URL or just a name
   #
   if ($url != '' || $text != '' ) {
      #echo "they want to add something!!!!<br>";
      #echo "add $text<br>";
      #echo "add $url<br>";
      add_a_friend($text,$url);
   }
?>
<form action="friends_add_delete.php" method="post"> 
<input type="submit" name=submit value="ADD"><br>
Text to be displayed
<br>
<input type="text" name=text   size="60" maxlength="60" value="<?php echo $text;?>"> 
<p>
URL to show when text is clicked on
<br>
<input type="url" name=url size="256" maxlength="16000" value="<?php echo $url;?>"> 
</form> 
<?php
   #  
   # run the query
   #
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   #  
   # get the data from the query back one item at a time
   #
   echo "<table border=\"1\">";
   echo "<tr style=\"font-weight:bold;\">";
   echo "<td>&nbsp;</td>";
   echo "<td>Name</td>";
   echo "<td>URL</td>";
   echo "<td>URL</td>";
   echo "<td>Date Added</td>";
   echo "</tr>";
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $name=$line['name'];
      $url=$line['url'];
      $id=$line['id'];
      $date_created=$line['date_created'];



      $html_tag="";
      if ($url == '' ) {
         $html_tag="$name";
      }
      else {
         $html_tag="<a href=\"$url\">$name</a>";
      }
      echo "<tr>";
      echo "<td><a href=\"friends_add_delete.php?id=$id\">DELETE</a></td>";
      echo "<td>$name</td>";
      echo "<td>";
      echo $url;
      if ($url == '' ) {
         echo "&nbsp;";
      }
      echo "</td>";
      echo "<td>$html_tag</td>";
      echo "<td><nobr>$date_created</nobr></td>";
      echo "</tr>";
   } 
   echo "</table>";
   # 
   # close the SQL connection 
   # 
   mysql_close($link); 
?>
<p>
<center>
<a href="friends.php">Friends of the Strategic Edge</a>
</center>
<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

ftp_build_ftp_statements.html

TOC

<pre>
patsch196
binary
cd strategic-edge.org
lcd se
get .htaccess
get .htpasswd
get 0_____model.php
get 0____css.css
get 0____css_white.css
get 0_email_addresses.php
get 0_php_function_dup_email.php
get 0_php_function_dup_email_00.php
get 0_php_functions.php
get 0_php_functions_v03.php
get 0_php_functions_v04.php
get add.php
get add_03.php
get add_email.php
get add_email_08.php
get add_email_09.php
get add_fax.php
get add_fax_00.php
get add_fax_01.php
get add_fax_03.php
get add_new_member_email.php
get add_press_release_email.php
get add_press_release_email_00.php
get add_press_release_email_01.php
get add_press_release_email_02.php
get add_snip.php
get add_snip_v00.php
get add_snip_v01.php
get background_11.jpg
get background_12.jpg
get background_12s.jpg
get both_background.jpg
get change_it.php
get change_it_02.php
get change_it_fax.php
get control-panel.html
get control-panel.php
get display_coming_events.php
get display_coming_events_00.php
get display_functions.php
get display_images.php
get display_images_00.php
get display_programs.php
get dogs.php
get email.txt
get email_all.txt
get email_newsletter.php
get email_newsletter_22.php
get email_newsletter_23.php
get email_newsletter_24.php
get email_read_and_load.php
get email_read_and_load2.php
get friends.php
get friends_add_delete.php
get friends_add_delete_00.php
get friends_add_delete_01.php
get ftp_build_ftp_statements.php
get ftp_build_ftp_statements_00.php
get ginger_background.jpg
get ginger_background2.jpg
get home.jpg
get html_to_displayable_html.php
get index.html
get index.php
get insert_load_press_release.php
get jims.jpg
get jims_cafe.php
get list.php
get list_12.php
get list_13.php
get list_deleted_email.php
get list_deleted_email_00.php
get list_email.php
get list_email_15.php
get list_email_16.php
get list_email_17.php
get list_email_18.php
get list_fax.php
get list_fax_00.php
get list_press_releases.php
get ll0ve.html
get marie.php
get mike.php
get mike_00.php
get mike_email_him.php
get mike_email_him_00.php
get mike_email_him_01.php
get mikes_indymedia_photos.php
get money.jpg
get money2.jpg
get money3.jpg
get money3s.jpg
get money4.jpg
get mortgage_info.php
get mortgage_info_v00.php
get new-otis-background.jpg
get new-otis-background2.jpg
get notes_mime_attachment.php
get pastspeakers.php
get pat_protesting.php
get pat_protesting_april_06.jpg
get patsbio-v01.php
get patsbio.php
get play-pen.php
get quotes.php
get random.pl
get ricky_duncan_concealed_carry.txt
get run_php_in_a.html
get seba.100webspace.net
get send_an_email.php
get sginger1.jpg
get sginger2.jpg
get sotis1.jpg
get sotis2.jpg
get sql_passwords.php
get tempe_arrest.html
get tempe_arrest_notes.jpg
get test.html
get test.php
get test_style.html
lcd control-panel
cd control-panel
get index.pl
cd ..
lcd ..
cd dog_photos
lcd dog_photos
get P1040546.JPG
get P1040548.JPG
get P1040550.JPG
get P1040551.JPG
get P1040552.JPG
get P1040553.JPG
get P1040554.JPG
get P1040555.JPG
get P1040559.JPG
get P1040560.JPG
get P1040561.JPG
get P1040562.JPG
get P1040563.JPG
get P1040564.JPG
get P1040565.JPG
get P1040566.JPG
get P1040567.JPG
cd ..
lcd ..
cd http:
lcd http
get mike_email_him.php
cd ..
lcd ..
cd minutes
lcd minutes
get 0____model.php
get Scan10001.jpg
get Scan10001.php
get Scan10002.JPG
get Scan10002.php
get Scan10003.JPG
get Scan10003.php
get Scan10004.JPG
get Scan10004.php
get Scan10005.JPG
get Scan10005.php
get Scan10006.JPG
get Scan10006.php
get Scan10007.JPG
get Scan10007.php
get Scan10008.JPG
get Scan10008.php
get Scan10009.JPG
get Scan10009.php
get Scan10010.JPG
get Scan10010.php
get Scan10011.JPG
get Scan10011.php
get Scan10011b.html
get Scan10017.JPG
get Scan10017.php
get Scan10018.JPG
get Scan10018.php
get Scan10019.JPG
get Scan10019.php
get Scan10020.JPG
get Scan10020.php
get Scan10021.JPG
get Scan10021.php
get Scan10022.JPG
get Scan10022.php
get Scan10023.JPG
get Scan10023.php
get Scan10024.JPG
get Scan10024.php
get Scan10025.JPG
get Scan10025.php
get Scan10026.JPG
get Scan10026.php
get Scan10027.JPG
get Scan10027.php
get Scan10028.JPG
get Scan10028.php
get ce2008-08-14.php
get ce2008-08-28.php
get comingevents.php
get index.html
get m2008-01-31.php
get m2008-07-03.php
get m2008-07-17.php
get m2008-07-31.php
get m2008-08-14.php
get minutes.php
get minutes_00.php
get minutes_01.php
get minutes_02.php
get minutes_03.php
get minutes_04.php
get pr2008-08-14.php
get pr2008-08-28.php
cd ..
lcd ..
cd stuff_to_delete
lcd stuff_to_delete
get 0____model.html
get 0____model_old.html
get 0_php_functions_v00.php
get 0_php_functions_v01.php
get 0_php_functions_v02.php
get add_00.php
get add_01.php
get add_02.php
get add_email_00.php
get add_email_01.php
get add_email_02.php
get add_email_03.php
get add_email_04.php
get add_email_05.php
get add_email_06.php
get add_email_07.php
get change_it_00.php
get change_it_01.php
get email_newsletter_00.php
get email_newsletter_01.php
get email_newsletter_02.php
get email_newsletter_03.php
get email_newsletter_04.php
get email_newsletter_05.php
get email_newsletter_06.php
get email_newsletter_07.php
get email_newsletter_08.php
get email_newsletter_09.php
get email_newsletter_10.php
get email_newsletter_11.php
get email_newsletter_12.php
get email_newsletter_13.php
get email_newsletter_14.php
get email_newsletter_15.php
get email_newsletter_16.php
get email_newsletter_17.php
get email_newsletter_19.php
get email_newsletter_20.php
get email_newsletter_21.php
get index.html
get list_00.php
get list_02.php
get list_03.php
get list_04.php
get list_05.php
get list_07.php
get list_08.php
get list_09.php
get list_10.php
get list_11.php
get list_email_00.php
get list_email_01.php
get list_email_02.php
get list_email_03.php
get list_email_04.php
get list_email_05.php
get list_email_06.php
get list_email_07.php
get list_email_08.php
get list_email_09.php
get list_email_10.php
get list_email_11.php
get list_email_12.php
get list_email_13.php
get list_email_14.php
cd ..
lcd ..
cd test
lcd test
get index.pl
cd ..
lcd ..
</pre>

ftp_build_ftp_statements.php

TOC

<html>
<head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<?php
  function doit_toit($subdirectory) {
  if ($subdirectory == '') {
     $subdirectory='.';
  }
  if ($subdirectory != '.') {
     echo "<p>";
     echo "cd $subdirectory<br>";
     echo "lcd $subdirectory";
     echo "<p>";
  }
  #
  # list these programs
  #
  $programs=array();
  #$hd=opendir("."); 
  $hd=opendir($subdirectory);  
  while ($the_file_name=readdir($hd)) {
      #
      # dont list these files
      #
      if ($the_file_name == '.' || 
          $the_file_name == '..'
        ) {
         continue;
      }
      #
      # process these files
      #


     if (preg_match("/\./",$the_file_name)) {
        $the_file_name=preg_replace("/^/","get ",$the_file_name);
     }
     else {
        $the_file_name=preg_replace("/^/","cd ",$the_file_name);
     }



      array_push($programs, $the_file_name);
  } 
  closedir($hd); 

  #
  # sort the programs before listing them
  # by file name, then path name
  #
  asort($programs);

  foreach ($programs as $foo) {
     echo "$foo<br>";

  }

  if ($subdirectory != '.') {
     echo "<p>";
     echo "cd ..<br>";
     echo "lcd ..";
     echo "<p>";
  }

     return;
  }
  echo "cd strategic-edge.org<br>";
  echo "lcd se<br>";
  echo "binary<br>";
  doit_toit('.');
  doit_toit('control-panel');
  doit_toit('dog_photos');
  doit_toit('http:');
  doit_toit('minutes');
  doit_toit('stuff_to_delete');
  doit_toit('test');
?>

html_to_displayable_html.php

TOC

<?php
#
# convert HTML that a browser can display
# to HTML a human can view on the browser
# ie:
#       <html>
#           <h1>frog dog</h1>
#           <a href="foo.html">foo</a>
#       </html>
#
# becomes
#
#       &lt;html&gt;
#       &nbsp;&nbsp;&nbsp;&nbsp;&lt;h1&gt;frog&nbsp;dog&lt;/h1&gt;
#       &nbsp;&nbsp;&nbsp;&nbsp;&lt;a&nbsp;href="foo.html"&gt;foo&lt;/a&gt;
#       &lt;/html&gt;
#
# which of ourse displayed by a browser shows
#
#       <html>
#           <h1>frog dog</h1>
#           <a href="foo.html">foo</a>
#       </html>
#
function html_to_displayable_html($text) {
     #
     # & becomes &amp;
     #
     $text=preg_replace("/&/","&amp;",$text);
     #
     # < becomes &lt;
     #
     $text=preg_replace("/</","&lt;",$text);
     #
     # > becomes &gt;
     #
     $text=preg_replace("/>/","&gt;",$text);
     #
     # SPACE or '' becomes &nbsp;
     #
     $text=preg_replace("/ /","&nbsp;",$text);
     #
     # TAB becomes &nbsp;&nbsp;&nbsp;
     #
     #$text=preg_replace("/\t/","&nbsp;",$text);
     return $text;
}
?>

index.html

TOC

<html>
PATS new web page!!!!!!!!!!!!!
</html>

index.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2>What is the Strategic Edge?</h2>

The Strategic Edge Business Alliance is a Non-Partisan 
group of Business Owners, Sales Reps, Interested Parties, & 
Just Plain  Regular Folks.  We meet for breakfast every-other Thursday, & provide a forum for civil 
discourse on a wide variety of topics.  We are NOT a ?LEADS 
GROUP?, but lots of business is done among members & their 
referrals.  We try to provide a means for anyone with ?a good 
story?, to come out & tell us.  We also meet to establish rapport 
& trust with fellow members, in case we need to find a vendor, 
consultant or professional, for almost anything imaginable, (but 
?legal?).  The public is welcome, and we encourage anyone 
interested to come ?check us out?.   
<p> 

<h2>THE RULES</h2>
<ol>
<li>   Please arrive before 7:30 Am, & Turn your cel phone OFF!!    
<li>   Be "nice":  No Profanity, & No Caustic Comments directed at 
someone present 
<li>   Tip Generously
</ol>

The Strategic Edge Business Alliance meets every other Thursday, 
at Jim's Coney Island Cafe.
Please arrive before 7:30 Am   

Jim's Coney Island Cafe,
1750 No. Scottsdale Rd., 
Tempe, Az. 85281,
at the southwest corner of Scottsdale & Cavalier,  1 block south of McKellips, ~ 1 mile north of the 202 Freeway <a href="jims_cafe.php">map</a>.
<p>


If you or a friend/associate have an interesting  story, 
innovative idea, or a ?good cause? you?d like to tell us about, 
please call & let us know!!  We welcome new ideas & new folks.   
<p> 
And do we have FUN!!
<a name="coming_events">
<h2>Next Meeting:  
<?php
   #
   # get the next speakers for future meetings
   #
   $next_day_of_week=file_get_contents('next_day_of_week.txt');
   echo $next_day_of_week;
?>
,  
<?php
   #
   # get the next speakers for future meetings
   #
   $next_date_of_year=file_get_contents('next_date_of_year.txt');
   echo $next_date_of_year;
?>
, 7:30 am</h2>

Our speaker will be 



 
  
<?php
   #
   # get the next stinking speaker and display it
   #
   $next_speaker=file_get_contents('next_speaker.txt');
   echo $next_speaker;
?>  
<p> 
Please Bring guests! 
<p>
<p>
<h2>Future meetings</h2>
<ul>     
<?php
   #
   # get the next speakers for future meetings
   #
   $next_speakers=file_get_contents('next_speakers.txt');
   echo $next_speakers;
?> 
</ul>
<h2>Minutes of Past Meetings, & Summary of Significant Past Speakers</h2>
<ul>  
<li><a href="minutes/minutes.php">Minutes of Past Meetings</a>
<li><a href="pastspeakers.php">Summary of Significant Past Speakers</a>
</ul>







<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

index_00_base.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<h2>What is the Strategic Edge?</h2>

The Strategic Edge Business Alliance is a Non-Partisan 
group of Business Owners, Sales Reps, Interested Parties, & 
Just Plain  Regular Folks.  We meet for breakfast every-other Thursday, & provide a forum for civil 
discourse on a wide variety of topics.  We are NOT a “LEADS 
GROUP”, but lots of business is done among members & their 
referrals.  We try to provide a means for anyone with “a good 
story”, to come out & tell us.  We also meet to establish rapport 
& trust with fellow members, in case we need to find a vendor, 
consultant or professional, for almost anything imaginable, (but 
“legal”).  The public is welcome, and we encourage anyone 
interested to come “check us out”.   
<p> 

<h2>THE RULES</h2>
<ol>
<li>   Please arrive before 7:30 Am, & Turn your cel phone OFF!!    
<li>   Be "nice":  No Profanity, & No Caustic Comments directed at 
someone present 
<li>   Tip Generously
</ol>

The Strategic Edge Business Alliance meets every other Thursday, 
at Jim's Coney Island Cafe.
Please arrive before 7:30 Am   

Jim's Coney Island Cafe,
1750 No. Scottsdale Rd., 
Tempe, Az. 85281,
at the southwest corner of Scottsdale & Cavalier,  1 block south of McKellips, ~ 1 mile north of the 202 Freeway <a href="jims_cafe.php">map</a>.
<p>


If you or a friend/associate have an interesting  story, 
innovative idea, or a “good cause” you’d like to tell us about, 
please call & let us know!!  We welcome new ideas & new folks.   
<p> 
And do we have FUN!!
<a name="coming_events">
<h2>Next Meeting:  Thursday, 9/11/8, 7:30 am</h2>

Our speaker will be Barbara Blewster re:  "The Real Origins of Nursery Rhymes & the Cultural Implications".  Please Bring guests! 
<p>
<p>
<h2>Future meetings</h2>
<ul>
<li>9/25-  Randall Holmes of the Az. Advocacy Network, re:  “Election Fraud 2008 — How Bad Can It Be?!”
<li>10/09- Local Progressive Radio talk show host, Cynthia Black, re: "Election Preview". 
<li>10/23- Open Forum for candidates; If you have any candidate in mind, for any office, call me directly
</ul>
<h2>Minutes of Past Meetings, & Summary of Significant Past Speakers</h2>
<ul>
<li><a href="minutes/minutes.php">Minutes of Past Meetings</a>
<li><a href="pastspeakers.php">Summary of Significant Past Speakers</a>
</ul>







<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

jims_cafe.php

TOC

<?php
 include "0_php_functions.php";
 dump_head('',         # set the title - default is Strategic Edge Business Alliance
           '',         # set default CSS to 
           'x',        # for mortgage info click here 
           'x'         # for pat's bio click here
           )

?>
<table width="100%">
<tr>
<td width="25%">&nbsp</td>
<td>
The Strategic Edge Business Alliance meets every other Thursday, 
at Jim's Coney Island Cafe. 
Please arrive before 7:30 a.m.  
at Jim's Coney Island Cafe, 1750 No. Scottsdale Rd., 
Tempe, Az. 85281, 
at the southwest corner of Scottsdale & Cavalier, 
1 block south of McKellips, 
~ 1 mile north of the 202 Freeway
</td>
<td width="25%">&nbsp</td>
</tr>
</table>
<p>
<img src="jims.jpg">
<?php
 #
 # print the end of each web page
 #
 dump_tail()
?>

krapola.txt

TOC

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <title>Free Website Hosting - Tripod free website templates to make your own free website</title>
  <meta name="description" content="Tripod is a free web host with easy site building tools for blogs, photo albums, Microsoft FrontPage(&reg;) support, and ftp, as well as a variety of subscription packages to choose from. Features include safe and reliable hosting, online help, and a variety of tools and services to give the flexibility you need."/>
  <meta name="keywords" content="free website,free website hosting,free website templates,website hosting,website templates"/>
  <meta name="keywords" content="free web site,free web site hosting,free web site templates,web site hosting,web site templates"/>

  <meta name="ROBOTS" content="ALL"/>

  <link rel="icon" href="/favicon.ico" type="image/bmp"/>
  <link rel="stylesheet" type="text/css" href="https://www.tripod.lycos.com/css/3pod.css" title="3pod" media="screen, projection"/>
  <link rel="stylesheet" type="text/css" href="https://www.tripod.lycos.com/css/tripod.css"/>

  <script type="text/javascript" src="http://hb.lycos.com/hb.js?site=tripod"></script>
  <script type="text/javascript" src="https://www.tripod.lycos.com/js/utils.js"></script>
  <script type="text/javascript" src="https://www.tripod.lycos.com/js/matchedCols.js"></script>

  <!-- Deprecated -->
  <script type="text/javascript" src="https://www.tripod.lycos.com/js/dmenu.js"></script>
  <script type="text/javascript" src="https://www.tripod.lycos.com/js/menubuilder.js"></script>
  <!-- /Deprecated -->

  <!--[if lt IE 7]>
  <script defer type="text/javascript" src="https://scripts.lycos.com/global/pngfix_map.js"></script>
  <![endif]-->

  <script type="text/javascript">
function popupWindow(link, width, height) {
var trpopWin = window.open(link,"trpopWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable-0,width="+width+",height="+height);
}
  </script>

<script type="text/javascript">
var cm_role = "live";
var cm_host = "tripod.lycos.com";
var cm_taxid = "/^";
</script>
<script type="text/javascript" src="https://scripts.lycos.com/catman/init.js"></script>
<script type="text/javascript">
var objAdMgr = new AdManager();
var strProdSetName = objAdMgr.chooseProductSet(); objAdMgr.renderHeader();
</script>



 </head>
 
 <body>
  <script type="text/javascript">lhb_drawHeader();</script>
  <!-- Page Container -->
  <div class="page">

   <!-- Header -->
   <div class="header clrfix">
    <div class="txtwrap">
     <a onclick="launchHelp('http://help.lycos.com/tripod/','LycosHelp');return false;" href="http://help.lycos.com/tripod/">Tripod Help</a><br/>

    </div>
    <div class="lft">
     <a href="https://www.tripod.lycos.com/"><img src="https://www.tripod.lycos.com/img/3pod/tripod_logo.gif" width="201" height="47" alt="logo" title="Tripod" class="logo"/></a>
     <img src="https://www.tripod.lycos.com/img/3pod/txt/top_tagline.gif" width="328" height="16" alt="Create your website, share your photos, share your opinions!" class="tag"/>
    </div>
   </div>
   <!-- /Header -->


   <br class="clr"/>
   
   <!-- Login Bar -->
   <div class="login">
    <form action="/adm/redirect/www/bin/membership/login" method="get">
     <div class="rgt">
      <input type="hidden" name="reflect" value="1"/>
      Username: <input type="text" name="u" value="" class="text"/>
      Password: <input type="password" name="p" value="" class="text"/>
      <input type="image" src="https://www.tripod.lycos.com/img/3pod/btn.login.png" name="submit" value="Log In"/>
     </div>
    </form>
    <img src="https://www.tripod.lycos.com/img/3pod/txt/login_tag.png" width="291" height="15" alt="" title="create your own website for free!" class="tag"/>
   </div>
   <!-- /Login Bar -->
   


   <!-- Promo -->
   <map name="promo" id="promo">
    <area shape="rect" coords="344,179,476,222" href="/adm/redirect/www/bin/membership/pref_link?to=subscribe" alt="" title="Start Now!"/>
   </map>
   <img src="/img/3pod/promo_box.gif" width="564" height="275" alt="promo" title="write a blog... build a site... share your photos!" class="promo" usemap="#promo"/>
   <!-- /Promo -->

   <!-- Featured Column -->
   <div class="feature rgt">
    <div class="box">
     <h1>Featured Package</h1>
      <div class="wrap">
       <img src="/img/3pod/disk_icon.gif" width="30" height="31" alt="icon" class="lft" style="margin: 0 10px 7px 0;"/><strong>Want a little more out of your site?</strong>
      <br class="clrL"/>
      Our subscription packages start at just $4.95 per month! For growing sites, we offer up to 10GB of disk space, domain names and more.<br/>
      <a href="/compare/index.tmpl">compare plans &raquo;&raquo;</a>
     </div>
    </div>

    <div class="box" style="margin-top: 5px;">
     <h1>Get Your Domain</h1>
     <div class="wrap">
      Only $12.95, including FREE POP email, subdomains, and domain forwarding
      <form action="http://tripod.domains.lycos.com/bin/domain_search" method="post">
      <input type="text" maxlength="32" name="domain" style="width: 85px; vertical-align: top;" />&nbsp;
      <select name="TLD" size="1" style="vertical-align: top;">
       <option value="com" selected>.com</option>
       <option value="net">.net</option>
       <option value="org">.org</option>
       <option value="biz">.biz</option>
       <option value="info">.info</option>
      </select>
      <input type="submit" value="Go!" name="Go!" style="vertical-align: top;">
      </form>
     </div>
    </div>
   </div>
   <br class="clr"/><br/>
   <!-- /Featured Column -->

   <!-- Hosting -->
   <div class="hosting lft">
    <h1 class="tab"><span>Tripod Hosting Packages</span></h1>
    <div class="alternateBox">
         <div class="bdrL">
          <div class="bdrR">
           <div class="alternateBoxText">
           <div class="rgt" style="width: 200px;">
               <img src="/img/3pod/txt/pro.gif" width="21" height="14" alt="Pro" title="Pro"/> | <a onclick="popWin('/adm/redirect/www/learnmore/tripodpro.html', 400, 310); return false;" href="/adm/redirect/www/learnmore/tripodpro.html">learn more</a>
               <ul>
                <li>No Ads</li>
                <li>3GB of Disk Space</li>
                <li>Domain Name</li>
                <li>Blogs and Photo Albums</li>
                <li>POP/IMAP Email</li>
               </ul>
               <br/>
               <div class="boxout">
                <strong>Our subscription packages start at just $4.95 per month!</strong><br/>
                <a href="/compare/index.tmpl">compare plans &raquo;&raquo;</a>
               </div>
              </div>
        
              <img src="/img/3pod/txt/free_plan.gif" width="61" height="14" alt="Free Plan" title="Free Plan"/> | <a onclick="popWin('/adm/redirect/www/learnmore/tripodfree.html', 400, 310); return false;" href="/adm/redirect/www/learnmore/tripodfree.html">learn more</a>
              <ul>
               <li>Easy Site Builder</li>
               <li>20MB of Disk Space</li>
               <li>Blogs and Photo Albums</li>
              </ul>
              <br/>
              <img src="/img/3pod/txt/plus.gif" width="28" height="14" alt="Plus" title="Plus"/> | <a onclick="popWin('/adm/redirect/www/learnmore/tripodplus.html', 400, 310); return false;" href="/adm/redirect/www/learnmore/tripodplus.html">learn more</a>
              <ul>
               <li>No Ads</li>
               <li>1GB of Disk Space</li>
               <li>Easy Site Builder</li>
               <li>Blogs and Photo Albums</li>
              </ul>
            </div>
          </div>
         </div>

 <div class="bottomBdrL">
  <div class="bottomBdrR"></div>
 </div>

</div>
</div>
   <!-- /Hosting -->

   <!-- Featured Sites -->
   <div class="sites rgt">
    <h1 class="tab"><span>Tripod Featured Sites</span></h1>
    <div class="alternateBox">
         <div class="bdrL">
          <div class="bdrR">
           <div class="alternateBoxText">
            <p>Our members build some of the best sites on the Web. Check out our collections of some of Tripod's finest...</p>

<ul style="width: 140px; float: left; list-style-image: none;">
 <li><a href="/hubs/britney_hub.html">Britney Spears</a></li>
 <li><a href="/hubs/cats_hub.html">Cats</a></li>
 <li><a href="/hubs/hobbies_hub.html">Hobbies</a></li>

</ul>

<ul style="width: 140px; float: right; list-style-image: none;">
 <li><a href="/hubs/music_hub.html">Music</a></li>
 <li><a href="/hubs/travel_hub.html">Travel</a></li>
 <li><a href="/hubs/wrestling_hub.html">Wrestling</a></li>
</ul>



                <div class="clr"></div>
           </div>
          </div>
         </div>

 <div class="bottomBdrL">
  <div class="bottomBdrR"></div>
 </div>

</div>
</div>

   <!-- /Featured Sites -->

<script type="text/javascript">
<!--
function isIE4() {
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
 }
function launchHelp(helpurl) {
HelpWin = window.open(helpurl, 'HelpWindow','toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=500');
if( ! isIE4() ) {
if (HelpWin.focus) {
HelpWin.focus();
}
}
if (HelpWin.focus!=null  &&  !isIE4()) 
{
HelpWin.focus();
}
if (HelpWin.opener == null) HelpWin.opener = window;
HelpWin.opener.name = "LycosMain";
}
//-->
</script>

   <div class="footer">
    <p><strong>Tripod:</strong> <a class="footerBlue" href="/adm/redirect/www/">home</a> | <a href="/adm/redirect/www/about/map/">site map</a> | <a href="/adm/redirect/www/about/">about tripod</a> | <a onclick="launchHelp('http://help.lycos.com/tripod/','LycosHelp');return false" href="http://help.lycos.com/tripod/">tripod help</a> | <a onclick="launchHelp('http://help.lycos.com/newticket.php','LycosHelp');return false" href="http://help.lycos.com/newticket.php">report tripod abuse</a> | <a href="/adm/redirect/www/site_map/">members</a> | <a href="https://www.angelfire.lycos.com/site_map/">angelfire members</a></p>
    <script type="text/javascript">lhb_drawFooter();</script>
   </div>
  </div>
  <!-- /Page Container -->


 </body>
</html>

list.php

TOC

<html>
<head>
<title>Strategic Edge Business Alliance</title>
<LINK rel="stylesheet" href="/0____css.css" type="text/css">
<META name="resource-type" content="Strategic Edge">
<META name="description" content="Strategic Edge">
<META name="distribution" content="global"> 
<META name="keywords" content="Strategic , Edge , Business , Alliance , 'Strategic Edge Business Alliance' , 'Strategic Edge' , 'Strategic Edge Business' , Pat , Schwind , 'Pat Schwind MBA' , 'Pat Schwind, MBA' , 'Pat Schwind'">
</head>
<body>
<h1 align="center">Strategic Edge Business Alliance</h1>
<?php
 include "0_php_functions.php";
 #dump_head('',         # set the title - default is Strategic Edge Business Alliance
 #          '',         # set default CSS to 
 #          '',        # for mortgage info click here 
 #          ''         # for pat's bio click here
 #          );
 $types=array('new_lead', 'called','gave up');






  function time_processed($seconds) {
     #
     # converts seconds to time to processs
     # like
     #    62 days, 10 hours 33 minutes and 22 seconds
     #
     $rc="";
     $sec=0;
     $min=0;
     $hour=0;
     $days=0;
     #$rem=$seconds%10;
     #$seconds-=$rem;
     #$seconds/=10;
     $oneminute=60*10;
     #$oneminute=60;
     $onehour=60*$oneminute;
     $oneday=24*$onehour;
     if ($seconds >= $oneday) {
       print "got days $oneday $seconds<br>";
       $rem=$seconds%$oneday;
       $seconds-=$rem;
       $days=$seconds/$oneday;
       $seconds=$rem;
       print "days=$days<br>";
     }
     if ($seconds >= $onehour) {
       print "got hours $onehour $seconds<br>";
       $rem=$seconds%$onehour;
       $seconds-=$rem;
       $hour=$seconds/$onehour;
       $seconds=$rem;
     }
     print "caculate minutes $seconds<br>";
     #if ($seconds >= $oneminute) {
     if ($seconds >= 60) {
       print "got minutes $oneminute $seconds<br>";
       #$rem=$seconds%$oneminute;
       $rem=$seconds%60;
       $seconds-=$rem;
       #$min=$seconds/$oneminute;
       $min=$seconds/60;
       print "min=$min<br>";
       $seconds=$rem;
     }
     if ($seconds >= 1 ) {
       print "got seconds $seconds<br>";
       $sec=$seconds;
     }
  

     if ($days > 0 ) {
        $rc="$days days $hour:$min:$sec";
     }
     else {
        $rc="$hour:$min:$sec";
     }
 
   
     return $rc;
  }








?>





<?php #include "sbd_head.php"; ?>
<?php
#
# figure out what to list
#      new leads
#      leads we called
#      leads we never contacted and gave up on
#      all leads
#
if ($what_to_list == '' ) {
   $what_to_list=$_POST["what_to_list"];
}
#echo "what $what_to_list<p>";
if ($what_to_list == '' ) {
   $what_to_list='new_lead';
}
#
# figure out how to sort them

#echo "sort $how_to_sort <p>";
if ($how_to_sort == '') {
   $how_to_sort=$_POST["how_to_sort"];
}
#echo "sort $how_to_sort<p>";
if ($how_to_sort == '' ) {
   $how_to_sort='date_created, name';
}
?>





<form action="list.php" method="post">
List: 
<span style="font-size:75%;">
<input type="radio" name="what_to_list" value="new_lead"
 <?php if ($what_to_list == 'new_lead' ) { echo " checked "; } ?> 
>New Leads
<input type="radio" name="what_to_list" value="called"

 <?php if ($what_to_list == 'called' ) { echo " checked "; } ?> 

>Called Leads
<input type="radio" name="what_to_list" value="gave up"
 <?php if ($what_to_list == 'gave up' ) { echo " checked "; } ?> 
>Gave up
<input type="radio" name="what_to_list" value="ALL"
 <?php if ($what_to_list == 'ALL' ) { echo " checked "; } ?> 
> All Leads
</span>
<br>
<p>Sort by: 
<span style="font-size:75%;">

<input type="radio" name="how_to_sort" value="date_created, name"
 <?php if ($how_to_sort == 'date_created, name' ) { echo " checked "; } ?> 
> Date Created

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="how_to_sort" value="date_closed, name"
 <?php if ($how_to_sort == 'date_closed, name' ) { echo " checked "; } ?> 
> Date Closed 


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="how_to_sort" value="name"
 <?php if ($how_to_sort == 'name' ) { echo " checked "; } ?> 
> Name


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="how_to_sort" value="phone_home, name"
 <?php if ($how_to_sort == 'phone_home, name' ) { echo " checked "; } ?> 
> Home Phone

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="how_to_sort" value="phone_work, name"
 <?php if ($how_to_sort == 'phone_work, name' ) { echo " checked "; } ?> 
> Work Phone

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="how_to_sort" value="phone_cell, name"
 <?php if ($how_to_sort == 'phone_cell, name' ) { echo " checked "; } ?> 
> Cell Phone

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="how_to_sort" value="phone_other, name"
 <?php if ($how_to_sort == 'phone_other, name' ) { echo " checked "; } ?> 
> Other Phone




&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="how_to_sort" value="ip, name"
 <?php if ($how_to_sort == 'ip, name' ) { echo " checked "; } ?> 
> IP address
</span>
<br>

<input type="submit" name=submit value="SUBMIT">
</form>



<?php
   if ($what_to_list == 'new_lead') {
      echo "<h1 align=\"center\">Call these people about loans!!!!</h1>";
   }
   if ($what_to_list == 'called') {
      echo "<h1 align=\"center\">Folks I called about loans</h1>";
   }
   if ($what_to_list == 'gave up') {
      echo "<h1 align=\"center\">Folks I gave up on</h1>";
   }
   if ($what_to_list == 'ALL') {
      echo "<h1 align=\"center\">Everybody!!!</h1>";
   }
?>









<table width="100%" border="0">
<tr>
<td>&nbsp;</td>
<td>
<?php
   function dump_line($name, $value) {
      if ($value != '') {
         echo "<tr><td align=\"right\">$name</td><td>$value</td></tr>";
      }
      return; 
   }
   require('sql_passwords.php');
   # 
   # connect to SQL 
   #  
   $link = mysql_connect($z_hardcoded_sqlurl,  
                         $z_hardcoded_database,  
                         $z_hardcoded_password ) 
                         or die('Could not connect: ' . mysql_error()); 
   # 
   # select the database I want to use 
   # 
   mysql_select_db($z_hardcoded_database) or die('Could not select database'); 
   #  
   # build sql statement to grab all the data entered so far
   #
   $query = "select name, 
                    phone_work, 
                    phone_home, 
                    phone_cell, 
                    phone_other, 
                    best_time, 
                    ip, 
                    id,
                    date_created,
                    date_closed,
                    TIMEDIFF(date_closed, date_created ) as respond_time, 


                    status
                 from messages ";
   if ( $what_to_list != 'ALL' ) {
      $query.= " where status='$what_to_list'   ";
   }
   else {
      $query.= " where status='new_lead' ||  
                       status='called' || 
                       status='gave up'   ";
   }
   if ($how_to_sort  != '' ) {
      $query.= "order by $how_to_sort ";
   }


   #
   # display the select
   # 
   $result = mysql_query($query) or die('Query failed: ' . mysql_error());
   $hits=0;
   echo '<table border="1">';
   while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { 
      # 
      # how to read like PERL does in PHP 
      # the name of each selected value is used as a subscript or hash value 
      # 
      $created_on=$line['name'];
      $phone_work=$line['phone_work'];
      $phone_home=$line['phone_home'];
      $phone_cell=$line['phone_cell'];
      $phone_other=$line['phone_other'];
      $ip=$line['ip'];
      $id=$line['id'];
      $best_time=$line['best_time'];
      #$comments=$line['comments'];
      $status=$line['status'];
      $date_created=$line['date_created'];
      $date_closed=$line['date_closed'];
      $respond_time=$line['respond_time'];


      if ($status == 'new_lead') {
         $date_closed='';
         #$status='';
      }