Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by CroNiX

  1. I don't know why you're doing it like you are, if I understand correctly. There is no need to put the POST value in a separate array and then loop over it, only to explode the value and assign it to another array.

     

    This assumes you have a form using arrays for the field name, IE:

    <input name="abc[]" type="checkbox" />

    <input name="abc[]" type="checkbox" />

    $updated = array();
    if (isset($_POST['abc']) && is_array($_POST['abc']))
    {
      foreach($_POST['abc'] as $field)
      {
        //grab id, name and date and assign to variables
        list($id, $name, $date) = explode(',', $field);
    
        //append $updated array with new array using wanted named key => field pairs
        $updated[] = array(
          'id'   => $id,
          'name' => $name,
          'date' => $date
        );
      }
    }
    
    print_r($updated);
    //assuming $_POST['abc'][0] = '1,xyz,06/04/2015'
    //assuming $_POST['abc'][1] = '2,abc,06/05/2015'
    array(
      0 => array(
        'id'   => '1',
        'name' => 'xyz',
        'date' => '06/04/2015'
      ),
      1 => array(
        'id'   => '2',
        'name' => 'abc',
        'date' => '06/05/2015'
      )
    );

    If you're meaning your form is set up like this and NOT using arrays for input names:

    <input name="abc" type="checkbox" />

     

    then it would be more like

    $updated = array();
    if (isset($_POST['abc']) && ! empty($_POST['abc']))
    {
      //grab id, name and date and assign to variables
      list($id, $name, $date) = explode(',', $_POST['abc']);
    
      //append $updated array with new array using wanted named key => field pairs
      $updated = array(
        'id'   => $id,
        'name' => $name,
        'date' => $date
      );
    }
    
    print_r($updated);
    //assuming $_POST['abc'] = '1,xyz,06/04/2015'
    
    array(
      'id'   => '1',
      'name' => 'xyz',
      'date' => '06/04/2015'
    );
  2. Basically the way most of them work is you output your image using html, and setting the height and width to be smaller, like a thumbnail. Then when you click the thumbnail, an image viewer pops up and shows the image at full size. Really nothing to do with PHP though.

  3. Personally I wouldn't store the whole path and would just store the filename and create the path when outputting (or define it as a variable and use that when outputting). What if you decide to change where you store the images down the road? They're all hardcoded in your db.

  4. You wouldn't store the abandoned cart data in session. You'd store it in another table using the users id, so when the user logs in you just check to see if they have an abandoned cart entry and see if they'd like to purchase it or delete it. When the cart is purchased, you wipe out that cart data from that table.

  5. You can't track text emails, and you will only be able to track the people using HTML email IF they have "display images" enabled in their email client, which is turned OFF in a lot of email clients by default.

     

    The way that tracking works is when the email client (basically a simple HTML browser) requests the image from YOUR server in order to display it, it creates an entry in the server log just like it does for ALL requests (html/js/css/etc) to the server. So at that point you KNOW the person opened the email or it wouldn't have made the image request. You obviously can't send an image in text email. So it's not perfect and won't be able to track everybody, only people who view the email as HTML AND have view images enabled.

  6. It seems pretty clear by the description in your first post what needs to be done.

     

    1) Create a DB schema to store the required data from the web page - You'll need to identify what is needed

    2) Retrieve the webpage using PHP

    3) Parse the required data from the retrieved webpage and insert it into the db into the appropriate fields in your table(s)

     

    The only thing that isn't clear to me is what is meant by "metadata".

  7. But why do you need the extra step of an ajax call to do that when you could just build the options with the same data getSalas.php is doing to begin with? The only time I'd do it the way you are is if the options need to change from their original values at some point, like they select something in SELECT box A, which changes the results available in SELECT box B.

  8. The website most likely is using some sort of facebook plugin, like to show likes and stuff. That code is spying on the users who are logged into facebook and who are also on your site, gathering information on everything they view or do on your site (at least pages that use their plugin). The same with google analytics...they track users viewing habits which is how they target "relevant" ads to each user. Same thing happens if you search in google and then go to a site that displays google adwords. You'll see ads on that site that is something you've searched for elsewhere.

     

    That's one reason why I always physically log out of facebook before going to a different site...then they can't track me. They can only track if you're logged into facebook and don't log out.

  9. What are these emails going to be for? Are they critical to your site? Will email go to end users or just internal staff? Email is a very complex beast if you want it to always get to the inbox of the recipient. There are IP reputations to consider, PTR records, RDNS records,  SPF record, DKIM, whether your IP (or IP on same subnet) is in a RBL, and several other things that have to be perfect or a lot of ISPs will either reject the email, or put it in spam. If your email is critical, I'd seriously look into services like SendGrid, or even using a GMail (for business) account to send the email through. You don't even need to have an email server as you can use an external SMTP service to send the email through and use a good mailer like PHPMailer instead of the basic mail() function that php supplies. You can spend a lot of time trying to get email right, but unless you're an expert I'd leave it to the experts :) It's a very complex thing to get right and, no offense, but you seem to be struggling with the basics here.

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