Paste2 Logo
  1. function newteam() {
  2.  
  3.         global $xdb;
  4.  
  5.         $c  = X1plugin_style();
  6.  
  7.         $c .= X1plugin_title(XL_teamcreate_title);
  8.  
  9.         $cookie = X1_userdetails();
  10.  
  11.         $username = $cookie[1];
  12.  
  13.         $to_userid = $cookie[0];
  14.  
  15.         if ( !isset($_POST['teamname']))return X1plugin_output($c .= X1plugin_title(XL_teamcreate_blankname));
  16.  
  17.         if(!preg_match("/^[a-z0-9 ]+$/i", $_POST['teamname']))return X1plugin_output($c .= X1plugin_title(XL_teamcreate_invalidfeed));
  18.  
  19.         if ( !isset($_POST['joinpassword']))return X1plugin_output($c .= X1plugin_title(XL_teamcreate_blankjpass));
  20.  
  21.         if ( !isset($_POST['mail']))return X1plugin_output($c .= X1plugin_title(XL_teamcreate_blankemail));
  22.  
  23.         if ( !isset($_POST['clantags']))return X1plugin_output($c .= X1plugin_title(XL_teamcreate_blanktags));
  24.  
  25.         if ( $_POST['joinpassword'] != $_POST['joinpassword2'])return X1plugin_output($c .= X1plugin_title(XL_teamcreate_jpassnomatch));
  26.  
  27.         if ( !isset($_POST['country']))return X1plugin_output($c .= X1plugin_title(XL_teamcreate_blankcountry));
  28.  
  29.         $samenick = count($xdb->GetAll("SELECT * FROM ".X1_prefix.X1_DB_teams."
  30.  
  31.         WHERE name=".$xdb->qstr($_POST['teamname'])));
  32.  
  33.         $sameemail = count($xdb->GetAll("SELECT * FROM ".X1_prefix.X1_DB_teamsevents."
  34.  
  35.         WHERE mail=".$xdb->qstr($_POST['mail'])));
  36.  
  37.         $maxteam = count($xdb->GetAll("SELECT * FROM ".X1_prefix.X1_DB_teams."
  38.  
  39.         WHERE playerone=".$xdb->qstr($_POST['captain'])));
  40.  
  41.         if ($maxteam >= X1_maxcreate)return X1plugin_output(X1plugin_title($c .= XL_teamcreate_toomanyteams));
  42.  
  43.         if ($samenick >= 1) {
  44.  
  45.                 return X1plugin_output(X1plugin_title($c .= XL_teamcreate_dupeteam));
  46.  
  47.         }else{
  48.  
  49.                 $new_pass = md5($_POST['password']);
  50.  
  51.                 modifysql("INSERT INTO", X1_DB_teams, "
  52.  
  53.                 (name, passworddb, mail, country, playerone, clantags, joinpassword, homepage, created)
  54.  
  55.                 VALUES
  56.  
  57.                 (
  58.  
  59.                 ".$xdb->qstr($_POST['teamname']).",
  60.  
  61.                 ".$xdb->qstr($new_pass).",
  62.  
  63.                 ".$xdb->qstr($_POST['mail']).",
  64.  
  65.                 ".$xdb->qstr($_POST['country']).",
  66.  
  67.                 ".$xdb->qstr($_POST['captain']).",
  68.  
  69.                 ".$xdb->qstr($_POST['clantags']).",
  70.  
  71.                 ".$xdb->qstr($_POST['joinpassword']).",
  72.  
  73.                 ".$xdb->qstr($_POST['homepage']).",
  74.                
  75.                 ".$xdb->qstr(date('M j Y'))."
  76.  
  77.                 )");
  78.  

date data