Dynamic Flashpaper file based on login

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sono_advertising
Forum Newbie
Posts: 3
Joined: Sun May 14, 2006 8:13 pm

Dynamic Flashpaper file based on login

Post by sono_advertising »

Hello everyone,

I am a newbie to this so be kind! :lol:

What I am after is a page that a user can log into (I have this already)...based on that page they will be taken to a single page that loads a flashpaper file based on the username used.

The page does not need to be secure or anything special. It is a simple means to having clients be able to approve their design jobs online.

I do not have a database, so the solution needs to be flat-file based.

I have searched high and low and can not find anything of this nature and would appreciate any advice.
If someone is kind enough to provide a solution I am more than happy to place their copyright details onto the page as hidden text.
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Re: Dynamic Flashpaper file based on login

Post by aerodromoi »

sono_advertising wrote: What I am after is a page that a user can log into (I have this already)...based on that page they will be taken to a single page that loads a flashpaper file based on the username used.
Whether you need a flash or an html login, the concept is basically the same. You store the password and the username in a php file (perhaps md5 encoded) and compare them with the input the user provides.
You don't need flatfiles for that.

aerodromoi
sono_advertising
Forum Newbie
Posts: 3
Joined: Sun May 14, 2006 8:13 pm

Post by sono_advertising »

Thanks aerodromoi for your reply,

I think I have made myself unclear.

I know how to do the login with username but what I need is to be able to display the relevant flashpaper file in a html page based on the username entered.

Thanks
ablaye
Forum Newbie
Posts: 13
Joined: Sun May 14, 2006 9:26 pm

Post by ablaye »

Well, then you need to create a file that associates a particular username with the relevant flashpaper file. There are many ways to do that. When the user is logged on, read the file and get the flashpaper file.
sono_advertising
Forum Newbie
Posts: 3
Joined: Sun May 14, 2006 8:13 pm

Post by sono_advertising »

Hi ablaye,

Yes thank you I am aware that there needs to be a reference file in order to link the username with the flashpaper file, but I do not know how to write the code that impliments what I am after.

As a mentioned I am a newbie and would appreciate some help from someone who could point me in the right direction whether it be a tutorial or a similar solution.
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Post by aerodromoi »

sono_advertising wrote:Hi ablaye,

Yes thank you I am aware that there needs to be a reference file in order to link the username with the flashpaper file, but I do not know how to write the code that impliments what I am after.

As a mentioned I am a newbie and would appreciate some help from someone who could point me in the right direction whether it be a tutorial or a similar solution.
Here's a snippet that prints out the code for different flashfiles based on the variable "id".
customer1 gets test1.swf, customer2 gets test2.swf and everyone else gets test3.swf

However, there is one drawback: You can still access the swf directly. This could only be prevented with a htaccess / php login or with an actionscript/php check. You might also want to check out LocalConnection(); to retrieve the domain name via actionscript.

aerodromoi

Code: Select all

<?php
$id = $_GET['id'];

function flashfunction($x,$y,$fpath){
         echo "<object type="application/x-shockwave-flash" data="".$fpath."" width="".$x."" height="".$y."">
              <param name="movie" value="".$fpath."" />
              <img src="img/noflash.gif" alt="no flash enabled" /></object><br />";
}

$flashfiles = array(
              array("250","120","test1.swf"),
              array("322","214","test2.swf"),
              array("331","220","test3.swf")
              );
              
switch($id){
  case "customer1": $file = 0; break;
  case "customer2": $file = 1; break;
  default: $file = 2; 
}

flashfunction($flashfiles[$file][0],$flashfiles[$file][1],$flashfiles[$file][2]);
?>
Post Reply