Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > เรื่องของ[Hotspot]ท่านเทพรบกวนดูcodeให้หน่อยครับ เมื่อ login แล้ว อยากให้เด้ง ไปเว็ปที่เราต้องการ ต้องแก้ส่วนใด



 

เรื่องของ[Hotspot]ท่านเทพรบกวนดูcodeให้หน่อยครับ เมื่อ login แล้ว อยากให้เด้ง ไปเว็ปที่เราต้องการ ต้องแก้ส่วนใด

 



Topic : 066351



โพสกระทู้ ( 1 )
บทความ ( 0 )



สถานะออฟไลน์




Code (PHP)
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Gologin
 *
 * Glologin Controller
 *
 * @package		gologin
 * @author		Nost radius
 * @version		1.0
 * @based on	Nost radius management
 * @license		GPL/GNU License Copyright (c) 2008 Nost Computer
 */
 
Class Gologin extends Hotspotlogin_Controller
{
	function __construct()
	{
		parent::__construct();

		$this->load->helper(array('security'));
		$this->load->library(array('form_validation'));

		$this->location = $this->uri->segment(3);
		
		if($this->agent->browser()=='Internet Explorer' && $this->agent->version()<7) $this->ie6 = TRUE;
		
		$use_template = (($this->agent->is_mobile()) || (isset($this->ie6))) ?  TEMPLATES: $this->config->item('template');

		$template_url = str_replace(':3990','',base_url());
		
		$this->template->write('template_path',$template_url.'templates/hotspotlogin/'.$use_template.'/');

	}

	function index()
	{

		if($this->agent->browser()=='Internet Explorer' && $this->agent->version()<7) $ie6 = TRUE;

		if($this->agent->is_mobile() || isset($this->ie6))
		{
		
			$state = $this->input->get('res', TRUE);
			$userurl = $this->input->get('userurl', TRUE);
			$redirurl = $this->input->get('redirurl', TRUE);
			$reply = $this->input->get('reply', TRUE);
			
			if($userurl!="") $gourl = $userurl;
			if($redirurl!="") $gourl = $redirurl;
			
			$form = array(
					'challenge'=>$this->input->get('challenge', TRUE),
					'uamip'=>$this->input->get('uamip', TRUE),
					'uamport'=>$this->input->get('uamport', TRUE),
					'userurl'=>$this->input->get('userurl', TRUE)
					);
					
			if($state=="success") $this->template->write('meta_refresh', meta('refresh', '0;url='.$gourl, 'equiv'));
			if($reply) $this->template->write('message', $reply);
			
			$post_url = str_replace(':3990','',site_url('/mobile'.$this->uri->segment(3)));

			$this->template	->write('auth_url',$post_url)
							->parse_view('hidden_form', 'public/mobile/hidden', $form);
		}
		
		$form['header'] = 'KP-Hotspot';

		$config = $this->siteconfigmodel->getConfig('global_config');
		$conf_data = $this->session->_unserialize($config->value);
		$sigupnurl = ($conf_data['reg_on_off']==1) ? anchor('signup','Signup','id="signup"') : '';
		$nas_id = ($this->agent->is_mobile()) ? $this->input->get('nasid', TRUE) : $this->session->userdata('nasid');

		$ap = $this->remotemodel->getAccesspoint('accesspoint.login_page,accesspoint.register',array('nas.nasname'=>$nas_id));
		$content_login = $ap->row();

		$login_page = $content_login->login_page;
		$content = (isset($this->ie6)) ? $this->template ->write_view('login_content','public/mobile/agen_view',array('login_page'=>$login_page)) :  $this->template->write('login_content',$login_page);

		$this->template ->write('site-name','Nost Hotspot')
						->write('header',$form['header'])
						->write('signup_url', ($content_login->register==1) ? $sigupnurl : '')
						->parse_view('body', 'themes/hotspotlogin/loginform', $form)
						->render();

	}

	function auth()
	{
		$ap = $this->remotemodel->getAccesspoint('nas.secret',array('nas.nasname'=>$this->session->userdata('nasid')));
		$uamsecret = $ap->row();

		$username = (isset($_GET['username'])) ? $_GET['username'] : '' ;
		$password = (isset($_GET['password'])) ? $_GET['password'] : '' ;
		$challenge = (isset($_GET['challenge'])) ? $_GET['challenge'] : '' ;
		
		$user = $this->gologinmodel->getEncryption($username);

		$hexchal = @pack ("H32", $challenge);
		if ($uamsecret->secret) {
			$newchal = pack ("H*", md5($hexchal . $uamsecret->secret));
		} else {
			$newchal = $hexchal;
		}

		$encryption = (isset($user->encryption) ? $user->encryption : '' );

		switch($encryption) {
			case 'md5' :  $pass_decode = substr(md5($password),0,15);
						  break;
			case 'crypt' : $pass_decode = crypt($password,"BL");
						  break;
			case 'md5ums' : $pass_decode = substr(md5("O]O" . $password . "O[O"),0,15);
						  break;
			default : $pass_decode = $password;
		}

		$response['response'] = md5("\0" . $pass_decode . $newchal);
		
		print "chilliJSON.reply(".json_encode($response).")";
		
	}

	function popup()
	{
		$config = $this->siteconfigmodel->getConfig('global_config');
		$conf_data = $this->session->_unserialize($config->value);
		
		$ap = $this->remotemodel->getAccesspoint('accesspoint.popup_page',array('nas.nasname'=>$this->session->userdata('nasid')));
		$content_login = $ap->row();
		
		$form_data = array(
						'changepwd_url'=>site_url('/gologin/changepass'),
						'contract_url'=>site_url('/gologin/contract'),
						'popup_message'=>$content_login->popup_page,
						'popup_content'=>$conf_data['editor']
						);

		// โหลดป๊อบอัพ
		$this->template ->add_css('forms.css')
						->write('site-name','User status')
						->parse_view('body', 'themes/hotspotlogin/popup', $form_data)
						->render();

	}
	
	function dcontent($uid)
	{

		$data = $this->gologinmodel->getPopupcontent($uid);
		print (isset($data->popup_page)) ? $data->popup_page : '';

	}
	
	function macdeny()
	{
		$this->template ->add_region('title')
						->write('site-name','Your device is not allow')
						->parse_view('body', 'themes/hotspotlogin/mac',array())
						->render();
	}
	
	function changepass()
	{
		$data = array('username'=>$this->uri->segment(3));
		$this->load->view('public/userform/changepass',$data);
	}

	function contract()
	{
		$this->load->model('usermodel');

		$message_field = array(
							   array(
									 'field'   => 'subject',
									 'label'   => 'Subject',
									 'rules'   => 'required'
								  ),
							   array(
									 'field'   => 'message',
									 'label'   => 'Message',
									 'rules'   => 'required'
								  )
							);

		$this->form_validation->set_rules($message_field);

		if($this->form_validation->run() == TRUE)
		{
			$data = array(
					'username'=>$_GET['uid'],
					'subject'=>$_POST['subject'],
					'message'=>$_POST['message'],
					'date'=>date('Y-m-d H:i:s')
					);
			$this->db->insert('message',$data);
			print json_encode(array('sucess'=>true,'message'=>'<div align="center">ข้อความถูกส่งแล้ว</div>'));
		}
		else
		{
			echo "<div id=\"message_box\">".
				form_open('','name="msg_form" id="msg"').
				form_label('หัวข้อ:'.nbs(5),'subject').
				form_input('subject','','id="subject" autocomplete="off" class="validate[required] text-input"'). br(2).
				form_label('ข้อความ:','message').
				form_textarea(array('name'=>'message','style'=>'width:100%;','id'=>'message','class'=>'validate[required] text-input')).br(1)."
				<input type=\"submit\" name=\"send\" id=\"send\" value=\"ส่งข้อความ\"/>".
				form_close().
				"</div>";
		}

	}
	
	function changepw()
	{
		$old_password = $this->input->post('old_password', TRUE);
		$new_passowrd = $this->input->post('new_password', TRUE);
		$confirm_password = $this->input->post('comfirm_password', TRUE);
		$username = $this->input->post('username', TRUE);
		
		$this->load->model('usermodel');
		
		$oldpass = $this->usermodel->getVoucher('password,billingplan',array('username'=>$username))->row();
		
		if($oldpass->password==$old_password)
		{
			if($new_passowrd!=$confirm_password)
			{
				$rep['rep'] = FALSE;
				$rep['msg'] = $this->lang->line('confirm_newpass');
			}
			else
			{
				$user_data = array('username'=>$username,'password'=>$new_passowrd);
				$rep = $this->usermodel->editVoucher($user_data);
			}
		}
		else
		{
			$rep['rep'] = FALSE;
			$rep['msg'] = $this->lang->line('old_pass_false');
		}
		
		print json_encode($rep);
		
	}

	function check_user()
	{

		$die = $this->gologinmodel->checkUserdie($_GET['username']);
		if($die) 
		{
			$rep['rep'] = FALSE;
			$rep['msg'] = sprintf($this->lang->line('online_check_false'),$_GET['username']);
		}
		else
		{
			$rep['rep'] = TRUE;
			$rep['msg'] = sprintf($this->lang->line('online_check_true'),$_GET['username']);
		}
		
		print json_encode($rep);

	}


	function user_detail()
	{
		$this->load->helper('number');
		$user_data = $this->gologinmodel->getUserdata($this->uri->segment(3));
		$time = ($user_data->type=='timetofinish') ? unix_to_human(strtotime(date('Y-m-d H:i:s', strtotime($user_data->start_time)) . ' + '.$user_data->amount.' day'), TRUE, 'th') : unix_to_human(strtotime(date('Y-m-d H:i:s', strtotime($user_data->start_time)) . ' +60 day'), TRUE, 'th');

		if($user_data->type=='timetofinish') {
			$format_time = 'DHMS';
		} else {
			$format_time = 'HMS';
		}
	
		$profile = $this->session->_unserialize($user_data->userprofile);
		
		$data = array(
					'plan_type'=>$user_data->type,
					'plan_name'=>$user_data->plan,
					'start_time'=>$user_data->start_time,
					'packet_used'=>$user_data->packet_used,
					'end_time'=>$time,
					'format_time'=>$format_time,
					'userprofile'=>$profile
					);
		
		print json_encode($data);
		
	}
	
	function help()
	{
		return TRUE;
	}
	
}
/* End of file gologin.php */
/* Location: ./system/nostradius/controllers/gologin.php */


ยาวหน่อยนะครับ
ปกติเมื่อ login ผ่าน มันก็จะเด้งเข้าเว็ปก่อนหน้านั้นอะครับ
แต่บางครั้งเมื่อ login แล้วมันก็ขึ้นหน้ามั่วๆครับ ไม่รู้จะทำยังไง

ขอบคุณล่วงหน้าครับผม



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-09-11 14:34:51 By : goradole View : 3138 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

อันนี้เป็นฟังก์ชั่นครับ จะต้องกลับไปดูอันที่เรียก function ครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-12 06:40:03 By : webmaster
 


 

No. 2



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

โดใช้ header("location:webpage.php");
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-12 06:40:49 By : webmaster
 

 

No. 3

Guest


ทำอย่างไรครับ ที่ว่าโดยใช้ header("location:webpage.php");
พอดีผมมือใหม่ ขอบคุณครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-12 13:43:38 By : kapo
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : เรื่องของ[Hotspot]ท่านเทพรบกวนดูcodeให้หน่อยครับ เมื่อ login แล้ว อยากให้เด้ง ไปเว็ปที่เราต้องการ ต้องแก้ส่วนใด
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่