Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'user account activation'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hi All, I am facing problem to activate an user by click on activation link that sent by email. Here is my code- UserController.php: public function actionCreate() { $model=new User; // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if(isset($_POST['User'])) { $model->attributes=$_POST['User']; $model->createtime=date('Y-m-d H:i:s'); $model->activationcode = sha1(mt_rand(10000, 99999).time().$model->email); if($model->save()) { $to = $model->email; $subject = "Welcome To My Site!" $message2 = "<html> <body>Please click this below to activate your membership<br />". Yii::app()->createAbsoluteUrl('user/check', array('activationcode' => $model->activationcode))." Thanks you </body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: My Site < admin@mysite.com>' . "\r\n"; mail($to,$subject,$message2,$headers); $this->redirect(array('view','id'=>$model->id)); } } $this->render('create', array('model'=>$model)); } public function actionCheck() { $activationcode = Yii::app()->request->getQuery('activationcode'); // collect user input data if(isset($activationcode)) { $model = User::model()->find('activationcode=:activationcode', array(':activationcode'=>$activationcode)); if($activationcode == $model->activationcode) { $model->status=1; //$model->validate(); $model->save(); Yii::app()->user->setFlash('check','Thank you for register with us'); $this->refresh(); } } // display the login form $this->render('check',array('model'=>$model)); } View file check.php: <?php if(Yii::app()->user->hasFlash('check')): ?> <div class="flash-success"> <?php echo Yii::app()->user->getFlash('check'); ?> </div> <?php endif; ?> I am not sure why activation link not working. After click on activation link then status not changed to 1 in database. Also, the page redirect to create view page. I was testing by adding 'check' in rules but then page stopped to redirect. I need quick help. With thanks, MRS
×
×
  • Create New...