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
https://forums.phpfreaks.com/topic/95611-a-php-plugin/
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
https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489461
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
https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489468
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.