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;
?>

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());
?>

Dec 17 2008

How to fetch data(s) using mysql_fetch_assoc ?

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);

?>

Dec 17 2008

Serious security flaw found in IE

Microsoft Internet Explorer logo, file pic from 2004

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 experts say.

Microsoft urged people to be vigilant while it investigated and prepared an emergency patch to resolve it.

Internet Explorer is used by the vast majority of the world’s computer users.

It’s a shame Microsoft have not been able to fix this more quickly
Darien Graham-Smith
PC Pro magazine

“Microsoft is continuing its investigation of public reports of attacks against a new vulnerability in Internet Explorer,” said the firm in a security advisory alert about the flaw.

Microsoft says it has detected attacks against IE 7.0 but said the “underlying vulnerability” was present in all versions of the browser.

Other browsers, such as Firefox, Opera, Chrome, Safari, are not vulnerable to the flaw Microsoft has identified.

Browser bait

“In this case, hackers found the hole before Microsoft did,” said Rick Ferguson, senior security advisor at Trend Micro. “This is never a good thing.”

As many as 10,000 websites have been compromised since the vulnerability was discovered, he said.

“What we’ve seen from the exploit so far is it stealing game passwords, but it’s inevitable that it will be adapted by criminals,” he said. “It’s just a question of modifying the payload the trojan installs.”

MICROSOFT SECURITY ADVICE
Change IE security settings to high (Look under Tools/Internet Options)
Switch to a Windows user account with limited rights to change a PC’s settings
With IE7 or 8 on Vista turn on Protected Mode
Ensure your PC is updated
Keep anti-virus and anti-spyware software up to date

Said Mr Ferguson: “If users can find an alternative browser, then that’s good mitigation against the threat.”

But Microsoft counselled against taking such action.

“I cannot recommend people switch due to this one flaw,” said John Curran, head of Microsoft UK’s Windows group.

He added: “We’re trying to get this resolved as soon as possible.

“At present, this exploit only seems to affect 0.02% of internet sites,” said Mr Curran. “In terms of vulnerability, it only seems to be affecting IE7 users at the moment, but could well encompass other versions in time.”

Richard Cox, chief information officer of anti-spam body The Spamhaus Project and an expert on privacy and cyber security, echoed Trend Micro’s warning.

“It won’t be long before someone reverse engineers this exploit for more fraudulent purposes. Trend Mico’s advice [of switching to an alternative web browser] is very sensible,” he said.

This could be the moment when the minnows in the browser wars finally score a significant victory
Rory Cellan-Jones
BBC technology editor

PC Pro magazine’s security editor, Darien Graham-Smith, said that there was a virtual arms race going on, with hackers always on the look out for new vulnerabilities.

“The message needs to get out that this malicious code can be planted on any web site, so simple careful browsing isn’t enough.”

“It’s a shame Microsoft have not been able to fix this more quickly, but letting people know about this flaw was the right thing to do. If you keep flaws like this quiet, people are put at risk without knowing it.”

“Every browser is susceptible to vulnerabilities from time to time. It’s fine to say ‘don’t use Internet Explorer’ for now, but other browsers may well find themselves in a similar situation,” he added.

Source