4cc41287689c8: Difference between revisions
From Joomla! Documentation
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 5: | Line 5: | ||
<source lang="php"> | <source lang="php"> | ||
<?php | <?php | ||
defined('_JEXEC') OR die("Restricted access"); | /* | ||
$user =& JFactory::getUser(); | This program is for adding in Jumi module | ||
It will show the cooperative account of login user | |||
which store in CSV file on the server | |||
*/ | |||
defined('_JEXEC') OR die("Restricted access"); // Prevent direct Access to the program | |||
$user =& JFactory::getUser(); // get user | |||
if ($user->guest) { | if ($user->guest) { | ||
echo "<h3>Please log in to see your report ! </h3>"; | echo "<h3>Please log in to see your report ! </h3>"; // Show this message if user not yet log in | ||
} else { | } else { | ||
$id = strtoupper($user->username); | // If user log in | ||
$fd = fopen ("http://btc-intranet.ap.bayer.cnb/coop/COOPBAL.csv", "r"); | $id = strtoupper($user->username); // Get user and store in $id | ||
$fd = fopen ("http://btc-intranet.ap.bayer.cnb/coop/COOPBAL.csv", "r"); // Open CSV file | |||
$found=0; | $found=0; | ||
while (!feof ($fd)) { | while (!feof ($fd)) { | ||
$buffer = fgetcsv($fd, 4096); | $buffer = fgetcsv($fd, 4096); // Get one record | ||
if(strtoupper($buffer[1]) == $id){ | if(strtoupper($buffer[1]) == $id){ | ||
$found = 1; | $found = 1; // if $id = login name then set flag $found | ||
break; | break; // exit loop | ||
} | } | ||
} | } | ||
fclose ($fd); | fclose ($fd); | ||
if($found){ | if($found){ // Display account detail | ||
echo "<h3> Report of ".$buffer[4]." For the month".$buffer[5]. "</h3><br/>"; | echo "<h3> Report of ".$buffer[4]." For the month".$buffer[5]. "</h3><br/>"; | ||
echo "<h4> Deposit Account of member no ".$buffer[3]."</h4>"; | echo "<h4> Deposit Account of member no ".$buffer[3]."</h4>"; | ||
| Line 41: | Line 48: | ||
echo "<br/>Please check your account <br/>"; | echo "<br/>Please check your account <br/>"; | ||
}else{ | }else{ | ||
// if check to end of file but not found | |||
echo "<h3>No Account for you, Please let us know if you are member of the Cooperation fund </h3>"; | echo "<h3>No Account for you, Please let us know if you are member of the Cooperation fund </h3>"; | ||
} | } | ||
Latest revision as of 11:41, 24 October 2010
Example
Jeeradate 06:03, 24 October 2010 (CDT) Edit comment