Location: PHPKode > projects > Protoforge > protoforge_v1.2/protoforge/linklist_edit_submit.php
<?php $deb = false;
require_once('config.inc.php');
require_once(PF_INCLUDE.'verifyUserID.inc.php');

if (require_once(PF_BASE.'connect.php'))
	$link = connect();

if (isset($_POST['redirect'])) { $redirect = $_POST['redirect']; }
else { $redirect = PF_ROOT; }

try {
	// Select all the information for the user's links
	$links_query = 'SELECT LL_ID FROM link_lists WHERE USER_ID = '.$uid;
	$links_result = mysql_query($links_query);
	if (!$links_result || mysql_num_rows($links_result) <= 0) {
		throw new Exception('Having trouble selecting your links');
	}
	mysql_query('start transaction');
	while ($links_row = mysql_fetch_assoc($links_result)) {
		if (isset($_POST['desc'.$links_row['LL_ID']]) && isset($_POST['link'.$links_row['LL_ID']])) {
			$update = 'UPDATE link_lists SET';
			$update .=' DESCRIPTION = \''.mysql_real_escape_string(strip_tags($_POST['desc'.$links_row['LL_ID']])).'\'';
			$update .=', LINK = \''.mysql_real_escape_string(strip_tags($_POST['link'.$links_row['LL_ID']])).'\'';
			$update .=' WHERE LL_ID = '.$links_row['LL_ID'].' and user_id = '.$uid;

			$result = mysql_query($update);
			if (!$result) {
				mysql_query('rollback');
				throw new Exception('Error encountered updating link: '.$links_row['LL_ID']);
			}
		}
	}
	mysql_query('commit');

} catch (Exception $e) {
	$pfutil = new PFUtil();
	$pfutil->error_page('Error: '.$e->getMessage());
}

$d = new Decode($redirect);
header('Location: '.$d->redirect());

?>
Return current item: Protoforge