Jump to content

A php plugin?


Perad

Recommended Posts

I have the following task.

 

Allow users to put code on their website which will show a poll.

 

What I need the script to do is the following...

 

-> Sit on the users homepage.

-> Connect to my server and request poll details

-> When form is submitted send option to my form, request poll results.

-> Show poll results.

 

I am thinking about using iframes.

 

<iframe src="http://site.com/poll.php?id=..."></iframe>

 

Now, would this work with iframes?

 

Whether it would or not does anyone know a better method which isn't iframe dependent?

 

Link to comment
Share on other sites

if you have a quality server im sure you could use sockets or url fopen() or similar to get all the information from a remote server.

 

eg on remote server have page called "poll_deails.php"

then use something similar to fopen("http://www.webserver.com/poll_details.php?detailsfor=thiswebsite");

 

then you would get a string you could explode into an array for all the seperate variables etc...

 

you could also add in poll_details.php:

 

if($_SERVER['REMOTE_ADDR'] != "website_ip_address"){ exit("Not Allowed"); }

 

 

hope this helps,

Link to comment
Share on other sites

what about create an Dynamic Image to show the results

 

<?php
$row['votes'] = 0;
//mysql stuff returns $row['votes']
$im  = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc  = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
imagestring($im, 1, 5, 5, "the votes are .{$row['votes']}.. ", $tc);
header("Content-Type: image/jpeg");
imagejpeg($im);
?>

 

<img src="www.mysite.com/votes.php">

 

of course your need to clean it up...

Link to comment
Share on other sites

my method does not mention that php is required on a remote server, it was just an example, you could easily use html/asp etc, or even flat files or exe's...

 

how is your remote server going to "feed" the information sp that your website can grab it?

Link to comment
Share on other sites

ok i misunderstood your post...

 

so you could use images as madtechie posted, you could use iframes as you suggested.

 

the image route can also be cached to prevent people from spamming images. images would be my first option....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.