how would i be able to add multiple awards to one user?
Unfortunately no one can be told what PunBB is - you have to see it for yourself.
You are not logged in. Please login or register.
PunBB Forums » Posts by Utchin
how would i be able to add multiple awards to one user?
i have the code
<?php
$dir = "./lists";
// process form submission, all pass hidden variable "name"
if ($_POST["name"]) {
$name = trim($_POST["name"]);
// ID and NAME tokens must begin with a letter ([A-Za-z])
// and may be followed by any number of letters, digits ([0-9]),
// hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
$idtoken = str_replace(" ", "-", $name);
// User names must start with a letter, and may contain only letters, numbers or spaces
if (preg_match("/^[a-zA-Z][a-zA-Z0-9\ ]*$/", $name)) {
$filename = $dir . "./lists/" . $name . ".lst";
// add item to list, if submitted
if ($_POST["item"]) {
// disable all HTML and remove surrounding whitespace
$item = htmlentities(trim($_POST["item"])) . "\n";
// file exists and is writable?
if (is_writable($filename)) {
// open file in append mode
if (!$fp = fopen($filename, 'a')) {
print "Cannot open file ($filename)";
exit;
} else {
// Add item to list.
if (!fwrite($fp, $item)) {
print "Cannot write to file ($filename)";
exit;
}
fclose($fp);
}
} else {
print "The file $filename is not writable";
exit;
}
// write edited list, if submitted
} elseif ($_POST["newlist"]) {
// escape HTML & make sure list ends with a line feed, or it might not write to file properly
$list = htmlentities(trim($_POST["newlist"])) . "\n";
// file exists and is writable?
if (is_writable($filename)) {
// Open $filename in write mode, to replace contents.
if (!$fp = fopen($filename, 'w')) {
print "Cannot open file ($filename)";
exit;
}
// Write new list to our opened file.
if (!fwrite($fp, $list)) {
print "Cannot write to file ($filename)";
exit;
}
fclose($fp);
} else {
print "The file $filename is not writable";
exit;
}
// add new user, if submitted
} elseif ($_POST["addname"]) {
// Does file already exist?
if (is_file($filename)) {
print $name . " already exists.";
exit;
} else {
// create empty list file for $name by opening it in write mode
$fp = fopen($filename, 'w');
fclose($fp);
}
}
// all form submissions should take us back to the user's list
$redir = "#" . $idtoken;
Header("Location:admin_loader.php?plugin=AMP_Awards1.php" . $redir);
} else {
// illegal name was submitted
print "Names must start with a letter or number, and contain only letters, numbers or spaces.";
exit;
}
} else {
print "nOBODY HERE BUT US CHICKENS!";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<h1>Awards</h1>
<hr>
<?php
//path of lists directory, absolute or relative to this script
$listdir = "./lists/";
//chdir($listdir);
//get list names
$lists = glob("*.lst");
foreach ($lists as $list) {
$name = preg_replace("./.lst$/", "", $list);
$idtoken = str_replace(" ", "-", $name);
$xmaslist = stripslashes(trim(file_get_contents($list)));
// create list heading, with named anchor
// note that named anchors with spaces are legal, but not recognized by all browsers
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
<h2 id="$idtoken">$name</h2>
<blockquote>
<pre>
$xmaslist
</pre>
<form action="admin_loader.php?plugin=AMP_Awards1.php" method="POST">
1
<p><input type="text" name="item" size="32" maxlength="72">
<input type="hidden" name="name" value="$name">
<input type="submit" value="Add item to list"></p>
</form>
<form action="edit1.php" method="POST">
<p><input type="hidden" name="name" value="$name">
<input type="submit" value="Edit $name's list"></p>
</form>
</blockquote>
</div>
<!-- List for $name ends here -->
EOD;
}
?>
<form action="admin_loader.php?plugin=AMP_Awards1.php" method="POST">
2
<p style="margin-top: 3em;"><strong>Missing?</strong> <br>
Add your name <em>(letters, numbers and spaces only)</em>:<br>
<input type="text" name="name" size="32" maxlength="64">
<input type="submit" name="addname" value="Add Name"></p>
</form>
</body>
</html>and i am trying to put it in to a admin page but am unable to fetch the results
im making a plug in, using a form in a plug in, but am having problems when returning the values? any one able to help?
sorry, found it..
yea. fixed now....
for thoes who want to know
the code
<?php
$xmaslist = stripslashes(trim(file_get_contents("cc.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?>should of been
<?php
$listdir = "lists";
$xmaslist = stripslashes(trim(file_get_contents("./lists/dob.lst")));
print <<<EOD
$xmaslist
EOD;
?>the dir code told it to go back a folder....
i have made a new page but i cant get the pun header and footer to show:
i am unsure what is the problem....any one know?
<?php
define('PUN_ROOT', './');
$style='index';
$header='pngfix';
require PUN_ROOT.'include/common.php';
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
?>
<style>
#borderless TD {BORDER: none;BORDER-BOTTOM: 1px dotted}
#borderless TH {BORDER: none;BORDER-BOTTOM: 1px dotted}
</style>
<div class="block boxed">
<h2><span>Marine Hunters clan ribbons and rankings </span></h2>
<div class="box">
<div id="ranks" class="inbox">
<table id="borderless" border="0">
<tr>
<th colspan="2">Badge </th>
<th width="507" style="text-align: center">Description</th>
<th width="175" style="text-align: center">Awarded to: </th>
</tr>
<tr>
<td width="1"> </td>
<td width="101" height="110"><img src="img/awards/coslarge.gif" width="100" height="100"></td>
<td><p align="center">The <strong>Chief of Staff Badge </strong>identifies the highest-ranking position within Marine Hunters. The Chief of Staff’s (CoS) main duty and responsibility is to ensure all members are completing their duties, roles and responsibilities as established </p> </td>
<td style="text-align: center">
<?php
//path of lists directory, absolute or relative to this script
$listdir = "lists";
chdir($listdir);
//get list names
//$lists = glob("Award 1.lst");
//foreach ($lists as $list) {
//$name = preg_replace("/.lst$/", "", $list);
//$idtoken = str_replace(" ", "-", $name);
$xmaslist = stripslashes(trim(file_get_contents("cosb.lst")));
// create list heading, with named anchor
// note that named anchors with spaces are legal, but not recognized by all browsers
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
<blockquote>
<pre>
$xmaslist
</pre>
</blockquote>
</div>
<!-- List for $name ends here -->
EOD;
//}
?>
</td>
</tr>
<tr>
<td> </td>
<td width="101" height="110"><img src="img/awards/dolarge.gif" width="100" height="72"></td>
<td><p align="center">The <strong>Division Officer Badge</strong> identifies the highest-ranking position in each of MH ’s Divisions.The Division Officer’s (DO) main duty and responsibility is to lead a Division consisting of up to 2 Battalions and a Head Training Office (HTO).Promotions and transfers also fall under the DO’s responsibilities, and are done based upon recommendation from his Battalion CO’s.</p> </td>
<td style="text-align: center">
<?php
$xmaslist = stripslashes(trim(file_get_contents("dob.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?>
</td>
</tr>
<tr>
<td> </td>
<td width="101" height="103"><img src="img/awards/htilarge.gif" width="100" height="100"></td>
<td><p align="center">The <strong>Head Training Instructor</strong> Badge identifies the officer in charge of his Division’s Head Training Office (HTO).The Head Training Instructor’s (HTI) main duty and responsibility is to control all aspects of his division’s training, from boot camp to advanced training courses. </p> </td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("hti.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="103"><img src="img/awards/weblarge.gif" alt="" width="100" height="100"></td>
<td><p align="center"><span lang="EN-US">The <strong>Web Team Badge </strong>identifies members of Tactical Warfare’s Web Team.</span><span lang="EN-US">The Web Team is comprised of members from various technical backgrounds, all of whom possess specialized skills in areas such as HTML and web design, multimedia publishing, or audio/visual editing.</span></p> </td>
<td style="text-align: center">
<?php
$xmaslist = stripslashes(trim(file_get_contents("wtb.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?></td>
</tr>
<tr>
<td> </td>
<td height="110"><div align="center"><img src="img/awards/combat.gif" alt="combat" width="63" height="102"></div></td>
<td>The <strong>Combat Cross</strong> is awarded for acts of exceptional gallantry in the face of the enemy on an operational mission or deployment, while engaged in ground operations. </td>
<td style="text-align: center">
<?php
$xmaslist = stripslashes(trim(file_get_contents("cc.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?></td>
</tr>
<tr>
<td> </td>
<td height="110"><div align="center"><img src="img/awards/forced.gif" alt="no1" width="64" height="104"></div></td>
<td>The <strong>Distinguished Service Medal </strong>is awarded to members of the Force in recognition of conspicuous serivce and dedication. Members who have an impeccible service record and who have demonstrated their dedication and commitment to the Force throughout an extended career are eligble for this award.</td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("dsm.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="110"><img src="img/awards/1yr.jpg" width="101" height="28"></td>
<td>The <strong>1 Year Service Ribbon</strong> is awarded to Unit Members who complete 1 year of continuous service for the Clan. It is a considerable honor to serve for this length of time. This award is made automatically after 1 year of service has been completed.</td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("ysr.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="110"><img src="img/awards/recruit.gif" width="101" height="27"></td>
<td>The<strong> Marine Hunters Qualification Ribbon</strong> is awarded automatically to new members on the successfull completion of the trial Recruit program.</td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("mhqr.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="110"><img src="img/awards/met.gif" width="64" height="20"></td>
<td>The <strong>Meritous Unit Citation </strong>is awarded to recognise exceptional Unit performance during a mission or deployment of an operational nature. It is awarded to all members of the Unit who participated in the deployment or mission, whether in a direct or support role.</td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("muc.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="110"><img src="img/awards/force.gif" width="64" height="20"></td>
<td>The <strong>Force Dedication Ribbon</strong> is awarded to members who demonstrate dedication to the Force through their gameplay, activity, or positive attiude.</td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("fdr.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="110"><img src="img/awards/Outstanding Volunteer Service Medal.jpg" width="75" height="21"></td>
<td><strong>Outstanding Volunteer Service Medal</strong> is Awarded for having 5+ active recruits in Marine Hunters.</td>
<td style="text-align: center"><?php
$xmaslist = stripslashes(trim(file_get_contents("ovsr.lst")));
print <<<EOD
<!-- List for $name starts here -->
<div class="xmaslist">
$xmaslist
</div>
<!-- List for $name ends here -->
EOD;
//}
?> </td>
</tr>
<tr>
<td> </td>
<td width="101" height="46"> </td>
<td> </td>
<td style="text-align: center"> </td>
</tr>
</table>
</div>
</div>
</div>
<?php
require PUN_ROOT.'footer.php';and when i open it the only thing that comes, along with my orignal stuff is
Warning: require(./footer.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\upload\main.php on line 247
Fatal error: require() [function.require]: Failed opening required './footer.php' (include_path='.;C:\php5\pear') in C:\wamp\www\upload\main.php on line 247
donst do anything when i add it to the css i am using??
i have changed the width of my forum to 800px and it is fine but i am now wounding if it is possible to change the width and then height of the header.php? i want the header 100%? i have looked in the php file but am unable to find any help? is this possible.
PunBB Forums » Posts by Utchin
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 5 official extensions. Copyright © 2003–2009 PunBB.