+ Reply to Thread
Results 1 to 5 of 5

Thread: a script that connects to database

  1. #1
    ChatIndia's Avatar
    ChatIndia is offline Community Advocate ChatIndia is on a distinguished road
    Join Date
    Sep 2009
    Location
    Exam Time. I won't tell you
    Posts
    1,320

    a script that connects to database

    Hi

    anybody who would volunteerly like to help me in making a simple script which can make change to a database. I don't want to give users to login to my database or access to admin panel of my script. so i dream to make a script which can alter database without giving users full access to database. Is it possible? Can you give me any hint or any web address on tutorials. I don't know programming but i can understand if i find a tutorial.

    Thanks in advance.
    Your appreciation is extremely Important. Click on the button at the bottom left corner of my post.

  2. #2
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: a script that connects to database

    In the most general sense, the things that happen in your database usually happen using your credentials, not the users' credentials, so that part's not a worry. Whether your users are authenticated or not (your choice, but I wouldn't usually let unauthenticated users do anything scarier than leave a comment on a blog), they will usually be the "same" user at the level of database interaction, even if they are different at the level of your application.

    That said, we don't know enough about what you want to do in order to be of much real help. All we can do is point you to the general case of PHP interacting with MySQL using, say, PHP Data Objects (PDO), but that leaves an awful lot of work for you to do. (Not that learning the whole field wouldn't be tremendously rewarding -- it would be -- but it doesn't get you much closer to your goal in the short term.) So can you elaborate on what you want to accomplish?
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  3. #3
    ChatIndia's Avatar
    ChatIndia is offline Community Advocate ChatIndia is on a distinguished road
    Join Date
    Sep 2009
    Location
    Exam Time. I won't tell you
    Posts
    1,320

    Re: a script that connects to database

    Okay, import the database in the attachment to the test sql server on your local computer

    you'll find there is a table "room" inside there are several room list. I think it would be fantastic if only one person (admin of that particular room) can edit that room.

    at present if i give room setting in admin panel, they get control over of each room.

    is that possible? or is it a very complicated programming which only very very expert programmer can accomplish?

    sorry, i can't attach an .sql extension file so i made it .txt. change it to .sql first before importing it to your sql server.
    Attached Files
    Last edited by ChatIndia; 10-27-2011 at 11:32 AM.
    Your appreciation is extremely Important. Click on the button at the bottom left corner of my post.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: a script that connects to database

    Room Admin signs in, you store his ID in a session.

    You present him with a form that allows him to "edit" that room (not sure what you want him to be able to edit/add, etc).

    He submits the form and the script knows what room is to be edited by looking at the admin's user name. Processes the update and reports back.

    But then you have to trust the room admin not to do anything stupid, since you are responsible.
    Nothing is always absolutely so.

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: a script that connects to database

    Samples should be minimized to reduce extraneous information. 279.2 KiB is far too much to have to wade through for a single table.

    Administrating a room implies a relationship: a room has an administrator, a user can administrate a room. Lucky you're dealing with a relational database. Since admin-room is a 1-to-n relationship (each room has at most one admin, and a user can be the admin of multiple rooms), you can fold the relationship into the `room` relationship (or table, as the kids say these days). In descalzo's scheme, this is how the system records which rooms a user can administrate.

    If you have other objects where access must be authorized (and where access rights can differ), it would be better to design an overall authorization scheme, rather than handling it piecemeal. Note that authorization (whether a particular entity should be given the access that it requests to an object) is distinct from, but related to, authentication (verifying credentials or identity). There are various patterns and sub-patterns to choose from: groups, roles, ACLs, ownership...
    Last edited by misson; 10-27-2011 at 04:47 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. How to connect my php script to database?
    By flash.engine50 in forum Programming Help
    Replies: 15
    Last Post: 01-29-2011, 05:56 AM
  2. Pls help me connect my database sql and script
    By west10155 in forum Free Hosting
    Replies: 7
    Last Post: 08-09-2010, 03:48 AM
  3. Wireless Connects but no Internet?
    By focus in forum Computers & Technology
    Replies: 6
    Last Post: 07-09-2010, 07:00 PM
  4. Softaculous - new database for every script?
    By unk9787 in forum Free Hosting
    Replies: 3
    Last Post: 12-25-2009, 12:17 PM
  5. install php script into sql database
    By LashRash in forum The Marketplace
    Replies: 2
    Last Post: 11-29-2007, 10:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers