Flash&PHP Kinda works.. but not well

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
Gappa
Forum Contributor
Posts: 119
Joined: Fri May 23, 2003 10:02 am

Flash&PHP Kinda works.. but not well

Post by Gappa »

Getting a head ache with some flash and PHP joint action... umm well it kinda is working, its just really ugly and all over the place can some one help me tidy this up please?

Its looking like ... http://www.hostultra.com/~Gappa/newsflash.php (ewww)

Heres the code

Code: Select all

<?php 
define('IN_PHPBB', true); 
/** 
   TODO: set $phpbb_root_path 
*/ 
$phpbb_root_path = 'phpBB2/'; 

include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
include($phpbb_root_path . 'includes/bbcode.'.$phpEx); 

$forumId = 6; 
$user_ip = '127.0.0.1'; 
/** calling init_userprefs will instantiate $template */ 
$userdata = session_pagestart($user_ip, $forumId); 
init_userprefs($userdata); 

/** 
   might be you have to change this depending on your config-data 
   if you see the smilie image filenames instead of the images... 
*/ 
$board_config['smilies_path'] = $phpbb_root_path . $board_config['smilies_path']; 


$query = 'SELECT topic_title, topic_id, FROM_UNIXTIME(topic_time,"%W the %D %M @ %r") AS Topic_Date, post_text, bbcode_uid, username FROM phpbb_topics RIGHT JOIN phpbb_posts_text ON topic_first_post_id=post_id JOIN phpbb_users WHERE forum_id='.$forumId.' AND topic_poster=user_id ORDER BY topic_time DESC'; 
$result = $db->sql_query($query); 

?> 

<?php    
while($row = $db->sql_fetchrow($result)) 
{ 
   // this field is in <prefix_>posts, I'm skipping it for now and enable all smilies 
   $row['enable_smilies'] = true; 
   // enable_bbcode (always true) and enable_html (always false) are ignored as well 

   $row['post_text'] = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $row['post_text']);    
   if ( isset($row['bbcode_uid']) && $row['bbcode_uid'] != '' ) 
      $row['post_text'] = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($row['post_text'], $row['bbcode_uid']) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $row['post_text']); 
   if ($row['enable_smilies']) 
      $row['post_text'] = smilies_pass($row['post_text']); 
?>

<OBJECT codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
WIDTH="600" HEIGHT="400" id="debug" ALIGN=""> 
<PARAM NAME=movie VALUE="debug.swf"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>
<PARAM NAME=FlashVars VALUE="topictitle=<?php echo $row['topic_title']; ?>&user=<?php echo $row['username']; ?>&topicdate=<?php echo $row['Topic_Date']; ?>&posttext= <?php echo $row['post_text']; ?>&topicid=<?php echo $row['topic_id']; ?>">
<EMBED src="debug.swf" quality=high bgcolor=#FFFFFF  flashvars="topictitle=<?php echo $row['topic_title']; ?>&user=<?php echo $row['username']; ?>&topicdate=<?php echo $row['Topic_Date']; ?>&posttext= <?php echo $row['post_text']; ?>&topicid=<?php echo $row['topic_id']; ?>" WIDTH="600" HEIGHT="400" NAME="debug" ALIGN="" 
TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> 
</OBJECT> 

<?php 
} 
?>
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

Post by Slippy »

I don't know about the link you provided... I simply get a blank screen and a pop up ad that locks my browser up -- forcing me to kill my process which is annoying.

Getting PHP and Flash to talk to each other is really not that difficult. From flash you use the command "GetURL" to post/get and you enter a PHP script as the location.

When you post or get to the PHP script -- it should send the necessary data back to flash via standard URL encoding.
Post Reply