Jump to content

Recommended Posts

Hey guys,

 

I'm running a lyrics website from a script I bought. There is an admin section where it lists all tracks that have been submitted by a user via the front end submit form. They are put in to a database called "pending lyrics". On the admin section I have to press 'approve' or 'decline' for each individual lyric (there's 300+ at the moment). I believe the lyrics are disseminated in to the correct tables when approved.

 

I have attached a screenshot of what I describe above.

 

Below is the page script for all of that functionality. What i'd like to be able to do is press a button that says "approve all". So it approves each individual track all together.

 


<?php

include_once("../config.inc.php");
include_once("../db_connect.php");

$ptitle    = "Approve New Lyrics";
$meta_keys = "";
$meta_desc = "";
$selected  = "ADMIN";

include("../header.php");

$approve = $_REQUEST['approve'];
$decline = $_REQUEST['decline'];
$item    = $_REQUEST['item'];

if($approve) {
  $get_info  = mysql_query("SELECT * FROM pendinglyrics WHERE id = ".$item." LIMIT 1");
  $artist    = mysql_result($get_info, 0, artist);
  $track     = mysql_result($get_info, 0, track);
  $album     = mysql_result($get_info, 0, album);
  $lyrics    = mysql_result($get_info, 0, lyrics);
  $dateadded = mysql_result($get_info, 0, dateadded);
  $insert    = mysql_query("INSERT INTO tracks (artist, title, album, dateadded) VALUES ('".$artist."', '".$track."', '".$album."', '".$dateadded."')");
  if($insert) {
    $trackid = mysql_insert_id();
$insert2 = mysql_query("INSERT INTO lyrics (trackid, lyrics) VALUES (".$trackid.", '".formatField($lyrics)."')");
if($insert2) $delete    = mysql_query("DELETE FROM pendinglyrics WHERE id = ".$item." LIMIT 1");
  }
}
elseif($decline) {
  $delete = mysql_query("DELETE FROM pendinglyrics WHERE id = ".$item." LIMIT 1");
}

  $pending = mysql_query("SELECT * FROM pendinglyrics ORDER BY dateadded LIMIT 300");

?>

<table width="100%" cellspacing="5" cellpadding="0">
  <tr>
    <td valign="top">
	<?php
	  echo "<b>Approve New Lyrics:</b><br><br>";
	  echo "Listed below are all the pending lyrics on the system. Choose the relevant option next to each item to approve or remove the lyrics.<br><br>";
	?>
	</td>
  </tr>
</table>

<?php
echo "<table width='100%' cellspacing='0' cellpadding='0'>";
if(mysql_numrows($pending) > 0) {
  $tracker = $start+1;
  while($row = mysql_fetch_array($pending)) {
    echo "<form method='POST' action='index.html'><input name='item' type='hidden' value='".$row[id]."'><tr><td width='40' align='right'><b>".$tracker.".</b>   </td><td class='listingtitle'><b>".$row[track]."</b> by <b>".$row[artist]."</b></td><td rowspan='2' width='150'><input name='approve' value='approve' type='submit'> <input name='decline' value='decline' type='submit'></td></tr></form>";
    echo "<tr><td></td><td>".trim(substr(stripslashes($row[lyrics]), 0, 120))."... <a href='viewitem.html?j=".$row[id]."' class='morelink'>view lyrics</a><br><br></td></tr>";
	$tracker++;
  }
}
else echo "<tr><td><br> <b>There are currently no pending lyrics.</b><br><br></td></tr>";
echo "</table>";
?>

<?php
include("../footer.php");
?>

 

 

Anyone got any ideas on whether this is possible? And if so, how to do it? Complete novice over here! :)

 

Looking forward to your thoughts!

 

Thanks,

 

 

[attachment deleted by admin]

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.