Login   Register  
PHP Classes
elePHPant
Icontem

File: add_user.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of johno dread  >  Yahoo MSN chat  >  add_user.php  >  Download  
File: add_user.php
Role: Auxiliary script
Content type: text/plain
Description: Add users to database
Class: Yahoo MSN chat
Determine if Yahoo or MSN users are online
Author: By
Last change:
Date: 2010-04-27 10:17
Size: 831 bytes
 

Contents

Class file image Download
<?php

/**
 * @author Leroy Johnson
 * @copyright 2010
 */


$server    "localhost";
$user    "root";
$pass    ='';



if(isset(
$_POST) && count($_POST) == 3)
{
    if(! 
preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix"$_POST['email']))
        
$_POST['email'] = '';
    
    
$conn mysql_connect($server,$user,$pass) or die(mysql_error());
    
    
$sql "INSERT INTO online_users.users (id, first_name, last_name, email) VALUES (NULL, '".$_POST['fname']."', '".$_POST['lname']."', '".$_POST['email']."');";

  
$result mysql_query($sql);
  
  if(!
$result)
      echo 
mysql_error();
  else
  {    echo 
"<p style='color:red;'>User Added Successfully. </p>";    
      echo 
"<p><a href = 'chat.php'>Users online</a></p>";
      unset(
$_POST);// prevent reinserting last record if refresh
  
}    


}

?>