₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,326,301 members, 8,425,945 topics. Date: Saturday, 13 June 2026 at 11:34 AM

Toggle theme

Campusconnects's Posts

Nairaland ForumCampusconnects's ProfileCampusconnects's Posts

1 (of 1 pages)

WebmastersFree Php Cgpa Calculator For Undergraduate by campusconnects(op): 10:31pm On Sep 09, 2010
Below is a CGPA Calculator:
version - 1.03,
programmer - Adepoju Aliu(O.O.U student),
Aim & objective - for the purpose of challenges from other programmers

<?php
?>
<form action='<?php echo $_SERVER[PHP_SELF]?>' method='post'>
<table border='0px' style='width:250px;margin-left:auto;margin-right:auto;float:left'>
<tr><td style='width:50px'><select name='rowNumber' style='border:1px solid #666;width:50px'>
<?php
for ($i=1;$i<=50;$i++)
{
$selected = ((isset($_POST['rowNumber']) && $_POST['rowNumber'] == $i) || (isset($_GET['rowNumber']) && $_GET['rowNumber'] == $i))?"selected":"";
print("<option value='".$i."'$selected>".$i."</option>"wink;
}
?>
</select></td>
<td><input type='submit' name='SpecifyRows' style='width:85px;cursor:pointer' value='Specify rows'/>&nbsp;&nbsp;<input type='submit' style='width:65px;cursor:pointer' name='reset' value='Reset'/></td></tr>
</table>
</form>
<?php

class gpClassic
{
public $_num;
public $_gp;
function __construct($num)
{
$this->_num = $num;
}
function rowNum()
{
echo <<< FORM
<form action='{$_SERVER[PHP_SELF]}?applications=yes&rowNumber={$_GET[rowNumber]}' method='post'>
<table border='0px' style='width:240px;margin-left:auto;margin-right:auto;float:left;clear:both'>
<tr style='background-color:#666;color:#fff;font-size:12px;text-align:center'><th style='width:20px'>S/N</th><th style='width:50px'>Unit</th><th style='width:75px'>Course Code</th><th style='width:60px'>Grade</th></tr>
FORM;
for ($us=1,$gs=1;$us<=$this->_num,$gs<=$this->_num;$us++,$gs++)
{
echo <<< FORM
<tr style='background-color:#ccc'>
<td style='text-align:center'>{$us}.</td>
<td style='width:50px'><select name='unit{$us}' style='border:1px solid #666;width:100%'>
<option value=''>Unit</option>
FORM;
for ($uo=1;$uo<=5;$uo++)
{
$selected = (isset($_POST[unit.$us]) && $_POST[unit.$us] == $uo)?"selected":"";
print("<option value='{$uo}' $selected>{$uo}</option>"wink;
}
echo <<< FORM
</select></td>
<td style='text-align:center;width:75px'><input style='width:75px;border:1px solid #666' type='text' name='courseCode{$us}' value={$_POST[courseCode.$us]} ></td>
<td style='width:60px'><select name='grade{$gs}' style='border:1px solid #666;width:60px'>
<option value=''>Grade</option>
FORM;

for ($go=5;$go>=0;$go--)
{
$selected = (isset($_POST[grade.$gs]) && $_POST[grade.$gs] == $go && $_POST[grade.$gs] != ""wink?"selected":"";
print("<option value='".$go."'$selected>"wink;
if ($go == 5)
print("A$go"wink;
elseif ($go == 4)
print("B$go"wink;
elseif ($go == 3)
print("C$go"wink;
elseif ($go == 2)
print("grin$go"wink;
elseif ($go == 1)
print("E$go"wink;
elseif ($go == 0)
print("F$go"wink;
print("</option>"wink;
}
print("</select></td>"wink;
print("</tr>"wink;
}
$calc = gpClassic::calc();
echo <<< FORM
<tr><td colspan=4 style='text-align:left'><span style='font-weight:bold'>CGPA: </span>{$calc}</td></tr>
<tr><td colspan=2 style='text-align:left'><input type='submit' name='calculate' style='cursor:pointer' value='Calculate'/></td><td colspan=2 style='text-align:right'><input type='submit' name='add' style='width:55px;cursor:pointer' value='Add'/>&nbsp;&nbsp;<input type='submit' name='rev' style='width:60px;cursor:pointer' value='Remove'/>
</td></tr>
</table>
</form>
FORM;
}

function handleError()
{
if (isset($_POST['calculate']))
{
for ($hg=1;$hg<=$this->_num;$hg++)
{
if (!isset($_POST[unit.$hg]) || $_POST[unit.$hg] == "" || !isset($_POST[courseCode.$hg]) || $_POST[courseCode.$hg] == "" || !isset($_POST[grade.$hg]) || $_POST[grade.$hg] == ""wink
{
return("<span style='color:red;font-family:arial;font-size:12px'>Error has occurred.</span>"wink;
}
if (!preg_match("/^[a-zA-Z]{3}[0-9]{3}$/", $_POST[courseCode.$hg]))
{
return("<span style='color:red;font-family:arial;font-size:12px'>Invalid course code.</span>"wink;
}
}
}
}

function calc()
{
if (isset($_POST['calculate']) && !gpClassic::handleError())
{
for ($tp=0;$tp<=$this->_num;$tp++)
{
$totalPoint[] = $_POST[unit.$tp] * $_POST[grade.$tp];
$totalUnit[] = $_POST[unit.$tp];
}
bcscale(2);
if (array_sum($totalUnit) != 0)
{
$this->_gp = bcdiv(array_sum($totalPoint), array_sum($totalUnit));
$_SESSION['gp'] = $this->_gp;
return($this->_gp);
}
else
{
return("0.00"wink;
}

}
else
{
return(gpClassic::handleError());
}
}

function reward()
{
$gp = $_SESSION['gp'];
if ($gp == 4.50 || $gp > 4.50)
{
return("FIRST CLASS"wink;
}
elseif (($gp == 3.50 || $gp > 3.50) && $gp < 4.50)
{
return("SECOND CLASS UPPER"wink;
}
elseif (($gp == 2.40 || $gp > 2.40) && $gp < 3.50)
{
return("SECOND CLASS LOWER"wink;
}
elseif (($gp == 1.50 || $gp > 1.50) && $gp < 2.40)
{
return("THIRD CLASS"wink;
}
elseif (($gp == 1.00 || $gp > 1.00) && $gp < 1.50)
{
return("PASS"wink;
}
}

}

if (isset($_POST['SpecifyRows']))
{
$_GET['rowNumber'] = $_POST['rowNumber'];
$instance = new gpClassic($_POST['rowNumber']);
$instance->rowNum();
}
else if (isset($_POST['calculate']))
{
$instance = new gpClassic($_GET['rowNumber']);
$instance->rowNum();
}
elseif (isset($_POST['reset']))
{
unset($_SESSION['gp']);
$instance = new gpClassic($_POST['rowNumber']);
$instance->rowNum();
}
else
{
if (isset($_POST['rev']) && $_GET['rowNumber'] >= 2)
{
$_GET['rowNumber'] = $_GET['rowNumber'] - 1;
$instance = new gpClassic($_GET['rowNumber']);
$instance->rowNum();
}
else
{
$_GET['rowNumber'] = $_GET['rowNumber'] + 1;
$instance = new gpClassic($_GET['rowNumber']);
$instance->rowNum();
}
}
?>
WebmastersFree Cgpa Calculator For Undergraduate Written With Php by campusconnects(op): 10:11pm On Sep 09, 2010
<?php
?>
<form action='<?php echo $_SERVER[PHP_SELF]?>' method='post'>
<table border='0px' style='width:250px;margin-left:auto;margin-right:auto;float:left'>
<tr><td style='width:50px'><select name='rowNumber' style='border:1px solid #666666;width:50px'>
<?php
for ($i=1;$i<=50;$i++)
{
$selected = ((isset($_POST['rowNumber']) && $_POST['rowNumber'] == $i) || (isset($_GET['rowNumber']) && $_GET['rowNumber'] == $i))?"selected":"";
print("<option value='".$i."'$selected>".$i."</option>"wink;
}
?>
</select></td>
<td><input type='submit' name='SpecifyRows' style='width:85px;cursor:pointer' value='Specify rows'/>&nbsp;&nbsp;<input type='submit' style='width:65px;cursor:pointer' name='reset' value='Reset'/></td></tr>
</table>
</form>
<?php

class gpClassic
{
public $_num;
public $_gp;
function __construct($num)
{
$this->_num = $num;
}
function rowNum()
{
echo <<< FORM
<form action='{$_SERVER[PHP_SELF]}?applications=yes&rowNumber={$_GET[rowNumber]}' method='post'>
<table border='0px' style='width:240px;margin-left:auto;margin-right:auto;float:left;clear:both'>
<tr style='background-color:#666666;color:#ffffff;font-size:12px;text-align:center'><th style='width:20px'>S/N</th><th style='width:50px'>Unit</th><th style='width:75px'>Course Code</th><th style='width:60px'>Grade</th></tr>
FORM;
for ($us=1,$gs=1;$us<=$this->_num,$gs<=$this->_num;$us++,$gs++)
{
echo <<< FORM
<tr style='background-color:#cccccc'>
<td style='text-align:center'>{$us}.</td>
<td style='width:50px'><select name='unit{$us}' style='border:1px solid #666666;width:100%'>
<option value=''>Unit</option>
FORM;
for ($uo=1;$uo<=5;$uo++)
{
$selected = (isset($_POST[unit.$us]) && $_POST[unit.$us] == $uo)?"selected":"";
print("<option value='{$uo}' $selected>{$uo}</option>"wink;
}
echo <<< FORM
</select></td>
<td style='text-align:center;width:75px'><input style='width:75px;border:1px solid #666666' type='text' name='courseCode{$us}' value={$_POST[courseCode.$us]} ></td>
<td style='width:60px'><select name='grade{$gs}' style='border:1px solid #666666;width:60px'>
<option value=''>Grade</option>
FORM;

for ($go=5;$go>=0;$go--)
{
$selected = (isset($_POST[grade.$gs]) && $_POST[grade.$gs] == $go && $_POST[grade.$gs] != ""wink?"selected":"";
print("<option value='".$go."'$selected>"wink;
if ($go == 5)
print("A$go"wink;
elseif ($go == 4)
print("B$go"wink;
elseif ($go == 3)
print("C$go"wink;
elseif ($go == 2)
print("grin$go"wink;
elseif ($go == 1)
print("E$go"wink;
elseif ($go == 0)
print("F$go"wink;
print("</option>"wink;
}
print("</select></td>"wink;
print("</tr>"wink;
}
$calc = gpClassic::calc();
echo <<< FORM
<tr><td colspan=4 style='text-align:left'><span style='font-weight:bold'>CGPA: </span>{$calc}</td></tr>
<tr><td colspan=2 style='text-align:left'><input type='submit' name='calculate' style='cursor:pointer' value='Calculate'/></td><td colspan=2 style='text-align:right'><input type='submit' name='add' style='width:55px;cursor:pointer' value='Add'/>&nbsp;&nbsp;<input type='submit' name='rev' style='width:60px;cursor:pointer' value='Remove'/>
</td></tr>
</table>
</form>
FORM;
}

function handleError()
{
if (isset($_POST['calculate']))
{
for ($hg=1;$hg<=$this->_num;$hg++)
{
if (!isset($_POST[unit.$hg]) || $_POST[unit.$hg] == "" || !isset($_POST[courseCode.$hg]) || $_POST[courseCode.$hg] == "" || !isset($_POST[grade.$hg]) || $_POST[grade.$hg] == ""wink
{
return("<span style='color:red;font-family:arial;font-size:12px'>Error has occurred.</span>"wink;
}
if (!preg_match("/^[a-zA-Z]{3}[0-9]{3}$/", $_POST[courseCode.$hg]))
{
return("<span style='color:red;font-family:arial;font-size:12px'>Invalid course code.</span>"wink;
}
}
}
}

function calc()
{
if (isset($_POST['calculate']) && !gpClassic::handleError())
{
for ($tp=0;$tp<=$this->_num;$tp++)
{
$totalPoint[] = $_POST[unit.$tp] * $_POST[grade.$tp];
$totalUnit[] = $_POST[unit.$tp];
}
bcscale(2);
if (array_sum($totalUnit) != 0)
{
$this->_gp = bcdiv(array_sum($totalPoint), array_sum($totalUnit));
$_SESSION['gp'] = $this->_gp;
return($this->_gp);
}
else
{
return("0.00"wink;
}

}
else
{
return(gpClassic::handleError());
}
}

function reward()
{
$gp = $_SESSION['gp'];
if ($gp == 4.50 || $gp > 4.50)
{
return("FIRST CLASS"wink;
}
elseif (($gp == 3.50 || $gp > 3.50) && $gp < 4.50)
{
return("SECOND CLASS UPPER"wink;
}
elseif (($gp == 2.40 || $gp > 2.40) && $gp < 3.50)
{
return("SECOND CLASS LOWER"wink;
}
elseif (($gp == 1.50 || $gp > 1.50) && $gp < 2.40)
{
return("THIRD CLASS"wink;
}
elseif (($gp == 1.00 || $gp > 1.00) && $gp < 1.50)
{
return("PASS"wink;
}
}

}

if (isset($_POST['SpecifyRows']))
{
$_GET['rowNumber'] = $_POST['rowNumber'];
$instance = new gpClassic($_POST['rowNumber']);
$instance->rowNum();
}
else if (isset($_POST['calculate']))
{
$instance = new gpClassic($_GET['rowNumber']);
$instance->rowNum();
}
elseif (isset($_POST['reset']))
{
unset($_SESSION['gp']);
$instance = new gpClassic($_POST['rowNumber']);
$instance->rowNum();
}
else
{
if (isset($_POST['rev']) && $_GET['rowNumber'] >= 2)
{
$_GET['rowNumber'] = $_GET['rowNumber'] - 1;
$instance = new gpClassic($_GET['rowNumber']);
$instance->rowNum();
}
else
{
$_GET['rowNumber'] = $_GET['rowNumber'] + 1;
$instance = new gpClassic($_GET['rowNumber']);
$instance->rowNum();
}
}
?>
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 5:14pm On Aug 23, 2010
Dual Core, pls  can u help me for the configuations of an intranet on internet information server(IIS)?
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 4:21pm On Aug 23, 2010
*dhtml , did i right for the solution i provided for dose guyz, because i'm totally confused abt wht they are lookin where as an implementation of PHP & RDBMS(MYSQL) can solve easily.
ProgrammingRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 4:14pm On Aug 23, 2010
olabukky & jeezfreak7, pls make an attempt 2 downloads:
if (window user)
,WAMP SERVER or separately (Apache, MYSQL, PHP), i'll back its
up with configurations;
for materials forward ur email address;
ProgrammingRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 4:04pm On Aug 23, 2010
mj , would mind 2 forward script within d range of form u created?
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 3:54pm On Aug 23, 2010
Donpuzo, let forget abt d issue of dat,now can u configure an intranet on internet information server(IIS) or any suitable web server?
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 3:25pm On Aug 23, 2010
Mark Donpuzo, why would u expect me 2 knw all, i stated PHP not integration of AJAX & PHP.
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 3:22pm On Aug 23, 2010
Mark Donpuzo, i noticed u're a good detector, can u help me out 4 d solutions of dose syntax including my own?
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 11:43am On Aug 23, 2010
Donpuzo, i luv dat, hope u knw we are here 2 support one anoda, pls correct the code posted.
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 11:14am On Aug 23, 2010
pls explain the exert thing u want 2 do, forget abt the lang. u want use, i'm a specialist in Javascript, PHP & MYSQL.
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 10:35am On Aug 23, 2010
Explain an exert thing u wanted to do, forget abt the language u want 2 use,.
To escape in PHP use for beginner:
(1)
<?php
?>
//client scripting lang(html, css, xml,javascript/vbscript etc). goes here
<?php
?>
(2)
heredoc
<?php
echo <<< TEXT
//client scripting lang. goes here
TEXT;
?>
PHP is a server scripting language
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 9:48am On Aug 23, 2010
solution: escape the client scripting languages in PHP, then output it as PHP code or use database instead.
WebmastersRe: How May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 9:01am On Aug 23, 2010
It just dat i need challenges 4rm Nigerians PHP programmers, may be with time u'll get 2 knw if i worth to be called guru or not.
WebmastersHow May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 7:50am On Aug 23, 2010
I always feel proud of being a PHP programmer while i'm looking for novice, expert and wizard to share my experiences with, i also have materials to release for the progress of PHP programmers.
ProgrammingHow May I Help You On Php Language, I'm A Php Guru? by campusconnects(op): 7:48am On Aug 23, 2010
I always feel proud of being a PHP programmer while i'm looking for novice, expert and wizard to share my experiences with, i also have materials to release for the progress of PHP programmers.
ProgrammingRe: I Want To Learn Programing by campusconnects: 9:53pm On Aug 22, 2010
would u mind to go into the world of web-programming ? If yes, be preparing yourself for the following languages: HTML5.0 & CSS3, Javascript/VbScript, XML,PHP & MYSQL, note: most of the listed languages has sub-langs to be treated along, I'm a PHP programmer, to reach me mail: info@campusconnects.net,campusconnectsng@yahoo.com or 08034309999
WebmastersHow Can I Set Up An Intranet On Internet Information Server(iis)? by campusconnects(op): 7:12pm On Aug 22, 2010
I'm a php programmer i need someone to help me for the configurations of an intranet on local server
Business To BusinessFor Bulk Sms At N2.5k /sms Visit Www.campusconnects.net /call 08034309999(aliu) by campusconnects(op): 6:59pm On Aug 22, 2010
We offer bulk SMS at N2.5k /SMS for more details visit www.campusconnects.net  or call 08034309999(Aliu).
Technology MarketFor Bulk Sms At N2.5k /sms Visit Www.campusconnects.net /call 08034309999(aliu) by campusconnects(op): 6:51pm On Aug 22, 2010
We offer bulk SMS at N2.5k /SMS, for details visit www.campusconnects.net or call 08034309999(Aliu)
PhonesFor Bulk Sms @ N2.50k/sms Visit Www.campusconnects.net / Call 08034309999(aliu) by campusconnects(op): 4:26pm On Aug 22, 2010
I offer bulk SMS @ N2.50k/SMS, for more details visit www.campusconnects.net or call 08034309999(Aliu).
Tech JobsRe: Free Programming Ebook On Php, Python, Java, Actionscript, C, C++, Javascript by campusconnects: 4:17pm On Aug 22, 2010
I'm interested in Javascript & PHP e-book, i also need an Intranet e-book. reach me thru : campusconnectsng@yahoo.com or info@campusconnects.net
ProgrammingIntranet Configurations On Internet information server(IIS) by campusconnects(op): 4:05pm On Aug 22, 2010
I'm a php programmer i need someone who can help me for the configurations of intranet on IIS7 or any other possible local server.

1 (of 1 pages)