<?php

include("../admin/GoTool/cat.inc");
 $connection = @mysqli_connect($host,$user,$password) or die(mysqli_error($connection));
$db = @mysqli_select_db($connection,$db_name) or die(mysqli_error($connection));
$blink='';
$CAPz='MIT';
$prog="Accountstarts_code.php";
$prog977="surveyDwTwLMITd.php";
$prog978="GoSlider/slider2e.php";
$Rtoday=date("Y-m-d h:i:s");
$hi2=0;
$hally="target=\"blank\"";

$test98=1225201477792;

$state2="I am creating an account for the Deacon Training program.";
$state1="I am creating an account for the Ministers in Training program.";
$state3="I am creating an account for the in Ministry Leader Training.";
$state4="I am creating an account for the in WOF Parishioner program.";
$builda="IMLD400BLK.png";

$logged=$_GET['log'];

 if (isset($_POST['jedID2'])) {
	$jedID2=$_POST['jedID2'];
}


 if (isset($_GET['az'])) {
	$az2=$_GET['az'];
}
       $checka1='';
       $checka2='';
       $checka3='';
$checka4='';

if ($az2==1){
 $checka1="checked";//mit
$checkstatement="<tr>
	<td width=\"32\">
		<p><font face=\"Verdana\"><input type=\"radio\" $checka1 value=\"14\" name=\"choice1\">
		</font>
	</td>
	<td width=\"5\">
	<font face=\"Verdana\">
	<img border=\"0\" src=\"$locquit1/IMLD/images/$builda\" width=\"1\"></font></td>
	<td><font face=\"Verdana\">$state1</font></td>
</tr>";
}


if ($az2==2){
 $checka2="checked";//deacon
$checkstatement="<tr>
	<td width=\"32\">
		<p><font face=\"Verdana\"><input type=\"radio\" $checka2 value=\"15\" name=\"choice1\">
		</font>
	</td>
	<td width=\"5\">
	<font face=\"Verdana\">
	<img border=\"0\" src=\"$locquit1/IMLD/images/$builda\" width=\"1\"></font></td>
	<td><font face=\"Verdana\">$state2</font></td>
</tr>";
}

if ($az2==3){
 $checka3="checked" ;//ministry leader
$checkstatement="<tr>
	<td width=\"32\">
		<p><font face=\"Verdana\"><input type=\"radio\" $checka3 value=\"28\" name=\"choice1\">
		</font>
	</td>
	<td width=\"5\">
	<font face=\"Verdana\">
	<img border=\"0\" src=\"$locquit1/IMLD/images/$builda\" width=\"1\"></font></td>
	<td><font face=\"Verdana\">$state3</font></td>
</tr>";
}

if ($az2==4){
 $checka4="checked" ;//parioners
$checkstatement="<tr>
	<td width=\"32\">
		<p><font face=\"Verdana\"><input type=\"radio\" $checka4 value=\"29\" name=\"choice1\">
		</font>
	</td>
	<td width=\"5\">
	<font face=\"Verdana\">
	<img border=\"0\" src=\"$locquit1/IMLD/images/$builda\" width=\"1\"></font></td>
	<td><font face=\"Verdana\">$state4</font></td>
</tr>";


}




$testy1=94;
  $sql33 ="SELECT * FROM $table_name92 WHERE information_id = '$testy1' ";
  $result33 = @mysqli_query($connection,$sql33) or die(mysqli_error($connection));
        $row22 =mysqli_fetch_array($result33,MYSQLI_ASSOC);
          $display_blocka=  $row22['description'];
           $display_blocka=stripslashes($display_blocka);
               $welcome=htmlspecialchars_decode($display_blocka);


$testy1=188;
  $sql33 ="SELECT * FROM $table_name92 WHERE information_id = '$testy1' ";
  $result33 = @mysqli_query($connection,$sql33) or die(mysqli_error($connection));
        $row22 =mysqli_fetch_array($result33,MYSQLI_ASSOC);
          $display_blocka=  $row22['description'];
           $display_blocka=stripslashes($display_blocka);
               $welcome12=htmlspecialchars_decode($display_blocka);
$welcome12=strip_tags($welcome12);


$testy1=190;
  $sql33 ="SELECT * FROM $table_name92 WHERE information_id = '$testy1' ";
  $result33 = @mysqli_query($connection,$sql33) or die(mysqli_error($connection));
        $row22 =mysqli_fetch_array($result33,MYSQLI_ASSOC);
          $display_blocka=  $row22['description'];
           $display_blocka=stripslashes($display_blocka);
               $welcome12a=htmlspecialchars_decode($display_blocka);



 $testy1=189;
  $sql33 ="SELECT * FROM $table_name92 WHERE information_id = '$testy1' ";
  $result33 = @mysqli_query($connection,$sql33) or die(mysqli_error($connection));
        $row22 =mysqli_fetch_array($result33,MYSQLI_ASSOC);
          $display_blocka=  $row22['description'];
           $display_blocka=stripslashes($display_blocka);
               $welcome13=htmlspecialchars_decode($display_blocka);

$testy1=191;
  $sql33 ="SELECT * FROM $table_name92 WHERE information_id = '$testy1' ";
  $result33 = @mysqli_query($connection,$sql33) or die(mysqli_error($connection));
        $row22 =mysqli_fetch_array($result33,MYSQLI_ASSOC);
          $display_blocka=  $row22['description'];
           $display_blocka=stripslashes($display_blocka);
               $problem13=htmlspecialchars_decode($display_blocka);




$logscript="<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
	            <tr>
	              <td width=\"400\"><img src=\"$locquit1/IMLD/images/CAP_Logo.jpg\" width=\"400\" height=\"293\" /></td>
	              <td width=\"400\"><p><span class=\"paragraphHeader\"><font size=\"14\">Log In</font></span>  <!----<a href=\"http://www.bronnernetwork.org/gotool/createaccount/Accountstart.php?az=$az\"><u>Click Here to Create an Account</u></a>---></p>
	               <form action=\"https://www.bronnernetwork.org/gotool/index.php?route=common/login\" method=\"post\" enctype=\"multipart/form-data\" id=\"form\">

	                <p><strong>Please login here:</strong></p>
	                <p>
	                  <label for=\"username\">Username:</label>
	                  <br />
	 <input type=\"text\" name=\"username\" style=\"margin-top: 4px;\" />
	                </p>
	                <p>
	                  <label for=\"password\">Password:</label>
	                  <br />
	<input type=\"password\" name=\"password\" style=\"margin-top: 4px;\" />
	                </p>
	                <p>
	                 <input type=\"submit\" value=\"Submit\" name=\"B3\">  </form>

	               </p></td>
	            </tr>
	          </table>
	          <p>
	          </p></td>
	        <td width=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        </tr>
	      <tr>
	        <td width=\"100\" height=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        <td width=\"800\" height=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        <td width=\"100\" height=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        </tr>
	      </table>
	$problem13";

                                            //class=required to make it red.


 $display_title= "Create An Account";
 $display_title11= "<font size=\"10\" color=\"#ab292b\">Create An Account</font>";
                    if ($jedID2==0){
$display_block="
            $welcome
 <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"$prog?token=$tok&log=$logged\">
        <input type=\"hidden\" name=\"jedID2\" value=\"5\"  />
<p><strong><font face=\"Verdana\">Create an Account</strong></p>
<p><font face=\"Verdana\"><strong>Information Session Code:</strong><input name=\"code98\" class=\"required2\" id=\"first\" type=\"text\" size=\"24\">
</font>
</p>
<p><font face=\"Verdana\"><strong>First Name:</strong><input name=\"first\" class=\"required2\" id=\"first\" type=\"text\" size=\"24\">
</font>
</p>
<p><font face=\"Verdana\"><strong>Last Name:</strong><input name=\"last\" class=\"required2\" id=\"last\" type=\"text\" size=\"24\">
</font>
</p>
<p><font face=\"Verdana\"><strong>Cell Phone:</strong><input name=\"cell\" class=\"required2\" id=\"cell\" type=\"text\" size=\"24\">
</font>
</p>
<p><font face=\"Verdana\"><label for=\"email\" required=\"required2\"><strong>Email Address:</strong></label><input name=\"email\" class=\"required\" id=\"email\" type=\"text\" size=\"35\">
</font>
</p>
<table border=\"0\" width=\"100%\">
	$checkstatement
	</table>


<!----<p><font face=\"Verdana\">I am a:
<select name=\"interest\" id=\"ainterest\" required=\"required\" size=\"1\">
<option value selected>-- Select --</option>
<option value=\"potential_planter\">Potential Church Planter</option>
<option value=\"interested_pastor\">Existing Pastor
</option>
<option value=\"interested_leader\">Church Leader
</option>
<option value=\"interested_individual\">Individual with General Interest</option>
</select></font></p>   --->
<p><label class=\"noselect\">
<font face=\"Verdana\">
<input name=\"newsletter\" style=\"width: 20px;\" value=\"1\" type=\"checkbox\"> I would like to
receive occasional emails from $CAPz regarding the latest news and
resources.</font></label></p>
<button class=\"fsSubmitButtonsmall\" type=\"input\">CREATE ACCOUNT</button>

           </form>



            ";


 ///<input type=\"submit\" value=\"Create Account\" name=\"B3\">

         }


if ($jedID2==5){
      $blink='';

    $firstname=addslashes($_POST['first']);
    $lastname=addslashes($_POST['last']);
    $phone=addslashes($_POST['cell']);
$phone = preg_replace("/[^0-9.]/", '', $phone);
    $email=addslashes($_POST['email']);
$code98=addslashes($_POST['code98']);

if ($code98==$test98){




$Wemail1=$email;
    $choice1=$_POST['choice1'];
    $newsletter=$_POST['newsletter'];
     $assigned_store[14]= 19;
     $assigned_store[15]= 19 ;//20
     $assigned_store[28]= 19;//21
 $assigned_store[29]= 19;//22

     $customer_group_id=$choice1;
      $status=1;

 if ( isset($_SERVER['HTTP_CLIENT_IP']) && ! empty($_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
}

$ip = filter_var($ip, FILTER_VALIDATE_IP);
$ip = ($ip === false) ? '0.0.0.0' : $ip;

if ( $firstname !=$blink AND $lastname !=$blink AND $email !=$blink AND $phone !=$blink){
$Pass=md5($phone);

 $sq112abT="SELECT * FROM $table_name36 Where email='$email'";
  $result33btT = @mysqli_query($connection,$sq112abT) or die(mysqli_error($connection));
  $num335 = mysqli_num_rows($result33btT);

  if ($num335<1){

  $sql2 = "INSERT INTO $table_name36 (store_id, firstname, lastname, email, telephone, fax, password ,newsletter,customer_group_id, ip,status,approved,date_added, salesrep_id )
VALUES ('$assigned_store[$choice1]','$firstname',  '$lastname','$email','$phone', '$fax', '$Pass','$newsletter','$customer_group_id','$ip', '$status', '1', '$Rtoday','$salesrep_id' )";
$result2 = @mysqli_query($connection,$sql2) or die(mysqli_error($connection));

//  $sq112abT="SELECT * FROM $table_name36 Where customer_group_id='$customer_group_id' AND email='$email' AND date_added='$Rtoday'";
//  echo " $sq112abT <br/>";
// $result112abT = @mysqli_query($connection,$sq112abT) or die(mysqli_error($connection));
//while ($row112abT = mysqli_fetch_array($result112abT)) {
// $idA=  $row112abT['customer_id'];

$rest = substr($locquit1, 8);  // returns "cde"
$rest2 = substr($locquit1, 12);  // returns "cde"

$msg .= "E-MAIL SENT From: admin@$rest2 \r\n";
$msg .= "Full Name: $firstname $lastname \r\n";
$msg .= "\r\n";
$msg .= "$welcome12  \r\n";
$msg .= "\r\n";
$msg .= "\r\n";
$msg .= "Username: $email \r\n";
$msg .= "\r\n";
$msg .= "Password: $phone \r\n";



$to2 ="glink@galliumgroup.com";

$to2 = "admin@$rest2";
$subject = "Your Account Has Been Created";
$mailheaders = "From: Bronner Network<admin@$rest2> \n";
$mailheaders .= "Reply-To: $to2\n";



mail($Wemail1, $subject, $msg, $mailheaders);

$logscript="<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
	            <tr>
	              <td width=\"400\"><img src=\"$locquit1/IMLD/images/CAP_Logo.jpg\" width=\"400\" height=\"293\" /></td>
	              <td width=\"400\"><p><span class=\"paragraphHeader\"><font size=\"14\">Log In</font></span>  <!----<a href=\"http://www.bronnernetwork.org/gotool/createaccount/Accountstart.php?az=$az\"><u>Click Here to Create an Account</u></a>---></p>
	               <form action=\"https://www.bronnernetwork.org/gotool/index.php?route=common/login\" method=\"post\" enctype=\"multipart/form-data\" id=\"form\">

	                <p><strong>Please login here:</strong></p>
	                <p>
	                  <label for=\"username\">Username:</label>
	                  <br />
	 <input type=\"text\" name=\"username\" value=\"$email\" style=\"margin-top: 4px;\" />
	                </p>
	                <p>
	                  <label for=\"password\">Password:</label>
	                  <br />
	<input type=\"password\" name=\"password\" value=\"$phone\" style=\"margin-top: 4px;\" />
	                </p>
	                <p>
	                 <input type=\"submit\" value=\"Submit\" name=\"B3\">  </form>

	               </p></td>
	            </tr>
	          </table>
	          <p>
	          </p></td>
	        <td width=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        </tr>
	      <tr>
	        <td width=\"100\" height=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        <td width=\"800\" height=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        <td width=\"100\" height=\"100\" align=\"left\" valign=\"top\">&nbsp;</td>
	        </tr>
	      </table>
	$problem13";



  $display_block="$welcome12a <br/>
  $logscript";
       }else{
     $display_block ="$welcome13 <br/> $logscript
<br/><br/> ";
//   $sql2 = "UPDATE $table_name36  SET store_id='$assigned_store', firstname='$firstname', lastname='$lastname', telephone='$phone', fax='$fax', password='$Pass' , newsletter='$newsletter', ip='$ip', status='$status',approved='approved',date_added='$Rtoday', salesrep_id='$salesrep_id' Where customer_group_id='$customer_group_id' AND email='$email' ";
//$result2 = @mysqli_query($connection,$sql2) or die(mysqli_error($connection));

      } }


}else{  //from the big catch check the numbers
	
	$display_block ="<br/><br/>The code you entered is incorrect. Please use the GO BACK button at the top and try again. <br/><br/><br/> $logscript
	<br/><br/> ";	
	
	
}




         }



?>

<!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" dir="ltr" lang="en" xml:lang="en">
<head>

<!---<SCRIPT LANGUAGE="JavaScript">
setTimeout('document.feedbackform.submit()',<? echo "$timer"; ?>);
</SCRIPT>    --->



<title><? echo "$display_title"; ?>  <? echo "$survey_num"; ?> jedID2=<? echo "$jedID2"; ?>id2=<? echo "$id2"; ?>map_id1=<? echo "$map_id1-$num3334[22]"; ?></title>
<link rel="stylesheet" type="text/css" href="../admin/view/stylesheet/stylesheet.css" />
<script type="text/javascript" src="../admin/view/javascript/jquery/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="../admin/view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="../admin/view/javascript/jquery/ui/themes/ui-lightness/jquery-ui-1.8.16.custom.css" />
<script type="text/javascript" src="../admin/view/javascript/jquery/ui/external/jquery.bgiframe-2.1.2.js"></script>
<script type="text/javascript" src="../admin/view/javascript/jquery/tabs.js"></script>

<link rel="stylesheet" type="text/css" href="../catalog/view/theme/default/stylesheet/stylesheet.css" />

<link rel="stylesheet" type="text/css" href="../catalog/view/theme/default/stylesheet/collap.css" />
<link rel="stylesheet" type="text/css" href="../catalog/view/theme/default/stylesheet/collap_cap.css" />
<link rel="stylesheet" type="text/css" href="../catalog/view/theme/default/stylesheet/stylesheet_cap.css" />


<script type="text/javascript" src="../admin/view/javascript/jquery/superfish/js/superfish.js"></script>
<script type="text/javascript" src="../admin/GoTool/risk/jquery.min.js"></script>
<script src="../admin/GoTool/risk/formwizard3.js" type="text/javascript">

/***********************************************         1.4.2 version of jQuery above
* jQuery Form to Form Wizard-
* This notice MUST stay intact for legal use
*
***********************************************/

</script>



<script type="text/javascript">

var myform=new formtowizard({
	formid: 'feedbackform',
	persistsection: false,
     validate: ['fname', 'lname', 'email'],
	revealfx: ['slide', 500]

})

var myform2=new formtowizard({
	formid: 'feedbackform2',
	persistsection: true,
	revealfx: ['fade', 1000],
	validate: ['order_username', 'order_sex', 'order_addr1', 'order_shippingmethod', 'order_feedback']
})


var myform3=new formtowizard({
 formid: 'staff_feedbackform',

 revealfx: ['slide', 500] //<--no comma after last setting
})


</script>

<style>
fieldset.sectionwrap{ /*fieldset that wraps around each form "page" */
border-width:0;
margin-top: 0;
	margin-bottom: 0;
   font: 16px Arial;
padding:2px;
}

legend{ /*title shown at top of each form page */
font:bold 16px Arial;
color: darkred;
}

div.stepsguide{ /*div that contains all the "steps" text located at top of form */
width: 640px; /*width of "steps" container*/
overflow:hidden;
margin-bottom:15px;
cursor:pointer;
}

div.stepsguide .step{ /*div that wraps around each "steps" text */
width:590px; /*width of each "steps" text*/
font: bold 10px Arial;
float:left;
}

div.stepsguide .disabledstep{ /*div that wraps around each "steps" text */
color:#C4C4C4;
}

div.stepsguide .step .smalltext{ /*small footer text inside "steps" text */
font-size: 12px;
font-weight: normal;
}

div.formpaginate{ /* CSS for pagination DIV container */
width: 800px;
overflow:hidden;
font-weight:bold;
text-align:center;
margin-top:1em;
}

div.formpaginate .prev, div.formpaginate .next{ /*CSS for "prev" and "next" SPAN elements within paginate container */
border-radius:5px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
padding:2px 5px;
background:darkred;
color:white;
cursor:hand;
cursor:pointer;
}


#feedbackform2 legend{ /*title shown at top of each form page */
color: navy;
}

#feedbackform2 div.field{
margin-bottom:7px;
}

#feedbackform2 div.formpaginate .prev, #feedbackform2 div.formpaginate .next{
background:navy;
}






</style>
        <!--- Timer -->


</head>
<body>




<div class="box">
    <div class="heading">
      <h1><img src="../admin/view/image/report.png" alt="" /> <? echo "$display_title"; ?> </h1>
      <? echo "$warning_clock"; ?>
    </div>
     <table> <tr><td>   </td> <td><FORM><INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="history.go(-1)"></FORM> </td> </tr> </table>
    <div class="content" >
    <table class=list>   <tbody>  <td></td><td align left>
      <? echo "$display_block"; ?> <? echo "$display_block77"; ?>  </td> <td></td>
  </tbody>   </table> </div>
  </div>




 <? echo "$string"; ?>
  <? echo "$display_blockFF"; ?>














 </body></html>




</html>
