testwidget

April 9, 2010

if (WIDGETBOX) WIDGETBOX.renderWidget(‘bd809636-faf8-42df-b82b-150f6ec16551’);Get the Poll Creator Pro widget and many other great free widgets at Widgetbox! Not seeing a widget? (More info)


My yahoo Updated

October 14, 2009

<object id=”pingboxgc8rly4p4pwŗ0″ type=”application/x-shockwave-flash” data=”http://wgweb.msg.yahoo.com/badge/Pingbox.swf&#8221; width=”240″ height=”420″><param name=”movie” value=”http://wgweb.msg.yahoo.com/badge/Pingbox.swf&#8221; /><param name=”allowScriptAccess” value=”always” /><param name=”flashvars” value=”wid=4v5F2Tu6V12qRYN8wvNskA–” /></object>


php project complete

June 18, 2009

hey hi guyz n gurls ,here is my complete project on php , hope it will help u learn  some concepts

it has php + ajax+jquery + other programming concepts embedded , i know n im sure it will be sof some help to you , so here are the links and please leave your comments and a thanks !

for the database part,install postgresql ,n restore the backup database file im uploading n create the required user as specified in my dbconfigfile.php

http://www.mediafire.com/?sharekey=027902a4c2eab199af924764f9977b1d90610570623fdc9cc95965eaa7bc68bc


index.php

June 18, 2009

<?php

session_start();
if (isset($_SESSION[“loginas”])){

header(‘Location:message.php?login=logout’);
exit(0);

}

if (isset($_REQUEST[‘btnSubmit’])){

if( $_SESSION[‘security_code’] == $_POST[‘security_code’] && !empty($_SESSION[‘security_code’] ) ) {

unset($_SESSION[‘security_code’]);
header(‘Location:http:index.php?msg=image_cap_valid’);

exit(0);
}
else {

header(‘Location:http:index.php?msg=image_cap_invalid’);
exit(0);
}
}
?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;

<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />

<title>National Information Infrastructure Management System</title>

<script language=”javascript”>
function clearLabel(val){
val.value = “” ;
val.focus();
}
</script>
<script language=”javascript”>
function gonext($url){
window.location=$url;
void();
}
</script>
</head>

<link rel=”stylesheet” type=”text/css” href=”css/common.css” />

<body onload=”document.frm_confirm_presence.security_code.focus()”>
<div align=”center”>

<table width=”1028″ id=”t1″>
<tr>

<td width=”1020″ height=”300″ align=”center” valign=”top”>
<div id=”top”>

</div>

</td>

</tr>

<tr>
<td height=”40″ align=”center”>

<div id=”menu”>

</div>

</td>
</tr>
<tr>
<td height=”505″ align=”center”><table width=”989″ border=”0″>
<tr>
<td width=”715″ height=”516″ valign=”top”><b style=”color:#F00; font-size:24px; font-family:Arial, Helvetica, sans-serif”>Dedicated to Deliver Quality Service to the Citizens</b>
<p>National Information Infrastructure is a software dedicated to the management of records of the citizens of Mauritius</p>
<p>It’s aim is to serve the population in the best possible way <span style=”font:Arial, Helvetica, sans-serif; color:#03C”>” aiming towards excellence is our moto “</span> we are confident.</p>

<table  height=”195″ align=”center”  style=”border:#CCC solid 1px;”>
<tr>
<td width=”463″ height=”31″ align=”center” valign=”middle” style=”color:#FFF; font-size:12px;” background=”images/niss_06.jpg”><strong><b style=”color:#FF0″>Confirm Human Presence</b></strong></td>
</tr>
<tr>
<td height=”118″><form action=”index.php” method=”post” name=”frm_confirm_presence” id=”frm_confirm_presence” onsubmit=”” >
<table width=”531″ border=”0″ align=”center” style=”font-size:12px; color:#09F;”>
<tr>
<td height=”33″ colspan=”3″ align=”center” valign=”middle”><b style=”color:#00F”>Click on the image to Refresh Image</b></td>
</tr>
<tr>
<td width=”163″ height=”33″ align=”right” valign=”middle”>&nbsp;<strong>Image Capture</strong></td>
<td width=”194″ align=”left” valign=”middle”><p>&nbsp;</p>
<p>&nbsp;
<input id=”security_code” name=”security_code” type=”text” onclick=”resetColor(‘security_code’)” />
</p></td>
<td width=”160″ align=”left” valign=”middle”><img src=”CaptchaSecurityImages.php?width=100&amp;height=33&amp;characters=5″ name=”code” id=”code” onclick=”gonext(‘index.php’)”/></td>
</tr>
<tr>
<td height=”33″ align=”right” valign=”middle”></td>
<td align=”center” valign=”middle”>&nbsp;
<input type=”submit”  style=”background-image:url(images/niss_06.jpg); color:#FFF; font-size:12px; border:solid #CCC 1px;” value=”Confirm Image” name=”btnSubmit” /></td>
<td></td>
</tr>
</table>
</form></td>
</tr>
</table>
<p align=”center”>&nbsp;
<?php
if (isset($_GET[“msg”])){
if ($_GET[“msg”] == “image_cap_invalid”){

echo ‘<table width=”458″ style=”border:#CCC solid 1px;” align=”center”>
<tr>
<td width=”232″ height=”31″ align=”center” valign=”middle” style=”color:#FFF; font-size:12px;” background=”images/niss_06.jpg”><strong><font color=”#FF0000″>Message</font></strong></td>
</tr>
<tr>
<td height=”56″><font color=”#FF0000″>You have Typed a Wrong Image Confirmation Code, PLease Try Again</font></td>
</tr>
</table>’;

}
}
?>
</p></td>
<td></td>

<td width=”258″ valign=”top”>
<?php
if ($_GET[“msg”] == “image_cap_valid”){
echo ‘<table width=”242″ style=”border:#CCC solid 1px;” align=”center”>
<tr>
<td width=”232″ height=”31″ align=”center” valign=”middle” style=”color:#FFF; font-size:12px;” background=”images/niss_06.jpg”><strong>Login</strong></td>
</tr>
<tr>
<td height=”118″><form action=”logincheck.php” method=”post” name=”frm_login” >
<table width=”223″ border=”0″ align=”center” style=”font-size:12px; color:#09F;”>
<tr>
<td width=”69″ height=”29″ align=”right” valign=”middle”><strong>Username</strong></td>
<td width=”144″ align=”left” valign=”middle”><input name=”txt_username” type=”text” id=”username” value=”” onclick= “clearLabel(document.forms[0].txt_username)” /></td>
</tr>
<tr>
<td height=”29″ align=”right” valign=”middle”><strong>Password</strong></td>
<td align=”left” valign=”middle”><input name=”txt_password” type=”password” id=”password” value=””  onclick= “clearLabel(document.forms[0].txt_password)” /></td>
</tr>
<tr>
<td height=”33″ align=”right” valign=”middle”>&nbsp;</td>
<td align=”center” valign=”middle”>
<input type=”submit”  style=”background-image:url(images/niss_06.jpg); color:#FFF; font-size:12px; border:solid #CCC 1px;” value=”Login” name=”login” /></td>
</tr>
<tr>
<td height=”33″ align=”right” valign=”middle”><strong>Help</strong></td>
<td align=”center” valign=”middle”>&nbsp;<a target=”_self” href=”forgetpassword.php” id=”forgot”>Forgot Password </a></td>
</tr>
</table></form></td>
</tr>
</table>’;
}
?>
</td>
</tr>
</table>                     <br/></td>
</tr>
<tr>

<td id=”bottom”  valign=”top” align=”center”>
<div style=”color:#FFF; font-size:11px; font-weight:600;”> <strong>Copyright &copy; 2009</strong></div>

</td>

</tr>

</table>

</div>
<!–<div align=”center”>
<div id=”bottom_menu”></div>
</div>–>
</body>

</html>


dbconfig file for php

June 18, 2009

#comment filename->dbconfigfile.php

<?php
$userhost     =’localhost’;
$username     = ‘NIIMSDBADMIN’;
$userpass     = ‘ASH-BLUSTER’;
$userdb     = ‘NIIMS’;
$userport     = ‘5432’;

?>


class for postgresql connection and things

June 18, 2009

#comment filename ->class.pgsql.php

<?php

class pgsql{

private $linkid;      // PostgreSQL link identifier
private $host;        // PostgreSQL server host
private $user;        // PostgreSQL user
private $passwd;      // PostgreSQL password
private $db;          // PostgreSQL database
private $result;      // Query result
private $querycount;  // Total queries executed

/* Class constructor. Initializes the $host, $user, $passwd
and $db fields. */
function __construct($host, $db, $user, $passwd) {
$this->host = $host;
$this->user = $user;
$this->passwd = $passwd;
$this->db = $db;
}

function connect(){
try{
$this->linkid = @pg_connect(“host=$this->host dbname=$this->db user=$this->user password=$this->passwd”);
if (! $this->linkid)
throw new Exception(“Could not connect to PostgreSQL server.”);
} catch (Exception $e) {
die($e->getMessage());
}
}//connect

function disconnect(){
pg_close($this->linkid);

}//disconnecting

/* Execute database query. */
function query($query){
try{
$this->result = @pg_query($this->linkid,$query);
if(! $this->result)
throw new Exception(“The database Wuery failed.” + pg_last_error($this->result));
}
catch (Exception $e){
echo $e->getMessage();
}
$this->querycount++;
return $this->result;
}

/* Determine total rows affected by query. */
function affectedRows(){
$count = @pg_affected_rows($this->linkid);
return $count;
}

/* Determine total rows returned by query */
function numRows(){
$count = @pg_num_rows($this->result);
return $count;
}

/* Return query result row as an object. */
function fetchObject(){
$row = @pg_fetch_object($this->result);
return $row;
}
/* Return query result row as an indexed array. */
function fetchRow(){
$row = @pg_fetch_row($this->result);
return $row;
}

/* Return query result row as an associated array. */
function fetchArray(){
$row = @pg_fetch_array($this->result,null,PGSQL_ASSOC);
return $row;
}

/* Return total number of queries executed during
lifetime of this object. Not required, but
interesting nonetheless. */
function numQueries(){
return $this->querycount;
}

/* Return the number of fields in a result set */
function numberFields() {
$count = @pg_num_fields($this->result);
return $count;
}

/* Return a field name given an integer offset. */
function fieldName($offset){
$field = @pg_field_name($this->result, $offset);
return $field;
}
function getResultAsTable() {
if ($this->numrows() > 0) {

// Start the table
$resultHTML = “<table border=’0′ bgcolor=’#FFFFCC’ cellspacing=’10’ cellpadding=’2′ align=’left’>\n<tr>\n”;

// Output the table headers
$fieldCount = $this->numberFields();
for ($i=0; $i < $fieldCount; $i++){
$rowName = $this->fieldName($i);
$sqlPosition = $i+1;
$resultHTML .= “<th><a href=\””.$_SERVER[‘PHP_SELF’].”?sort=$rowName\”>$rowName</a></th>”;
#$resultHTML .= “<th>$rowName</th>”;
} // end for

// Close the row
$resultHTML .= “</tr>\n”;

// Output the table data
while ($row = $this->fetchRow()){
$resultHTML .= “<tr>\n”;
for ($i = 0; $i < $fieldCount; $i++)
$resultHTML .= “<td>”.htmlentities($row[$i]).”</td>”;
$resultHTML .= “</tr>\n”;
}
// Close the table
$resultHTML .= “</table>”;
}
else {
$resultHTML = “<p>No Results Found</p>”;
}
return $resultHTML;
}

function pageLinks($totalpages, $currentpage, $pagesize, $parameter) {
// Start at page one
$page = 1;
// Start at record 0
$recordstart = 0;
// Initialize page links
$pageLinks = ”;
while ($page <= $totalpages) {
// Link the page if it isn’t the current one
if ($page != $currentpage) {
$pageLinks .= “<a href=\””.$_SERVER[‘PHP_SELF’].
“?$parameter=$recordstart\”>$page</a> “;
// If the current page, just list the number
}
else {
$pageLinks .= “$page “;
}
// Move to the next record delimiter
$recordstart += $pagesize;
$page++;
}
return $pageLinks;
}

#Handling Transaction Processing
function begintransaction() {
$this->query(‘START TRANSACTION’);
}

function commit() {
$this->query(‘COMMIT’);
}

function rollback() {
$this->query(‘ROLLBACK’);
}

function setsavepoint($savepointname){
$this->query(“SAVEPOINT $savepointname”);
}

function rollbacktosavepoint($savepointname){
$this->query(“ROLLBACK TO SAVEPOINT $savepointname”);
}

function setTransactionParamsSerialisable(){
$this->query(“SET TRANSACTION ISOLATION LEVEL SERIALIZABLE”);

}

function setTransactionParamsReadCommited(){
$this->query(“SET TRANSACTION ISOLATION LEVEL READ COMMITTED”);

}

}//class pgsql

?>


class upload tweak for image

June 18, 2009

#comment filename ->class.upload.php

<?php

class uploadObject{

private $allowedfiles;
private $max_filesize;
private $upload_path;
private $filename;
private $ext;
private $parameter_to_use;

function __construct($allowedfiles, $max_filesize, $upload_path, $filename,$parameter_to_use) {

$this->allowedfiles = $allowedfiles;
$this->max_filesize = $max_filesize;
$this->upload_path = $upload_path;
$this->filename = $filename;
$this->ext = substr($filename, strpos($filename,’.’), strlen($filename)-1);
$this->parameter_to_use = $parameter_to_use;
}

function upload(){

# Check if the filetype is allowed, if not DIE and inform the user.

if(!in_array($this->ext,$this->allowedfiles))
die(‘The file you attempted to upload is not allowed.’);

# Now check the filesize, if it is too large then DIE and inform the user.

if(filesize($_FILES[‘userfile’][‘tmp_name’]) > $this->max_filesize)
die(‘The file you attempted to upload is too large.’);

# Check if we can upload to the specified path, if not DIE and inform the user.

if(!is_writable($this->upload_path))
die(‘You cannot upload to the specified directory, please CHMOD it to 777 on linux or check permission on Windows.’);

$this->filename = $this->parameter_to_use.”.jpeg”; # Renaming our photo to an id

if(move_uploaded_file($_FILES[‘userfile’][‘tmp_name’],$this->upload_path . $this->filename))
{
$img_path = $this->upload_path. $this->filename;
return $img_path;
}
else{

echo ‘There was an error during the file upload.  Please try again.’;
exit(0);
}

}//upload

}//class

?>