⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 channel.php

📁 一个基于PHP网页的Flash播放器
💻 PHP
字号:
<?phprequire('assoc_to_xml.php');file_put_contents('channel_post_debug.txt', var_export($_POST, true));// Flash will send 'action'=>'SAVE' along with the data to save the user channel to the database;// PHP should return 'saved'=>'1' the save was successful, or '0' if was not.// The array sent by flash is like this:/*array(  'thumb' => 'channels/thumb.jpg',  'desc' => 'Loren Ipsun!',  'name' => 'My Channel',  'action' => 'SAVE',  'series' => '221, 233, 315, bla187',)Where 'series' is an array containing the video_ids of all channel series in order*/if($_POST['action'] == 'SAVE'){	$result = array('saved'=>1);}//if save// When the user chooses to edit a channel, flash will sent 'action'=>'LOAD' and the id of the channel;// PHP should return the channel data (name, description, etc) and the series data to populate the slots.// Note that the series data should be in the same format used for the series list.else if($_POST['action'] == 'LOAD'){	$series_list = array();	$serie = array('video_id'=>1, 'showName'=>'Sun', 'episodeNum'=>'111', 'episodeName'=>'Lalala', 'thumb'=>'series/sol_thumb.jpg', 				   'episodeDesc'=>'Lalala, etc, etc.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>2, 'showName'=>'Stick Man', 'episodeNum'=>'002', 'episodeName'=>'I am the Stick Man', 'thumb'=>'series/bola_thumb.jpg', 				   'episodeDesc'=>'Yes, he is the Stick Man', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>3, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');					   	$series_list[] = $serie;	$serie = array('video_id'=>4, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>5, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>6, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>7, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>8, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;	$serie = array('video_id'=>9, 'showName'=>'Work Out', 'episodeNum'=>'357', 'episodeName'=>'Hawaii Finale', 'thumb'=>'series/series_thumb.jpg', 				   'episodeDesc'=>'Loren ipsum e blah, blah, blah.', 'teaser'=>'teaser/omaha.jpg', 'promo'=>'promo/promo.flv');	$series_list[] = $serie;			$result = array(			  'thumb'=>'channels/et.jpg',			  'desc'=>'blah, blah, blah, blah, blah, blah, blah',			  'name'=>'My Channel',			  			  'series'=>$series_list,			);//result}//else if load// For delete Flash will send 'action'=>'DELETE' and the channel id;// PHP should return 'deleted'=>'1' if it was successful, or '0' if not.else if($_POST['action'] == 'DELETE'){	$result = array('deleted'=>1);}//else if delete// File upload: flash will send the file reference;// PHP is supposed to just move it to the right place. No answer required.else if(isset($_FILES['Filedata']['tmp_name'])){		$file_name = "channels/{$_FILES['Filedata']['name']}";	move_uploaded_file($_FILES['Filedata']['tmp_name'], $file_name);	chmod($file_name, 0777);	}//else if FILES// After uploading a file, flash will post 'action'=>'CHECK_FILE', along with the filename of the uploaded file;// here PHP can check the file size, resize it, rename it, do whatever is necessary with the file.// After that, it should return the file path ('file_path') // or an error message ('error') if the file is for some reason rejected (too big, for example).else if($_POST['action'] == 'CHECK_FILE'){		// In this example, I am just returning back the file path, has if everything was ok	// Note that Im also returning the directory where the file was moved, since flash can retrieve the file name of the file 	// it uploaded, but not the path where it was placed.	$result = array('file_path'=>"channels/{$_POST['file_name']}");		//if an error was found, you should return 'error' with the error message	//$result = array('error'=>'File size exceeds 400kb');}//else if FILESfile_put_contents('channel_res_debug.txt.txt', $result);$xml = assocToXML($result);echo $xml;?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -