Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/
Upload File :
Current File : /var/www/html/mmishra/mm/telephones.php

<?php
checkadmin($role);

$tbl = 'telephones';
$statuss = array('online','offline');

$rowid = $_REQUEST["rowid"];
if (!$rowid) $rowid = 0;
$fullname = $_POST["fullname"];
$designation = $_POST["designation"];
$phoneoffice = $_POST["phoneoffice"];
if (strlen($phoneoffice)<8) $phoneoffice = "91-532-$phoneoffice";
$phonehome = $_POST["phonehome"];
if (strlen($phonehome)<8) $phonehome = "91-532-$phonehome";
$mobileno = $_POST["mobileno"];
if (strlen($mobileno)<11) $mobileno = "91-$mobileno";
$email = $_POST["email"];
if (!$email) $email = str_replace(" ","",$fullname)."@uprtou.ac.in";
$faxno = $_POST["faxno"];
if (strlen($faxno)<8) $faxno = "91-532-$faxno";
$postaladdress = htmlsafe($_POST["postaladdress"]);
if (!$postaladdress) $postaladdress = "Sector-F, Shantipuram<br>Phaphamau, Allahabad";
$status = $_POST["status"];

if ($_POST["submit"] == 'SAVE') {
	if (mysql_num_rows(mysql_query("select * from $tbl where rowid=$rowid"))) {
		mysql_query("update $tbl set webid='$webid',fullname='$fullname',designation='$designation',
		phoneoffice='$phoneoffice',phonehome='$phonehome',mobileno='$mobileno',email='$email',faxno='$faxno',
		postaladdress='$postaladdress',status='$status',dateupdation=now() where rowid=$rowid");
	} else {
		mysql_query("insert into $tbl(webid,fullname,designation,phoneoffice,phonehome,mobileno,email,faxno,postaladdress,status,datecreation,dateupdation) 
		values('$webid','$fullname','$designation','$phoneoffice','$phonehome','$mobileno','$email','$faxno','$postaladdress','$status',now(),now())");
	}
}
        
echo "<table width='100%' style='font-size: 10px; border-color=red;' border='1'>
<tr><th>No.</th><th>Name</th><th>Designation</th><th>Contact Nos.</th><th>Email & Fax</th><th>Postal Address</th><th>Action</th></tr>";
if ($rowid) 
        echo "<tr><td colspan='7' align='right'><a href='$PHP_SELF?conf=$conf&rowid=0#editing'>New Contact</a></td></tr>";

$rs = mysql_query("select * from $tbl where webid='$webid' and status='online'");
while ($o = mysql_fetch_object($rs)) {
	$i++;
	if ($rowid == $o->rowid) {
	        $fullname = $o->fullname;
        	$designation = $o->designation;
	        $phoneoffice = $o->phoneoffice;
        	$phonehome = $o->phonehome;
	        if (!$phonehome) $phonehome = '--';
        	$mobileno = $o->mobileno;
	        if (!$mobileno) $mobileno = '--';
        	$email = $o->email;
	        if (!$email) $email = "@";
	        $faxno = $o->faxno;
	        if (!$faxno) $faxno = '--';
	        $postaladdress = htmlunsafe($o->postaladdress);
	        $status = $o->status;
	} else {
	        echo "<tr valign='top'><td>$i</td><td>$o->fullname</td><td>$o->designation</td>
        	<td>$o->phoneoffice&nbsp;(O)<br>$o->phonehome&nbsp;(R)<br>$o->mobileno&nbsp;(M)</td>
	        <td>$o->email<br>Fax: $o->faxno</td><td>".htmlunsafe($o->postaladdress)."</td><td><a href='$PHP_SELF?conf=$conf&rowid=$o->rowid#editing'>Edit</a></td></tr>";
	}
}
echo "</table>
<center>
<a name='editing'><input type='hidden' name='rowid' value='$rowid'></a>
<table class='dataform'>
<tr><td>Full Name<br>
<input type='text' name='fullname' size='50' value='$fullname'>
</td></tr>
<tr><td>Designation<br>
<input type='text' name='designation' size='50' value='$designation'>
</td></tr>
<tr><td>Phone No. (Office)<br>
<input type='text' name='phoneoffice' size='50' value='$phoneoffice'>
</td></tr>
<tr><td>Phone No. (Residence)<br>
<input type='text' name='phonehome' size='50' value='$phonehome'>
</td></tr>
<tr><td>Mobile No.<br>
<input type='text' name='mobileno' size='50' value='$mobileno'>
</td></tr>
<tr><td>Email<br>
<input type='text' name='email' size='50' maxlength='50' value='$email'>
</td></tr>
<tr><td>Fax No.<br>
<input type='text' name='faxno' size='50' maxlength='50' value='$faxno'>
</td></tr>
<tr><td>Postal Address<br>
<textarea name='postaladdress' rows='3' cols='50' maxlength='250'>$postaladdress</textarea>
</td></tr>
<tr><td>Status<br>
<select name='status'>
";
foreach ($statuss as $s) {
	echo "<option value='$s'";
	if ($s == $status) echo ' selected';
	echo ">$s</option>";
}
echo "</select></td></tr>
<tr><th><input type='submit' name='submit' value='SAVE'></th></tr>
</table>
</center>
";

?>