Connecting Tech Pros Worldwide Forums | Help | Site Map

I want to edit the table content from www level.

Rootshell
Guest
 
Posts: n/a
#1: Jul 17 '05
I need to create the table and I want to edit its content from www
level.

Here is some example:

http://www.rootshell.be/~flash44

There is a table.
Is there possibilty to edit the content using <input> command?

Could you show me the way how to do it?

My vision is:
User has its login and password. When he logs in the table space opens
and he can edit the content.

I need a few lines of code for example or url with similar idea.

Best regards.

Rootshell.

Steve
Guest
 
Posts: n/a
#2: Jul 17 '05

re: I want to edit the table content from www level.


This is an easy solution, but unfortunately it involves some of tedious
work.

Basically you are delving into content management. You want to split
your site in half: with a front end and a backend. The front end
obviously will show your polished finished product to the world and the
backend will be the admin side.

Now the fun begins. This should be pretty basic and easy to
understand. For each table cell, there are two states: public and
admin. Your table will show its contents based on its state. Its
state can only be changes if the right admin is logged in.

This will require a simple relation in a database. Create a table
called 'admins' and fill it with user data (name, Password, Login,
email, etc...) and tie it to a 'content cell' in your table. An
example would be a field called 'f_cellID'. You could even make these
cells in the database, so your script would assemble the entire table
dynamically. But for now, lets focus on the task at hand...

For each cell in your table, you are going to box it in php and set
content via the script...for example:

<td id="1">
<?php
// assuming you know who the admin is from a login script
if ($adminID == 1) {
include ("link_to_your_form.php");
} else {
// function to display data
displayData();
}
?>
</td>

The include file will just be a small form.
<form method="POST" action="file_that_handles_data.php">
<textarea name="my_text">STUFF</textarea>
<input type="hidden" name="adminID" value="1">
<!-- the admin ID is pulled from the database after a successful
login -->
<input type="submit" value="Submit">
</form>

Of course for each cell, you will have a different value: 1, 2, 3, X,
Y, Meatwad, Frylock, etc...

When the admin logs in, you will need to create a session admin so that
script kiddies dont trash your site. Validation is simple enough:

$attributes = array_merge($HTTP_POST_VARS, $HTTP_GET_VARS);
if ($attributes["adminID"] == $_SESSION["adminID"]) {
// the right person is logged in...
} else {
// someone is trying to circumvent your security! (or their session
expired)
}

I'm at work, so this is abbreviated. If you need any more assistance,
post.

Steve
Guest
 
Posts: n/a
#3: Jul 17 '05

re: I want to edit the table content from www level.


This is an easy solution, but unfortunately it involves some of tedious
work.

Basically you are delving into content management. You want to split
your site in half: with a front end and a backend. The front end
obviously will show your polished finished product to the world and the
backend will be the admin side.

Now the fun begins. This should be pretty basic and easy to
understand. For each table cell, there are two states: public and
admin. Your table will show its contents based on its state. Its
state can only be changes if the right admin is logged in.

This will require a simple relation in a database. Create a table
called 'admins' and fill it with user data (name, Password, Login,
email, etc...) and tie it to a 'content cell' in your table. An
example would be a field called 'f_cellID'. You could even make these
cells in the database, so your script would assemble the entire table
dynamically. But for now, lets focus on the task at hand...

For each cell in your table, you are going to box it in php and set
content via the script...for example:

<td id="1">
<?php
// assuming you know who the admin is from a login script
if ($adminID == 1) {
include ("link_to_your_form.php");
} else {
// function to display data
displayData();
}
?>
</td>

The include file will just be a small form.
<form method="POST" action="file_that_handles_data.php">
<textarea name="my_text">STUFF</textarea>
<input type="hidden" name="adminID" value="1">
<!-- the admin ID is pulled from the database after a successful
login -->
<input type="submit" value="Submit">
</form>

Of course for each cell, you will have a different value: 1, 2, 3, X,
Y, Meatwad, Frylock, etc...

When the admin logs in, you will need to create a session admin so that
script kiddies dont trash your site. Validation is simple enough:

$attributes = array_merge($HTTP_POST_VARS, $HTTP_GET_VARS);
if ($attributes["adminID"] == $_SESSION["adminID"]) {
// the right person is logged in...
} else {
// someone is trying to circumvent your security! (or their session
expired)
}

I'm at work, so this is abbreviated. If you need any more assistance,
post.

Closed Thread