コード例 #1
0
 public function store()
 {
     Notes::where('email', Auth::user()->email)->update(array('notes' => Input::get('notes')));
     TBD::where('email', Auth::user()->email)->update(array('tbd' => Input::get('tbd')));
     $input = Input::all();
     for ($i = 0; $i < count($input); $i++) {
         if (!Links::where('links', '=', Input::get("link{$i}"))->exists()) {
             if (Input::get("link{$i}") != "") {
                 Links::insert(array('email' => Auth::user()->email, 'links' => Input::get("link{$i}")));
             }
         }
     }
     if (Input::hasFile('photo')) {
         $count = Image::where('email', Auth::user()->email)->count();
         if ($count >= 4) {
             echo "USER CAN ONLY HAVE 4 PHOTOS MAX";
             return Redirect::back();
         }
         $extension = Input::file('photo')->getClientOriginalExtension();
         if ($extension == "gif" || $extension == "jpeg") {
             Image::insert(array('email' => Auth::user()->email, 'image' => file_get_contents(Input::file('photo'))));
         } else {
             echo "CAN ONLY DO GIF OR JPEG";
         }
     }
     $imageCount = Image::where('email', Auth::user()->email)->count();
     for ($i = 0; $i < $imageCount - 1; $i++) {
         if (Input::get("delete{$i}") != null) {
             $imageTable = Image::where('email', Auth::user()->email)->get();
             //echo $imageTable[$i+1]["id"];
             Image::where('id', $imageTable[$i]["id"])->delete();
         }
     }
     return Redirect::to('profile');
 }
コード例 #2
0
 public function store()
 {
     if (!Input::has('email', 'password', 'confirmPassword')) {
         $this->failure("Must fill in the values");
     }
     if (Input::get('password') != Input::get('confirmPassword')) {
         $this->failure("PASSWORDS NOT THE SAME");
     }
     $rules = array('email' => 'unique:users,email');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $this->failure('That email address is already registered. You sure you don\'t have an account?');
     }
     if (!filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) {
         $this->failure("username must be an email");
     }
     $verificationCode = md5(time());
     User::insert(array('email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'verification' => $verificationCode));
     Image::insert(array('email' => Input::get('email'), 'image' => ''));
     Notes::insert(array('email' => Input::get('email'), 'notes' => ''));
     TBD::insert(array('email' => Input::get('email'), 'tbd' => ''));
     Links::insert(array('email' => Input::get('email'), 'links' => ''));
     Mail::send('emails.emailMessage', array('code' => $verificationCode, 'email' => Input::get('email')), function ($message) {
         $message->to('*****@*****.**', 'Jan Ycasas')->subject('Welcome!');
     });
     echo "Go Log In";
     return Redirect::to('/');
 }
コード例 #3
0
ファイル: LinksController.php プロジェクト: mamtou/wavephp
 /**
  * 提交信息
  */
 public function actionModified()
 {
     $Links = new Links();
     $data = $this->Common->getFilter($_POST);
     $id = (int) $data['lid'];
     unset($data['lid']);
     if ($id == 0) {
         $Links->insert($data);
     } else {
         $Links->update($data, array('lid' => $id));
     }
     $this->jumpBox('成功!', Wave::app()->homeUrl . 'links', 1);
 }
コード例 #4
0
ファイル: links.php プロジェクト: neworldwebsites/noblessecms
function insertProcess()
{
    $send = Request::get('send');
    $valid = Validator::make(array('send.title' => 'required|min:1|slashes', 'send.parentid' => 'slashes', 'send.url' => 'required|min:1|slashes'));
    if (!$valid) {
        throw new Exception("Error Processing Request: " . Validator::getMessage());
    }
    $loadData = Links::get(array('where' => "where url='" . String::encode($send['url']) . "'"));
    if (isset($loadData[0]['url'])) {
        throw new Exception("This link exists in database.");
    }
    if (!($id = Links::insert($send))) {
        throw new Exception("Error. " . Database::$error);
    }
    $updateData = array('sort_order' => $id);
    Links::update($id, $updateData);
}