Jump to content

redbrad0

Members
  • Posts

    107
  • Joined

  • Last visited

    Never

Everything posted by redbrad0

  1. From our website we are connecting to GMAIL to send our emails through SMTP. For some reason it is not sending the emails to the CC or BCC email address event though GMAIL shows it was included in the email. Am I missing something in the below code? $currentTime = time(); $emailTo = "redbrad0@domain.com"; $emailCC = "brad@domain.com"; $emailBCC = "events@domain.com"; $emailSubject = "TEST Email at (" . $currentTime . ")"; $emailBody = "This is the body of the email"; $headers = array(); if (!empty($emailTo)) $headers['TO'] = $emailTo; if (!empty($emailCC)) $headers['CC'] = $emailCC; if (!empty($emailBCC)) $headers['BCC'] = $emailBCC; if (!empty($emailSubject)) $headers['Subject'] = $emailSubject; $headers['From'] = "events@domain.com"; $mime = new Mail_mime("\n"); $mime->setTXTBody($emailBody); $body = $mime->get(); $headers = $mime->headers($headers); $mail = Mail::factory('smtp', array ('host' => 'ssl://smtp.gmail.com', 'auth' => true, 'port' => 465, 'username' => 'events@domain.com', 'password' => 'thepasswordhere')); try { $result = $mail->send($emailTo, $headers, $emailBody); } catch (TixException $ex) { echo "<font color=red>Error:" . $ex->getCode() . "</font><br>"; } echo "Emailed at (" . $currentTime . ")<br>"; die; [attachment deleted by admin]
  2. Thanks everyone for all the details and examples.
  3. Since eregi_replace is deprecated I am trying to convert it to a new regexp replace but cant seem to get it. I thought you could just replace eregi_replace with preg_replace but that is not working. Can someone help me with converting this as I cant seem to figure it out. $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="' . $linkprefix . '\\1">\\1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="' . $linkprefix . 'http://\\2">\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text);
  4. In my code I call PEAR::isError to see if there was an error in the SQL Query so I can log it but its always returning this error. Does anyone know a fix? I have tried to search google it and found http://pear.php.net/bugs/bug.php?id=9950 but it does not say how to fix it. Does anyone have any ideas? Error Non-static method PEAR::isError() should not be called statically $query = "SELECT Column FROM TableName"; $res = $db['database']->query($query); if (PEAR::isError($res)) { $logger->err("Error pulling results from DB. Query:" . $query); }
  5. Can someone help me convert this into a PHP 5 valid code? It looks like I would use stristr but looking at php.net it seems like there is something else I should change. if (eregi("^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$", $parts[1], $regs)) {
  6. Sorry if I didn't hit on the point exactly, but what I'm worried about is the people that manage the servers and the programers that are working on the site. Let's just say I wrote software for a application that I am selling online. They need full access to the source code to be able to make modifications but I wouldn't want them to be able to put the code on a warez site or anything else allowing people to download it without paying. Does this help?
  7. I've been developing a php application that runs my entire company for the last 4 years. One of the things I never thought of until now is that the server guys or anyone else could copy the source code and db and be able to start up another company which brings up my question to you.... How would you protect your application? My thought is to create one small php file that is encrypted with something that is required to make the entire site run (not sure at this point what it would be that they couldn't just rebuild). Then if this file sees it's on a different domain/ip it requests data from my site which logs the info for me to look at. If I find out it's something not approved, it would then not allow the program to run and will give a error. What is your idea?
  8. I am working on taking out the Deprecated functions from my site so while replacing ereg with preg_match I get the below error. Per a message I found on the internet it says to replace ereg with preg_match and everything should work. Can anyone assist me with fixing this error? Error: Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash Part where error is contained if (preg_match('enum.(.*).', $row['Type'], $match)) { $opts = explode(',', $match[1]); foreach ($opts as $item) $finalResult[] = substr($item, 1, strlen($item)-2); } Full Function function getEnumOptions($table, $field) { global $db; $finalResult = array(); if (strlen(trim($table)) < 1) return false; $query = "show columns from " . $db['tickets_slave']->escapeSimple($table); $res =& $db['tickets']->query($query); if (PEAR::isError($res)) { throw new TixException($_SERVER['SCRIPT_NAME'] . ":", TixExceptionCodes::UNKNOWN_ERROR); } else { try { while ($res->fetchInto($row)) { if ($field != $row["Field"]) { } else { //check if enum type if (preg_match('enum.(.*).', $row['Type'], $match)) { $opts = explode(',', $match[1]); foreach ($opts as $item) $finalResult[] = substr($item, 1, strlen($item)-2); } } } } catch (TixException $ex) { throw new TixException($_SERVER['SCRIPT_NAME'] . ":", TixExceptionCodes::UNKNOWN_ERROR); } } return $finalResult; }
  9. On our website, our employees have a custom program that is installed on all the systems that gets associated with a file extension. Then on our website, we have a javascript that sends the file to print which is automatically downloaded and then the file is handled and processed by our local installed application. The problem is that we are having to enable automatic file downloads which opens a security risk. Is there another way that we can handle this so we dont have to adjust their security zone settings? <SCRIPT> setTimeout('location.href="pop_print.php?order=189063"', 1); </SCRIPT>
  10. I just purchased a program that connects via ODBC to any database. The problem is that I don't want to specify the database connection information, so I am hoping I can create a web page with XML feed (or something like that) that the odbc can read and return the data. Is there something like this out there or is it even a possibility?
  11. This seems like a stupid question but I cant seem to figure it out. What I am trying to do is generate an array that looks like the below sample but have all the Member ID's group so I know the card each member grabbed. Array ( [889557275612] => Array ( [0] => Array ( [Cards_ID] => 51 [Cards_MemberID] => 889557275612 [Cards_Card] => 308292114653 [Cards_DateTime] => 1969-12-31 18:00:00 ) [1] => Array ( [Cards_ID] => 51 [Cards_MemberID] => 889557275612 [Cards_Card] => 308292114653 [Cards_DateTime] => 1969-12-31 18:00:00 ) ) [971131027757] => Array ( [0] => Array ( [Cards_ID] => 51 [Cards_MemberID] => 971131027757 [Cards_Card] => 308292114653 [Cards_DateTime] => 1969-12-31 18:00:00 ) ) ) $query = "SELECT * FROM Cards"; $res =& $db['tickets']->query($query); if (PEAR::isError($res)) throw new TixException($_SERVER['SCRIPT_NAME'] . ":", TixExceptionCodes::UNKNOWN_ERROR); $cardsGrouped = array(); while ($res->fetchInto($row)) { array_push($cardsGrouped[$row['Card_MemberID']], $row); }
  12. I have a sample PHP script where I am posting data to UPS using curl, and then getting the data returned. The problem I am having is when I get curl_exec to pull the data and store it in a variable, it is actually printing it out on the web page. Does someone see a problem with this script on why its pulling the data and printing it instead of storing in the $result variable? $xmlRequest = "<?xml version=\"1.0\"?>\n". "<AccessRequest>\n". " <AccessLicenseNumber>" . $LicenseNumber . "</AccessLicenseNumber>\n". " <UserId>" . $Username . "</UserId>\n". " <Password>" . $Password . "</Password>\n". "</AccessRequest>\n". "<?xml version=\"1.0\"?>\n". "<AddressValidationRequest xml:lang=\"en-US\">\n". " <Request>\n". " <TransactionReference>\n". " <CustomerContext>MarketingWebForce.com</CustomerContext>\n". " <XpciVersion>1.0001</XpciVersion>\n". " </TransactionReference>\n". " <RequestAction>AV</RequestAction>\n". " </Request>\n". " <Address>\n"; $xmlRequest .= " <City>Oklahoma City</City>\n"; $xmlRequest .= " <StateProvinceCode>OK</StateProvinceCode>\n"; $xmlRequest .= " <PostalCode>73142</PostalCode>\n"; $xmlRequest .= " </Address>\n". "</AddressValidationRequest>"; //set POST variables $url = 'https://wwwcie.ups.com/ups.app/xml/AV'; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,'1'); curl_setopt($ch,CURLOPT_POSTFIELDS,$xmlRequest); [color=red]//execute post echo "<hr>PULLING DATA<br>"; $result = curl_exec($ch); echo "<hr>DATA PULLED<br>";[/color] //close connection curl_close($ch); echo "<hr>PRINTING DATA<br>"; print_r($result); echo "<hr>DATA PRINTED<br>";
  13. We have a custom software that some of our clients use that we wrote. When these users are in out backend website i want the website to know if they have the program installed on the computer they are logged in on. I know javascript can't access to see if a program is installed but wondering if there was something else that could be used. Even if I have to get our printing software written in a different language (its in C# .net) I need to find a way. Our clients use all sort of browsers so it would need to work on the main browsers.
  14. Wow what a great topic and great info. Thanks everyone for your posts. I am starting to think that building a table of available barcodes is the way to go and setting the max number of barcodes available in the database to a number that I should not need more than that in any given day. Because barcodes are released everyday as they were not used, when I release the barcodes because they are no longer needed I will add them back into the available barcodes which should help finding new barcodes easier. Trying to add a salt pattern, I dont see that mt_rand supports this. Do you have a example? mt_rand ( int $min , int $max )
  15. I thought about creating a array of all the barcodes in use, and then running a search on the array on each barcode to find a empty one, but thought it could be a bad idea to store that many items in a array. Basically when I start to generate barcodes, I am not just generating one but I generate approx 500 - 5,000 at a time as a product can have anywhere between 500 - 5,000 barcodes that need to be associated with it. Anyone else?
  16. In our software, each item has its own 12 digit unique barcode. We are getting close to having 1 million records which out of 500 million, you would think we would not have any problems. I ran a test with our script and generated and logged 990,319 barcodes which are listed below. You can see that calling 1 million barcodes I only generated 162 unique. Because I check if the barcode is unique by searching the database I am having to run a TON of querys. Questions 1. Is there a better way to generate a random 12 digit number (has to start with a 1 - 9) 2. Can you think of a way to improve finding a unique barcode even if I have 400 million barcodes in our database? function generateBarcode() { $tmpBarcodeID = ""; $tmpCountTrys = 0; while ($tmpBarcodeID == "") { srand ((double) microtime( )*1000000); $random_1 = rand(1,9); $random_2 = rand(0,9); $random_3 = rand(0,9); $random_4 = rand(0,9); $random_5 = rand(0,9); $random_6 = rand(0,9); $random_7 = rand(0,9); $random_8 = rand(0,9); $random_9 = rand(0,9); $random_10 = rand(0,9); $random_11 = rand(0,9); $random_12 = rand(0,9); $tmpBarcodeID = $random_1 . $random_2 . $random_3 . $random_4 . $random_5 . $random_6 . $random_7 . $random_8 . $random_9 . $random_10 . $random_11 . $random_12; // LETS CHECK TO SEE IF THIS NUMBER HAS EVER BEEN USED $query = "select count(Barcode_ID) as tot from Barcode where Barcode_Barcode='" . $tmpBarcodeID . "'"; $res =& $this->db->query($query); if (PEAR::isError($res)) { throw new TixException("Barcode.class:", TixExceptionCodes::DATABASE_ERROR); } else { if ($res->numRows() == 1) { $res->fetchInto($row); if ($row['tot'] == 0 && !empty($tmpBarcodeID)) { $this->barcode = $tmpBarcodeID; return $tmpBarcodeID; } } $tmpBarcodeID = ""; $tmpCountTrys++; } } } TotBarcodes Barcode_TimesCalled 162 1 907 2 3354 3 9112 4 20493 5 37695 6 59876 7 83655 8 103426 9 115105 10 117007 11 108835 12 92765 13 74812 14 55155 15 38704 16 25616 17 16299 18 9841 19 5818 20 3529 21 2275 22 1436 23 1088 24 800 25 658 26 497 27 422 28 291 29 210 30 150 31 127 32 64 33 55 34 35 35 19 36 11 37 8 38 3 40 2 41 1 42 1 47
  17. At some point around 8:30 this morning I am just noticing that the imagerotate function is no longer working on our server. This is a dedicated server so I have full control over it. Looking at PHPINFO I show that the GD Library is installed and enabled. Anyone have any ideas what could have happened or what I can do to try and fix this? GD Support enabled GD Version 2.0 or higher FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.3.7 T1Lib Support enabled GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled
  18. So if I store the _FILES into a array like suggested, then I can handle this? But doesn't that mean that the files will be uploaded to the server? I could just make the image upload the last part of the "wizard" but I would rather keep it where it is. So any suggestions on the way to handle this would be great.
  19. This isnt really a question on how to upload a image to the server but more how I can let the user select a file to upload and pass the location that the user wants to upload the image from to another page. This other page will allow them to fill out some additional information and then when they click submit, at that time it will upload the image to the server. I was thinking I might be able to pass the value thru a hidden input field, but I can't seem to get it to work. Is this even a possibility?
  20. I am using a class that returns information in a array. If I do print_r on the info that is returned it outputs the below info I am trying to return the value of "status" and of the "id" but this just returns a empty variable. I am sure this is something simple, but can't seem to figure out what its doing. echo "Status:" . $event['@attributes']['status'] . "<br>"; echo "ID:" . $event['id'] . "<br>"; The full code is below $ev = &new Services_Eventful(); // THE BELOW CODE WILL ADD A EVENT // ---------------------------------------------------------------------- $args = array( 'title' =>'THIS IS A TEST EVENT BY BRAD', 'start_time' => '2009-01-27 20:00:00', 'description' => 'THIS IS THE DESCRIPTION OF BRADS TEST EVENT', 'free' => '0', 'price' => '$25.00 - $35.00', 'venue_id' => 'V0-001-001450976-5' ); $event = $ev->call('events/new', $args); // ---------------------------------------------------------------------- if ( PEAR::isError($event) ) { print("An error occurred: " . $event->getMessage() . "\n"); print_r( $ev ); } else { echo "Status:" . $event['@attributes']['status'] . "<br>"; echo "ID:" . $event['id'] . "<br>"; } // The return value from a call is a SimpleXML data object. print_r( $event );
  21. I am trying to get the width of each character so I can write the text to the middle of the screen. The problem is, there is a big difference if in the imagettftext i set the font size from 10 to 50. How can I grab the accurate font width depending on the font size? $font_file = "cour.ttf"; $font_black = imagecolorresolve($im, 0, 0, 0); $font = imageloadfont($font_file); // Font size should be set here I am guessing $text_width = imagefontwidth($font); imagettftext($image, 10, 0, 10, 30, $font_black, $font_file, "size 10"); imagettftext($image, 40, 0, 10, 30, $font_black, $font_file, "size 40");
  22. var purchase_warning="**** EVENT INFORMATION - CONFIRM WITH CUSTOMER ****\n\n"; purchase_warning+= "- Must be at the venue by 9:30 PM. - Under 18 must have a adult"; purchase_warning+="\n\nCall (866) 888-8888 if you have any questions."; Sorry I wasnt that clear. Starting Code var purchase_warning="**** EVENT INFORMATION - CONFIRM WITH CUSTOMER ****\n\n"; purchase_warning+= "{$Event->get_ImportantEventInformation('Javascript')}"; purchase_warning+="\n\nCall (866) 888-8888 if you have any questions."; Output var purchase_warning="**** EVENT INFORMATION - CONFIRM WITH CUSTOMER ****\n\n"; purchase_warning+= "- Must be at the venue by 9:30 PM. - Under 18 must have a adult"; purchase_warning+="\n\nCall (866) 888-8888 if you have any questions."; Expected Output var purchase_warning="**** EVENT INFORMATION - CONFIRM WITH CUSTOMER ****\n\n"; purchase_warning+= "- Must be at the venue by 9:30 PM.\n - Under 18 must have a adult"; purchase_warning+="\n\nCall (866) 888-8888 if you have any questions.";
  23. I have a function that returns information and either displays it in HTML on the page, or displays it in Javascript. The problem is if someone puts content with line breaks, that messes up Javascript. The problem is that when it writes it out into the browsers html, it doesnt display the \n, it just does a character return. How can I stop this? function get_ImportantEventInformation($DisplayType='HTML') { if ($DisplayType=='Javascript') { return str_replace("\r\n", "\n", $this->options['ImportantEventInformation']); } else { return nl2br($this->options['ImportantEventInformation']); } }
×
×
  • 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.