...

View Full Version : Sample codes PHP5+MySQL5 for Profiling with display Picture.



play_maker101
11-18-2010, 03:56 PM
Guyz i need your help, can you provide me the sample codes in PHP5+MySQL5 that will create a Profiling with display Picture on it. thanks in advance btw.
-reil-

mlseim
11-18-2010, 03:56 PM
What is a "Profiling"?

play_maker101
11-18-2010, 04:02 PM
Sir it will much more similar to a Bio-data format. im really having a hard time on how to display a picture on a borrower's profile. BTW im creating our mini library system.i hope you will provide me some sample codes Sir. thanks in advance.
-reil-

mlseim
11-18-2010, 04:21 PM
So you have nothing written yet ... no code to show us?
You want us to write it for you?

play_maker101
11-19-2010, 03:14 AM
If you want to Sir, but here's the code that my partner made. We want to upload a book's picture in our databasa(MySQL5) & then display it including the picture that we uploaded during we encode the record's book.



<?php require_once('Connections/Library.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO titles (title_id, title, pub_id, au_id, pubdate, notes) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['title_id'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['pub_id'], "text"),
GetSQLValueString($_POST['au_id'], "text"),
GetSQLValueString($_POST['pubdate'], "date"),
GetSQLValueString($_POST['notes'], "text"));

mysql_select_db($database_Library, $Library);
$Result1 = mysql_query($insertSQL, $Library) or die(mysql_error());

$insertGoTo = "titlemasterpage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_Library, $Library);
$query_rsAuthors = "SELECT au_id, au_lname, au_fname FROM authors ORDER BY au_lname ASC";
$rsAuthors = mysql_query($query_rsAuthors, $Library) or die(mysql_error());
$row_rsAuthors = mysql_fetch_assoc($rsAuthors);
$totalRows_rsAuthors = mysql_num_rows($rsAuthors);

mysql_select_db($database_Library, $Library);
$query_rsPubs = "SELECT pub_id, pub_name FROM publishers ORDER BY pub_name ASC";
$rsPubs = mysql_query($query_rsPubs, $Library) or die(mysql_error());
$row_rsPubs = mysql_fetch_assoc($rsPubs);
$totalRows_rsPubs = mysql_num_rows($rsPubs);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php $pagetitle="The Night Owl"?>
<html xmlns="http://www.w3.org/1999/xhtml" >
<meta http-equiv="Content-Type" content="; charset=" />
<title>AL Navarro Library System</title>
<link rel="stylesheet" href="styles.css" type="text/css" media="screen" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
left:105px;
top:147px;
width:797px;
height:41px;
z-index:1;
}
-->
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
</head>
<body>

<?php include("includes/header.php"); ?>
<p>&nbsp; </p>
<div id="apDiv1">
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="index.php">HOME</a></li>
<li><a href="#" class="MenuBarItemSubmenu">TRANSACTION</a>
<ul>
<li><a href="#">BORROW</a></li>
<li><a href="#">RETURN</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#">BORROWER</a>
<ul>
<li><a href="#">ADD</a></li>
<li><a href="#">PROFILES</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">BOOKS</a>
<ul>
<li><a href="titleinsertpage.php">ADD</a></li>
<li><a href="titlemasterpage.php">TITLE LIST</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">SEARCH</a>
<ul>
<li><a href="titlesearch.php">TITLE</a></li>
<li><a href="authorsearch.php">AUTHOR</a></li>
<li><a href="borrowersearch.php">BORROWER</a></li>
</ul>
</li>
<li><a href="logout.php">LOG-OUT</a></li>
</ul>
</div>
<br />
<p>INSERT NEW BOOK TITLE</p>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Title_id:</td>
<td align="left" valign="middle"><span id="sprytextfield1">
<input type="text" name="title_id" value="" size="32" />
<span class="textfieldRequiredMsg">Enter the title ID.</span></span>
e.g. RT1987</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Title:</td>
<td align="left" valign="middle"><span id="sprytextfield2">
<input type="text" name="title" value="" size="32" />
<span class="textfieldRequiredMsg">Enter the book title.</span></span></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Author</td>
<td align="left" valign="middle"><select name="au_id">
<?php
do {
?>
<option value="<?php echo $row_rsAuthors['au_id']?>" ><?php echo $row_rsAuthors['au_fname']?> <?php echo $row_rsAuthors['au_lname']?></option>
<?php
} while ($row_rsAuthors = mysql_fetch_assoc($rsAuthors));
?>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Publisher</td>
<td align="left" valign="middle"><select name="pub_id">
<?php
do {
?>
<option value="<?php echo $row_rsPubs['pub_id']?>" ><?php echo $row_rsPubs['pub_name']?></option>
<?php
} while ($row_rsPubs = mysql_fetch_assoc($rsPubs));
?>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Publication Date:</td>
<td align="left" valign="middle"><span id="sprytextfield3">
<input type="text" name="pubdate" value="" size="32" />
<span class="textfieldRequiredMsg">Enter the publication date.</span></span>
e.g. yyyy/mm/dd</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right" valign="top">Notes:</td>
<td align="left" valign="middle"><span id="sprytextarea1">
<textarea name="notes" cols="50" rows="5"></textarea>
<span class="textareaRequiredMsg"><span class="textfieldRequiredMsg">Enter the</span><span class="textfieldRequiredMsg">Enter the</span><span class="textfieldRequiredMsg">Enter the</span>Enter an information about the book.</span></span></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td align="left" valign="middle"><input type="submit" value="Insert Record" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p><a href="titlemasterpage.php">Return to Masterpage</a></p>
<?php include("includes/footer.php"); ?>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur"]});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {validateOn:["blur"]});
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1"
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>
<?php
mysql_free_result($rsAuthors);

mysql_free_result($rsPubs);
?>



i hope you will give us the right solution or advices...tnx



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum