[PHP] Sending PHP mail with Authentication

2013-09-25 Thread dealTek
Hi All,

Semi newbie email question...

I have used the - mail() — Send mail php function to send email from a site.

now it seems the server is blocking this for safety because I should be using 
authentication

Q: mail() does not have authentication - correct?

Q: So I read from the link below that maybe I should use - PEAR Mail package 
 is this a good choice to send mail with authentication?

...any suggestions for basic sending email with authentication (setup info and 
links also) would be welcome


http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session_unset - session_destroy issue

2013-08-15 Thread dealTek
Hi all,

I am having trouble with session_destroy - session_unset and $_SESSION = 
array()... I am trying to STOP and destroy all session vars..


with the simple code test below I would think it would echo test 1 BUT FAIL on 
test2 
- however it shows both for me...

how do I UNSET - DESTROY SESSIONS?


?php


session_start();

$_SESSION['var1'] = 'test1';
echo 'br / test1 '. $_SESSION['var1'].' ';

session_unset();
session_destroy();
$_SESSION = array();


$_SESSION['var1'] = 'test2';

echo 'br / test2 ' . $_SESSION['var1'];



?


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Session Vars not staying active

2013-08-03 Thread dealTek
Hi all,


I am having trouble with session vars.

I'm trying to implement the credit card direct pay method outlined here...

http://developer.authorize.net/api/dpm/

- Basically, page 1 is my form that goes outside my site to the cc gateway 
company then comes back with a result... (PG2)

Problem: if I try to create session vars on page 1 - they don't work on page 2.

Am I correct in thinking that when this process leaves my site and goes to the 
gateway, then returns, it is similar to creating a new session and that is why 
the session vars don't remain active?

Thanks in advance.




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] query order issue

2013-07-20 Thread dealTek
Hi all,


I have a page that starts with several mysql sql query searches and displays 
data below...

then I added a form (with hidden line do-update value UPDATE) on the same 
page with action to same page...


then above other sql queries - I put...

if ((isset($_POST[do-update]))  ($_POST[do-update] == update)) {

---do update query---

echo 'meta http-equiv=refresh content=0; url=gohere.php';

}

but it shows error that happens AFTER the meta http-equiv=refresh has happened


Catchable fatal error: xxx on line 226



BTW - the meta http-equiv=refresh does work but the error flashes 1st for a 
second...

Q: I would have thought that it would not go past the line - meta 
http-equiv=refresh - but it does any insight on this






--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Making a Timeout Expiration Length to Session Variables

2013-07-07 Thread dealTek
Hi all,

I would like to make a timeout length to session variables, so that if a user 
didn't use the browser page for let's say 5 minutes - the session variables 
would expire and the user would need to login again.


Q: What's the best way to implement this functionality?


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] newbie PDO query display question

2013-06-16 Thread dealTek
Hi all,

newbie PDO question...

I think (hard to tell - buried in a wrapper class) I am doing a select query 
using  - PDO::FETCH_ASSOC like...

wrapper -- return $pdostmt-fetchAll(PDO::FETCH_ASSOC);

---

so my query is like...

$results = $db-select(mytable, id = 201); //just 1 exact record)

then I can loop like..
foreach ($results as $result) {
    
?

  tr
td?php echo $result[First]; ?/td
td?php echo $result[Last]; ?/td
td?php echo $result[id]; ?/td

  /tr

This all works fine.

--- But since I only have 1 exact record - I don't need to LOOP anything - 
so...

Q: How do I display the columns without a loop


these fail - so what will work

echo $results[First];
echo $results[First][0]; ???
echo $results[First][1]; ???





--
Thanks,
Dave
r...@musenet.com
[db-3]




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] newbie PDO query display question

2013-06-16 Thread dealTek

On Jun 16, 2013, at 3:37 PM, Stephen stephe...@rogers.com wrote:

 Here is a sample from my code:
 
 $photo_category_list = ;
$SQL = SELECT category_id, category_name FROM gallery_category ORDER by 
 category_order;
try {
$stmt = $dbh-prepare($SQL);
$stmt-execute();
while ( list( $id, $name) = $stmt-fetch(PDO::FETCH_NUM)) {
$photo_category_list .= option value=$id$name/option\n;
   }
}
catch (PDOException $e){
echo 'Error getting category name. ' . $e-getMessage();
}
return $photo_category_list;
 
 Try to avoid your code assuming that you will just get one record back 
 (unless you use Limit 1)
 


Thanks Stephen,

Nice code!

you mentioned ... - to avoid your code assuming that you will just get one 
record back

But what about the case where you are deliberately just showing one record as 
in  FIND ONE PERSON like where ID = 101 ?

do you still need to loop through when you just selected/displayed 1 ITEM? 

Q: How do I display the columns without a loop in this 1 record case...?


these fail - so what will work?

echo $results[First];
echo $results[First][0]; ???
echo $results[First][1]; ???



 While works better than foreach for getting the result rows from PDO








--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] newbie PDO query display question

2013-06-16 Thread dealTek
 
 
 When you know there is only one row to be returned you can do this:
 
 $photo_category_list = ;
   $SQL = SELECT category_id, category_name FROM gallery_category ORDER by 
 category_order;
   try {
   $stmt = $dbh-prepare($SQL);
   $stmt-execute();
   list( $id, $name) = $stmt-fetch(PDO::FETCH_NUM));
  }
   }
   catch (PDOException $e){
   echo 'Error getting category name. ' . $e-getMessage();
   }
 
 echo $id;
 echo $name;
 
 And you could also do
 
   list( $result[id], $result[name]) = $stmt-fetch(PDO::FETCH_NUM));
 
 
 -- 
 Stephen
 

Thanks very much for your help Stephen - I will try this asap!




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Detect and Redirect Mobile Users

2013-06-12 Thread dealTek
Hi all,

I'm curious of a simple, common, universal way to detect a mobile user so I can 
redirect them to a mobile directory...

What is best for this: Javascript - CSS - PHP?

I think for my purposes if I can detect screen size or mobile browser agent - 
that would be good enough for what I need right now.

Thanks in advance - Dave


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using Table prefixes

2013-06-08 Thread dealTek
Hi all,

I can see the basic need for a table prefix in a case where you may use one 
mysql database for several projects at once so as to distinguish tables per 
project like...


Project 1

mysales_contacts
mysales_invoices
etc

and

jobs_contacts
jobs_invoices

however I was told a long time ago to use a prefix tbl_ like tbl_Mytable but 
I don't really see much need for this by itself ... Am I missing something?



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Looking for a good working PDO and/or mysqli database class to get started with OOP

2013-05-31 Thread dealTek

On May 30, 2013, at 7:30 PM, tamouse mailing lists tamouse.li...@gmail.com 
wrote:

 Sounds like the OP is asking for a pre-built CRUD interface that
 adapts to his tables and their relationships. It's a fair question,
 just one I don't have an answer to. There must be some kind of ORM for
 PHP?




Thanks tamouse - that is what I was trying to ask about...

Thanks Bastien for the suggestions...
Propel? Eloquent? Doctrine?

Do any of the ones  listed below the email seem like a good start?

Q: DOES ANYONE HAVE ANY OPINIONS ON THE ONES BELOW?

- - - - - MySQLi

https://github.com/ajillion/PHP-MySQLi-Database-Class

http://www.phpclasses.org/package/2359-PHP-MySQL-database-wrapper-using-MySQLi-extension.html

http://snipplr.com/view/22992/

Jeffrey Way...
http://forrst.com/posts/Mysqli_Database_Class-hxb

http://www.dotred.be/blog/database-classes-for-mysql-mysqli-and-mssql/

- - - - - PDO

Jeffrey Way - some issues here in comments
http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/

http://www.phpclasses.org/package/7533-PHP-Access-SQL-databases-using-PDO.html

http://www.doctrine-project.org/projects/dbal.html

http://pear.php.net/package/MDB2


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Looking for a good working PDO and/or mysqli database class to get started with OOP

2013-05-30 Thread dealTek
Hi all, Thanks for your help...

I'm looking for a very good, pre made, working PDO and/or mysqli database class 
(in a wrapper) - to get started with, that has all the basic needs like UPDATE 
- INSERT - DELETE - QUERY etc. That would be very helpful. I'm also trying to 
learn OOP, and creating my own class to start out is over my head, so one that 
is recommended here would be a good start. 

There are many examples on the net - The problem is that commenters often have 
issues with the code, and as a beginner in this area - these issues are 
sometimes over my head and it would be best for me if someone could recommend a 
good working standard model to start.


Q: DOES ANYONE HAVE ANY OPINIONS ON THE ONES BELOW?

- - - - - MySQLi

https://github.com/ajillion/PHP-MySQLi-Database-Class

http://www.phpclasses.org/package/2359-PHP-MySQL-database-wrapper-using-MySQLi-extension.html

http://snipplr.com/view/22992/

Jeffrey Way...
http://forrst.com/posts/Mysqli_Database_Class-hxb

http://www.dotred.be/blog/database-classes-for-mysql-mysqli-and-mssql/

- - - - - PDO

Jeffrey Way - some issues here in comments
http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/

http://www.phpclasses.org/package/7533-PHP-Access-SQL-databases-using-PDO.html

http://www.doctrine-project.org/projects/dbal.html

http://pear.php.net/package/MDB2


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Can javascript or php help with this

2013-05-26 Thread dealTek

On May 26, 2013, at 5:48 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 5/25/2013 9:11 PM, dealTek wrote:
 
 On May 25, 2013, at 4:30 PM, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 
 So - create another field on your form.  Add an onclick event to your 
 submit button.  Have it run a js function that takes the two fields and 
 places them into the new field.
 
 function combineFields()
 {
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
 }
 
 Might have to play with this syntax to avoid the values being 
 arithmetically added instead of concatenated, but this is one way.
 
 And of course - you could try posting on a js site instead of a php one.
 

 
 HTH.
 BTW - I see a small typo in my concat statement - 'Id', not 'ID'.
 
 -- 

AHA - at first it was not working but now it works like a charm - THANKS Jim - 
this really helps a lot!!!



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Can javascript or php help with this

2013-05-25 Thread dealTek
Hi all,

I have a php form that has a pull down select for MONTH and one for YEAR

- usually when the form is submitted you would combine them at the other end 
like 0517 (like credit card exp date) - but in this case I need to combine them 
prior to submitting the form...

I don't know javascript but I'm curious if someone might know a way to use 
javascript (or some other method) to set another input field - EXPDATE - to 
contain the value MONTH  YEAR combined prior to submitting the form?

... and in this case the form is going outside my site and other reasons so 
it's best to set this up prior to submitting the form.

 
--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Can javascript or php help with this

2013-05-25 Thread dealTek

On May 25, 2013, at 4:30 PM, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 
 So - create another field on your form.  Add an onclick event to your submit 
 button.  Have it run a js function that takes the two fields and places them 
 into the new field.
 
 function combineFields()
 {
  var mm = document.getElementById(monthfld).value;
  var yy = document.getElementById('yearfld).value;
  document.getElementByID(mmyy).value = +mm+yy;
  return true;
 }
 
 Might have to play with this syntax to avoid the values being arithmetically 
 added instead of concatenated, but this is one way.
 
 And of course - you could try posting on a js site instead of a php one.
 


Thanks so much Jim - I will check into this (and I did just join a 
javascript list)


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Moving from mysql functions to mysqli or PDO - which is best?

2013-05-23 Thread dealTek

On May 18, 2013, at 11:33 AM, Matijn Woudt tijn...@gmail.com wrote:

 
 Probably some people will say PDO, others will say MySQLi, in general it 
 doesn't really matter, and I think you have named the biggest differences in 
 your mail.
 So if you're going to stick with MySQL anyway, you can take advantage of the 
 speed with MySQLi. 
 
 What class are you looking for?
 MySQLi can be used as a class, and PDO is a class too?
 
 - Matijn 


Hi Matjin,

Sorry for the delay in getting back... 

Thanks for the update Matjin,

 Also I'm also trying to learn OOP, so I'm looking for a very good working PDO 
 and/or mysqli database class - to get started with, that has all the basic 
 needs like UPDATE - INSERT - DELETE - QUERY etc. That would be very helpful.


I'm still looking into both possibilities either MySQLi or PDO and the idea of 
creating a class myself is just over my head at this point. When I managed to 
find some home grown classes for either - often the comments from other users 
would point to bugs/issues with the code so they didn't seem like good starting 
points This is why I imagine that any recommendations of both MySQLi or PDO 
classes from this good group would be a better starting point.

Thanks in advance!



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Moving from mysql functions to mysqli or PDO - which is best?

2013-05-18 Thread dealTek
Hi folks,

[post newbie abilities] - I'm attempting to move away from PHP mysql functions 
to something newer, either mysqli or PDO.

I have read various things about them, but I'm curious at this point which 
would be best to learn for the present and future. I'm usually working on small 
to medium size projects.

I understand that PDO has an extra abstraction layer so it can work with / 
convert to other databases like oracle and others fairly easily, but some have 
said that PDO can be a bit slower the MySQLi?

So I would really like to hear opinions on the best choices of either MySQLi or 
PDO.

Also I'm also trying to learn OOP, so I'm looking for a very good working PDO 
and/or mysqli database class - to get started with, that has all the basic 
needs like UPDATE - INSERT - DELETE - QUERY etc. That would be very helpful.

Thanks in advance for your opinions!


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] looking for a PDF generator class/library for PHP 5?

2013-05-18 Thread dealTek

Thanks Jose and Ali - I will look into them.

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] looking for a PDF generator class/library for PHP 5?

2013-05-17 Thread dealTek
Hi all,

I'm looking into a good versatile PDF generator class/library to use with PHP 
5? --- Preferably one which is maintained somewhat recently...

Mostly needed for basic pages, but I also have some longer reports (more than 
one  8.5 x 11 page) and it would be nice if  the pdf was able to split it up 
without losing part of the font when crossing page boundaries etc...



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek
Hi all,

newbie - just starting with trying to parse XML...


$mylist = simplexml_load_file('thelist.xml');

then use a foreach to echo the data...

?php
$mysongs = simplexml_load_file('songs.xml');

foreach ($mysongs as $songinfo) {
$title=$songinfo-title;
$artist=$songinfo-artist;
$date=$songinfo['dateplayed'];
echo $title.' --- ';
echo $artist.' --- ';
echo $date.' --- ';
echo ' /br ';
}

?

that I get ...

Question: how do you use $mylist when the xml is not as a file but is returned 
on a web page?


an example of the real xml I am trying to work with is like this demo below 

Goal : when this response comes back - I would like to be able to get the data 
as php and then update the database


example
?xml version=1.0 encoding=UTF-8?
response
  result1/result
  result-textSUCCESS/result-text
  transaction-id1865264174/transaction-id
  result-code100/result-code
  authorization-code123456/authorization-code
  avs-resultN/avs-result
  cvv-resultN/cvv-result
  action-typesale/action-type
  amount12.00/amount
  ip-address::1/ip-address
  industryecommerce/industry
  processor-idccprocessora/processor-id
  currencyUSD/currency
  order-descriptionSmall Order/order-description
  merchant-defined-field-1Red/merchant-defined-field-1
  merchant-defined-field-2Medium/merchant-defined-field-2
  order-id1234/order-id
  tax-amount2.00/tax-amount
  shipping-amount0.00/shipping-amount
  billing
first-nameJohn/first-name
last-nameSmith/last-name
address11234 Main St./address1
cityBeverly Hills/city
stateCA/state
postal90210/postal
countryUS/country
phone555-555-/phone
emailt...@example.com/email
companyAcme, Inc./company
cc-number40**0002/cc-number
cc-exp0118/cc-exp
  /billing
  shipping
first-nameMary/first-name
last-nameSmith/last-name
address11234 Main St./address1
cityBeverly Hills/city
stateCA/state
postal90210/postal
countryUS/country
address2Unit #2/address2
  /shipping
  product
product-codeSKU-123456/product-code
descriptiontest product description/description
commodity-codeabc/commodity-code
unit-of-measure1/unit-of-measure
unit-cost5./unit-cost
quantity1./quantity
total-amount7.00/total-amount
tax-amount2.00/tax-amount
tax-rate1.00/tax-rate
discount-amount2.00/discount-amount
discount-rate1.00/discount-rate
tax-typesales/tax-type
alternate-tax-id12345/alternate-tax-id
  /product
  product
product-codeSKU-123456/product-code
descriptiontest 2 product description/description
commodity-codeabc/commodity-code
unit-of-measure2/unit-of-measure
unit-cost2.5000/unit-cost
quantity2./quantity
total-amount7.00/total-amount
tax-amount2.00/tax-amount
tax-rate1.00/tax-rate
discount-amount2.00/discount-amount
discount-rate1.00/discount-rate
tax-typesales/tax-type
alternate-tax-id12345/alternate-tax-id
  /product
/response








--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote:

 A webpage is a file, that (usually) a browser downloads and parses. You'll 
 do exactly the same :-) I don't know exactly, but you can try to pass the URL 
 directly to simplexml_load_file(). If this doesn't work, download the content 
 (for example with file_get_contents()) and pass it to 
 simplexml_load_string(). There are obviously many other approaches, but you 
 should now have an idea :-)
 

Thanks Sebastian for the help

Actually what is happening in my case is:

page1.php is sending out to credit card company - getting processed - then 
coming back to the *same page1.php* with the XML data listed below...

- so I'm not going to some other page to get it - it is coming to me to the 
same page I am on..

so - after the XML result comes in - I need to assign the php to the XML 
somehow...

I hope I am making myself clear

Thanks in advance for the help


 Or you use a specialized library like Guzzle.
 
 Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:
 Hi all,
 
 newbie - just starting with trying to parse XML...
 
 
 $mylist = simplexml_load_file('thelist.xml');
 
 then use a foreach to echo the data...
 
 ?php
 $mysongs = simplexml_load_file('songs.xml');
 
 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }
 
 ?
 
 that I get ...
 
 Question: how do you use $mylist when the xml is not as a file but is 
 returned on a web page?
 
 
 an example of the real xml I am trying to work with is like this demo below 
 
 
 Goal : when this response comes back - I would like to be able to get the 
 data as php and then update the database
 
 
 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response
 
 
 
 
 
 
 
 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]
 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek
;

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Add http headers to let 
it know we're sending XML

$xmlString = $xmlRequest-saveXML();

curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirects

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return into a variable

curl_setopt($ch, CURLOPT_PORT, 443); // Set the port number

curl_setopt($ch, CURLOPT_TIMEOUT, 15); // Times out after 15s

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlString); // Add XML directly in 
POST



curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);





// This should be unset in production use. With it on, it forces the ssl 
cert to be valid

// before sending info.

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);



if (!($data = curl_exec($ch))) {

print  curl error = .curl_error($ch) .\n;

throw New Exception( CURL ERROR : . curl_error($ch));



}

curl_close($ch);



return $data;

  }



  // Helper function to make building xml dom easier

  function appendXmlNode($parentNode,$name, $value) {

$tempNode = new DOMElement($name,$value);

$parentNode-appendChild($tempNode);

  }



?






--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-15 Thread dealTek

On Feb 14, 2013, at 11:46 AM, Bastien Koert phps...@gmail.com wrote:

 
 
 The DreamInCode one is good. MySQLi is the recommended option over
 MySQL since the mysql one is deprecated. PDO is also a great option
 since you can prepare your queries to help sanitize the data
 
 -- 
 
 Bastien



Thanks Bastien,

I imagine this is what you were referring to?

http://www.dreamincode.net/forums/topic/54239-introduction-to-mysqli-and-prepared-statements/

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-15 Thread dealTek
 ;
 */
public function delete($table, $condition)
{
$cdt = $this-get_condition($condition);
$this-sql = 'delete from ' . $table . ' where ' . $cdt;
return $this-exec($this-sql, __METHOD__);
}

/**
 * 
 * @Function : exec;
 * @Param  $ : $sql, $method;
 * @Return Int ;
 */
public function exec($sql, $method = '')
{
try
{
$this-sql = $sql . $this-tail;
$efnum = parent::exec($this-sql);
}
catch(PDOException $e)
{
echo 'PDO ' . $method . ' Error: ' . $e-getMessage();
}
return intval($efnum);
}

/**
 * 
 * @Function : setLimit;
 * @Param  $ : $start, $length;
 * @Return ;
 */
public function set_limit($start = 0, $length = 20)
{
$this-tail = ' limit ' . $start . ', ' . $length;
}
}
?



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]











--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread dealTek
Hi everybody,

Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
(using CRUD)

Simple story: creating this class database by myself is way over my head. So it 
be best for me to find something on the Internet that has already been created 
and working to pro specs (using CRUD with good security etc).

In my studying, it seems that there is a difference between MySQL and MySQLi - 
MySQLi  being the preferred choice if I understand correctly.

There are lots of examples on the Internet however I don't know enough about it 
to know a good starting example from a bad starting example, so I would much 
appreciate any assistance pointing me towards a good starting point

This seems a good start to me untrained eye, but it seems to be for mysql - not 
mysqli...

http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/

http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/

http://snipplr.com/view/8417/

http://snipplr.com/view/12535/

any assistance is appreciated!

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread dealTek


On Feb 14, 2013, at 9:49 AM, dealTek deal...@gmail.com wrote:

 Hi everybody,
 
 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)
 
 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).
 
 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.
 
 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point
 
 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...
 
 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/
 
 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/
 
 http://snipplr.com/view/8417/
 
 http://snipplr.com/view/12535/
 
 any assistance is appreciated!



An Here Jeffry Way discusses the PDO API

http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/






 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]
 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] newbie with imap_mail_move

2013-02-09 Thread dealTek
Hi all,

I'm a newbie with imap_mail_move

trying to open the INBOX and move all mail to LEGACY folder box (got this 
code from the net)


it shows these errors... any idea how to fix this?

---

Warning: reset() [function.reset]: Passed variable is not an array or object in 
/home/bbeast/public_html/emtest/em-move.php on line 91

Warning: implode() [function.implode]: Invalid arguments passed in 
/home/bbeast/public_html/emtest/em-move.php on line 92

Notice: Unknown: Error in IMAP command received by server. (errflg=2) in 
Unknown on line 0

---


?php


$host1='{mail.xxx.com:993/ssl/novalidate-cert}INBOX';
$user='xxx';
$pass='xxx';


$mbox=@imap_open($host1,$user,$pass) or die(Can't connect:  . 
imap_last_error());

$mbox_name = INBOX;
$newmbox_name = LEGACY;



if ($mbox_name != $newmbox_name) { 
  reset($msg_no); 
  $messageset = implode (,,$msg_no); 
  imap_mail_move($mbox,$messageset,$newmbox_name); 
  imap_expunge($mbox); 
} 


imap_close($mbox);
?

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Noobie starting to learn OOP for databases needs help

2012-12-16 Thread dealTek
Hi all,

Noobie starting to learn oop for databases from here:

https://github.com/JeffreyWay/PHP-MySQL-Database-Class/blob/master/MysqlDb.php

I've got lots working but have a few issues:

1 - after an insert I'd like to get the id of the new record and I'm not sure 
how to get that...

mysql_insert_id (depricated?) or mysqli_insert_id() (I am using mySql 5.3)

not sure where to add this... (most likely in MysqlDb.php but I don't know 
where or how...)

http://de.php.net/manual/en/function.mysql-insert-id.php

2 - how does one do aggrigate select queries like SELECT SUM(price) FROM 
mytable ... what I tried seemed to fail...


And if anyone can point to some good OOP training URL's I'd appreciate it.

Thanks in advance for any assistance...







--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-12]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Noobie starting to learn OOP for databases needs help

2012-12-16 Thread dealTek

On Dec 16, 2012, at 10:08 AM, Sebastian Krebs krebs@gmail.com wrote:

 2012/12/16 dealTek deal...@gmail.com
 
 Hi all,
 
 Noobie starting to learn oop for databases from here:
 
 
 https://github.com/JeffreyWay/PHP-MySQL-Database-Class/blob/master/MysqlDb.php
 
 I've got lots working but have a few issues:
 
 1 - after an insert I'd like to get the id of the new record and I'm not
 sure how to get that...
 
 mysql_insert_id (depricated?) or mysqli_insert_id() (I am using mySql 5.3)
 
 not sure where to add this... (most likely in MysqlDb.php but I don't know
 where or how...)
 
 
 Instead of true let insert() return the id.
 
 And while looking at your code:
 - You wrote in your DocBlocks, that the methods returns a boolean 0 or 1.
 Beside that this is wrong (0 or 1 are integers) you return either 'true' or
 nothing. You should return 'false' as well.
 - Returning a boolean to indicate the success of a method only makes sense,
 when not successful is a valid case, but I guess when 'delete()' fail it
 not be treatened as normal. You should throw an Exception instead. This
 also includes: It's not required, that a method returns something in every
 case. If delete() for example doesn't have to tell something, it
 shouldn't.
 
 
 
 http://de.php.net/manual/en/function.mysql-insert-id.php
 
 2 - how does one do aggrigate select queries like SELECT SUM(price) FROM
 mytable ... what I tried seemed to fail...
 
 
 Nothing seems to fail ;) Either it fails, or not (or it just doesn't
 behave, like expected, what I see as fail too). So what happens?
 

Hi Sebastian,

Of course you're right well it does fail here...

when I try a page with this...

$results = $db-query('SELECT SUM(price) FROM tbl_1218');

the error is
Fatal error: Problem preparing query in /Users/me/Sites/db/test/sqldb.php on 
line 281


   /**
* Method attempts to prepare the SQL query
* and throws an error if there was a problem.
*/
   protected function _prepareQuery() 
   {
  //echo $this-_query; rev this is now fixed with this update
  if (!$stmt = $this-_mysql-prepare($this-_query)) {
 trigger_error(Problem preparing query, E_USER_ERROR); --- this 
is line 281
  }
  return $stmt;
   }




 
 
 
 And if anyone can point to some good OOP training URL's I'd appreciate it.
 
 Thanks in advance for any assistance...
 
 
 
 
 
 
 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-12]
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -- 
 github.com/KingCrunch


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-12]



Re: [PHP] Working on a Subsummary Report

2011-12-17 Thread DealTek

On Dec 16, 2011, at 12:56 PM, Jim Lucas wrote:
 
 
 1) What does your db schema look like?
 2) What SQL do you currently use?
 3) What criteria do you want to use to sort the data?
 4) Will the output be plaintext, html, etc?
 5) Is this going to be used to import into another app, or display  printing?
 

Hi Jim - sorry I didn't see this earlier...


1 - schema - think of a basic 2 table system  parent table and line items 
table... - but really all the important fields are in the child line items...
2 - mysql 5.xx
3 - sort 1st by date (all records happen 1st of every month) then product (only 
2 products needed for this)
4 - html for now
5 - for now just display and printing like:


JAN 2011
--- PRODUCT 1

data row 1
data row 2

--- PRODUCT 2

data row 3
data row 4

like that...


- thanks for checking this out




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]





Re: [PHP] Working on a Subsummary Report

2011-12-17 Thread DealTek
 
 
 for the above to work right, you will need to loop through the mysql result 
 set
 one time.  Placing all the results in to one large array.  Then you can loop
 through the array as many times as needed.
 
 What you will probably find is that you can sort all the data into the proper
 order withing your SQL statement.  Then display the data looping through the
 mysql result set once without having to create the additional array mentioned 
 in
 my first statement above.



Thanks Jim,

I will look into how to make this work with arrays...

more beginner questions...

- as stated -  when I try to loop through 2x ...
- the table 2 only shows 1 record..
- Q: ... like the query number row number? needs to be reset - but how?

So is it not possible to loop more than 1x? Is that why we are loading into 
array?


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working on a Subsummary Report

2011-12-16 Thread DealTek
 
 
 I would give consideration to the 'group by' function for your query, and 
 loop through that.

Thanks Mike - will do...

--

*beginner question* - what would we call this type of query/display:

reporting or summary or ? I'm not sure what terms look up?

it would be similar to query all categories and their products sold in a year 
and display like:

summary heading1
CAT 1
 sub head 1--- Prod 1

--- sales prod data 1
--- sales prod data 2 etc

 sub head 2--- Prod 2

--- sales prod data 3
--- sales prod data 4 etc

summary heading2
CAT 2
 sub head 3--- Prod 3

--- sales prod data 5
--- sales prod data 6 etc


any other hints will help a lot...

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working on a Subsummary Report

2011-12-16 Thread DealTek
 
 
 what about creating a master report that has the total summarized by
 category and then offering a drill thru type structure to dig deeper
 in certain areas?



- Hi Bastien,

That's a cool idea. In this case they want it on a longer single page so they 
may save or print all at once.

A while back - I remember doing a query for let's say just the unique product 
names - then as I looped though them in a table - I did a sub query for all 
records with that product name and did a 2nd loop in a second table to show 
them  It ended up working like I wanted but I'm not sure if this was the 
best way to do it


-

also

also while I am testing I am trying to loop through the query 2 times

table 1

i tell it to show records if they meet criteria 1

then do again in table 2

table 2

i tell it to show records if they meet criteria 2

but the table 2 only shows 1 record

Q: ... like the query number row number? needs to be reset - but how?




- like ...

like 2x ...

  ?php do { ?
  
 ?php if ($row_get1['loc'] = 'back') { ?
  
tr
  td?php echo $row_get1['id']; ?/td
  td?php echo $row_get1['loc']; ?/td
  tdnbsp;/td
  tdnbsp;/td
  tdnbsp;/td
  tdnbsp;/td
/tr

   ?php  }; ?

?php } while ($row_get1 = mysql_fetch_assoc($get1)); ?



 
 
 -- 

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Geo IP Location help needed...

2011-10-24 Thread DealTek
newbie question!

Hi all,

So, I had - Geo IP Location -  installed for me on my VPS server by a network 
tech

http://us3.php.net/manual/en/book.geoip.php


then I used: 

geoip_country_name_by_name(xxx) to display the country by name

basically works ok - however a few people say that my page: 

1- will display their remote ip with $_SERVER['REMOTE_ADDR'];

2- ! but for some - the country name is blank ! (defeats the whole purpose)

- I am not sure how:  Geo IP Location actually works...  

Q: Am I correct in assuming that when a country name does NOT show - is it 
because that particular IP is NOT seen by Geo IP Location?

We just installed the latest version (I think) yesterday 

Is it reading from some old outdated database - or 



Q: Is there some code that can ALWAYS tell the country name of the IP?




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Geo IP Location help needed...

2011-10-24 Thread DealTek

On Oct 24, 2011, at 6:23 PM, Bastien wrote:

 
 On 2011-10-24, at 9:07 PM, DealTek deal...@gmail.com wrote:
 
 

 Dave,
 
 If the IP is showing, could there be some left over debug in some function?
 
 If the IP is not in your list it could be anything from a new range for a 
 region to IP spoofing or some anonymizer or even an old DB
 
 Bastien Koert
 905-904-0334

Thanks Bastien,

simple code on my part - so no debug stuff...

 ?php
$ip = $_SERVER['REMOTE_ADDR'];
$this = geoip_country_name_by_name($ip);
echo 'The country you are in is : '.$this;
?

The tester with the error was a friend on his home dsl and also on his 
smartphone (so no IP spoofing from him)...

but maybe the db is old from - Geo IP Location? hmmm .  how do I check?

the link does not provide any contact info...
http://us3.php.net/manual/en/book.geoip.php


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Newbie security database connection question

2011-08-19 Thread DealTek
Hello,

NEWBIE: I have a security question:

When working with PHP and MySQL, it seems that a one method is to create a 
connection.php page to the database that will store the connection parameters 
such as username, password and URL ip in clear text and include this on various 
pages.

Since hackers seem to be getting better and better every day:

-  Is this common practice to store this security data in the clear on the PHP 
webpage?

- Wouldn't it be possible for a hacker to SNIFF around and pick up this 
sensitive clear text security data?

- Is there some better, more secure way to communicate from the website to the 
MySQL data source that is somehow sending encrypted information rather than 
clear text back and forth?

Thanks in advance for your help.


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-11]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Setting up a 2 Column Display for SQL Recordset

2010-08-13 Thread DealTek
newbie question:

Hi Folks,

I have a php / sql data recordset that has 200 names that I want to display in 
a 2 column display ( down on left then down on right side - not left right - 
left right).

So I can create a 2 column table. Then I need to split the data result in 2 
parts - so part 1 (1-100 records) is on the left column and part 2 (101 - 200 
records) is on the right column.

Q: I'm not quite sure how to split / display the records ... Is there some kind 
of internal sql rec number that I can monitor? What is the best way to set this 
up?



--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-10]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Updating Multiple rows in mysql w php at once (newbie)

2010-08-13 Thread DealTek
Hi all,

another newbie question

I have a recordset from mysql - a list of 20 or so  products...


1 - I would like create an edit form to loop through the records and edit a 
text field called 'favorite' for each of the records - (this, I have done)...

2 - then I would like to submit the form and update all records favorite field 
at once...

Q: so how do I create the form and response page so that I can update all 20?

I'm sure it involves numbering the form names like:

$c = 1 - then increment counter

input name =favorite?php echo $c; ?  ...   (1 - text)
input name =favorite?php echo $c; ?  ... (2 - text)
input name =favorite?php echo $c; ?  ... (3 - text)
input name =favorite?php echo $c; ?  ... (4 - text)



...not sure how to loop thru these on the response / update page to get them 
updating correctly




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-10]





Re: [PHP] Creating an Entire .html page with PHP

2010-01-27 Thread dealtek

On 1/26/2010 6:08 PM, clanc...@cybec.com.au wrote:


In principle this is extremely simple. Take your existing procedure to generate 
the page
then:

1. $page = '';

2. Replace every echo 'whatever'; statement with $page .= 'whatever';, and 
everyhtml
with $page .= 'html';

3. file_put_contents($page,$file) // The manual is down (again!) and I have 
forgotten the
format.

4. echo( file_get_contents($file));  // to generate the PHP page.

However I strongly suspect that it is possible to simply redirect all the 
'echo's in your
existing procedure to write to $page (or $file?), without changing the code at 
all. Is
this so?

   

Thanks Clancy for the details - much appreciated,

Actually I would like to use BOTH techniques. If it's possible to take 
an exsisting page and just save that (without all the rewriting ) that 
would also be great...


As an example, say you had a details master dynamic php page to display 
let's say a product (pulled from the database from url ID=334 or whatever)


If I also wanted to create a STATIC .html page from that  for just this 
one product - it would be great to be able to this too.


Part of the reason for this is as Ashley mentioned: SEO

Another thing I'm trying to do is create some admin pages - where a user 
can type in some text and choices - and hard coded .html pages go on the 
site.



Thanks for the help

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP MS Sequel Server

2010-01-17 Thread dealtek

http://www.aspfree.com/c/a/MS-SQL-Server/Using-PHP-with-MS-SQL-Server/

This article seems to sate that PHP can interface with MS Sequel Server 
? If so, is it about the same level of complexity as working with PHP  
MySQL? If one was to choose php  one DB over the other in a general 
comparison (not cost): any preferences?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php