Jump to content

Destruction

Members
  • Posts

    108
  • Joined

  • Last visited

    Never

Posts posted by Destruction

  1. TheOne17:  It appears the problem is this is what they're doing, but customers are simply replying directly to the emails instead of using the links. 

     

    Versatilewt:  Personally I would think the current system would work fine if the customers knew they couldn't simply email back.  I would suggest firstly using an unmonitored email address, stating that it is and setting up an autoresponder so that if they reply, they get an email straight back saying that if they've replied to a ticket they should click the link as this is an unmonitored address.  This will save you creating a system to handle the other and the additional processing etc.

     

    If you are still looking for a way to do this there are tutorials out there on how to use shell scripting to forward emails through a php script etc.  Otherwise you could write a script with imap functions (handles pop3 etc too) in order to parse the emails and set it as a cron.  If you want a more "live" or "realtime" solution I wouldn't really suggest this.  I had a link for a tutorial on evolt if i remember correctly, I'll look it up in a bit and let you know if I find it.

     

    Dest

  2. I can't think of a single good reason why it's a viable discussion.  The person asked for help not flames.  Learn forum etiquette before posting please. 

     

    Also, have you actually benchmarked the differences in string parsing with different arrangements of quotes?  The difference when I've done so in the past is almost negligible.  I will point out that I'm a performance, efficiency, and security freak so I tend to test as many of these theories out as possible for myself.  Still, regardless of it being almost negligible, I tend towards the most efficient option performance-wise.  You need it if you ever get slashdotted or the like ;) lol

     

    Just a small thing to wonder...

    "Learn the basics" - I would have thought that was why they were here?

     

    Dest

  3. "Another solution would be to store the data in hidden fields on the webpage"

     

    Depending on the data of course, otherwise this is just as bad for security as it can be altered and reposted and if there isn't sufficient processing, would cause possible exploits.

     

    Dest

  4. A little theory first.  Say you have ABC and XYZ as you've used above, and you add it to the string each time you have...

     

    First order: $cart = 'ABC'

    Second order: $cart = 'ABC, XYZ'

     

    As you can see above, if you compare XYZ with $cart on your third order it will not be the same.  You would be best using an array, something along the lines of this, before you start using $cart:

     

    <?php
    $cart = array();
    ?>
    

     

    Then your code would be something like:

     

    <?php
    if(count($cart) > 0)
    {   
      if(!in_array($_GET['id'], $cart))
      {
        $cart[] = $_GET['id'];
      }
      else
      {
        echo "you already order the book!";
      }
    }
    ?>
    

     

    This simply checks if there are any items in the array and if so, if any match $_GET['id'].  This is a simple example that you can tailor to suit your needs but I would suggest using arrays in this instance.

     

    Dest

  5. Likely would be best using conditions to check if the files exist before the rewrite and only use the rule if they don't.  This would be accomplished with this I believe:

     

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule ^profiles/([0-9]+) /profiles.php?id=$1 [QSA,L]

     

    If it's PHP that the problem is occurring with using the include() statement this does not have anything to do with the browser so you'll need to check your include statements.

     

    Hope this helps,

     

    Dest

  6. list($nr_rows) = @mysql_fetch_row

    Firstly, why are you using list instead of just $nr_rows = @mysql_fetch_row etc.
    Secondly, that will return an array, empty() is for checking if a string is empty.  An empty array, if I recall, will still return a string value of Array ().
    Thirdly, SELECT COUNT(*) doesn't return a row, it returns a value/result.  You would be best using mysql_fetch_result($query, 0) perhaps.
    Lastly, You are suppressing the error messages using @ but are not providing an alternative.  Without an alternative, you are not going to see what the actual error is.  That is a part of why nesting queries is a very bad idea, as well as the performance issues of using mysql_fetch_row regardless of whether mysql_query actually worked correctly etc.

    Dest
  7. I believe it is because of the internal array pointer as discussed in WebChat.  When you are checking with if(!$result->fetch_array()) you're moving the internal pointer forward one place and there's only one record.  Thus, when it tries to loop, there's nothing for it to loop.  Comment this out and try again.

    Ideally, try checking the number of rows returned is greater than 0 rather than using fetch_array() to check.

    Dest
  8. $query1 = mysql_query("SELECT DISTINCT u.referral FROM user u, transaction t WHERE u.id=t.userID");
    $idlist = array();
    while($row = mysql_fetch_assoc($query1)) {
        $idlist[] = $row['referral'];
    }
    $idlist = explode(",", $idlist);
    $query2 = mysql_query("SELECT *, COUNT(id) AS referrals FROM user WHERE id IN ($idlist) GROUP BY id");

    Or something similar...

    HTH

    Dest
  9. I've come across this recently.  Double check your primary key has it's auto_increment defined.  If not, this will need adjusting otherwise every entry attempted on INSERT without specifying a unique id will fail.  This has happened when I've moved a database from one server to another with a different version so I suspect when I came across it it was a compatibility issue perhaps.

    Dest
  10. Could it be this part...
    $stringlength = strlen($VAL1);
    $VAL2 = substr($VAL2, 11, $stringlength);

    If not, at least that's one thing that'd need changing perhaps.  Although realistically it sounds like it's the math that's at fault.  Also dividing by 200 then multiplying by 100 is the same as dividing by 2, so I'm wondering why the extra work?  Also, why multipy by negative 1?

    Dest
  11. Explode has a third parameter which is limit.  I'll give an example:

    [code]
    <?php
    $var = '/boot username because i said so';
    $parts = explode(' ', $var, 3);
    ?>
    [/code]

    The above will produce an array of 3 parts maximum, the last part will be everything remaining that wasn't exploded.  So, the above would produce:

    1st part: /boot
    2nd part: username
    3rd part: because i said so

    Hope this helps,

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