![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
d_barszczak
-
Posts
188 -
Joined
-
Last visited
Posts posted by d_barszczak
-
-
I hate to say this but they are right. Unless you understand how it works you will only have the chapter that tells you how to create basic authentication. You also find it difficult to add new features at a later date.
The book that i originally started with was call PHP & MySQL for Dummies. That gave me an excellent start and now i can create practically anything. This forum has also been a great help over the years.
-
A common way to do this would to have a time limit on the id in the database as Neil pointed out but if you use php to send the file I think you can then remove the key from the database once the file has been send.
// Use the database to get the file name and file location for the submited key. header('Content-Disposition: attachment; filename="download.jpg"'); readfile('images/100.jpg'); // Remove the key from the database.
This would download the file images/100.jpg which has been stored on the webserver to avoid duplicate names and sent to the user in a more user friendly way.
You could also timelimit a cookie so the user can download it again if it fails. Usually you get about 24 hours.
-
I think if you miss out the first / that should work also:
images/ not /images/
-
./ in html is not required because it does not have access to the linux root whereas php does.
-
Your web root is entirely different from your root directory.
Think of / in linux as your C:\ and ./ as your current working directory. Your web root is usually something like /home/username/public_html/
By using ./images/image.jpg you are looking for /home/username/public_html/images/image.jpg and by using /images/image.jpg you are using /images/image.jpg you are looking for just that. Hope this helps you understand a little better.
Do a little research on linux filesystems.
-
Excellent thanks. I wasn't far off but that really helped.
-
Hi all
I have a column `idnumber` that contains data such as SCH-DEP-001 and i want to run a distinct query on this column for everything before the last dash.
SCH-DEP-
SCH-DEP2-
Not all the middle values are 3 digits.
Is this possible?
-
Hi all
Im am using sqllite for a project and i am about to start using triggers. Is there a way to view the names of triggers i have set. i.e. show triggers.
-
Thanks for your help I have done it. Users can now sign up to my forum through my registration page.
-
Hi all,
I am currently designing a system in which I would like users that register on my site to automatically have a user account created on my SMF forum.
For some reason when i create a username and password from a SQL query I still get an access denied message. Think they may be more to this somehow. I like SMF and don't really want to change it but this is becoming a problem.
Hope someone can help.
-
I have built a "Engine" that is all oop and has a built in permissions management systems. I saves me a lot of coding but is currently only used for websites and applications built by my business.
I can also merge permissions between sites and develop modules rather that recode a miilion authentcation systems for every customer that requires a login system.
Well worth developing one if your program lots of sites.
-
The way i have done this in the past would be to have a users table, a groups table and a members table.
Users:
Uid | Username | Password
1 System ChangeMe
Groups:
Gid | Groupname
1 Administrators
12 Premium Membership
Members:
Mid | Uid | Gid
1 1 1
Then you do the same thing for your videos
Video_Members:
id | vid | gid
1 | 25 | 1
2 | 25 | 12
In the above example administrators and premium members would have access to video 25.
This might seem complicated at first but once you develop some oop functions to manage the memberships then it becomes a lot less complicated in the long run. Plus you could then use the same membership system should you add other features to the site.
-
-
Just wondered if Open Office could be considered a replacement for MS Office.
-
Hmm good point...
I need to allow for sub domains so i could do something like "http://*.integrateditsystems.co.uk" or require a hitcounter for each sub domain.
Will have to have a think about this then.
-
Hi all,
Once again i have been tripped up by regex so hope you can help.
I have a hitcounter script that submits an id and the url of the page the script was run. I need to be able to detect a domain within the url i.e.
// Check to see if site is registered. $domain = "integrateditsystems.co.uk"; $url = "http://www.integrateditsystems.co.uk/support"; if ($domain exists within $url) return true else false; // Help Me!!
-
Thanks!!
That looks really complicated. Just wish i could get my head round it:)
-
Hi all,
I am useless when it comes to regex so all help is much appreciated.
I have php template system which i use and i am about to add a new utitity to it that easily allow you to add resources to a page. I need to be able to pick tags out of a page of html. e.g.
<p>[resource type=image' id='1' height='100' width='100]</p>
I would like the script to detect the [resource ] tags and any data within such as id='1' place in an array.
Is this even possible?
-
Thank you PFMaBiSmAd.
-
I have a column called `shortname` and i need to add a prefix to every entry of 'ths_'. Is there a way i can do this with one query without having to use php.
Thanks.
-
The following line of code works fine when in the same html document but won't work from a seperate .js file.
document.getElementById('menubar').innerHTML = "<p>Test Message</p>";
Any Ideas?
-
Thanks!!
I thnk the first reply is a php script not a JavaScript
The second reply got it though, thanks again!!!
-
Hi All.
I need to convert a variable : myVar = "Test".
Into an array : myArray[0] = T, myArray[1] = e, myArray[2] = s. and so on.
Does anyone have any ideas?
-
The height between the 2 horizontal rules and the menu text change.
It's IE7 & FF 2 i am testing it with.
[SOLVED] Unique filename upload challenge!
in PHP Coding Help
Posted
Why are you using mysql_num_rows + 1 to give your files their unique identifier. You should use a Primary Key with auto increment.
The problem you have is that you can duplicate your ids.
eg.
I have 10 images in my database with ids 1 - 10 so my next id is 11.
I delete number 5 so my next id is 10... But 10 already exists.
You should use LAST_INSERT_ID() to get your files new id.
Insert information into database.
Get the LAST_INSERT_ID().
Rename the file.