You can use below script to show the image file for public access, but public don’t have direct access to the file itself. Because its located outside of the public folder.
<?php
/* Read local file from /home/bar */
$localfile = file_get_contents(”/home/userX/foo.jpg”);
echo $localfile;
?>
Posted on December 17th, 2008 by Denie
Filed under: Scripting, Tutorials | No Comments »
Use below scripts :
mysql_insert_id() example
<?php
$link = mysql_connect(’localhost’, ‘mysql_user’, ‘mysql_password’);
if (!$link) {
die(’Could not connect: ’ . mysql_error());
}
mysql_select_db(’mydb’);
mysql_query(”INSERT INTO mytable (product) values (’kossu’)”);
printf(”Last inserted record has id %d\n”, mysql_insert_id());
?>
Posted on December 17th, 2008 by Denie
Filed under: Scripting, Tutorials | No Comments »
mysql_fetch_assoc — Fetch a result row as an associative array
<?php
$conn
= mysql_connect(”localhost”, “mysql_user”, “mysql_password”);
if (!
$conn) {
echo “Unable to connect to DB: ” . mysql_error();
exit;
}
if (!
mysql_select_db(”mydbname”)) {
echo “Unable to select mydbname: ” . mysql_error();
exit;
}
$sql = “SELECT id as userid, fullname, userstatus
FROM sometable
WHERE userstatus = 1″;
$result = mysql_query($sql);
if (!
$result) {
echo “Could not successfully run query ($sql) from DB: ” . mysql_error();
exit;
}
if (
mysql_num_rows($result) == 0) {
echo “No rows found, nothing to print so am exiting”;
exit;
}
// While a row of data exists, put that row in $row as an associative array
// Note: If you’re expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you’ll
// then create $userid, $fullname, and $userstatus
while ($row = mysql_fetch_assoc($result)) {
echo $row["userid"];
echo $row["fullname"];
echo $row["userstatus"];
}
mysql_free_result($result);
?>
Posted on December 17th, 2008 by Denie
Filed under: Scripting, Tutorials | No Comments »
Internet Explorer is used by the vast majority of the world’s computer user
Users of Microsoft’s Internet Explorer are being urged by experts to switch to a rival until a serious security flaw has been fixed.
The flaw in Microsoft’s Internet Explorer could allow criminals to take control of people’s computers and steal their passwords, internet [...]
Posted on December 17th, 2008 by Denie
Filed under: Internet, Windows | No Comments »