Jump to content

jus wannit 2 work! Help!!!


postman

Recommended Posts

I sit here with clumps of cherished hair around my chair... :confused:

 

I know little about PHP and less about mySQL. I have a PHP file that updates a "product" array when I go to add it appears to work at POST. However, the it fails to display the added product. I bought this script some years ago and 6 mos later author abandoned support. :'(  Any help is appreciated... 

Link to comment
Share on other sites

Thanks thorpe,

 

for the pointer!

 

path: ..\..\admin\products\update\index.php

<?php
  include ("../../../include/settings/settings.inc.php");
  include ("../../../include/functions/common.inc.php");
  include ("../../../include/functions/database.inc.php");
  include ("../../../include/functions/security.inc.php");
  include ("../../../include/functions/members.inc.php");
  include ("../../../include/functions/products.inc.php");

  session_start();

  secure_admin_page();

  register_variables("POST", "action", "product_id", "product_name", "product_price", "product_link", "product_download_link", "product_description", "product_recurring", "product_is_active", "product_image", "do_delete_picture");

  $session_str = "";
  if (!empty($_SESSION["my_session_path"]))
  {
    $session_str = "?".$_SESSION["my_session_path"];
  }

  $error_result = "";

  if (!empty($action))
  {
    if (store_product($product_id, $product_name, $product_price, $product_link, $product_download_link, $product_description, $product_recurring, $product_is_active, $product_image, $do_delete_picture))
    {
      Header("Location: ".WEBSITE_URL."admin/products/".$session_str);
      exit();
    }
    else
    {
      include ("../../../include/templates/header.tpl.php");
      include ("../../../include/templates/admin/products/update/index.tpl.php");
      include ("../../../include/templates/footer.tpl.php");
    }
  }
  else
  {
    $product = get_selected_product($product_id);
    if (is_array($product))
    {
      $product_name = $product["name"];
      $product_price = $product["price"];
      $product_link = $product["link"];
      $product_download_link = $product["download"];
      $product_description = $product["description"];
      $product_recurring = $product["recurring"];
      $product_is_active = $product["is_active"];
    }
    include ("../../../include/templates/header.tpl.php");
    include ("../../../include/templates/admin/products/update/index.tpl.php");
    include ("../../../include/templates/footer.tpl.php");
  }
?>

In HTML I would be looking for a "submit" issue, in PHP I am so lost...

Link to comment
Share on other sites

postman, the function in your code, register_variables(), has little or nothing to do with register_globals and the link you posted.

 

Your register_variables() function likely validates and extracts the supplied list of named variables out of the $_POST array, but that is just a guess. Without the relevant parts of your script, it will be virtually impossible for anyone to remotely help you.

 

You have not really provided much useful information in this thread. For example, what is the name and version of this script (in case someone who reads this thread has it or knows its' inner workings)? Is the operation you attempted something the script normally does, but it failed for some specific data you tried? Has the operation you attempted worked before and if so, what was different about the data you just attempted to use vs what you used before? Where there any errors (did you check the web server error log for relevant errors as well)? At the point where the data should have showed up, was there any difference at all in the output? .... i.e. supply some helpful information that would allow someone to help you with your problem.

 

 

Link to comment
Share on other sites

PMF,

 

I wish I had better knowledge of PHP and maybe I could comply. I am hesitant to mention the script by name as in another thread on a similar script the new user was berated as a scammer.

 

The script was working. I had tech support at my web host try it this AM and he said it wasnt adding it to the Db. That leads me to surmise it is similar to "submit" in html. Since the script generates the submission form. I suppose what I need to know is that the code  I posted was in fact the form generator, or if it is as you said,  $_POST array.  Which would define the array? So I guess the question is, "is this code generating an input form and is the "(SUBMIT)" syntax to execute correct?

 

This is kinda like giving directions in a forest when all the landmarks are trees. But thanks anyways.

Link to comment
Share on other sites

PFM,

 

Thank you very much! That gives me a place to start. There is a functions directory ..\include\funtions\products.inc.php

 

before i post it, and thorpe has to edit it :D (i guess its the table option). I want to mention. While stumbling around in my Cpanel I activated the OScommerce. It want a stronger password, after that none of the member functions worked. Tech support restored the PW and now the admin product function does not work (the issue we are discussing). However that product.inc.php is just chock full of else error messages. I get no error. I will post the product.inc.php code if needed. I just recall mySQL is picky about change config. after a Db is created. Once a turing script I I had to delete the Db and start over. I just thought the absent errors might be a clue.  *oh, forum scrolls long posts auto ::)

Link to comment
Share on other sites

:DWell! As I am gluing the clumps of cherished hair, back!  Just like HTML it is always the code previous to the error. When I got back to the beginning of the script I was left to stare at mySQL. After a while I began to think what was before the Db and that was it. Tables. ::)

Link to comment
Share on other sites

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.