Jump to content

d_barszczak

Members
  • Posts

    188
  • Joined

  • Last visited

Posts posted by d_barszczak

  1. 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.

  2. 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.

  3. 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.

     

  4. 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.

  5. 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?

  6. 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.

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

  8. 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.

  9. Which users cron is your plesk control panel showing because it could be the root crontab thats running the jobs. Which flavour of linux are you using?

  10. 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!!
    
    

  11. 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?

  12. 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?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.