Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How Do I Retrieve Images Dynamically Based On The Login Username?


I have created a site in Joomla with a login (no self registration,
users are provided with username and password by the admin).
The users are supposed to login to a specific page where they can see
4 images.
I have the following code:
<?php
// define directory path
$dir = "images/user1/";

// iterate through files
// look for JPEGs
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (preg_match("/.jpg/", $file)) {
// read EXIF headers
$exif = exif_read_data($file, 0, true);
echo "<tr>";
// get thumbnail
// link to full image
echo "<td valign=top><a
href=$dir/$file><imgsrc=thumbnail.php?file=$file></a><td>";
echo "<td valign=top><font size=-1>";
// get file name
echo "File: <b>" . $exif['FILE']['FileName'] .
"</b><br/>";
// get timestamp
echo "Timestamp: " . $exif['IFD0']['DateTime'] .
"<br/>";
// get image dimensions
echo "Dimensions: " . $exif['COMPUTED']['Height'] . "
x " . $exif['COMPUTED']['Height'] . " <br/>";
// get camera make and model
echo "Camera: " . $exif['IFD0']['Model'];
echo "</font></td>";
echo "</tr>";
}
}
closedir($dh);
}
}
?>

The question now is how to change the code to dimamically replace the
folder name by the login username used.
For example....if user2 logs in the images loaded will be only those
in the folder images/user2, if user3 logs in it will be from the
folder images/user3, etc...
I am a little confused as to how to implement that in Joomla but as
long as I have the code right I thinkI can just insert the code into
the appropriate page using a mambot.
If anybody here has any tips on how to accomplish that it would be
extremely appreciated.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Retrieve Data Based On The Dates?
I have been searching everywhere on the net on how to retrieve data based on the dates. for eg. today's date. Is it possible to do this? If yes, how can it be done?

Can't Get Username/password Mysql-based Retrieval Working
I can't seem to figure out how to set up a MySQL-based password and username php app. Here's my code, it just goes blank when I run it and I can't figure out why. Code:

Create A Optgroup Dynamically Based On The Value Of An Array
how to create a optgroup dynamically based on the value of an
array...

for eg....

Dynamically Creating URLS Based On User Input !
I am looking to create pages on the fly or dynamically based on user input. For example if i have www.example.com and they visit this and enter 'bob' in a textfield and press submit they create www.example.com/bob.html . How would I go about this ? I am guessing I need to create a folder when submit is pressed in my website directory ?

Dynamically Populating Listboxes Based On Previous Selection
How do I populate the second listbox in this form based on the selection of the first listbox?

The first listbox is populated by this query:
$year_query = "SELECT distinct year FROM bench_data";
The second listbox should essentially be populated by this:
$industry_query = "SELECT distinct comp_desc FROM comp_desc, benc_data where $_POST['year']=bench_data.year and bench_data.comp_key=comp_desc.comp_key";

I know this is alot to ask, but please EXPLAIN the code.  I am new and need the explanation elucidated and not just supplied code that will accomplish the goal. Code:

Login/username Issue Arrays
I am attempting to make a list of valid usernames and passwords for a login page. I am exploring the world of arrays in PhP and I am having trouble. You guys can see what I am trying to do with the code below, I need to have $validun[0] corrilate with $validpw[0], etc. etc. all the way to [3]. Does anyone have any ideas? Code:

How To Retrieve And Display Remote Images?
I'm trying to write a quick script that will grab say a .jpg image from a remote web site, store it in a variable (optional) then print it to the screen.

Normally just linking would work, but I'm trying to hide where the images come from for a branded version of a site. However all I've managed to get so far is garbage on the screen which I assume is the image, but in ASCII format. PHP Code:

Session Based Login Script
I have built this login script, it logs u in and shows the first page... i have built it to be require()'ed, when i have required it from a browser script i made it loads the front page, then when i ask for browser.php?edit=file.html

It then asks me to re login and takes me back to the front page! PHP Code:

Session Based Login Script
I am currently creating a session based login script as follows; PHP Code:

Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and
when people click one item, we will refresh the same page with the
product name as parameter, and in turn we want to include a HTML file
into the content area of the same page.

I know it is recommended to put everything into database, but we want
the web site to be very "portable", so the drop-downlist and the
content should both in text files.

Let's say the drop-down list will be poplulated from the product.txt
file, and there will be a file for each corresponding item in the
drop-down list. From the user point of view, if he wants to add a new
product, he will just need to open the product.txt file, and add a new
line with the product name, "Laptop", then add a new text file named
"laptop" in the same folder which contains the HTML fragment to be
included in the content area.

What is the easiest way to do this?

EyeOS : Opensource Web Based Operating System Based On "php"
EyeOS is a Opensource web based operating system based on "php".

try demo here

http://eyeos.info/eyeOS/

Session Problem - Login Screen Continually Reloads After Pressing The Login Button
I am trying to get sessions to work on a log in screen to give certain
users access to certain pages/directories. The problem is that when
the login button is pushed (or the enter key pressed) the login screen
redraws, never loading the next page. I don't get any error messages.
I am using FreeBSD-5.1/Apache-2.0.46/MySQL-4.1.0.1/PHP-4.4.3.4

I have pasted the code below:

Login Lgout And Login Without Closing Session Gives Redirection Error
I am stepping through a text book that sets up different websites. The
one I am testing is user registration.

I set up the scripts and this is what I observe:

Login (verifying against a mysql db) - no problem.
Logout - no problem.

Close the browser and try again - no problem.

Login > Logout > Login WITHOUT closing browser I get:

An error occurred while loading http://login.php when it should redirect
me to http://localhost/index.php.

I read somewhere on the news group that the
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname
($_SERVER['PHP_SELF']) . "/index.php") (in my example code) is called
once and so the error?

The logout.php destroys the $_SESSION variables, session itself and any
cookies so I thought it would be "like new" the second time around?

It appears to be linked to sessions but don't know enough to know how to
correct.

Upload Multiple Images From A Folder At A Time And Watermark The Images
I have a problem with uploading multiple images from a folder at a
time with a single mouse click and water mark the images with text.
Can any body please help me with code and suggestion about this issue?

Stamps/inserts Small Images (logos) Onto Larger Images.
It may be called image stamping or water marking but im not sure. Basically i want a script that prints/stamps a smaller image onto a larger one, the smaller mage being a logo. This will make it harder for people to steal my pictures as they will have my logo on them.

An example of this is with ebay, when you submit a picture of the item your selling ebay will printe a small logo in the bottom right corner of the picture. Could anyone suggest a script for this, just a simple one then i can mess around with it and make it better.

Stamps/inserts Small Images (logos) Onto Larger Images.
It may be called image stamping or water marking but im not sure.
Basically i want a script that prints/stamps a smaller image onto a larger one, the smaller mage being a logo. This will make it harder for people to steal my pictures as they will have my logo on them.

An example of this is with ebay, when you submit a picture of the item your selling ebay will printe a small logo in the bottom right corner of the picture.
Could anyone suggest a script for this, just a simple one then i can mess around with it and make it better.

Login Script Forcing Me To Login Twice?
I have built a login script and for some strange reason its forcing me to login twice. Not saying the user/pass is wrong first time, it moves the headers fine, it just show the old page with the login any ideas? Code:

Login Page Not Redirecting After Login
I've used this same snippet of code in other login forms without a problem (with some slight modifications from script to script) but this one seems to baffle me.

Basically it takes the login and validates the entries (validation works, error messages display if left blank), then checks the database for a match. If there's a match then it is supposed to forward the person onto the proper page using the 'header' function. Problem is it's not. Basically it's reverting back to the 'index.php' page (login page) and the display is completely blank. Here's the code for index.php: Code:

Get Username From IIS
I am trying to get the username a person enters when using basic
authentication with IIS. Can php do that? That is a person enters a url.
He is prompted by IIS for a username & password. IIS allows the user in.
I am assuming the server now has the username somewhere.

Using The Username
I am using the sessions for different users, based on their username,,, can i use this statement $username = session_name('username');

Getting Username
My directory uses .htaccess authorization by requiring a username and
password. I want to keep a simple log of all transactions to a DB which
will provide the who-what-when-where for all edit/add/delete
operations. To this end, I want to obtain the username provided in the
..htaccess login. I've tried $PHP_AUTH_USER and $PHP_REMOTE_USER but
both variables are blank.

Random Images From Google Images
I am trying to set up a page that will show a random image of something on
a web page (e.g. cats) taken from a random Google Image.

I can't find any sample code to do this. Can someone point me to an
example?

Only One Session Per Username, But How?
I am developing a small database which users will have to log in with a username and password, which is checked against a MySql database. I am using sessions which will end when they either hit the log out button or close their browser. Everything works fine so far, but I can't figure out a good way of making sure if a username is currently logged in (has a session open) that no one else can log in using that username. Would adding a column to the database and querying the database to see if they are logged in be the best, or is there an easier way with sessions that I just don't know about. The issue with using a database by switching a simple yes/no column, would be if they close their browser or computer freezes, they try to log in but can't because the database was never reset.

Displaying Username
I am newbie to php. I did a login Script using dreamweaver tools.Everything works fine but i have problem showing username like welcome username! on top of page when user logged in.I need like this when unauthorised user enters in to my website it should display login box.When user registered and logged in it should display message like WELCOME user! in the same place.

Suggesting Available Username
I have to show some of the posible usernames available when a user can
not get a perticular username in a very normal member registration
form.

Validate Username
I have created a sign up page. People enter their password twice and those fields are compared. If not the same then an error message is given. I want to compare an entered username against a username in y database. My script so far is: Code:

Checking For Username...
How do I check in a mySQL table called 'Users' on column user_name when
registering a new user_name to make sure the new 'user_name' does not
already exist in that column?

Username And Password
I've got this 'helpdesk' application where people can simply fill out a form and send it off. Each time they have to type in their name, phone number and email address- then answer the questions that they're having problems with. I'd rather store that common non-variable info in a database and pull it out so that they don't have to type it in each time.

Is this possible without issuing each individual their own username/password? Or would it be best to have each person log in one time and create their own accounts?

Before I just had 3 or 4 general usernames/passwords that the organization members used. I'm trying to keep confusion down to a minimum here. Would it be feasible to have them log in with their last name and pull the information based on that- or there must be another way.

Username For A Session
What is the best way to keep track of a username during a session? Let me elaborate a bit... I want to set up a username/password with htaccess and then allow the verified users access to a number of webpages which allow them to add/delete/modify different items.

But I want to keep track of who the current verified user is. What is the best way? A cookie? An environment variable?

Adding Username To Url
I am developing a multilevel marketing system. This system will provide
users their own website(virtual). No real disk space. just play by
database and account status (paid or not paid).

I would like to have the url of a registered user like this

www.mysite.com/username/

I can create up to this point. when i tried to access this url. its the
requested url is not found..

Validate Username
Can anyone tell me how use regular expression to validate a username
with alpha numeric and special character but not space?

Username Regex
anyone have regex script to check the "username" value, to avoid it use special characther?

Validating A Username
Okay I want to check if a USERNAME already exists in the database: PHP Code:

Username Filtering
I'm having problems with regular expressions. How could i check if a variable has only letters and numbers in it?

PHP-AT: Where To Put Username And PW For SetReturnURL
I am trying to make a setReturnURL call with PHP-AT using
Ebay_Authentication->add (hope this is the right way). But I don't know
where to put the needed username and password for this call. I did it in
the ebay.config.php and even set it via setRequestPassword /
setRequestUser but I always get an error like "wrong password or wrong
username".

Set FTP Username And Password
I create a new user and set up the directories with a script. One of the directories is for uploading files and I create an FTP username and password manually in my isp’s control panel. This locks down the directory when the user logins with an FTP client.

I have been told that I should be able to set the FTP username and password from the script but despite lots of searching cannot find the answer.

Windows Username
i am using apache,mysql and php on windows XP and soon wil move to windows server 2003, need something that will work on both. i need some kind of script that will get me the current clients windows username.

i dont really care what language it will be written. all i need is that it will be possible to embbed it into php page without any extra modules if possible, if not then with some kind of module that is free. (how to embbed it as well will be more than welcome)

How To Use PHP To Retrieve Data From A PDF
I am looking for a tutorial, script about how to use PHP to retrieve data (Ex: filled customer input in a PDF file) from a PDF file and store it as a XML file.

Retrieve Formname
In my PHP script I want to put the name of the form, i'm currently in, into
a variable.

So far I haven't found an answer!

How Do I Retrieve $Variable From URL?
How Do I Retrieve $Variable From URL? I am designing a user registration section for a web site. "Page One" below contains excerpts from the user input form and "Page Two" below contains excerpts from the script that 1).inputs the data into the database and 2).sends an e-mail with the $UserName variable appended to the URL. Pages One and Two work just fine. Page Three is where I'm having the difficulty.

My question is this: How do I get the $UserName variable that is appended to the URL on page two (that is subsequently sent in an e-mail) to insert into the "UPDATE $TableName..." query shown below on Page Three? PHP Code:

How Do I Retrieve The Next Record?
I am searching the mySQL DB for a particular item num. When it retunrs the result I want to be able to go to the 'NEXT' and 'PREV' records in the order of the Table. Do I first need to put in an auto increment or index column?

Retrieve Body Tag
If I have a body tag that looks something like this <body id="home
page"> where each page on my website has a unique "id", is it possible
to retrieve the body tag in PHP and pass the id along as a variable?

Cannot Retrieve Data In Utf-8 From Php
I have a IIS server with php3 installed. I have SQL server database
and data stored in unicode format (nvarchar fields). In header of my
php I have the meta: <meta HTTP-EQUIV="content-type"
CONTENT="text/html; charset=UTF-8">.

I have the following problem:

- I trie to do a query using ODBC (version 3.525.1022.0) and SQL
Server odbc driver (version 200.85.1022.00). The query doesn't
retrieve information in utf format and accents and extra characters
aren't showed correctly.

- I trie to di the query usin native OLE DB. I use mssql funtions and
the problem is the same.

If I install php4 and I use "new
COM("ADODB.Connection",NULL,CP_UTF8);", then it works correctly.

Anybody knows if its posible to retrieve data from sql-server in utf-8
format using php3?

I see in other postings that odbc driver only accept utf-8 in version
3.7 or higher? Is it true? If is true, where I can download odbc
driver 3.7?

Retrieve All Pics From Url
I want to get all pics (.jpg) from a url and I use this code but sometimes
with some urls it doesnt work :(
Anyone can check it out?

$text = implode("", file($url));
$text = eregi_replace("<!--([^-]|-[^-]|--[^>])*-->","", $text);
while (eregi("[:space:]*(img)[:space:]*=[:space:]*([^ >]+)", $text, $regs))
{
$regs[2] = ereg_replace(""", "", $regs[2]);
$regs[2] = ereg_replace("'", "", $regs[2]);
$regs[2] = preg_replace("/(s.+)/" , "" , $regs[2]);
if(eregi(".jpg|.jpeg|.jpe",$regs[2])){
echo $regs[2]."<br>";
}
$text = substr($text, strpos($text, $regs[1]) + strlen($regs[1]));
}

Retrieve String From URL
i have the following URL : www.mysite.com/Rates/USA/1/China/2
i wana extract the two countries from this URL ( USA and China)
N.B: this URL is rewrited using mode rewrite.

Retrieve Arrays From URL
how would you go about getting an array form the URL?

can you just post it like this "domain.com/index.php?array=1,2,3,4

and then use: <?php
$array = $_GET['array'];
and then the array would read as:
$array[0] == 1
$array[1] == 2
etc...

Retrieve Info Via Id
How can I retrieve data from my database based on the item's id and how can I built it up on one page dynamically?

Username, Password, And Hotmail?
I have a script that collects a username and password which doesn't
seem to work if the user is a hotmail/msn frame.

When they get a message on the system a notification is sent to them
with a link to the site, and again, that link doesn't work as it
should - unfortunately a lot of the users use hotmail.

What's the problem? What do I need to do?

How Can I Get IMAP Username And Password?
the IMAP functions has been compiled into PHP on my server, and then each time access my page index.php from a web browser, I was asked enter username and password, is there any nice person tell me, how can I get IMAP username and password?


Copyright © 2005-08 www.BigResource.com, All rights reserved