Jump to content

change link text


mdvignesh

Recommended Posts

change link text

<?php 
require 'connect.php';
?>
<html>
<head><title>Admin</title>
<link rel="stylesheet" type="text/css" href="tab_style.css">
<script type="text/javascript">

function getXMLHTTP() {
	var xmlhttp=false;	
	try{
		xmlhttp=new XMLHttpRequest();
	}
	catch(e)	{		
		try{			
			xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e){
			try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e1){
				xmlhttp=false;
			}
		}
	}

	return xmlhttp;
    }

function approve(e) {
var req = getXMLHTTP();
if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById("appr <?php echo $fet['s_id']; ?>").innerHTML=req.responseText;					
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", "approve.php?stu="+e, true);
		req.send(null);
	}		
}

function block(b) {
var req = getXMLHTTP();
if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('blok').innerHTML=req.responseText;					
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", "block.php?blo="+b, true);
		req.send(null);
	}		
}
</script>
</head>
<body>
<?php
$admin_err='';
$pass_err='';
if (isset ($_REQUEST['submit'])) {
require 'connect.php';

$admin = $_REQUEST['admin'];
$pass = $_REQUEST['password'];
    $err=0;

if($admin=="") {
          $admin_err="enter username";
          $err=1;
}
    if($pass=="") {
          $pass_err="enter password";
          $err=1;
    }
if ($err == 0) {

	$check = mysql_query("SELECT admin FROM admin_login WHERE admin='".$admin."' and password='".$pass."' ");
	$exi = mysql_num_rows ($check);

	if($exi == 0) $err_msg = "Username/password combination incorrect.";
	else {
		$sel = mysql_query("SELECT * FROM stud");
		echo "<h4 class='table-caption'>Students</h4>";
		while ($fet = mysql_fetch_array($sel)) {		
			?>
			<div class="base-layer">
			<div class="table-row">

				<div class="c_one"><p class="text"> <? echo $fet['name']; ?></p></div>

				<div class="c_two"><p class="text"> <? echo $fet['email']; ?></p></div>

				<div class="c_three"><p class="text"> <? echo $fet['school']; ?></p></div>

				<div class="c_four"><p class="text"> <? echo $fet['subject']; ?></p></div>

				<div class="c_five"><p class="text"> <? echo $fet['class']; ?></p></div>

				<div class="c_six"><p class="text"> <? echo $fet['teacher']; ?></p></div>

				<div class="c_seven" id="appr <?php echo $fet['s_id']; ?>"><p class="text">
				<?php if ($fet['approve'] == 0) ?>
					<a href="#" onClick="return approve(<?php echo $fet['s_id']; ?>);" 
					style="text-decoration:none">	
					Approve</a>	
				</p>
				</div>

				<div class="c_eight" id="block"><p class="text">
				<?php if($fet['approve'] == 1) ?>
						<a href="#" onClick="block(<?php echo $fet['s_id']; ?>);" style="text-decoration:none">
						Block
						</a>
				</p>
				</div>
				<div class="space-line"> </div>
			</div>
			</div>
			<?php	
		}
		die(mysql_error());
	}
}
}
?>
<form  id="formid" method="post" name="myform" action="">
<p>
<label for="username">Admin:</label>
<input name="admin" type="text" size="20" value="<?php if(isset($admin)) echo $admin; ?>" />
<?php echo $admin_err; ?>
</p>

<p>
<label for="pass">Password:</label>
<input name="password" type="password" value="<?php if(isset($pass)) echo $pass;?>" />
<?php echo $pass_err; ?>
</p>

<p>
<input name="submit" type="submit" value="Log in" >
</p>

<?php if(isset($err_msg)) echo $err_msg; ?>
</form>
</body>
</html>

 

 

approve.php

<?php
require_once 'connect.php';
$id = $_REQUEST['stu'];
$upd = mysql_query ("UPDATE stud SET approve = '1' WHERE s_id = ".$id." ");
if (!$upd)
	die(mysql_error());
	//header("Location:administrator.php");
	echo "Approved";
	//echo "<h3>Student Approved</h3>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.