Jump to content

Recommended Posts

Hello

 

I am currently running a site which runs a listing of programs. I have a form in admin area to add new listings, and members mail me with info, so I can add their programs.

 

I would like to have this more automated, so here is what I need ( and my question)

 

I can easily put my "add program form" to the members area, but need some kind of "approve" function in admin area.

 

Is it possible to add such function, by editing the mysql table ( some table with a "false" statement) and so on, or is this way to complicated to figure out?

 

Best regards,

Casper

You are on the track. Do it mysql with my sql by adding a column like active or approved. If this is false then do not display/use the program. If it is approved allow the program to be used.

 

Not really complicated if you ask me, you just need to add a new form for the approval process.

well, my biggest problem is:

 

I kinda understand how this works, but writting the needed php code will definitly be a failure:-(

 

I guess as these programs are listed in order I should use like program number, and then approved with a value like 0 for not approved and 1 for approved.

 

So not really sure where to start....

 

Any ideas would be appriciated..

 

Create a new mysql table called "approval" or something similiar.

 

Anytime a new function is requested you put this into the approval table. From here you display on a page the approval table which shows the new functions that need approved. Here you do have that column of approved with a 1 or 0. If you choose to approve the item then you copy that function right then and there to the "functions" table or the current table. Anything in that table is allowed to be used. Then you set the approved = 1 and go on. If you choose to deny the action, set the approved to -1. This is so you can choose to pull it up at a later date if you want to. Or just delete if you do not approve.

 

Hope that helps.

I would start by determining what information I would store in the MySQL Database, Here's a simple Table layout for possible entry....

IDNAMESUBMITTEDAUTHOR
STATUS

1PHP-GTK12-21-08PEARSON
0

2PHP-GTK212-25-08PEARSON
1

 

Next i would go about creating a form for possible file upload/other information eg;

<form action="" method="POST" >
<input type="text" name="project" value=""  />
<input type="text" name="author" value=""  />
<input type="file" name="file" value=""  />
<input type="submit" name="submit" value=""  />
</form>

/*
you would process the upload, or data, and pass it into the database....at which point the user part of this would be complete...

You would simply extract the data from the database and create approve/disable links from an admin page, which would then call another piece of php to edit the given value of the table for the given item... :-) 
*/

 

 

Hope this kinda makes sense... are you trying to make this as a stand alone script ? or making part of a greater, already active project ?

 

 

This would be a part of an already installed script, so the form and tables are already created. I guess "all" I need is to add the aprove part to the table, and edit the pages for which it appears to read this value. Then the admin part to make and approved "button" to change this value.

 

Let me see what I can do, and thanks for the help. If you have any bright ideas let me know:-)

I have added a row in the "moneysoftware" table named "approved" with value "0"

 

The below code is how it fetches the information from the "moneysoftware" table.

 

What should I write so it will only show the below info, if the "approved value is "1"?

And where to put it?

 

<?
$memuser=$_SESSION["username_session"];
if($_POST) {
foreach($_POST as $k=>$v) {
if($k!="p") {
$mailbody .=$k." = ".$v."\r\n";
}
}
$d=Split("\r\n",$mailbody);
for($i=0;$i<count($d)-1;$i++) {
  $dataa=split(" = ",$d[$i]);
  $dataa[0]=eregi_replace("username","",$dataa[0]);

   $rs=mysql_query("select * from moneysoftware where ID=".$dataa[0]);
   if(mysql_num_rows($rs)>0) {
    $arr=mysql_fetch_array($rs);
    $user="admin";
    $rss=mysql_query("select * from membersmoneysoftware where Username='$memuser' and PID=$arr[0]");
    if(mysql_num_rows($rss)>0) {
    $rss=mysql_query("update membersmoneysoftware set affiliateid='".$dataa[1]."' where Username='$memuser' and PID=$arr[0]");
     }
     else {
         if($dataa[1]=="") { 
 } 
	 else {
     $sql="insert into membersmoneysoftware(Username,PID,affiliateid) values ('$memuser',$arr[0],'$dataa[1]')";
     mysql_query($sql);
 }
     }
    }
}
echo "<br><br><b>Records Updated Successfully</b><br>";
}


$result=mysql_query("Select * from users where Username='$_SESSION[username_session]'");
$rs=mysql_fetch_row($result);
$ref_by=$rs[11];

if($ref_by=="") {
$user="admin";
}
else {
$rs=mysql_query("select * from users where Username='$ref_by'");
if(mysql_num_rows($rs)>0) {
$user=$ref_by;
}
else {
$user="admin";
}
}

  $sql = "Select * from moneysoftware order by ID";
  $result = mysql_query($sql);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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