Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Faq System And Register_globals Fix


invasi0n

Recommended Posts

Hello,

 

I've done exactly what Harald Ponce de Leon said here and everything works just fine with one exception, the FAQ System. The problem is that the Admin side (faq_manager.php) is like dead. I can't edit, add, delete faqs anymore.

 

Anyone knows where the problem could be?

 

 

Here is admin/faq_manager.php

 

<?php
/*
 FAQ system for OSC 2.2 MS2 v2.1  22.02.2005
 Originally Created by: http://adgrafics.com [email protected]
 Updated by: http://www.webandpepper.ch [email protected] v2.0 (03.03.2004)
 Last Modified: http://shopandgo.caesium55.com [email protected] v2.1 (22.02.2005)
 Released under the GNU General Public License
 osCommerce, Open Source E-Commerce Solutions
 Copyright (c) 2004 osCommerce
*/

 require('includes/application_top.php');
 require(DIR_WS_LANGUAGES . $language . '/faq.php');
 require(DIR_WS_FUNCTIONS . '/faq.php');

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo FAQ_SYSTEM; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<table border=0 width="100%">
<?php

switch($faq_action) {

 case "Added":
$data = browse_faq($language,$HTTP_GET_VARS);
$no = 1;
if (sizeof($data) > 0) {
  while (list($key, $val) = each($data)) {
	  $no++;
  }
};
$title = FAQ_ADD . ' #' . $no;
echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=AddSure');
include('faq_form.php');
 break;

 case "AddSure":
function add_faq ($data) {
  $query = "INSERT INTO " . TABLE_FAQ . " VALUES(null, '$data[visible]', '$data[v_order]', '$data[question]', '$data[answer]', NOW(''),'$data[faq_language]')";
  tep_db_query($query);
  unset($HTTP_POST_VARS);
}
if ($v_order && $answer && $question) {
  if ((INT)$v_order) {
	add_faq($HTTP_POST_VARS);
	$data = browse_faq($language,$HTTP_GET_VARS);
	$title = FAQ_CREATED . ' ' . FAQ_ADD_QUEUE . ' ' . $v_order;
	include('faq_list.php');
  } else {
	  $error = 20;
  }
} else {
  $error = 80;
}
 break;

 case "Edit":
if ($faq_id) {
  $edit = read_data($faq_id);
  $data = browse_faq($language,$HTTP_GET_VARS);
  $button = array("Update");
  $title = FAQ_EDIT_ID . ' ' . $faq_id;
  echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=Update');
  echo tep_draw_hidden_field('faq_id', $faq_id);
  include('faq_form.php');
} else {
  $error = 80;
}
 break;

 case "Update":
function update_faq ($data) {
  tep_db_query("UPDATE " . TABLE_FAQ . " SET question='$data[question]', answer='$data[answer]', visible='$data[visible]', v_order=$data[v_order], date = now() WHERE faq_id=$data[faq_id]");
}
if ($faq_id && $question && $answer && $v_order) {
  if ((INT)$v_order) {
	update_faq($HTTP_POST_VARS);
	$data = browse_faq($language,$HTTP_GET_VARS);
	$title = FAQ_UPDATED_ID . ' ' . $faq_id;
	include('faq_list.php');
  } else {
	  $error = 20;
  } 
} else {
  $error = 80;
}
 break;

 case 'Visible':
function tep_set_faq_visible($faq_id, $HTTP_GET_VARS) {
  if ($HTTP_GET_VARS['visible'] == 1) {
	return tep_db_query("update " . TABLE_FAQ . " set visible = '0', date = now() where faq_id = '" . $faq_id . "'");
  } else{
	return tep_db_query("update " . TABLE_FAQ . " set visible = '1', date = now() where faq_id = '" . $faq_id . "'");
  } 
}
tep_set_faq_visible($faq_id, $HTTP_GET_VARS);
$data = browse_faq($language,$HTTP_GET_VARS);
if ($HTTP_GET_VARS['visible'] == 1) {
  $vivod = FAQ_DEACTIVATED_ID;
} else {
  $vivod = FAQ_ACTIVATED_ID;
}
$title = $vivod . ' ' . $faq_id;
include('faq_list.php');
 break;

 case "Delete":
if ($faq_id) {
  $delete = read_data($faq_id);
  $data = browse_faq($language,$HTTP_GET_VARS);
  $title = FAQ_DELETE_CONFITMATION_ID . ' ' . $faq_id;
  echo '
	  <tr class="pageHeading"><td>' . $title . '</td></tr>
	  <tr><td class="dataTableContent"><b>' . FAQ_QUESTION . ':</b></td></tr>
	  <tr><td class="dataTableContent">' . $delete[question] . '</td></tr>
	  <tr><td class="dataTableContent"><b>' . FAQ_ANSWER . ':</b></td></tr>
	  <tr><td class="dataTableContent">' . $delete[answer] . '</td></tr>
	  <tr><td align="right">
  ';
  echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=DelSure&faq_id='.$val[faq_id]);
  echo tep_draw_hidden_field('faq_id', $faq_id);
  echo tep_image_submit('button_delete.gif', IMAGE_DELETE);
  echo '<a href="' . tep_href_link(FILENAME_FAQ_MANAGER, '', 'NONSSL') . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
  echo '</form></td></tr>';
} else {
  $error = 80;
}
 break;


 case "DelSure":
function delete_faq ($faq_id) {
  tep_db_query("DELETE FROM " . TABLE_FAQ . " WHERE faq_id=$faq_id");
}
if ($faq_id) {
  delete_faq($faq_id);
  $data = browse_faq($language,$HTTP_GET_VARS);
  $title = FAQ_DELETED_ID . ' ' . $faq_id;
  include('faq_list.php');
} else {
  $error = 80;
}
 break;


 default:
$data = browse_faq($language,$HTTP_GET_VARS);
$title = FAQ_MANAGER;
include('faq_list.php');
 break;
}

if ($error) {
 $content = error_message($error);
 echo $content;
 $data = browse_faq($language,$HTTP_GET_VARS);
 $no = 1;
 if (sizeof($data) > 0) {
  while (list($key, $val) = each($data)) {
	$no++; 
  }
 };
 $title = FAQ_ADD_QUEUE . ' ' . $no;
 echo tep_draw_form('',FILENAME_FAQ_MANAGER, 'faq_action=AddSure');
 include('faq_form.php');
}
?>
</table>
</td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Nobody who use Faq System has this problem?

Hi invasi0n,

 

I have just installed FAQ system, I was wondering how can I edit the questions ? I mean, I have English question 1?.

You know how I am supposed to edit the FAQ ??

Thanks in advance.

Cheers,

BrazilianLink

Link to comment
Share on other sites

Did you install the sql?

Hi again Coopco,

Yes I did install the faq.sql file. Am I supposed to edit the FAQ System through this sql file ?

If yes, sorry to ask you, how can I do that ? Can I do via myPHPAdmin ??

Thanks once again for your help.

Regards,

BrazilianLink

Link to comment
Share on other sites

Hi again Coopco,

Yes I did install the faq.sql file. Am I supposed to edit the FAQ System through this sql file ?

If yes, sorry to ask you, how can I do that ? Can I do via myPHPAdmin ??

Thanks once again for your help.

Regards,

BrazilianLink

No.

 

In admin FAQ System, on the right, there is a culumn called action. One icon is edit, the other is delete.

 

At the bottom is an insert and cancel. Use insert to put in a new page.

Link to comment
Share on other sites

No.

 

In admin FAQ System, on the right, there is a culumn called action. One icon is edit, the other is delete.

 

At the bottom is an insert and cancel. Use insert to put in a new page.

I see it now. Thanks a lot for that !!

Cheers

Link to comment
Share on other sites

@ Brazilianlink

Can you tell me please if you have Register_Globals OFF?

Did you change anything in configure.php, or is this after the august osc update?

Link to comment
Share on other sites

  • 1 month later...

I am having the same issues too. I can not insert, edit or delete through the Admin. All the buttons just refresh the page and do nothing. If I want to add, edit, or delete something I have to do it through the database. So if their a fix for this?

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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