hi all,
I am doing a login page where different users can log in like Superadmin,Admin, User. when Admin logins he can create projects,note that each admin is also given some memory to use he should not exceed that.so my problem is that whenever admin creates a project and if that project size is greater than memory he is having then an alert msg should be displayed. so please help me.
<?php
$id=$_GET['f1'];
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory);
$con=mysql_connect("10.70.1.50","invensis","invensis");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_myproject",$con);
if($_SESSION[usedmemory] < $_SESSION[allocatedmemory])
{
$sql="INSERT INTO projects(projectname,allocatedmemory,createdby)
VALUES ('$_POST[projectname]','$_POST[allocatedmemory] $_POST[size]','$_SESSION[username]')";
echo "New Project Added";
if(!mysql_query($sql,$con))
{
die('Error:' . mysql_error());
}
}
else
{
echo "cannot add project";
}
?>