<object id=”pingboxgc8rly4p4pwŗ0″ type=”application/x-shockwave-flash” data=”http://wgweb.msg.yahoo.com/badge/Pingbox.swf” width=”240″ height=”420″><param name=”movie” value=”http://wgweb.msg.yahoo.com/badge/Pingbox.swf” /><param name=”allowScriptAccess” value=”always” /><param name=”flashvars” value=”wid=4v5F2Tu6V12qRYN8wvNskA–” /></object>
php project complete
June 18, 2009hey 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”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<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”> <strong>Image Capture</strong></td>
<td width=”194″ align=”left” valign=”middle”><p> </p>
<p>
<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&height=33&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”>
<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”>
<?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”> </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”> <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 © 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
?>
Class for message
June 18, 2009# comment ->filename ->class.messagepanel.php
<?php
class messagedisplay{
private $msg_type;
private $msg_color;
private $msg_content;
private $msg_url_redirection;
private $msg_redirection_time;
private $msg_heading;
private $msg_url_disp;
function __construct($msg_type,$msg_content,$msg_url_redirection,$msg_redirection_time,$msg_heading,$msg_url_disp){
$this->msg_type = $msg_type; # Will allow different color scheme to be applied to our msg box
$this->msg_content = $msg_content; # Content that will be displayed in the box
$this->msg_url_redirection = $msg_url_redirection; # Will store url to which we will be redirected
$this->msg_redirection_time = $msg_redirection_time; # will store number of seconds to wait for redirection
$this->msg_heading = $msg_heading; # Will display the heading of our message box
$this->msg_url_disp = $msg_url_disp; # Will display msg between url
}//constructor
function displayMsg(){
if ($this->msg_type == “ERROR”)
$this->msg_color = “red”;
elseif($this->msg_type == “NORMAL”)
$this->msg_color = “green”;
elseif($this->msg_type == “INFO”)
$this->msg_color = “white”;
echo ‘<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>’;
echo ‘<html xmlns=”http://www.w3.org/1999/xhtml”>’;
echo ‘<head>’;
echo ‘<META HTTP-EQUIV=”refresh” CONTENT=”‘.$this->msg_redirection_time.’;URL=’.$this->msg_url_redirection.’”>’;
echo ‘<title>Message Display Panel</title>’;
echo ‘<link href=”moos/inettuts.css” rel=”stylesheet” type=”text/css” />’;
echo’<link rel=”stylesheet” type=”text/css” href=”css/common.css” />’;
echo ‘<script type=”text/javascript” src=”moos/jquery-1.2.6.min.js”></script>’;
echo ‘<script type=”text/javascript” src=”moos/jquery-ui-personalized-1.6rc2.min.js”></script>’;
echo ‘<script type=”text/javascript” src=”moos/inettuts.js”></script></HEAD><BODY>’;
echo ‘</head>’;
echo ‘<body>’;
echo ‘</HEAD><BODY>’;
echo ‘<div align=”center”>’;
echo ‘<table width=”1028″ id=”t1″>’;
echo ‘<tr>’;
echo ‘<td width=”1020″ height=”300″ align=”center” valign=”top”>’;
echo ‘<div id=”top”>’;
echo ‘</div>’;
echo ‘</td>’;
echo ‘</tr>’;
echo ‘<tr>’;
echo ‘<td height=”40″ align=”center”></td>’;
echo ‘</tr>’;
echo ‘<tr>’;
echo ‘<td height=”505″ align=”center” valign=”top”>’;
echo ‘<div align=”center”>’;
echo ‘</div>’;
echo ‘<div id=”columns”>’;
echo ‘<ul id=”column1″>’;
echo ‘</ul>’;
echo ‘<ul id=”column2″>’;
echo ‘<li>’;
echo ‘<div>’;
echo ‘<h3>’.$this->msg_heading.’</h3>’;
echo ‘</div>’;
echo ‘<div>’;
echo ‘<p><h3><b>’.$this->msg_content.’</b></h3></p>’;
echo ‘<p>You Will be Automatically Redirected to Required Page in ‘. $this->msg_redirection_time .’ Seconds.</p>’;
echo ‘<p>If you aren\’t forwarded to the new page, <br/><a href=”‘.$this->msg_url_redirection.’”>’.$this->msg_url_disp.’</a>.</p>’;
echo ‘</div>’;
echo ‘</li>’;
echo ‘</ul>’;
echo ‘</div>’;
echo ‘<br/></td>’;
echo ‘</tr>’;
echo ‘<tr>’;
echo ‘<td id=”bottom” valign=”top” align=”center”>’;
echo ‘<div style=”color:#FFF; font-size:11px; font-weight:600;”> <strong>Copyright © 2009</strong></div>’;
echo ‘</td>’;
echo ‘</tr>’;
echo ‘</table>’;
echo’</div>’;
echo ‘</body>’;
echo ‘</html>’;
}//displayMSg
}//class message display
?>
A simple class for managing Postgresql
June 18, 2009#comment -page saved as >class.encp.php
<?php
function secureRandomKey(){
$str = ”;
$chars = str_shuffle(‘abcdefghijklmnopqrstuvwxyzZXCVBNMASDFGHJKLPOIUYTREWQ1234567890′);
$len = strlen($chars);
#$minchar = 48;
$maxchar = 32;#rand($minchar,$len);
for ($i = 0; $i < $maxchar; $i++)
{
$str .= $chars[mt_rand(0, $len-1)];
}
return $str;
}//generate randow key;
class SymmetricCrypt
{
// The initialization vector
private static $_msHexaIv = ‘c7098adc8d6128b5d4b4f7b2fe7f7f05c7098adc8d6128b5d4b4f7b2fe7f7f05′;
// Use the Rijndael Encryption Algorithm
private static $_msCipherAlgorithm = MCRYPT_RIJNDAEL_256;
/* Function encrypts plain-text string received as parameter
and returns the result in hexadecimal format */
public static function Encrypt($plainString,$_msSecretKey)
{
// Pack SymmetricCrypt::_msHexaIv into a binary string
$binary_iv = pack(‘H*’, self::$_msHexaIv);
// Encrypt $plainString
$binary_encrypted_string = mcrypt_encrypt(
self::$_msCipherAlgorithm,
$_msSecretKey,
$plainString,
MCRYPT_MODE_CBC,
$binary_iv);
// Convert $binary_encrypted_string to hexadecimal format
$hexa_encrypted_string = bin2hex($binary_encrypted_string);
return $hexa_encrypted_string;
}
/* Function decrypts hexadecimal string received as parameter
and returns the result in hexadecimal format */
public static function Decrypt($encryptedString,$_msSecretKey)
{
// Pack Symmetric::_msHexaIv into a binary string
$binary_iv = pack(‘H*’, self::$_msHexaIv);
// Convert string in hexadecimal to byte array
$binary_encrypted_string = pack(‘H*’, $encryptedString);
// Decrypt $binary_encrypted_string
$decrypted_string = mcrypt_decrypt(
self::$_msCipherAlgorithm,
$_msSecretKey,
$binary_encrypted_string,
MCRYPT_MODE_CBC,
$binary_iv);
return $decrypted_string;
}
function generateRandomKey(){
$key1 = secureRandomKey();
$key2 = secureRandomKey();
$finalKey1 = (substr($key1,0,16));
$finalKey2 = (substr($key2,15,16));
$finalKey = $finalKey1.$finalKey2;
return $finalKey;
}//function generate random key
}
?>
my whole vb.net sample project code url
May 19, 2009http://www.mediafire.com/?sharekey=a1f25174745d66d700d27174b47c6657e04e75f6e8ebb871
My module used in vb.net
May 19, 2009Module MyLibraryCodes
‘This modules contains the code that is used and repeats through this project
Public path As String = “C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\New Age Entertainment MIS”
Public loged_on As String
Public login_attempts As Integer ‘variable used to chek login attempt
Public usertype_admin As Boolean ‘is used like a session variable to know throughout if user is an admin
Public Sub load_default_combo(ByRef cmbox As ComboBox)
With cmbox
.SelectedItem = 0
.SelectedValue = 0
.SelectedIndex = 0
.Items.IndexOf(0)
End With
End Sub
Public Function msg_panel(ByRef txt As TextBox, ByVal msg_title As String, ByVal msg As String)
If txt.Text.Trim = String.Empty Then
MessageBox.Show(msg_title, msg, MessageBoxButtons.OK, MessageBoxIcon.Error)
txt.Focus()
changecolor(txt, Color.Red)
txt.SelectAll()
Return False
End If
Return True
End Function
Public Sub clearComponent(ByRef frm As Form)
‘this component clears the component text on a form
For Each txt As Control In frm.Controls
If TypeOf txt Is TextBox Then
txt.Text = “”
End If
If TypeOf txt Is ComboBox Then
txt.Text = “”
End If
If TypeOf txt Is MaskedTextBox Then
txt.Text = “”
End If
Next
End Sub
Public Sub changecolor(ByRef txt As TextBox, ByVal clor As Color)
‘This procedure allows the color of a textbox to be changed
txt.BackColor = clor
End Sub
Public Sub enable_components(ByRef frm As Form, ByVal cvalue As Boolean)
‘This Procedure enables and disables components Accordingly
For Each txt As Control In frm.Controls
If TypeOf txt Is TextBox Then
txt.Enabled = cvalue
End If
If TypeOf txt Is ComboBox Then
txt.Enabled = cvalue
End If
If TypeOf txt Is DateTimePicker Then
txt.Enabled = cvalue
End If
If TypeOf txt Is MaskedTextBox Then
txt.Enabled = cvalue
End If
If TypeOf txt Is CheckBox Then
txt.Enabled = cvalue
End If
Next
End Sub
Public Sub DbConnect(ByRef conn As OleDb.OleDbConnection)
‘This procedure creates a Connection to database
‘Dim path As String = System.AppDomain.CurrentDomain.BaseDirectory()
Dim connString As String = _
“Provider=Microsoft.Jet.OLEDB.4.0;” & _
“Data Source=” & path & “\Video_Club_MIS.mdb;” & “Jet OLEDB:Database Password=” & “administrator”
conn = New OleDb.OleDbConnection(connString)
Try
conn.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub DbDisconnect(ByRef conn As OleDb.OleDbConnection)
‘This procedure close a connection to database
conn.Close()
End Sub
Public Sub ChekMdiChild(ByRef frm As Form)
‘This procedure checks whether an mdi child already exist , n if so, closes it
For Each f As Form In frm.MdiChildren
f.Close()
Next
End Sub
End Module
Posted by atishrajub
Posted by atishrajub
Posted by atishrajub