Jump to content

Hotspot on image - then execute php help


nutt318

Recommended Posts

Well I have an image with a bunch of buttons and I want to be able to use a hotspot to act as a button to execute some PHP. I have the following but I am in need of some direction.

 

As you can see the image is there and the first hotspot is on the Add Address. When I put my php code in it just creates a normal button. Is there a different spot I need my php code or a differway to complete this?

 

Thanks.

 

<body>
<img src="buttons_osc1.gif" width="500" height="305" border="0" usemap="#Map" />
<map name="Map" id="Map"><area shape="rect" coords="56,12,181,33" href="

<?php
if($_POST['Submit']){
   $open = fopen("hello.txt","a+");
   $text = "hello\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">";
echo "<input name=\"Submit\" type=\"submit\" value=\"hello\" />\n
</form>";

?>" /></map>
</body>

Link to comment
https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/
Share on other sites

<body>
<img src="buttons_osc1.gif" width="500" height="305" border="0" usemap="#Map" />
<map name="Map" id="Map"><area shape="rect" coords="56,12,181,33" href="#" onclick="javascript:document.frm1.submit();" /></map>

<?php
if($_POST['Submit']){
   $open = fopen("hello.txt","a+");
   $text = "hello\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">";
echo "<input name=\"Submit\" type=\"hidden\" value=\"hello\" />\n
</form>";

?>
</body>

Well, it doesnt seem to work right. Do I have something wrong again?

 

<body>
<img src="control.png" width="600" height="350" border="0" usemap="#Map" />

<map name="Map" id="Map">
  <area shape="rect" coords="43,8,105,29" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit100();"  />
  <area shape="rect" coords="6,35,68,56" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit101();" />
  <area shape="rect" coords="80,35,142,56" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit102();" />
  <area shape="rect" coords="48,63,102,83" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit103();" />

</map>

<?php
if($_POST['Submit100']){
   $open = fopen("commands.dat","a+");
   $text = "81\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/control.php']."\" method=\"post\">";
echo "<input name=\"Submit100\" type=\"hidden\" value=\"Submit100\" />\n
</form>";
?>

<?php
if($_POST['Submit101']){
   $open = fopen("commands.dat","a+");
   $text = "82\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">";
echo "<input name=\"Submit101\" type=\"hidden\" value=\"Submit101\" />\n
</form>";
?>
<?php
if($_POST['Submit102']){
   $open = fopen("commands.dat","a+");
   $text = "85\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">";
echo "<input name=\"Submit102\" type=\"hidden\" value=\"Submit102\" />\n
</form>";
?>
<?php
if($_POST['Submit103']){
   $open = fopen("commands.dat","a+");
   $text = "84\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">";
echo "<input name=\"Submit103\" type=\"hidden\" value=\"Submit103\" />\n
</form>";
?>



</body>

Well I thought I had the code right but it does all 4 php commands. Is there something out of place? Do I need the map id different?

 

<img src="control.png" width="600" height="350" border="0" usemap="#Map" />

<map name="Map" id="Map"> <area shape="rect" coords="43,8,105,29" href="#" onclick="javascript:document.frm1.submit();"  /></map>
<map name="Map" id="Map"> <area shape="rect" coords="6,35,68,56" href="#" onclick="javascript:document.frm2.submit();" /></map>
<map name="Map" id="Map"> <area shape="rect" coords="80,35,142,56" href="#" onclick="javascript:document.frm3.submit();" /></map>
<map name="Map" id="Map"> <area shape="rect" coords="48,63,102,83" href="#" onclick="javascript:document.frm4.submit();" /></map>



<?php
if($_POST['Submit']){
   $open = fopen("commands.dat","a+");
   $text = "81\n";
   fwrite($open, $text);
   fclose($open);
}
echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/control.php']."\" method=\"post\">";
echo "<input name=\"Submit\" type=\"hidden\" value=\"Submit\" />\n
</form>";
?>

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.