<?php 
@header('Content-type: text/html;charset=utf-8');
session_start();
require_once('view_users.php');
//echo $user_id;
?>
<html>  
<head lang="en">  
    <meta charset="UTF-8">  
    <link type="text/css" rel="stylesheet" href="bootstrap-3.2.0-dist\css\bootstrap.css">  
    <title>Registration</title>  
</head>  
<style>  
    .login-panel {  
        margin-top: 150px;  
  
</style>  
<body>  
  
<div class="container"><!-- container class is used to centered  the body of the browser with some decent width-->  
    <div class="row"><!-- row class is used for grid system in Bootstrap-->  
        <div class="col-md-4 col-md-offset-4"><!--col-md-4 is used to create the no of colums in the grid also use for medimum and large devices-->  
            <div class="login-panel panel panel-success">  
                <div class="panel-heading">  
                    <h3 class="panel-title">Registration</h3>  
                </div>  
                <div class="panel-body">  
                    <form role="form" method="post" action="registration2.php">  
                        <fieldset>  
<p align="center"><b><font color="#FF6600">ضع الكود الذي وصلك للبريد هنا لتفعيل عظويتك واذا لم يصلك ضع كلمة code : </font>
    <center><b>يجب تسجيل الدخول?</b> <br></b><a href="login.php">Login here</a></center>
                            <div class="form-group">  
   <input class="form-control" placeholder="hashh" name="hashh" type="text" value="">  
                <p align="center"><font color="#FF6600"><b>اكتب اي نص:</b></font></p>
  <p align="center"><textarea rows="23" name="mes" cols="50" dir="rtl"></textarea></p>
  <p align="center"><span lang="en-us"><b>------------------------------</b></span></p>
  <p align="center"><font color="#FF6600"><b>«ضع ايميلك«:</b></font></p>
  <p align="center"><input rows="1" name="emails" cols="50" maxlength="50" dir="ltr"></input></p>
                            </div>  
  
  
                            <input class="btn btn-lg btn-success btn-block" type="submit" value="post" name="upp" >  
  
    </fieldset>  
                    </form>  
                    <center><b>Already registered ?</b> <br></b><a href="login.php">Login here</a></center><!--for centered text-->  
                </div>  
            </div>  
        </div>  
    </div>  
</div>  
  
</body>  
  
</html>  
<head>
<meta http-equiv="Content-Language" content="ar-sa">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>»”г «ббе «б—Ќгд «б—Ќнг</title>
</head>

<body>
<?php  
//registration2.php
  session_start();
  require_once('view_users.php');
if(!$_SESSION['email'])  
{  
    require_once('view_users.php');
    header("Location: login.php");
//redirect to the login page to secure the welcome page without login access.  
}  
  session_start();
  
if(!$_SESSION['email'])  
{  
  
    header("Location: login.php");
//redirect to the login page to secure the welcome page without login access.  
}  
include("database/db_conection.php");//make connection here  
//register
if(isset($_POST['upp']))  
{  
    //$user_name=$_POST['name'];//here getting result from the post array after submitting the form.  
    //$user_pass=$_POST['pass'];//same  
   // $user_email=$_POST['email'];//same  
    //$groub_id=0;
//same 
$hashh=$_POST['hashh'];
   //$hash = md5( rand(0,1000) );
    /*if($user_name=='')  
    {  
        //javascript use for input checking  
        echo"<script>alert('Please enter the name')</script>";  
exit();//this use if first is not work then other will not show  
    }  
  
    if($user_pass=='')  
    {  
        echo"<script>alert('Please enter the password')</script>";  
exit();  
    }  
  
    if($user_email=='')  
    {  
        echo"<script>alert('Please enter the email')</script>";  
    exit();  
    }  */
//here query check weather if user already registered so can't register again.  
    $check_email_query="select * from users WHERE user_email='$user_email'";  
    $run_query=mysqli_query($dbcon,$check_email_query);  
  
    if(mysqli_num_rows($run_query)>0)  
    {  
echo "<script>alert('Email $user_email is already exist in our database, Please try another one!')</script>";  
exit();  
    }  
  /*$check_email_query="select * from users WHERE hash='$hashh'";  
    $run_query=mysqli_query($dbcon,$check_email_query);  
  
    if(mysqli_num_rows($run_query)>0)  
    {  
//$id ="$zb";
$Upda_news = mysql_query("UPDATE users SET groub_id='0' WHERE user_email='$user_email'");
}*/
/*echo "<script>alert('Email $user_email is already exist in our database, Please try another one!')</script>";  
exit(); */
   
//insert the user into the database.  
    /*$insert_user="insert into users (user_name,user_pass,user_email,groub_id,hash) VALUE ('$user_name','$user_pass','$user_email','$groub_id','$hash')"; */
  $user_email=$_SESSION['email'];                
$email = explode("\r\n", $emails);
//$email = $emails;
$mes="$mes,code :$hash,$user_email ,user '$user_name'";
$count = count($email) ;
//$cou= $user_email;
//$emails=$user_email;
//$sender="code";
$emailsss=$user_email;
$sm="webmail@shafeen.atwebpages.com";
//$email[$cou]= '$user_email';
$headers .= "From: $sender <$sm>\r\n";

for($cou =0 ; $cou <= $count ; $cou ++){
mail($emailsss, $name, $mes, $headers);
} echo"<script>window.open('registration2.php','_self')</script>";
}







