"I want Userid who own IDs can delete ReplyID of that ID"
HI, i restarted to do users comment mod again by using
User Comments/ Reviews(database does not use the Userid field as the key).:http://webmagic.hypermart.net/dbman/multi31.txt
R E L A T I O N A L D A T A B A S E S:http://www.jpdeni.com/dbman/Mods/relational.txt
Both instruction have no option i need.
Both of MY databases do not use Userid field as the key,i have only two dbs that are key field ,one is ID for topic database and other is ReplyID for reply database
It works fine at this moment but i wonder,
How can I allow user who post the ID can modify or delete reply records post by default users.
I tested reply to ID by default user ,and the reply database look like this;
4|22|reter||24-02-2001|retretr|||Yes|||default
If user who own this ReplyID is default ,So how to make the topicID owner can del or modify the reply records post by default users?
below is what in my .cgi file;
sub switch_to_reply {
#-----------------------------------------------------
$cols = 'ID,ReplyID,ReplyName,ReplyBgColor,ReplyDate,ReplyMessage,ReplyEmail,ReplyICQ,ReplyValidated,ReplyPopular,YourUsername,Userid';
@db_cols = split /,/,$cols;
$db_file_name = $db_script_path . "/reply.db";
$db_sort{'ReplyDate '} = 'date';
}
sub switch_to_topic {
#-----------------------------------------------------
$cols = 'ID,Name,Age,Location,Email,mm,ICQ,dd,Homepage,Date,Info,Userid,Sex,Graphic,Rating,Votes, yyyy,AllowEmail,Validated,Popular,Color,Province, AllowPostReply';
@db_cols = split /,/,$cols;
$db_file_name = $db_script_path . "/topic.db";
$db_key_pos = 0;
}
code i added to reply.html at sub html_record_form
after my (%rec) = @_;
##############
if ($in{'ID'}) {
$rec{'ID'} = $in{'ID'};
}
and code i added in topic.html at sub html_record_long
if ($rec{'AllowPostReply'} eq "Y") {
print qq|<tr>
<td width="100%">
<a href="$db_script_url?db=reply&uid=$db_uid&ID=$rec{'ID'}&add_form=1">µÔªÁ˹è͹Ð</a></font></td>
</tr>|;
}
then in this sub at the bottom after |; before }add code
###add switch
# Tell DBMan to look in the other database
&switch_to_reply;
#Clear out any previous search terms
undef %in;
# Get rid of any bold tags that might be in the userid field
$rec{'ID'} =~ s/<.?B>//g;
# Look for items added by this user
$in{'ID'} = $rec{'ID'};
#add this for only validate show
#$in{'Validated'} = 'Yes';
# Sort the results by the DateAdded field, in descending order
$in{'sb'} = 5;
$in{'so'} = 'descend';
# Set the maximum number of hits per page to a large enough number to guarantee that all records will be returned
$in{'mh'} = 100;
# Do the search
my ($status2,@hits2) = &query("view");
# If there are any search results
if ($status2 eq "ok") {
# Calculate the number of records returned
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
# Set up a table for the display
print qq|<table cellpadding=0 cellspacing=0 border=1>|;
# Go through each hit and print out the results
for (0 .. $numhits2 - 1) {
# Break the array into a hash for printing
%rec2 = &array_to_hash($_, @hits2);
# Print out the link to the full item record
# Note that I am using $db_script_url and *not* $db_script_link_url.
print qq|
<tr><td>$rec2{'ReplyID'}
</td></tr> |;
}
print qq|</table>|;
}
# Tell DBMan to go back to the original database
&switch_to_topic;
Any help would be great appreciated.
Please Excuse me for my poor knoledge of PERL
Regards,
Act.
HI, i restarted to do users comment mod again by using
User Comments/ Reviews(database does not use the Userid field as the key).:http://webmagic.hypermart.net/dbman/multi31.txt
R E L A T I O N A L D A T A B A S E S:http://www.jpdeni.com/dbman/Mods/relational.txt
Both instruction have no option i need.
Both of MY databases do not use Userid field as the key,i have only two dbs that are key field ,one is ID for topic database and other is ReplyID for reply database
It works fine at this moment but i wonder,
How can I allow user who post the ID can modify or delete reply records post by default users.
I tested reply to ID by default user ,and the reply database look like this;
4|22|reter||24-02-2001|retretr|||Yes|||default
If user who own this ReplyID is default ,So how to make the topicID owner can del or modify the reply records post by default users?
below is what in my .cgi file;
sub switch_to_reply {
#-----------------------------------------------------
$cols = 'ID,ReplyID,ReplyName,ReplyBgColor,ReplyDate,ReplyMessage,ReplyEmail,ReplyICQ,ReplyValidated,ReplyPopular,YourUsername,Userid';
@db_cols = split /,/,$cols;
$db_file_name = $db_script_path . "/reply.db";
$db_sort{'ReplyDate '} = 'date';
}
sub switch_to_topic {
#-----------------------------------------------------
$cols = 'ID,Name,Age,Location,Email,mm,ICQ,dd,Homepage,Date,Info,Userid,Sex,Graphic,Rating,Votes, yyyy,AllowEmail,Validated,Popular,Color,Province, AllowPostReply';
@db_cols = split /,/,$cols;
$db_file_name = $db_script_path . "/topic.db";
$db_key_pos = 0;
}
code i added to reply.html at sub html_record_form
after my (%rec) = @_;
##############
if ($in{'ID'}) {
$rec{'ID'} = $in{'ID'};
}
and code i added in topic.html at sub html_record_long
if ($rec{'AllowPostReply'} eq "Y") {
print qq|<tr>
<td width="100%">
<a href="$db_script_url?db=reply&uid=$db_uid&ID=$rec{'ID'}&add_form=1">µÔªÁ˹è͹Ð</a></font></td>
</tr>|;
}
then in this sub at the bottom after |; before }add code
###add switch
# Tell DBMan to look in the other database
&switch_to_reply;
#Clear out any previous search terms
undef %in;
# Get rid of any bold tags that might be in the userid field
$rec{'ID'} =~ s/<.?B>//g;
# Look for items added by this user
$in{'ID'} = $rec{'ID'};
#add this for only validate show
#$in{'Validated'} = 'Yes';
# Sort the results by the DateAdded field, in descending order
$in{'sb'} = 5;
$in{'so'} = 'descend';
# Set the maximum number of hits per page to a large enough number to guarantee that all records will be returned
$in{'mh'} = 100;
# Do the search
my ($status2,@hits2) = &query("view");
# If there are any search results
if ($status2 eq "ok") {
# Calculate the number of records returned
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
# Set up a table for the display
print qq|<table cellpadding=0 cellspacing=0 border=1>|;
# Go through each hit and print out the results
for (0 .. $numhits2 - 1) {
# Break the array into a hash for printing
%rec2 = &array_to_hash($_, @hits2);
# Print out the link to the full item record
# Note that I am using $db_script_url and *not* $db_script_link_url.
print qq|
<tr><td>$rec2{'ReplyID'}
</td></tr> |;
}
print qq|</table>|;
}
# Tell DBMan to go back to the original database
&switch_to_topic;
Any help would be great appreciated.
Please Excuse me for my poor knoledge of PERL
Regards,
Act.