Solved

Simple php poll problem

Posted on 2004-08-07
25
609 Views
Last Modified: 2012-05-05
hi,

I have made a php poll based on the same php poll used to rate flash tutorials at flash kit. Example: http://www.flashkit.com/tutorials/Getting_Started/

Your notice how each tutorial has a number of hits and rating (number of votes) displayed near it name. When you open up the tutorial their is a voting system, that you can use to vote with.

Example:
http://www.flashkit.com/tutorials/Getting_Started/Using_La-Eddie_Ca-10/index.php

My php poll is exactly the same. My problem is that I don't want users to be able to vote more than once. The user needs to be able to vote once for each tutorial. I don’t want the user to be locked out from voting on all the tutorials once they vote for one of them. Quite simple a user can vote for a tutorial once only but can cast a vote on each tutorial at least once. The code needs to be simple as wee add new tutorials on a regular bases. I also haven't a clue how to use mysql so if your code uses that feature you need to explain it to me in layman’s terms please. If a user has already voted I want a message on the tutorial page where they cast their vote to be displayed saying sorry you have already voted. You will need to use and edit the code below.

You can see a working example of my poll here: http://www.webwasp.co.uk/test/poll/

The first tutorial : Simple Links  (http://www.webwasp.co.uk/test/poll/a01=simple-links/index.php) is the only one that has the php poll installed on it so far

Any help would be appreciated

This is all my code for the php poll:

Ratings.php
http://www.webwasp.co.uk/test/poll/Ratings.php
=====================================================================================
  <table border="1" cellspacing="0" cellpadding="0" align="center">
    <tr><td align="center">Please Indicate what you thought about this Tutorial</td></tr>
      <tr><td align="center">(1 for the worst review, 10 for the best...)</td></tr>
    <tr>
      <td align="center">
         <table width="100%" border="1" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center"><input type="checkbox" name="checkbox1" value="1" onClick="Javascript:HandleBoxes(1)">1</td>
            <td align="center"><input type="checkbox" name="checkbox2" value="2" onClick="Javascript:HandleBoxes(2)">2</td>
            <td align="center"><input type="checkbox" name="checkbox3" value="3" onClick="Javascript:HandleBoxes(3)">3</td>
            <td align="center"><input type="checkbox" name="checkbox4" value="4" onClick="Javascript:HandleBoxes(4)">4</td>
            <td align="center"><input type="checkbox" name="checkbox5" value="5" onClick="Javascript:HandleBoxes(5)">5</td>
                  <td align="center"><input type="checkbox" name="checkbox5" value="5" onClick="Javascript:HandleBoxes(6)">6</td>
                  <td align="center"><input type="checkbox" name="checkbox5" value="5" onClick="Javascript:HandleBoxes(7)">7</td>
                  <td align="center"><input type="checkbox" name="checkbox5" value="5" onClick="Javascript:HandleBoxes(8)">8</td>
                  <td align="center"><input type="checkbox" name="checkbox5" value="5" onClick="Javascript:HandleBoxes(9)">9</td>
                  <td align="center"><input type="checkbox" name="checkbox5" value="5" onClick="Javascript:HandleBoxes(10)">10</td>
          </tr>
        </table>
       </td>
    </tr>
    <tr><td align="center"><form action='<?php print (ReturnCurrPage($HTTP_SERVER_VARS['PHP_SELF'])); ?>' target="_self" method="post" name="Rating">
                             <input name="CurrentArticle" type="hidden" value="<?php print $ArticleID ?>">
                             <input name="SelectedRating" type="hidden" value="">
                             <input type="submit" name="Submit" value="Submit">
                                       </form>
    </td></tr>
  </table>
=====================================================================================



Rating_Functions.php:
http://www.webwasp.co.uk/test/poll/Rating_Functions.php
=====================================================================================
<?php
  function ReturnCurrPage($CurrPage){
      for ($x=0;$x<strlen($CurrPage);$x++) {
        if ($CurrPage[$x] == "/") { $tmpPos = $x; }
      }
      return (substr($CurrPage,($tmpPos+1)));
  }

  function UpdateRating() {
    $strError = "";
    $Flag = 3;
    $link = mysql_connect("*****","*****","*****") or $Flag = 1;
    if ($Flag == 3){
      mysql_select_db("webwasp_co_uk1") or $Flag = 2;
      if ($Flag  <> 3){
        mysql_close($link);  // No Database Found Found!
      } else {  // DB LINK ESTABLISHED
        $z = $_POST['CurrentArticle'];
        $query = "select NumofRates, CurrentScore  from ratings where ArticleID = '$z';";
        $result = mysql_query($query);
        if (mysql_num_rows($result) == 0) {
          // ERROR NO ARTICLE IN DB - START NEW ID RECORD
          $x = 1;
              $y = $_POST['SelectedRating'];
              $query = "Insert Into ratings Values ('$z', '$x' , '$y');";
          mysql_query ($query);
        } else {
          while ($row = mysql_fetch_row($result)) {
            $x = $row[0];
            $y = $row[1];
          }
          $x++;
          $y = $y + $_POST['SelectedRating'];
          $query = "Update ratings Set NumofRates = '$x', CurrentScore = '$y' Where ArticleID = '$z';";
          mysql_query($query);
        }
      }
      mysql_close($link);   // CLOSE DB
    } else { // NO CONNECTION AVAILABLE
      }
  }

  function ReturnRating($ArtID) {
    $strError = "";
    $Flag = 3;
    $link = mysql_connect("*****","*****","*****") or $Flag = 1;
      if ($Flag == 3){
      mysql_select_db("webwasp_co_uk1") or $Flag = 2;
        if ($Flag  <> 3){
        mysql_close($link);  // No Database Found Found!
        $ReturnVar =  "Not Rated";
        } else {  // DB LINK ESTABLISHED
        $z = $ArtID;
        $query = "select NumofRates, CurrentScore  from ratings where ArticleID = '$z';";
        $result = mysql_query($query);
        if (mysql_num_rows($result) == 0) {     //  NO ARTICLE IN DB - NOT RATED
          $ReturnVar =  "Not Rated";
        } else {
          while ($row = mysql_fetch_row($result)) {
            $x = $row[0];
            $y = $row[1];
          }
          $tmpVal = ($y / $x);
              if (strpos($tmpVal,".") === false){
                $tmpVal = $tmpVal . ".00";
              } else {
                if ( ((strlen($tmpVal)) - (strpos($tmpVal,"."))) > 3 ) {
                    $tmpWhole = substr($tmpVal, 0, strpos($tmpVal,"."));
                    $tmpDec = substr($tmpVal,strpos($tmpVal,".")+1);
                    for ($loop=(strlen($tmpDec));$loop>1;$loop--){
                        if (  $tmpDec[$loop] >= 5 ) {  ($tmpDec[$loop-1]) +1; }
                    }
                    $tmpDec = substr($tmpDec,0,2);
                    $tmpVal = $tmpWhole . "." . $tmpDec;
                  }
              }
              $ReturnVar = "Rated: " . $tmpVal . " / 10";
        }
        mysql_close($link);   // CLOSE DB
      }

    } else { // NO CONNECTION AVAILABLE
        $ReturnVar =  "Not Rated";
      }
      return ($ReturnVar);
  }
?>
=====================================================================================


Rating.js
http://www.webwasp.co.uk/test/poll/Rating.js
=====================================================================================
// JAVA SCRIPT RATING'S FORM HANDLER
function HandleBoxes(intBox){
  document.Rating.SelectedRating.value = intBox;
  checkbox1.checked = false;
  checkbox2.checked = false;
  checkbox3.checked = false;
  checkbox4.checked = false;
  checkbox5.checked = false;
  switch (intBox){
    case 1: checkbox1.checked = true;
            break;
    case 2: checkbox2.checked = true;
            break;
    case 3: checkbox3.checked = true;
            break;
    case 4: checkbox4.checked = true;
            break;
    case 5: checkbox5.checked = true;
            break;
  }
}
=====================================================================================


Index page for the tutorial where user can vote:
http://www.webwasp.co.uk/test/poll/a01=simple-links/index.php
=====================================================================================
<!-- RATINGS VARIABLES START   -->
//Sets the uniqe ID for the tutorial
//Each tutorial must have it's own ID
<?php
  $ArticleID = 1;  //CHANGE THIS VALUE TO INDICATE CURRENT DOCUMENT'S RATING TABLE ID
  include ("../Rating_Functions.php");
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != ""){ UpdateRating(); }
?>
<script language="JavaScript" type="text/javascript" src="../Rating.js"></script>
<!-- RATINGS VARIABLES END -->

//Displays the voting table
  <!-- RATINGS VARIABLES START   -->
<?php include ("../Ratings.php"); ?>
<!-- RATINGS VARIABLES END   -->
=====================================================================================


Index page for the list of all the available tutorials. Where the ratings are displayed for each tutorial
http://www.webwasp.co.uk/test/poll/index.php
=====================================================================================
<!-- RATINGS VARIABLES START   -->
<?php include ("Rating_Functions.php"); ?>
<!-- RATINGS VARIABLES END  -->


<?php print(ReturnRating(1)); ?>
=====================================================================================

Cheers
Rabid Lemming

0
Comment
Question by:Rawdon Hume
  • 13
  • 10
  • 2
25 Comments
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
I have a good idea for your problem. If you haven't already give each of the tutorials on your website a unique id number...1.2.3.4.5 etc.

create a table in your database that would look very basically like this:

CREATE TABLE poll_votes
(
poll_id int not null,
user text not null
);

when a person votes insert the poll_id of the poll they voted on along with there IP address (or username if you have members).

when the page loads OR when the user trys to submit a vote, use a little something like the following to check if they have already voted onece:

$query = "SELECT * FROM poll_votes WHERE poll_id='".$currentPollID."' AND user='".$_SERVER["REMOTE_ADDR"]."'";
$result = mysql_query($query);
$num = mysql_num_rows($result);

if($num == 1)
{
  //they have already voted once, tell them they cant vote again
}
else
{
  //add the vote
}

That will do the trick, of course you will have to change it to suit your site. Im sorry that i could not do it myself, but i currently have my server uninstalled because i am doing some upgrades.

Any problems with it? Tell me and i will sort them out for you, and if you need a little help integrating it into your site i will do my best to help you blindly and hopefully ill have my server back up soon and i might be able to write it into there for you.

Zac Charles
0
 
LVL 2

Expert Comment

by:TaintedGod
Comment Utility
Yes, that will work. Just make sure they have to log in first, then store there username in the database. Storing ip's may not work as planned because of the use of proxies not only by users but isp's aswell and then there is of course the dialup users, where there ip changes every internet session.
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

The tutorial have to be accusable by all user. As I don’t want to restrict it to members only. Each tutorial has its own id if you look at the:

===================================================================
<!-- RATINGS VARIABLES START   -->
//Sets the uniqe ID for the tutorial
//Each tutorial must have it's own ID
<?php
  $ArticleID = 1;  //CHANGE THIS VALUE TO INDICATE CURRENT DOCUMENT'S RATING TABLE ID
  include ("../Rating_Functions.php");
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != ""){ UpdateRating(); }
?>
<script language="JavaScript" type="text/javascript" src="../Rating.js"></script>
<!-- RATINGS VARIABLES END -->

//Displays the voting table
  <!-- RATINGS VARIABLES START   -->
<?php include ("../Ratings.php"); ?>
<!-- RATINGS VARIABLES END   -->
===================================================================

The $ArticleID = 1 is the id of the tutorial. I was thinking of using the following code to allow users to only vote once. Its some different code I found but I don’t know how to adapt it for my php poll ?

===================================================================
<?
// ---------------
// define options
// ---------------
error_reporting(E_ERROR);
$file_data = 'text_poll.txt'; // text file name (CHMOD 777);
$cookie_duration = 3600;      // how long cookie remains (3600 = 1 hour)
$cookie_title='text_poll_1';
// ---------------------
// prevent browser cache
// ---------------------
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// ---------------
// read data from
// text file
// ---------------
function readData()
{
   GLOBAL $file_data, $HTTP_COOKIE_VARS, $cookie_title;
   // --------------------
   // load file into array
   // --------------------
   $fp = file($file_data);
   // -----------------------------
   // print each value of the array
   // -----------------------------
   while(list($line,$value) = each($fp))
   {
      // --------------------------------
      // replace the newline with the '&'
      // --------------------------------
      print "&" . eregi_replace("\r\n","",$value);
   }
   if(isset($HTTP_COOKIE_VARS["$cookie_title"]))
   {
      print "&allow=false";
   } else {
      print "&allow=true";
   }
}
// -------------------
// Save data to the
// text file
// -------------------
function saveData($num)
{
   GLOBAL $file_data, $HTTP_COOKIE_VARS, $cookie_duration, $cookie_title;
   if(isset($HTTP_COOKIE_VARS["$cookie_title"]))
   {
      die("registered=already voted");
   }
   if(number_format($num) < 1) die("registered=true");
   $fp_array = @file($file_data);
   $fp = @fopen($file_data,"r+");
   $temp_string = '';
   foreach($fp_array as $key => $value)
   {
      $line = explode('=',$value);
      $theName = $line[0];
      $theValue = eregi_replace("\r\n","",$line[1]);
      if(substr($theName,0,5)=='votes')
      {
         $theValue = number_format(eregi_replace("\r\n","",$line[1]));
         $matching_num = number_format(substr($theName,5,2));
         if($matching_num==$num)
         {
            $theValue++;
         }
      }
      $temp_string .= "$theName=$theValue\n";
   }
   @fwrite($fp,$temp_string);
   @fclose($fp);
   setCookie($cookie_title, time(), time() + $cookie_duration);
   print "registered=true";
}
// -----------------
// Decisional switch
// -----------------
switch($HTTP_GET_VARS['action'])
{
   case 'saveData':
      saveData($HTTP_GET_VARS['num']);
      break;
   default:
      readData();
      break;
}
?>
===================================================================

Any ideas?

Cheers
Rabid Lemming
0
 
LVL 2

Expert Comment

by:TaintedGod
Comment Utility
Could you tell us how secure you want this to be? I already mentioned how storing ip's wont be very secure and the method above just uses cookies. If cookies are disable, then that wont do a thing to stop them, if they have a cookie cleaner, again, that wont do a thing.

Though if you are that concerned about it, you could use all of the different ways to make it as hard as possible but, this seems a little too much just for a poll. I still think that you should make them sign up for a free account before they can view any of your resources, which will allow you to easily stop them from voting more than once.
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
here is a similar idea to my first...

when a user votes, set a cookie on their computer with the ArticleID included in it, like this:
setcookie("Article".$ArticleID,"voted_already",time()+90*90*90*90*90); //This cookie eill expire after we all die :P

once again... when they try and vote, check if the cookie is set, if not, add the vote, like this:
$cookie_name = "Article".$ArticleID;
if(isset($_COOKIE[$cookie_name]))
{
  //computer has already voted
}
else
{
  //add the vote
}



you could even make it that a computer could only vote once per week..
setcookie("Article".$ArticleID,"voted_already",time()+604800); //This cookie will expire in a week


there is one issue with this method, and all others that invlove cookies..and that is people who delete there cookies or have them disabled. I would suggest using a method of both my ideas:
1-Set a cookie
  -Add their IP to the database

2-Check for the cookie set
  -Check for the IP in the database

If a user is on dialup, like i am :(, they are not going to want to pay however much a phone call costs to dissconnect and reconnect again just to mess with your poll.

Over all these solutions i would suggest that you add free member accounts, which allow the user to see the voting poll, and then in a database track who has voted and stop the user from voting multiple times that way. You could achieve this by using my first example with the username instead of the ip address.

Another idea, which is still an idea, even though you can get around it by re-opening your browser is setting a session variable and then checking for it when they try and vote again, not the most secure method but i know i couldn't be bothered closing and re-opening a browser just to screw up even my worst enemies poll :P

Anyway, I would go with the free members (sign up to let them vote and mabey a few other benefits) and then tract the members userId or userName in the database.

Let me know how it goes,
Zac Charles
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

I think the cookie idea will probably be enough, it doesn’t have to be 100 % full proof as you said its a only a poll so at the end of the day it wont matter a grate deal if a user votes more than once. i figure cookies will be easier than ip’s and I doubt that many users will disable them or have them disabled

How can I use the cookie code you gave above and incorporate it into the php code I got already? The php got was given me by an experts-exchange member so I don’t really know where or which part of the code to tie the cookie code into and how to return a message to the user informing them they have already voted?

Cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
stay around and ill write it in for you, ok?
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

yer that’s kewl I will await in early anticipation

Cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
lol, try this...

--------------------------------------------------------------------------
<!-- RATINGS VARIABLES START   -->
//Sets the uniqe ID for the tutorial
//Each tutorial must have it's own ID
<?php
  $ArticleID = 1;  //CHANGE THIS VALUE TO INDICATE CURRENT DOCUMENT'S RATING TABLE ID
  include ("../Rating_Functions.php");
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "")
  {
    $cookie_name = "Article".$ArticleID;
    if(isset($_COOKIE[$cookie_name]))
    {
      die('you have already voted once');
    }
    else
    {
      UpdateRating();
    }
  }
?>
<script language="JavaScript" type="text/javascript" src="../Rating.js"></script>
<!-- RATINGS VARIABLES END -->

//Displays the voting table
  <!-- RATINGS VARIABLES START   -->
<?php include ("../Ratings.php"); ?>
<!-- RATINGS VARIABLES END   -->



---------------------------------------------------------------------------------------------------
function UpdateRating() {
    $strError = "";
    $Flag = 3;
    $link = mysql_connect("*****","*****","*****") or $Flag = 1;
    if ($Flag == 3){
      mysql_select_db("webwasp_co_uk1") or $Flag = 2;
      if ($Flag  <> 3){
        mysql_close($link);  // No Database Found Found!
      } else {  // DB LINK ESTABLISHED
        $z = $_POST['CurrentArticle'];
        $query = "select NumofRates, CurrentScore  from ratings where ArticleID = '$z';";
        $result = mysql_query($query);
        if (mysql_num_rows($result) == 0) {
          // ERROR NO ARTICLE IN DB - START NEW ID RECORD
          $x = 1;
            $y = $_POST['SelectedRating'];
            $query = "Insert Into ratings Values ('$z', '$x' , '$y');";
          mysql_query ($query);
        } else {
          while ($row = mysql_fetch_row($result)) {
            $x = $row[0];
            $y = $row[1];
          }
          $x++;
          $y = $y + $_POST['SelectedRating'];
          $query = "Update ratings Set NumofRates = '$x', CurrentScore = '$y' Where ArticleID = '$z';";
          mysql_query($query);
        }
        setcookie("Article".$ArticleID,"voted_already",time()+90*90*90*90*90);
      }
      mysql_close($link);   // CLOSE DB
    } else { // NO CONNECTION AVAILABLE
     }
  }

------------------------------------------------------------------------------------------
shouldnt be to hard to see what they replace :)

tell me how that goes, i cant test it because my server is still uninstalled....

Zac Charles
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
note: the first half of that will actually stop the rest of the page from loading if they have already voted once, and i dont think you would want that....so actully use this one: (it will write in bold 'you have already voted once' and then not add the vote)

<!-- RATINGS VARIABLES START   -->
//Sets the uniqe ID for the tutorial
//Each tutorial must have it's own ID
<?php
  $ArticleID = 1;  //CHANGE THIS VALUE TO INDICATE CURRENT DOCUMENT'S RATING TABLE ID
  include ("../Rating_Functions.php");
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "")
  {
    $cookie_name = "Article".$ArticleID;
    if(isset($_COOKIE[$cookie_name]))
    {
      echo('<b>you have already voted once</b>');
    }
    else
    {
      UpdateRating();
    }
  }
?>
<script language="JavaScript" type="text/javascript" src="../Rating.js"></script>
<!-- RATINGS VARIABLES END -->

//Displays the voting table
  <!-- RATINGS VARIABLES START   -->
<?php include ("../Ratings.php"); ?>
<!-- RATINGS VARIABLES END   -->


-Zac Charles
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

I tried the code you suggested  but it still allows me to vote more than once?

http://www.webwasp.co.uk/test/poll/a01=simple-links/index.php

any ideas why?

cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
sorry for the long response, i just had tea, ill take a look now :)
you still there by the way??
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
:D Im so happy, i got all of my server to work again with all the new versions :P

If you can give me the sql for what your polls lable looks like i will test it then write it back on here for you all working :)
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

err. the sql table? lol is this it?

# phpMyAdmin SQL Dump
# version 2.5.7-pl1
# http://www.phpmyadmin.net
#
# Host: www.webwasp.co.uk
# Generation Time: Aug 08, 2004 at 09:31 AM
# Server version: 4.0.20
# PHP Version: 4.3.8
#
# Database : `webwasp_co_uk1`
#

# --------------------------------------------------------

#
# Table structure for table `ratings`
#

CREATE TABLE `ratings` (
  `ArticleID` bigint(8) unsigned zerofill NOT NULL default '00000000',
  `NumofRates` int(6) NOT NULL default '0',
  `CurrentScore` double(3,2) NOT NULL default '0.00',
  UNIQUE KEY `NewIndex` (`ArticleID`)
) TYPE=MyISAM;

#
# Dumping data for table `ratings`
#

INSERT INTO `ratings` VALUES (00000001, 28, '204.00');

I dont know if thats it or not?

cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
yea, that is it, cool, ill do it right now, ive already set up all the files :)
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
ok, here you go, all you need to do is replace this page and it will work, i have also added delCookie.php for you so you can delete the cookie and test it just so you know how well it works :)

//--------------------[ \a01=simple-links\index.php ]-----------------
<?php
//Sets the uniqe ID for the tutorial
//Each tutorial must have it's own ID
  $ArticleID = 1;  //CHANGE THIS VALUE TO INDICATE CURRENT DOCUMENT'S RATING TABLE ID
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "")
  {
    setcookie($ArticleID,"yes",time()+90*90*90);
  }
?>
<!-- RATINGS VARIABLES START   -->
<?php
  include ("../Rating_Functions.php");
 
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "")
  {
    UpdateRating();
  }
?>
<script language="JavaScript" type="text/javascript" src="../Rating.js"></script>
<!-- RATINGS VARIABLES END -->

<center>
------------------------------
this is a bunch of precontent(like the tutorial)
------------------------------

  <!-- RATINGS VARIABLES START   -->
<?php
//Displays the voting table
if(!isset($_COOKIE[$ArticleID]))
{
  include ("../Ratings.php");
}
else if( (isset($_COOKIE[$ArticleID])) || ((isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "") )
{
  print '<table border="1"><tr><td><b>You have already voted once</b></td></tr></table>';
}
?>

------------------------------
this is a bunch of postcontent(like your footer with all the links)
------------------------------
</center>

<!-- RATINGS VARIABLES END   -->


//-----------------------[ \delcookie.php ]------------------------
<?php
$ArticleID = 1;
setcookie($ArticleID,"yes",time()-3600);
?>

There you go :)

Zac Charles
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

I am sorry you kind of lost me their I was following you up to where you went on about : this is a bunch of precontent(like the tutorial)

I didn’t know where to put all the code afterwards ?

I have bundled up all the files for you in a WinZip file that you can download here: http://www.rabidlemming.com/phpPoll.zip

Extract the files (don’t drag and drop the files from WinZip) when you extract the files using WinZip it will create a folder called "Php Poll" all the files you need are in their

I hate to ask so much but I can’t work it out sorry

Cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
its alright, i live for this stuff you know :P, ill do it now :)
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

lol kewl I appreciate it

Cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
Ok done:

--------------------------[ INDEX.PHP (the one for the first tutorial on simple links, that is located in a01=simple-links) ]------------------
<?php
/*
<!--RATINGS VARIABLES START PART1  -->
*/

//Sets the uniqe ID for the tutorial
//Each tutorial must have it's own ID
  $ArticleID = 1;  //CHANGE THIS VALUE TO INDICATE CURRENT DOCUMENT'S RATING TABLE ID

  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "")
  {
    setcookie($ArticleID,"yes",time()+90*90*90);
  }
?>
<!-- RATINGS VARIABLES END PART1 -->


<!--Updated by Philip 28-1-03 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/00-falsh-tutorial.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->

<!-- RATINGS VARIABLES START PART2  -->
<?php
  include ("../Rating_Functions.php");
 
  if ( (isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "")
  {
    UpdateRating();
  }
?>
<script language="JavaScript" type="text/javascript" src="../Rating.js"></script>
<!-- RATINGS VARIABLES END PART2 -->

<title>Flash Tutorial: Simple Links - webwasp.co.uk</title>
<meta name="Keywords" content="flash,  flash MX, free flash,  web design, actionscript, macromedia, shockwave, tutorial, beginner, intermediate, advanced, help, tips, downloads, movie clip, beginner, intermediate, advanced, action script, movie, fla, swf" />
<meta name="Description" content="The Web Wasp Flash tutorials will allow the beginner, intermediate or advanced Flash developer to get to grips with all aspects of Flash design. The easy to follow instructions, and downloads, will help developers of all abilities improve their Flash skills." />

<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<meta name="GENERATOR" content="Microsoft FrontPage 4.0" />
<meta name="ProgId" content="FrontPage.Editor.Document" />

<style type="text/css">
A:active {text-decoration: none}
A:hover {text-decoration: underline; color: #DD6900;}
</style>

<!-- InstanceBeginEditable name="Document head" -->

<meta name="GENERATOR" content="Microsoft FrontPage 4.0" />
<meta name="ProgId" content="FrontPage.Editor.Document" />

<link rel="stylesheet" href="../../Templates/webwasp.css" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>
<meta name="Keywords" content="Flash tutorial, create simple links, Flash animation" />
<meta name="Description" content="Tutorial to learn how to link one Flash page with another." />
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<!-- InstanceEndEditable -->

<!-- InstanceParam name="pagecount" type="boolean" value="true" -->
<!-- InstanceParam name="GoogleAd" type="boolean" value="true" -->
<!-- InstanceParam name="donation" type="boolean" value="true" -->
<!-- InstanceParam name="Previous-Next" type="boolean" value="true" -->
<!-- InstanceParam name="Flash_Ed_Software" type="boolean" value="true" -->



</head>

<body  bgcolor="#FFFFFF" topmargin="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="14" valign="top" bgcolor="#FFFFFF"><div align="right">
      <p>
          <a name="top" id="top"></a>&#8226;
            <a href="../../index.php" class="links-head">Home</a> &#8226;
            <a href="../index.php" class="links-head">Tutorials</a> &#8226;
            <a href="../../flash-sample-movies/samples.php" class="links-head">Samples</a> &#8226;
            <a href="../../forum/index.php" class="links-head">Forum</a> &#8226;
            <a href="../tutorials-by-date.php" class="links-head">Whats New </a> &#8226;
            <a href="../../pay4downloads.php" class="links-head">Downloads</a> &#8226;
            <a href="../../forms/newsletter.php" class="links-head">Newsletter</a> &#8226;
            <a href="../../links/index.php" class="links-head">Links</a> &#8226;
            <script language="JavaScript" type="text/javascript"><!--
//Sets up the bookmark details
if (navigator.appName == "Microsoft Internet Explorer")
      { document.write(" <A href=\"javascript:window.external.AddFavorite('"+location.href+"','"+document.title+"')\" class='links-head'>Bookmark Page</A>");}
else if (navigator.appName == "Netscape")
      { document.write(" - Press Ctrl + D");      }
//--></script>
&#8226;&nbsp;&nbsp; </p>

    </div></td>
  </tr>
  <tr>
    <td height="28" valign="top" background="../../images/background-top.gif"> &nbsp;&nbsp;&#8226;
      <a href="../../forms/index.php" class="links-head">Contact Us</a> &#8226;
      <a href="../../books/macromedia/index.php" class="links-head">Software</a> &#8226;
      <a href="../../consultation/index.php" class="links-head">Consultation</a> &#8226;
      <a href="../../forms/index.php" class="links-head">Advertise</a>  &#8226;
      <a href="../../log-on.php" class="links-head">Members Logon </a> &#8226;
      <a href="../../pay4downloads.php" class="links-head">Become a Member</a> &#8226;
      </td>
  </tr>
  <tr>
    <td>
      <div align="center">
        <script type="text/javascript"><!--
google_ad_client = "pub-9647556063329552";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_color_border = "663366";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
        <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
      </script>
      </div>

      <hr />      <p align="left" class="links-head"><img src="../../images/webwasp-head.gif" width="544" height="47" /><br />
        <a href="../../books/macromedia/index.php" class="links-head">Official Macromedia Affiliate</a></p></td></tr>
</table>

<p class="text"><span class="subhead-Pink">Students</span> and <span class="subhead-Pink">Teachers</span> can buy <span class="subhead-Red">Flash MX 2004</span> for <span class="subhead-Red">$99</span>!! <a href="../../books/macromedia/students.php">Click here for details</a> <br />
<span class="text-Small">Price correct at time of publication. Macromedia may change the price at any time.</span></p>
<hr />

<!-- InstanceBeginEditable name="Document body" -->
<p style="margin:0cm;margin-bottom:.0001pt" align="left"><b><span class="heading11"><font color="#6699CC" face="Verdana" size="3" class="main-head">Flash Tutorial
        MX 2004 - Simple Links</font></span></b></p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left"><b><span class="heading11"><font color="#6699CC" face="Verdana" size="3" class="main-head">01
  </font></span><font color="#FF0000"><span class="heading11"><font face="Verdana" size="2">Beginners</font></span></font><span class="main-head"><font face="Verdana" size="2"><font size="2" color="#6699CC"> <br />
  </font></font></span><font face="Verdana" size="2"><font size="2" color="#6699CC"><span class="subhead">Flash
   Compatibility:</span></font><span class="heading11"> <font color="#FF00FF">MX<span class="main-head"><span class="subhead"><b><font face="Verdana"> </font></b></span></span></font></span><font color="#FF00FF"><b><font face="Verdana">2004</font></b></font><span class="heading11"><font color="#000000"><span class="main-head"><span class="subhead"><b><font face="Verdana" size="2"><font color="#000000"><b><font face="Verdana"><font color="#000000">&nbsp;&nbsp;&nbsp; </font></font></b></font><font face="Verdana"><span class="text style1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></font></b></span></span></font></span></font><span class="head"><font face="Verdana"><font face="Verdana">For </font></font></span></b><span class="head"><font face="Verdana"><font face="Verdana">Flash <strong>MX</strong></font></font></span><font face="Verdana" size="2"><b><span class="heading11"><font color="#000000"><span class="main-head"><font face="Verdana"><span class="text"><font color="#000000"> <a href="images/flash-MX/index-mx.php">click
  here</a></font></span></font></span></font></span></b></font></p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left"><span class="subhead"><b><font size="2" face="Verdana">Written
        by:</font><font color="#000000" size="2" face="Verdana"> </font></b></span><b><font color="#000000" size="2" face="Verdana">Phil</font><span class="heading11"><font face="Verdana" size="2"><font color="#000000"></font></font></span></b></p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left"><span class="subhead"><b><font size="2" face="Verdana">Length:</font> </b></span><b><font color="#000000" size="2" face="Verdana">1500
      words</font></b></p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left">&nbsp;</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="text"><span class="text">This
  tutorial is designed for people who have little or <b>NO</b> <b>Experience</b>
  of using flash. The aim of the tutorial is to:</span></p>
<p class="text">Show you how to link one Flash 'page' with another 'page'. Page
  is in inverted commas because Flash does not really have pages but frames, but
  the idea is the same. </p>
<blockquote>
  <p class="text"><strong>Note:</strong> Don't get Flash 'frames' mixed up with HTML 'frames'.
      They are completely different. </p>
</blockquote>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="text"><span class="text">Confused
  already? Well actually is is not difficult (hopefully)!</span></p>
<blockquote>
  <p align="left" class="text" style="margin:0cm;margin-bottom:.0001pt"><strong>Cross
      Ref:</strong>
    If you wish to learn how to make a hyperlink, a link from a Flash movie to
      a  new web page, go to the beginners tutorial: <a href="../a15-hyperlink/hyperlink.php">15
       hyperlinks</a></p>
</blockquote>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="text"><font face="Verdana" size="2"><b><font face="Verdana" size="2"><b><img src="../../images/floppy-disk.gif" width="13" height="13" />
  </b></font><font color="#6699CC">My Example: <a href="../../pay4downloads.php">Download
the Flash file</a> </font><font face="Verdana" size="2"><b><font color="#FF0000">&nbsp;Beg </font><font face="Verdana" size="2"><b><font face="Verdana" size="2"><b><font color="#FF0000">01</font></b></font></b></font><font color="#FF0000">a</font></b></font></b></font></p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="text">&nbsp;</p>
<table width="100%" border="0" cellpadding="0">
  <tr>
    <td align="left" valign="bottom"> <div align="left">
        <p>
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
 width="200" height="130" id="simple-links" align="">
            <param name="movie" value="images/Beg-01a__Simple-Links.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#CCCCFF" />
            <embed src="images/Beg-01a__Simple-Links.swf" quality="high" bgcolor="#CCCCFF"  width="200" height="130" name="simple-links" align=""
 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
            </embed>
          </object>
&nbsp;&nbsp;</p>
        <p><span class="text">        </span></p>
    </div></td>
  </tr>
</table>
<p style="margin:0cm; margin-bottom:.0001pt; font-style: italic;" align="left" class="text">Click on
the triangle button.</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="text">&nbsp;</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="text">Example
   of small Flash Movie with buttons linking one 'page' or frame of the flash
   movie to the next.</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left">&nbsp;</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead"><br />
  Step
  One: Setting up the document</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead">&nbsp;</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead"><span class="text">We
    are going to open a new Flash document and customise  it. </span></p>
<ol>
  <li class="text">Go to: <strong>File &gt; New &gt; General Tab &gt; Flash Document &gt;
      OK</strong></li>
  <li class="text">The work space in Flash is often quite cluttered with <span class="text">Panels.
      Panels are tool boxes and although useful - much of the time time you don't
      need them and I think for beginners they are confusing. For this reason
      we are going to close then all except for the Ti</span><span class="text">meline
      and Tools. You can turn these Panels off and On in the Windows Menu. <br />
      <br />
      <img src="images/01-window.gif" width="203" height="325" /><br />
      <em>Only the Timeline and Tools are open.<br />
      <br />
      </em><strong>Note:</strong> You should also close all the Panels that you will find in the sub
      menus. The sub menus can be accessed via the little triangles: <em><img src="../../images-mx04/mx04-sub-menu.gif" width="4" height="7" /><br />
      <br />
      </em> </span></li>
  <li class="text"><span class="text"> We are now ready to customise the document.
      Go to: <strong>Modify &gt; Document</strong>.</span></li>
  <li class="text"><span class="text">Type in the dimensions that you want for
       your movie. The one above is 200 x 130 px (pixels).</span></li>
  <li class="text"><span class="text">Select a background colour by clicking
      on  the coloured swatch.</span></li>
  <li class="text">Click: OK.</li>
  <li class="text">Save your file<br />
    <br />
    <img src="images/02-doc.gif" width="372" height="230" /><br />
    <em>Your Document Properties should look like this.</em></li>
</ol>
<p class="subhead"><br />
Step Two: Setting up Frame 1</p>
<ol>
  <li class="text">Using the Text Tool
    <img src="../../images-mx04/mx04-text-tool.gif" width="13" height="14" /> on the tool bar type: <strong>'Page
    One' </strong>on the stage. The stage
    is the visible 'page'<span class="text">.
    </span></li>
  <li class="text"> When you have finished typing go back to the Selection tool
  <img src="../../images-mx04/mx04-selection-tool.gif" width="7" height="13" />. </li>
  <li class="text">If you want to change the colour, style or size of the font
    you can do so in the Property Inspector:<strong> Window &gt; Properties</strong>  </li>
  <blockquote>
    <p class="text"><strong>Note: </strong> If
            you want to change the type settings the text must be selected.
            If you click on your text with the Selection Tool <img src="../../images-mx04/mx04-selection-tool.gif" width="7" height="13" /> the
            text will have a blue rectangle around it:<br />
      <br />
      <strong><img src="images/03-text.gif" width="119" height="38" /><br />
      </strong></p>
  </blockquote>
  <li class="text">Go to: <strong>Windows &gt; Other
        Panels &gt; Common Libraries &gt; Buttons</strong>.<br />
      <br />
    To
    look at the buttons you need to double click on the folders <img src="../../images-mx04/mx04-folder.gif" width="14" height="16" />.
    Choose a button and drag it out on to the stage. I selected: <strong>Circle
    Buttons &gt; Circle
         Button - Next</strong>. You can move the position of the button by clicking
          on it with the Selection Tool <img src="../../images-mx04/mx04-selection-tool.gif" width="7" height="13" /> and
  dragging it.  </li>
  <blockquote>
    <p class="text"><strong>Note:</strong> If you take a different button from the Common
                Button Library avoid Knobs, Faders and Component buttons as they
        work differently.<br />
    </p>
  </blockquote>
  <li class="text">Place anything else that you may want on the first frame. You
        can draw with some of the tools on the tool bar or copy and paste clip art
        from other programs such as Word. You can also paste from graphics programs
  like Freehand, Illustrator or CorelDraw.</li>
  <li class="text"><span class="text">Save your file.</span></li>
</ol>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead"><br />
  Step
  Three: Setting up Frame 2</p>
<ol style="margin-bottom: .0001pt">
  <li class="text">Go to the Timeline and place your cursor
            in frame 2. Right click (Ctrl click on a Mac) and select: <strong>Insert
    Keyframe</strong><br />
    You will now have a black dot in both frames 1 and 2. This copies
    all the
            contents from frame one and places them onto frame 2. It is the same
    as copy and paste. Your stage should look the same as before you clicked
    in
            frame two but now you are actually in a different place in the movie.
    The red play head should now be in frame two:<br />
    <br />
    <img src="images/04-stage.gif" width="309" height="256" /><br />
    <em>Two black dots in the timeline represent the keyframes.<br />
    </em><br />
  </li>
  <li class="text">Use your Text Tool <img src="../../images-mx04/mx04-text-tool.gif" width="13" height="14" /> to
    over write the word 'one' and type 'two'. It should now say: <strong>Page
    two</strong></li>
  <li class="text">When you have finished typing reselect the Selection Tool: <img src="../../images-mx04/mx04-selection-tool.gif" width="7" height="13" /></li>
  <li class="text">Go back to the Common Button Library (<strong>Windows &gt; Other
      Panels &gt; Common Libraries &gt; Buttons</strong>) and select a button
      as the back button and drag it onto the stage.</li>
  <li class="text">Click on the back dot in frame 1 and you
            will see that the difference between the two frames. </li>
  <li class="text">Click on the black dot (called a keyframe)
              in frame 2 and add any additional graphic and text elements that
    you may want.</li>
  <li class="text">Save your file.</li>
</ol>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead">&nbsp;</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead">&nbsp;</p>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead">Step
   Four: Setting up Frame 3</p>
<ol>
  <li class="text"><span class="text">Right click in frame 3 and select select:
       <strong>Insert Keyframe</strong></span></li>
  <li class="text">Make any changes to frame 3 as you did for frame 2.</li>
  <li class="text">Save your file.</li>
</ol>
<p class="subhead"><br />
Step Five: Testing the Movie</p>
<ol>
  <li class="text">Time to test your movie. Go to:<strong> Control &gt; Test
    Movie</strong>  </li>
  <blockquote>
    <p class="text"><strong>Note</strong>: This takes you to a new window. Your movie should be jumping
          from frame to frame non stop. You should be able to see a clear difference
          between
          all three
        frames.</p>
  </blockquote>
  <li class="text">Close the window. You do this by clicking on the lower of
    the  two crosses <img src="../../images-mx04/mx04-cross.gif" width="8" height="8" /> in the
    top right hand corner of your screen. This will not close your file but only
    the test window. </li>
</ol>
<p style="margin:0cm;margin-bottom:.0001pt" align="left" class="subhead"><br />
  Step
  Six: Stopping the Movie from Auto Playing</p>
<ol>
  <li class="text"><span class="text">Welcome to ActionScript. Your first bit
      of  programming! You need to select frame 1 (the first frame
      with a black dot in it): <strong>Click on key frame
  1</strong></span></li>
  <li class="text">Open the Actions Panel. On the keyboard press: <strong>F9</strong><br />
    <br />
    <strong>Important:</strong> If you
      have selected the Frame correctly the Actions panel should say Actions -
      Frame. Beware it is easy to attach your Actions to the wrong thing! Get in
      the habit of checking the top of the Actions panel before you use it.<br />
    <br />
    <img src="../../images-mx04/mx04-acts-frame.gif" width="214" height="106" /><br />
    <em>Always check what it says in the top left
    corner of the Actions Panel.</em><br />
    <br />
  </li>
  <li class="text">Click on the: <strong>Plus Sign <img src="../../images-mx04/mx04-actions-plus.gif" width="15" height="14" />  &gt; Global
      Functions &gt; Timeline
      Control
  &gt; Stop<br />
  <br />
  </strong>Your Actions Panel should display the following ActionScript:<br />
  <br />
  <span class="as-black">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="as-key-words">stop</span><span class="as-black">();</span><br />
  <br />
  </li>
  <li class="text">Close the Actions Panel - on the keyboard press: <strong>F9</strong></li>
  <li class="text">A small <b>a</b> should appear above the black dot in frame
    one. This indicates that the key frame has some Actionscript attached to
    it.<br />
    <br />
    <img src="images/05-a.gif" width="242" height="95" /><br />
    <em>Note the little '</em><span class="as-black">a</span><em>' in frame 1.</em><br />
    <br />
  </li>
  <li class="text">Test your movie:<strong>Control &gt; Test Movie</strong><br />
    Your movie should be
    stopped on frame one.</li>
  <li class="text">Close the test Window.</li>
  <li class="text">Save your file.</li>
</ol>
<p class="subhead"><br />
Step Seven: Attaching actionscript to the buttons</p>
<ol>
  <li class="text">In the timeline, if you are not already on frame 1, drag the
    red playhead to: <strong>Frame 1</strong></li>
  <li class="text">On the stage select the: <strong>Button</strong></li>
  <li class="text">Open the Actions Panel - on the keyboard press: <strong>F9</strong><br />
    <br />
    <strong>Important: </strong>If you have selected the button correctly the
    Actions panel should say Actions - Button in the top corner:<br />
    <br />
    <img src="../../images-mx04/mx04-acts-buttons.gif" width="242" height="95" /><br />
    <em>Always check what it says in the top left corner of the Actions Panel.</em>    <br />
    <br />
  </li>
  <li class="text">Type the following code into the Actions Panel: </li>
</ol>
<blockquote>
  <p class="as-black"><font color="#000084">&nbsp;</font>&nbsp;&nbsp;&nbsp;<span class="as-key-words">on</span> (<font class="as-key-words">release</font>)
    {<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font class="as-key-words">gotoAndStop</font>(2);<br />
    &nbsp;&nbsp;&nbsp;&nbsp;}</p>
  <p class="text">This means that when the mouse button is released you will go
    to frame 2 and stop.</p>
</blockquote>
<p class="subhead"><br />
Step Eight: Testing the button</p>
<ol>
  <li class="text">Time to test again. Go to: <strong>Control &gt; Test Movie</strong></li>
  <li class="text">Click on your button. You should move to frame 2.</li>
  <li class="text">Close the test Window by clicking on the cross: <img src="../../images-mx04/mx04-cross.gif" width="8" height="8" /></li>
</ol>
<p class="subhead"><br />
Step Nine: Add the Actions to the remaining buttons</p>
<p class="text">Add the actionscript to the remaining buttons and you are home
  and  dry. Well done. To do this go back and repeat<font color="#6699cc"><strong>
  Step Seven</strong></font>. Except this time do not go to frame 1 but goto
  frame  2 and select first one button and then the next. <br />
  <br />
  Your actionscript will look slightly different as you the buttons will be moving
  you to different frames. The actionscript that moves you from frame 2 to frame
  1 will look like this:</p>
<blockquote>
  <p class="as-black"><span class="as-key-words">on</span> (<span class="as-key-words">release</span>)
    {<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font class="as-key-words">gotoAndStop</font>(1);<br />
  }</p>
</blockquote>
<p class="text">The actionscript that moves you from frame 2 to frame 3 will look
  this:</p>
<blockquote>
  <p class="as-black"><font color="#000084">on</font> (<font color="#000084">release</font>)
    {<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000084">gotoAndStop</font>(3);<br />
  }</p>
</blockquote>
<p class="text">When you have done both of these buttons will also need to go
  to frame 3 and set the actionscript for that button.</p>
<p class="text">Remember to keep testing your movie: <strong>Control &gt; Test
  Movie</strong></p><BR>
  <!-- RATINGS VARIABLES START   -->
<?php
//Displays the voting table
if(!isset($_COOKIE[$ArticleID]))
{
  include ("../Ratings.php");
}
else if( (isset($_COOKIE[$ArticleID])) || ((isset($_POST['SelectedRating'])) && $_POST['SelectedRating'] != "") )
{
  print '<center><table border="1"><tr><td><b>You have already voted once</b></td></tr></table></center>';
}
?>
<!-- RATINGS VARIABLES END   -->
<!-- InstanceEndEditable -->



<p><span class="text">If you have found this page useful please support this site by clicking on the sponsored ad below:</span></p>

<div align="center">
     <script type="text/javascript"><!--
google_ad_client = "pub-9647556063329552";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_color_border = "663366";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
        <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
      </script>
</div>


</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <p><span class="text"><br />
    If you can please donate a small amount. Every little bit helps and keep us webwasps alive.</span>
    <input type="hidden" name="cmd" value="_xclick" />
    <input type="hidden" name="business" value="philip@webwasp.co.uk" />
    <input type="hidden" name="no_shipping" value="1" />
    <input type="hidden" name="return" value="http://www.webwasp.co.uk/odds-ends/thankyou.htm" />
    <input type="hidden" name="cancel_return" value="http://www.webwasp.co.uk/odds-ends/cancel.htm" />
  </p>
  <p>
    <input type="hidden" name="cn" value="Comments" />
    <input type="hidden" name="currency_code" value="USD" />
    <input type="hidden" name="tax" value="0" />
    <span class="subhead">Donation </span> <span class="text">- from  any where in the world - Thanks
    <input type="image" src="https://www.paypal.com/images/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
    </span></p>
  <input type="hidden" name="undefined_quantity" value="0">
  <input type="hidden" name="no_note" value="0">
  <input type="hidden" name="bn" value="wa_dw_3.0.4">
</form>
  <p class="text">If you have <span class="subhead-Black">not</span> found this tutorial useful, help us improve
  by telling us why: <a href="../../forum/index.php">Forum</a></p>

<!-- InstanceBeginEditable name="EditRegion8" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <!--DWLayoutTable-->
  <tr class="subhead">
    <td width="50%" height="14" valign="top"><div align="left"></div></td>
    <td width="50%"><div align="right"><font face="Verdana"><b><font color="#CCCCCC" size="2"><a href="../a02-tweening/index.php">next tutorial</a></font></b></font></div></td>
  </tr>
</table>
<!-- InstanceEndEditable -->



<hr />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="30" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td height="30" valign="top">
      <div align="right">
        <p align="right"> <!-- InstanceBeginEditable name="dot" -->&#8226;<!-- InstanceEndEditable -->
            <span class="text">
            <!-- InstanceBeginEditable name="counterFile" --><span class="text">
            <?php
$counterFile='counter.txt';
if($cfHandler=@fopen($counterFile,'r+'))
      {
      $visitors=fread($cfHandler,filesize($counterFile));
       settype($visitors,'integer');
      print($visitors.' visitors to this page since ');
      rewind($cfHandler);
      fwrite($cfHandler,++$visitors);
      fclose($cfHandler);
      }
      else{echo "No info available on number of visitors to this page";};
?>
            </span><!-- InstanceEndEditable --><!-- InstanceBeginEditable name="counterdate" --><span class="text">Jan 04</span><!-- InstanceEndEditable --><br /></span></p>
      </div></td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="14" valign="top" bgcolor="#FFFFFF"><div align="right">
        <p>
            &#8226;
            <a href="../../index.php" class="links-head">Home</a> &#8226;
            <a href="../index.php" class="links-head">Tutorials</a> &#8226;
            <a href="../../flash-sample-movies/samples.php" class="links-head">Samples</a> &#8226;
            <a href="../../forum/index.php" class="links-head">Forum</a> &#8226;
            <a href="../tutorials-by-date.php" class="links-head">Whats New </a> &#8226;
            <a href="../../pay4downloads.php" class="links-head">Downloads</a> &#8226;
            <a href="../../forms/newsletter.php" class="links-head">Newsletter</a> &#8226;
            <a href="../../links/index.php" class="links-head">Links</a> &#8226;
            <script language="JavaScript" type="text/javascript"><!--
//Sets up the bookmark details
if (navigator.appName == "Microsoft Internet Explorer")
      { document.write(" <A href=\"javascript:window.external.AddFavorite('"+location.href+"','"+document.title+"')\" class='links-head'>Bookmark Page</A>");}
else if (navigator.appName == "Netscape")
      { document.write(" - Press Ctrl + D");      }
//--></script>
&#8226;&nbsp;&nbsp; </p>
    </div></td>
  </tr>
  <tr>
    <td height="28" valign="top" background="../../images/background-top.gif"> &nbsp;&nbsp;&#8226;
          <a href="../../forms/index.php" class="links-head">Contact Us</a> &#8226;
            <a href="../../books/macromedia/index.php" class="links-head">Software</a> &#8226;
            <a href="../../consultation/index.php" class="links-head">Consultation</a> &#8226;
            <a href="../../forms/index.php" class="links-head">Advertise</a> &#8226;
            <a href="../../log-on.php" class="links-head">Members Logon </a> &#8226;
            <a href="../../pay4downloads.php" class="links-head">Become a Member</a> &#8226;</td>
  </tr>
</table>
</body>

<!-- InstanceEnd --></html>





There you go, that will work and it isnt hard to notice what you need to put in your other tutorial pages :)

Zac Charles
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility

hi,

I hate to be a pain but is their any chance you could update the file and upload them for me to download as that would be a lot easier for me please?

Sorry to be such a pain like

Cheers
Rabid Lemming
0
 
LVL 7

Accepted Solution

by:
zac_charles earned 500 total points
Comment Utility
hehe,

DelCookie.php(my cookie deleter for testing:
http://www.geocities.com/kimodog1/delCookie.php

Index.php(the simple-links index):
http://www.geocities.com/kimodog1/index.php.php


Zac Charles
0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

that worked like a charm thank you. Will this code still allow users to vote at least once for each tutorial?

cheers
Rabid Lemming
0
 
LVL 7

Expert Comment

by:zac_charles
Comment Utility
Yes it will, because it sets the cookie name as the articleid.

so article 1 will look for a cookie named "1" and stop the user from voting again, while..
article 136 will look for a cookie named "136" and stop the use from voting again :)

Im glad i could help you,
Zac Charles

0
 
LVL 2

Author Comment

by:Rawdon Hume
Comment Utility
hi,

Fantastic! Thank you for all your help

Cheers
Rabid lemming
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now