Location: PHPKode > projects > MyJobList > MyJobList.v0.1/mjl-includes/users.inc.php
<?php

function FUNCT_USER_PASSWORD_FRM(){
	global $theme;
	$rdata = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	$rdata .= file_get_contents('mjl-themes/'.$theme.'/user_pw_form.theme.html');
	$rdata .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
	
	return $rdata;
}

function FUNCT_USER_PROFILE(){
	global $theme;
	$result = mysql_query('SELECT * FROM users WHERE UID = '.$_SESSION['cid'].' LIMIT 1');
	$cnt = mysql_num_rows($result);
	if ($cnt > 0){
		$row = mysql_fetch_array($result);
	}
$profform = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
$profform .= '<form method="POST" action="?loc=prof&act=1">	
<table cellspacing="2" cellpadding="0" border="0" class="uprofile">
	<tr><td align="right">First Name: &nbsp;</td><td align="left"><input type="TEXT" name="fname" size="35" value="'.$row['FIRSTNAME'].'" /></td></tr>
	<tr><td align="right">Last Name: &nbsp;</td><td align="left"><input type="TEXT" name="lname" size="35" value="'.$row['LASTNAME'].'" /></td></tr>
	
	<tr><td align="right">Mail Address 1: &nbsp;</td><td align="left"><input type="TEXT" name="add1" size="45" value="'.$row['STREETADDRESS1'].'" /></td></tr>
	
	<tr><td align="right">Mail Address 2: &nbsp;</td><td align="left"><input type="TEXT" name="add2" size="45" value="'.$row['STREETADDRESS2'].'" /></td></tr>
	
	<tr><td align="right">City: &nbsp;</td><td align="left"><input type="TEXT" name="city" value="'.$row['CITY'].'" /></td></tr>
	
	<tr><td align="right">State: &nbsp;</td><td align="left"><input type="TEXT" name="state" value="'.$row['STATE'].'" /></td></tr>
	
	<tr><td align="right">Zip: &nbsp;</td><td align="left"><input type="TEXT" name="zip" value="'.$row['ZIP'].'" /></td></tr>
	
	<tr><td align="right">Phone: &nbsp;</td><td align="left"><input type="TEXT" name="phone" size="25" value="'.$row['PHONE'].'" /></td></tr>


	<tr><td align="right">Email: &nbsp;</td><td align="left"><input type="TEXT" name="email" size="45" value="'.$row['EMAIL'].'" /></td></tr>
	
	<tr><td align="right">Website: &nbsp;</td><td align="left"><input type="TEXT" name="website" size="55" value="'.$row['WEBSITE'].'" /></td></tr>

	<tr><td colspan="2" align="center"><input type="submit" value="Update Profile" /></td></tr>
</table></form>';
$profform .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');

	return $profform;
}

function FUNCT_RESUME_LIST(){  //this is the list seen in the employer area
	global $theme;
	
	$result = mysql_query('SELECT * FROM resumes WHERE `UID` = '.$_SESSION['cid'].' ORDER BY `DATEPOSTED`' );
	$cnt = mysql_num_rows($result);
	
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	if ($cnt > 0){
		if ($cnt < 3){
			$putmore = '<a href="?loc=resumes&act=1">Add a resume</a>';
		}else{ $putmore = '';}
		$retval .= $putmore.'<table class="resumelist" width="100%" cellpadding="2" cellspacing="1" border="0"><tr><th align="center">Title</th><th align="center">Date Posted</th><th align="center">Action</th></tr>';
		while($row = mysql_fetch_array($result)){
			$retval .= '<tr><td><a href="?loc=rview&id='.$row['ID'].'">'.$row['RESUMETITLE'].'</a></td><td align="center">'.date("M j, Y", strtotime($row['DATEPOSTED'])).'</td><td align="center"><a href="?loc=resumes&act=2&id='.$row['ID'].'">Edit</a>|<a href="?loc=resumes&act=3&id='.$row['ID'].'">Delete</a></td></tr>';
		}
		$retval .= '</table>';
	}else{
		$retval .= 'There are no resume\'s to list.  Add your first resume.  <a href="?loc=resumes&act=1">Add</a>';
	}	
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');

	return $retval;
}

function FUNCT_RESUME_FORM(){
	global $theme;
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	$retval .= '<div class="resumeform">
		<form method="POST" action="?loc=resumes&act=1">
			<input type="CHECKBOX" name="searchable" value="CHECKED" /> Employer Searchable<br /><br />
			Title:<br />
			<input type="TEXT" name="resumetitle" size="65" class="restit" /> <br /><br />
			Resume:<br />
			<TEXTAREA cols="65" rows="25" name="resumebody"></TEXTAREA><br />
			<input type="SUBMIT" value="Submit Resume" />
		</form></div>';
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
		
	return $retval;
}

function FUNCT_EDIT_RESUME_FORM($mrid){
	global $theme;
	$result = mysql_query('SELECT * FROM resumes WHERE UID = '.$_SESSION['cid'].' AND ID = '.$mrid.' LIMIT 1');
	$cnt = mysql_num_rows($result);
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	if ($cnt > 0){
		$row = mysql_fetch_array($result);
		$retval .= '<div class="resumeform">
			<form method="POST" action="?loc=resumes&act=2&id='.$mrid.'">
				<input type="CHECKBOX" name="searchable" '.$row['SEARCHABLE'].' /> Employer Searchable<br /><br />
				Title:<br />
				<input type="TEXT" name="resumetitle" size="65" class="restit" value="'.$row['RESUMETITLE'].'" /> <br /><br />
				Resume:<br />
				<TEXTAREA cols="65" rows="25" name="resumebody">'.$row['RESUMEBODY'].'</TEXTAREA><br />
				<input type="SUBMIT" value="Update Resume" />
			</form></div>';
	}else{
		$retval .= "The resume you are searching for does not exist.  Please try your search again.  if you continue to have problems please contact the site administrator.";
	}
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
		
	return $retval;
}

function FUNCT_COVER_LIST(){  //this is the list seen in the employer area
	global $theme;
	
	$result = mysql_query('SELECT * FROM covers WHERE `UID` = '.$_SESSION['cid'].' ORDER BY `DATEPOSTED`' );
	$cnt = mysql_num_rows($result);
	
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	if ($cnt > 0){
		if ($cnt < 3){
			$putmore = '<a href="?loc=covers&act=1">Add a cover</a>';
		}else{ $putmore = '';}
		$retval .= $putmore.'<table class="coverlist" width="100%" cellpadding="2" cellspacing="1" border="0"><tr><th align="center">Title</th><th align="center">Date Posted</th><th align="center">Action</th></tr>';
		while($row = mysql_fetch_array($result)){
			$retval .= '<tr><td><a href="?loc=cview&id='.$row['ID'].'">'.$row['COVERTITLE'].'</a></td><td align="center">'.date("M j, Y", strtotime($row['DATEPOSTED'])).'</td><td align="center"><a href="?loc=covers&act=2&id='.$row['ID'].'">Edit</a>|<a href="?loc=covers&act=3&id='.$row['ID'].'">Delete</a></td></tr>';
		}
		$retval .= '</table>';
	}else{
		$retval .= 'There are no cover letter\'s to list.  Add your first cover letter.  <a href="?loc=covers&act=1">Add</a>';
	}	
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');

	return $retval;
}

function FUNCT_COVER_FORM(){
	global $theme;
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	$retval .= '<div class="resumeform">
		<form method="POST" action="?loc=covers&act=1">
			<input type="CHECKBOX" name="searchable" value="CHECKED" /> Employer Searchable<br /><br />
			Title:<br />
			<input type="TEXT" name="covertitle" size="65" class="covtit" /> <br /><br />
			Cover Letter:<br />
			<TEXTAREA cols="65" rows="25" name="coverbody"></TEXTAREA><br />
			<input type="SUBMIT" value="Submit Cover Letter" />
		</form></div>';
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
		
	return $retval;
}

function FUNCT_EDIT_COVER_FORM($mrid){
	global $theme;
	$result = mysql_query('SELECT * FROM covers WHERE UID = '.$_SESSION['cid'].' AND ID = '.$mrid.' LIMIT 1');
	$cnt = mysql_num_rows($result);
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	if ($cnt > 0){
		$row = mysql_fetch_array($result);
		$retval .= '<div class="resumeform">
			<form method="POST" action="?loc=covers&act=2&id='.$mrid.'">
				<input type="CHECKBOX" name="searchable" '.$row['SEARCHABLE'].' /> Employer Searchable<br /><br />
				Title:<br />
				<input type="TEXT" name="covertitle" size="65" class="covtit" value="'.$row['COVERTITLE'].'" /> <br /><br />
				Cover Letter:<br />
				<TEXTAREA cols="65" rows="25" name="coverbody">'.$row['COVERBODY'].'</TEXTAREA><br />
				<input type="SUBMIT" value="Update Cover Letter" />
			</form></div>';
	}else{
		$retval .= "The resume you are searching for does not exist.  Please try your search again.  if you continue to have problems please contact the site administrator.";
	}
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
		
	return $retval;
}

function FUNCT_USER_EMAIL($mtype = ''){
	global $theme;
	
	switch($mtype){
		case 'sent':
			$bgcolora = "background-color:#eeeeee;border-bottom:1px solid #000000";
			$bgcolorb = "background-color:#ffffff;";
			$sqlquery = 'SELECT * FROM mail WHERE FUID = '.$_SESSION['cid'].' ORDER BY SENTDATE ASC';
			break;
		default:
			$bgcolora = "background-color:#ffffff;";
			$bgcolorb = "background-color:#eeeeee;border-bottom:1px solid #000000";
			$sqlquery = 'SELECT * FROM mail WHERE TUID = '.$_SESSION['cid'].' ORDER BY SENTDATE ASC';
	} 
	
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');

	$retval .= '<div class="messages"><span class="mtab1" style="'.$bgcolora.';"><a href="?loc=messages&act=inbox" title="Inbox">Inbox</a></span><span class="mtab2" style="'.$bgcolorb.';"><a href="?loc=messages&act=sent" title="Sent">Sent</a></span><span class="mtab3">&nbsp;&nbsp;&nbsp;</span><br /><br /><table border="0" cellpadding="2" cellspacing="0" width="100%" class="msgblock">
	<tr><th>Subject</th><th>Name</th><th>Date</th><th>Action</th></tr>';

	$result = mysql_query($sqlquery) or die(mysql_errno().', '.mysql_error());
	$cnt = mysql_num_rows($result);
	if ($cnt == 0) {
		$retval .= '<tr><td colspan="4">There are no messages.</td></tr>';
	}else{
		switch($mtype){
			case 'sent':
				while($row = mysql_fetch_array($result)){
					$subresult = mysql_query('SELECT COMPANYNAME FROM companies WHERE CID = '.$row['CID'].' LIMIT 1') or die();
					$subrow = mysql_fetch_array($subresult);
					$retval .= '<tr><td><a href="?loc=msg&act='.$row['ID'].'">'.$row['SUBJECT'].'</a></td><td>'.$subrow['COMPANYNAME'].'</td><td>'.$row['SENTDATE'].'</td><td align="center"><a href="?loc=messages&act='.$mtype.'&a=del&mid='.$row['ID'].'"><img src="mjl-themes/'.$theme.'/delete.gif" border="0" alt="Delete"></a></td></tr>';
				}
				break;
			default:
				while($row = mysql_fetch_array($result)){
					$subresult = mysql_query('SELECT COMPANYNAME FROM companies WHERE CID = '.$row['CID'].' LIMIT 1') or die();
					$subrow = mysql_fetch_array($subresult);
					$retval .= '<tr><td><a href="?loc=msg&act='.$row['ID'].'">'.$row['SUBJECT'].'</a></td><td>'.$subrow['COMPANYNAME'].'</td><td>'.$row['SENTDATE'].'</td><td align="center"><a href="?loc=messages&act='.$mtype.'&a=del&mid='.$row['ID'].'"><img src="mjl-themes/'.$theme.'/delete.gif" border="0" alt="Delete"></a></td></tr>';
				}
		}
	}
	$retval .= "</table></div>";
	
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
	return $retval;
}

function FUNCT_SHOW_USER_MSG($msg, $ea = ''){
	
	$sqltxt = 'SELECT * FROM mail WHERE ID = '.$msg.' LIMIT 1';
	$result = mysql_query($sqltxt) or die();
	$cnt = mysql_num_rows($result);
	
	if($cnt > 0){	
		$row = mysql_fetch_array($result);
		$subject = $row['SUBJECT'];
		$messg = $row['MESSAGE'];
		$cover = $row['COVER'];
		$resume= $row['RESUME'];
		
		if ($_SESSION['cid'] == $row['TUID']){
			$fromuser = $row['FCID'];
			$retval = FUNT_READNEW_USER_MSG($subject,$messg,$fromuser,$msg, $ea);
		}elseif($_SESSION['cid'] == $row['FUID']){
			$touser = $row['TCID'];
			$retval = FUNT_READSENT_USER_MSG($subject,$messg,$cover,$resume,$touser,$ea,$msg);
		}
	}
	
	return $retval;
}

function FUNT_READNEW_USER_MSG($s,$m,$f,$mid,$eq){
	global $theme;
	
	$result = mysql_query('SELECT * FROM companies WHERE CID = '.$f.' LIMIT 1');
	$row = mysql_fetch_array($result);
	$coname = $row['COMPANYNAME'];
	
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	$retval .= '<a href="?loc=messages">Back</a>';
	$retval .= '<div class="usermsg">
	<a href="?loc=msg&act='.$mid.'&a=reply"><img src="mjl-themes/'.$theme.'/reply.gif" border="0" alt="Reply"></a><br /><strong>From:</strong> '.$coname.'<br />';
	$retval .= '<strong>Subject:</strong> '.$s.'<hr style="width:50%">';
	$retval .= $m.'</div>';
	$replyfrm = '';

	if ($eq == 'reply'){
		$replyfrm = '<br /><br /><div class="replyfrm">
		<form method="post" action="?loc=msg&act='.$mid.'">
		<input type="hidden" name="touser" value="'.$f.'" />
		<input type="hidden" name="tsbj" value="'.$s.'" />
		<TEXTAREA name="myreply" class="replybox"></TEXTAREA><br />
		<input type="SUBMIT" value="Send Reply" />
		</form></div>';
	}	  
	$retval = $replyfrm.$retval;
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
	return $retval; 
}

function FUNT_READSENT_USER_MSG($s,$m,$c,$r,$f, $eq,$mid){
	global $theme;
	$result = mysql_query('SELECT * FROM companies WHERE CID = '.$f.' LIMIT 1');
	$row = mysql_fetch_array($result);
	$coname = $row['COMPANYNAME'];
	
	$retval = file_get_contents('mjl-themes/'.$theme.'/user_area_header.theme.html');
	$retval .= '<a href="?loc=messages">Back</a>';
	if  ($c != -1){
		$result = mysql_query('SELECT * FROM covers WHERE ID = '.$c.' AND UID = '.$_SESSION['cid'].' LIMIT 1');
		$cnt = mysql_num_rows($result);
		if ($cnt > 0){
			$row = mysql_fetch_array($result);
			$cover = '<br /><strong>Attached Cover:</strong> <a href="?loc=cview&id='.$row['ID'].'" target="_blank">'.$row['COVERTITLE'].'</a><br />';
		}
	}else{
		$cover = '<br />';
	}
	if ($r != -1){
		$result = mysql_query('SELECT * FROM resumes WHERE ID = '.$r.' AND UID = '.$_SESSION['cid'].' LIMIT 1');
		$cnt = mysql_num_rows($result);
		if ($cnt > 0){
			$row = mysql_fetch_array($result);
			$resume = '<strong>Attached Resume:</strong> <a href="?loc=rview&id='.$row['ID'].'" target="_blank">'.$row['RESUMETITLE'].'</a><br /><br /><hr style="width:50%">';
		}
	}else{
		$resume = '<br /><br /><hr style="width:50%">';
	}
	
	$retval .= '<div class="usermsg"><a href="?loc=messages&act=sent&a=del&mid='.$mid.'"><img src="mjl-themes/'.$theme.'/delete.gif" border="0" alt="Reply"></a>
<br /><strong>To:</strong> '.$coname.'<br />';
	$retval .= '<strong>Subject:</strong> '.$s.'<hr style="width:50%">';
	$retval .= $cover;
	$retval .= $resume;
	$retval .= $m.'</div>';
	$retval .= file_get_contents('mjl-themes/'.$theme.'/user_area_footer.theme.html');
	return $retval;
}
?>
Return current item: MyJobList