PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i created a folder for images. i want my program to be like this, if the user entered his username and password, his picture will be displayed to the index page.
my question is, what syntax should i use to access or get the jpg file to be displayed in the index page
feyd wrote:you'd need to know what filename to load, this should be stored in the database in the user's settings (hidden from their direct control).
It's then a matter of knowing if the file is there and then writing out the image tag into the html stream.
im going to have to agree with fyed its the best solution sorry n00b Saibot even though your solution will work, but putting the information in the database is better
<?
if($action == "login"){
// perform code here that validates user's existence
// If user exists, go to page where you want picture to appear
$username = $_POSTї'username'];
header("Location: index.php?username=$username"); }
?>
Then to display their picture on the page where you want it to appear
PrObLeM wrote:
sorry n00b Saibot even though your solution will work, but putting the information in the database is better
My solution doesn't involve overhead on a db connection. it would be much faster my way. but anyway, I think atleast he is much better informed now to take decision on his own
needing a database connection to find information all depends on what you have cached off in say.. a filesystem session... if the system already incorporates a query against the table holding the data, it doesn't add more than a few milliseconds (at most). But let's face it, php, along with pretty much all the other interpretted scripting language, isn't the fastest kid on the block...