?
Solved

checking tutorial links

Posted on 2009-04-10
18
Medium Priority
?
228 Views
Last Modified: 2012-05-06
hello there,
I have a website where I receive submitted links.. every single day I get about 200-300 submissions..
and I have to check each link manually to know which category they belong to.. the categories are
1. canines 2. felines 3. birds 4. reptiles
the links are stored in the database mysql.. so the questions is what can I do so that I can check
those links daily but put them in their own category faster?

I was thinking of maybe having a frame in the bottom showing the submitted links and
4 buttons with categories in the top so that I can click them and automatically put the link into its own category
and then move on to next link.. what do you guys think?
0
Comment
Question by:XK8ER
  • 11
  • 7
18 Comments
 
LVL 9

Expert Comment

by:Mahdii7
ID: 24120355
This may sound silly, but I think the most logical way to do this is have the user select a category while submitting, then you simply moderate them. You could make the process easier with a possible curl request to check validity and maybe store the <title> of the page (so you could quickly dismiss inappropriate links).
0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120357
i know about curl and checking the page, i know I can also have the users submit to the cats.. but thats not what im looking for!!
0
 
LVL 9

Expert Comment

by:Mahdii7
ID: 24120366
Great, so aside from that all I can really suggest is parsing the HTML of the site and trying to code an algorithm to "guess" the category.

Do you have any idea at all on how you would like to accomplish this? Or you just want someone to make it happen? Those are my suggestions, sorry they don't work for you. Maybe someone will program some AI for you.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:XK8ER
ID: 24120377
all I can say is that I dont want anything automated.. I really need to check All of them manually but the question is how can I do that faster!!
0
 
LVL 9

Expert Comment

by:Mahdii7
ID: 24120381
How do you do it currently? Whats your process? I'm sure we could streamline it. I thought you wanted an automated system, sorry, I misunderstood.
0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120423
I open each link on a new tab then I copy/paste it where it belongs..
0
 
LVL 9

Expert Comment

by:Mahdii7
ID: 24120445
I don't know, maybe I'm getting frustrated here for no good reason.. I'd be happy to help you if you let me help you.. But I feel like you either aren't trying, don't know what to ask for, or you don't understand how your site currently works.

You copy + paste the URLs, that's all good, but how do you store the URLs? Is there information you could grab (automatically) to help you make a quicker decision on where the link should go?

How do you add the URLs to their categories? PHPMyAdmin? Administrative front-end that you've programmed? SQL prompt through SSH? Manual creation of HTML page?

What information do you need to add to your website? Just the URL + Category? How do you store this information?

Do you have a code snippet of your administrative panel (if applicable) so I could provide you with some relevant code?

0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120479
alright after testing for hrs I think something like this would be great..
with a php and mysql.. so open test.php and make a mysql query to get the record like (newLinks)

and then if you click in dogs
UPDATE newLinks SET group=1

or clicking on cats
UPDATE newLinks SET group=2

you see what im trying to do here? i need help on the mysqld queries though

the mysql database had id, url, groupid
<table class="style1" align="center">
	<tr>
		<td align="center"><a href="#">Cats</a> | <a href="#">Dogs</a></td></tr>
		<tr><td align="center">URL: </td></tr>
		<tr><td align="center"><iframe src="http://google.com" width="1020" height="800"></iframe></td>
	</tr>
</table>

Open in new window

0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120482
id, url, groupid, checked

checked default is 0 so that we dont check the same urls over and over
0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120506
something like this

SELECT * FROM `newLinks` WHERE checked = 0 LIMIT 0,1

Open in new window

0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120532
this is what I have done so far and its showing the links from mysql is this correct coding? im not an expert!!
<?PHP
$conn = mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db('db_site', $conn) or die(mysql_error());
 
$query="SELECT * FROM `newLinks` WHERE checked = 0 LIMIT 0,1";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
 
?>
 
<table class="style1" align="center">
	<tr>
		<td align="center"><a href="#">dogs</a> | <a href="#">cats</a></td></tr>
		<tr><td align="center">ID: <? echo $row['id']; ?></td></tr>
		<tr><td align="center"><iframe src="<? echo $row['url']; ?>" width="1020" height="800"></iframe></td>
	</tr>
</table>
 
<? } ?>

Open in new window

0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120558
the only help I need now is, how can I make the buttons

UPDATE newLinks SET group=3 WHERE id=30;

that part
0
 
LVL 9

Expert Comment

by:Mahdii7
ID: 24120571
sec
0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120595
this is what I have so far
<?PHP
$conn = mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db('db_site', $conn) or die(mysql_error());
 
if ($_GET['move'] != '') {
			//UPDATE newLinks SET groupid=3 WHERE id=$row['id'];
}
 
$query="SELECT * FROM `newLinks` WHERE kra_check = 0 LIMIT 0,1";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
 
?>
 
<table class="style1" align="center">
	<tr>
		<tr><td align="center"><iframe src="<? echo $row['url']; ?>" width="1020" height="800"></iframe></td>
		<tr><td align="center">Gallery ID: <a href="<? echo $row['url']; ?>" target="_blank"><? echo $row['id']; ?></a></td></tr>
		<td align="center"><a href="?move=1&id=<? echo $row['id']; ?>">dogs</a> | <a href="?move=2&id=<? echo $row['id']; ?>">cats</a></td></tr>					
	</tr>
</table>
 
<? } ?>

Open in new window

0
 
LVL 9

Accepted Solution

by:
Mahdii7 earned 2000 total points
ID: 24120657
This will work out of the box when you link jQuery (http://www.jquery.com) on line: 98

Replace all static arrays with mysql arrays. Adjust the table names/fields as needed.

Should make things go a LOT faster, and has a preview in iframe.

Cheers
<?php
/*
Connect to DB, load libraries etc....
 
 
 
SQL Structure:
 
link_cats
	lc_id | int(12) | PRIMARY_KEY | AUTO_INCREMENT
	lc_name | VARCHAR(255)
	etc...
 
links_filtered
	lf_id | int(12) | PRIMARY_KEY | AUTO_INCREMENT
	lf_cat | int(12)
	lf_url | VARCHAR(255)
	etc...
	
links_submitted
	ls_id | int(12) | PRIMARY_KEY | AUTO_INCREMENT
	ls_url | VARCHAR(255)
	etc...
 
 
For this demonstration, everything will be STATIC, replace STATIC values with DATABASE QUERIES
 
*/
 
function update_lnk($cat, $url){
	$url = mysql_real_escape_string($url);	
	$cat = mysql_real_escape_string($cat);	
	
	$sql = "INSERT INTO links_filtered (lf_cat, lf_id)
			VALUES ('$cat', '$url')";
	// if (mysql_query($sql)){ return true; }else{ return false }    etc..
	return true;
}
 
function deny_lnk($id){
	$id = mysql_real_escape_string($id);	
	
	$sql = "DELETE FROM links_submitted WHERE ls_id = '$id'";
	// if (mysql_query($sql)){ return true; }else{ return false }    etc..	
	return true;
}
 
 
/* First - accept any requests... */
 
if (isset($_GET['deny'])){
	if (deny_lnk($_GET['deny'])){
		echo "Link #".$_GET['deny']." was deleted!";
	}else{
		echo "Query did not execute! Check your code!";
	}
	
	die(); // stop output
}
 
if (isset($_GET['accept'])){
	if (update_lnk($_GET['id'], $_GET['accept'])){
		echo "Link ".$_GET['accept']." was accepted.";
	}else{
		echo "Query did not execute! Check your code!";
	}
	
	die(); // stop output
}
 
 
/* Otherwise.. Load interface */
 
 
// mysql_query("SELECT ls_id, ls_url FROM links_submitted"); ... etc, get array
$submitted = array();
$submitted[] = array("ls_id" => 0, "ls_url" => "http://www.cats.com");
$submitted[] = array("ls_id" => 1, "ls_url" => "http://www.tigers.com");
$submitted[] = array("ls_id" => 2, "ls_url" => "http://www.birds.com");
$submitted[] = array("ls_id" => 3, "ls_url" => "http://www.doves.com");
$submitted[] = array("ls_id" => 4, "ls_url" => "http://www.ligers.com");
 
$rows = count($submitted); // mysql_num_rows
 
// mysql_query("SELECT lc_id, lc_name FROM link_cats"); .. etc
$categories = array();
$categories[] = array("lc_id" => 0, "lc_name" => "Cats");
$categories[] = array("lc_id" => 1, "lc_name" => "Birds");
$categories[] = array("lc_id" => 2, "lc_name" => "Misc");
 
$cat_rows = count($categories); // mysql_num_rows
 
// Okay, some fancy front end
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="/path/to/jquery.js"></script>
<script type="text/javascript">
<!--
	// jQuery structure.. www.jquery.com
 
 
function ajaxCall(query, id){
	if (query.indexOf("accept") == 0){ // if it's accept
		// load the category selected
		query += "&id=" + $("#select_"+id).val();
	}
	$.ajax({
		url:"<?=$_SERVER['PHP_SELF']?>?"+query,
		method:"GET",
		beforeSend: function(){
			$("#info").animate({opacity:0}, 500); // fade before request
		},
		success: function(html){
			$("#info").html(html);
			$("#info").animate({opacity:1}, 500); // fade back when complete, with result
		}
	});
}
 
function setPreview(url){
	$("#ourIframe").attr("src", url);
}
-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Manage Links</title>
</head>
 
<body>
<div align="center" style="width:100%; height:50px;" id="info">Welcome</div>
<?php
//Display links
for($i=0; $i<$rows; $i++){ // static equiv of: while($something = mysql_fetch_assoc($resource)){ (do this) }
	$array = $submitted[$i];// for readability
	?>
<div align="center" style="width:100%;">
    <?=$array['ls_url']?> | 
    <a href='#' onClick='setPreview("<?=$array['ls_url']?>")'>Load Submittal #<?=$array['ls_id']?></a> | 
    <a href='#' onClick='ajaxCall("accept=<?=$array['ls_url']?>", "<?=$array['ls_id']?>")'>Accept Submittal</a> 
    [Category]
    <select id="select_<?=$array['ls_id']?>">
    <?php
    for ($n=0; $n<$cat_rows; $n++){
	$cat_array = $categories[$n];// for readability
		?>
        <option value="<?=$cat_array['lc_id']?>"><?=$cat_array['lc_name']?></option>
        <?php
	}
	?>
    </select> | 
    <a href='#' onClick='ajaxCall("deny=<?=$array['ls_id']?>")'>Delete Submittal</a>
</div>
	<?php
}
?>
<div align="center" style="width:100%;">
- Loader -<br />
<iframe id="ourIframe" src="" width="800" height="600" style="width:800px; height:600px;"></iframe>
</div>
</body>
</html>

Open in new window

0
 
LVL 9

Expert Comment

by:Mahdii7
ID: 24120671
And since you'll have 200-300 links, I'd suggest wrapping the link output in a ~300 high div with overflow:auto so you dont scroll back and forth so much.
0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120682
im trying to query first record, and once checked click on dogs or cats.. and it will not show again because it has been checked already..
so that way two people can be working at the same time..
0
 
LVL 1

Author Comment

by:XK8ER
ID: 24120896
its saying that this line $ is not defined

$.ajax({
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question