hi everyone any can tell me few things i like to create plugins myself but few things i cant understand like
in the two below codes in “form” both have method=POST but what does action mean i have seen many plugins having differnts like its <form action="?saveSettings" method=“POST” any one can help how its works beacuse i once created a plugin and when i try to to click save or sumbit it dont do anything pls little about isset
and i just started learning php thanks
1 code
First of all, please use php or codes tags. You can use the # or php button, as described in the IMPORTANT message written above the text box when you make a new thread or reply to one.
As for:
<form action="?saveSettings" method="POST">
The action is the page to which the data is sent. The method is how the data is sent. GET data is put into the URL:
http://some-page.com/?saveSettings&firstName=Bob&lastName=Bloggs
Whereas POST data is sent along with the request.
What parts do you not understand? What is the code meant to do?
thanks for the reply
these codes r the index.php for the plugin there is one more file name main.php. main.php part has functions which will run the plugin and index.php has layout save button and so on in index.php i dont understand y some times people use “?saveSettings” or some time "/plugins/PennyPower/index.php"or ’
here is one complete plugin
first index.php: [php]<?php
require_once ‘…/…/fB_PluginAPI.php’;
define ( ‘fvFoalLinks_File’ , $_SESSION[‘base_path’].“plugins/fvFoalLinks/data.txt”);
define( ‘fvFoalLinks_version’, ‘2.1’ );
include ‘main.php’;
$s=Load_Settings();
if(isset($_GET[‘saveSettings’])) {
$horse = serialize($_POST[‘horse’]);
$links = $_POST[‘links’];
file_put_contents($_SESSION[‘base_path’] . ‘plugins/fvFoalLinks/’ . $_SESSION[‘userId’] . ‘_data.txt’, $horse);
file_put_contents($_SESSION[‘base_path’] . ‘plugins/fvFoalLinks/’ . $_SESSION[‘userId’] . ‘_links.txt’, $links);
}
fBAcctHeader();
echo ‘’;
echo ’
a.donate {text-decoration: none;}
body {background-color: #EBEBEB;}
.mainTable {
margin-top: 15px;
background-color:#FFFFFF;
border:1px solid #878787;
}
.mainTable th {padding: 5px 100px;border:1px solid #878787; background-color: #1E3F82; font-size:13pt; color:white;}
.mainTable td {padding: 5px 100px;border:1px solid #878787;}
.mainTable tr:hover { background-color:#FF7D1A; color: #FFFFFF;}’;
echo ‘’;
echo ‘
echo ‘
fvFoalLinks 2.1
’;
echo ‘

echo ‘This plugin will make links of each foal you select, then disable itself.
’;
echo ‘You can select how many links you want it to make at the bottom of the list.
’;
echo ‘
echo ’
Image | Name | Select your Foal | '; $horse= Units_GetByType('animal'); foreach($horse as $horses){ if(strpos($horses['name'],'horse')!== false || strpos($horses['name'],'pony')!== false || strpos($horses['name'],'stallion')!== false || strpos($horses['name'],'mustang')!== false || strpos($horses['name'],'appaloosa')!== false || strpos($horses['name'],'clydesdale')!== false || strpos($horses['name'],'breton')!== false || strpos($horses['name'],'morgan')!== false || strpos($horses['name'],'buckskin')!== false) { if (strpos($horses['name'],'sale') !== false) continue; if (strpos($horses['name'],'foal')!== false) continue; if (strpos($horses['name'], 'dancinghorse') !== false) continue; if (strlen($horses['name']) === 5) continue; echo '
---|---|---|
' . $horses['realname'] . ' | '; echo '' . $horses['realname'] . ' Foal Link | '; echo '|
No. of Links To Produce:<input type=“text” name=“links” value="’.$links.’" size=“1” / > |
?>[/php]
now main.php:
[php] <?php define( 'fvFoalLinks_Dir', 'plugins/fvFoalLinks/' ); define( 'fvFoalLinks_version', '1.1' ); define ( 'fvFoalLinks_File' , "plugins/fvFoalLinks/data.txt"); function fvFoalLinks_init() { $_SESSION ['hooks']; $_SESSION ['this_plugin']; echo "Loaded fvFoalLinks 2.1\r\n"; $_SESSION ['hooks']['after_load_settings'] = 'fvFoalLinks_run'; } function Load_Settings() { $s=file_get_contents($_SESSION['base_path'] . 'plugins/fvFoalLinks/' . $_SESSION['userId'] . '_data.txt'); if(!$s){ $s = 0; } return $s; } function fvFoalLinks_run() { $s=Load_Settings(); $data = unserialize($s); $l=file_get_contents($_SESSION['base_path'] . 'plugins/fvFoalLinks/' . $_SESSION['userId'] . '_links.txt'); foreach($data as $horse){ for($i=1; $i<=$l; $i++){ AddLog2('Making ' . Units_GetRealnameByName($horse) . ' Foal Reward Link'); $amf = new AMFObject(""); $amf->_bodys[0] = new MessageBody(); $amf->_bodys[0]->targetURI = 'FlashService.dispatchBatch'; $amf->_bodys[0]->_value[0] = GetAMFHeaders(); $amf->_bodys[0]->_value[1][0]['params'][0] = $horse; $amf->_bodys[0]->_value[1][0]['sequence'] =GetSequense(); $amf->_bodys[0]->_value[1][0]['functionName'] = "WanderingAnimalService.onShareFoal"; $amf->_bodys[0]->_value[2] = 0; $res = RequestAMF($amf, true); if ($res['res'] == 'OK') { if (isset($res['amf2']->_bodys[0]->_value['data'][0]['data']['rewardUrl'])) { $uSQL = 'INSERT OR REPLACE INTO rewardstore(userid, rewardlink, rewarditem, timestamp) values("' . $_SESSION['userId'] . '","' . $res['amf2']->_bodys[0]->_value['data'][0]['data']['rewardUrl'] . '", "' . $horse . '", "' . time() . '")'; $_SESSION['vRewardStoreDB']->exec($uSQL); } }Addlog2('Genenrated ' . Units_GetRealnameByName($horse) . ' Foal Reward Link'); } } unlink($_SESSION['base_path'] . 'plugins/fvFoalLinks/' . $_SESSION['userId'] . '_data.txt'); unlink($_SESSION['base_path'] . 'plugins/fvFoalLinks/' . $_SESSION['userId'] . '_links.txt'); } [/php]