Re: [PHP] undef func

2013-05-10 Thread James Yerge
On 05/10/2013 06:08 PM, Gabriel Ricci wrote:
 pear isntall php-dev


 Att.

 Gabriel Ricci
 

 Website http://gabrielricci.github.com
 Follow @gabrielricci http://www.twitter.com/gabrielricci
 Facebook profile http://www.facebook.com/gabrielricci2, GitHub
 profilehttp://www.github.com/gabrielricci/
 http://code.google.com/p/syslibjs/


 On Fri, May 10, 2013 at 7:07 PM, georg georg.chamb...@telia.com wrote:

 **
 So thanx again, closing in. It turned out that I had tried; yum install
 php_pear  // i.e. with an underscore, should be with hyphen !
 so crawling a mm forward; then stuck on; pecl install pdo_odbc// in
 this case the undrscore is ok (!)
 which fails as

 Cant find php headers in /usr/include/php  followed by Error phpize
 failed

 /georg

 - Original Message -
 *From:* Serge Fonville serge.fonvi...@gmail.com
 *To:* georg georg.chamb...@telia.com
 *Cc:* Gabriel Ricci gabrielri...@gmail.com ; Daniel 
 Browndanbr...@php.net; tamouse
 mailing lists tamouse.li...@gmail.com ; PHP 
 Generalphp-general@lists.php.net
 *Sent:* Friday, May 10, 2013 11:41 PM
 *Subject:* Re: [PHP] undef func

  Assuming OP is using a distro that uses yum for package management;
 A yum whatprovides pecl should provide the package name that needs to be
 installed, in case of an apt based distro, this could be done through
 aptitude. Either way, it seems what might provide more information is
 details like the commands executed, the distro used and the errors received

 HTH

  Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


 2013/5/10 georg georg.chamb...@telia.com

 noop, didnt take, no such package, was my reward

 /georg
   - Original Message -
   From: Gabriel Ricci
   To: georg
   Cc: Daniel Brown ; tamouse mailing lists ; PHP General
   Sent: Friday, May 10, 2013 11:06 PM
   Subject: Re: [PHP] undef func


   To have pecl, you need to install PEAR first, yum install php-pear
 (or yum install php5-pear) should work.


   Then you can try pecl install pdo_odbc.



   Att.

   Gabriel Ricci
   

   Website
   Follow @gabrielricci
   Facebook profile, GitHub profile





   On Fri, May 10, 2013 at 6:03 PM, georg georg.chamb...@telia.com
 wrote:

 unfortunately that didnt take, pecl is undefined command (my linux is
 not so strong)
 trying yum renders no such package



 - Original Message - From: Daniel Brown danbr...@php.net
 To: tamouse mailing lists tamouse.li...@gmail.com
 Cc: georg georg.chamb...@telia.com; PHP General 
 php-general@lists.php.net
 Sent: Friday, May 10, 2013 9:21 PM
 Subject: Re: [PHP] undef func




   On Fri, May 10, 2013 at 3:18 PM, tamouse mailing lists
   tamouse.li...@gmail.com wrote:


 Aren't DLLs a Windows thing?


  Yeah, I misread the bit about MS XP and thought he was using XP
   for this install.  I just realized the remainder of the discussion
   between us was off-list, so - for posterity - my response, when
   finding out it is indeed a Linux box, is: pecl install pdo_odbc.

   --
   /Daniel P. Brown
   Network Infrastructure Manager
   http://www.php.net/

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




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





Should be yum install php-devel

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



Re: [PHP] else if vs switch

2012-06-15 Thread James Yerge
On 06/15/2012 06:44 PM, April Mains wrote:
 Ah yes that's it. 

 Thank you for your help. Have a good weekend.

 April

 On 2012-06-15, at 4:29 PM, Joshua Kehn wrote:

 Way easier to just use a map.

 $mapping = array(
  'Calgary' = abc@emailaddress,
  'Brooks' = def@emailaddress,
  // etc
 );
 $toaddress = $mapping[$city];

 Regards,

 –Josh
 
 Joshua Kehn | @joshkehn  
 http://joshuakehn.com

 On Jun 15, 2012, at 6:20 PM, April Mains wrote:

 I have 25 cities and am currently using the following to set the $toaddress 
 for submitting student pre-registration forms based on the city selected:

 if ($city == Calgary) {
$toaddress = abc@emailaddress;
 } elseif ($city == Brooks) {
$toaddress = def@emailaddress;

 and so on.


 Would using switch statements like the following make any appreciable 
 difference?

 switch ($city) {
caseCalgary:
$toaddress = abc@emailaddress;
break;
caseBrooks:
$toaddress = def@emailaddress;
break;

and so on.

 Is there a more elegant solution?

 Thank you for your help,

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



If a database solution isn't desired, check out the parse_ini_file()
function. You can create a simple INI file containing the necessary
mappings and, instead of having to touch the code every time you need to
update a record, you simply modify the INI file.

Another solution would be to use Joshua's suggestion but instead of
managing the array in the PHP file using that array, throw the array in
a separate PHP file and simply require_once() it.

Of course, these solutions assume that the PHP script reading the INI
file or including the PHP that contains the array has the appropriate
file permissions to do so.

Just my two cents :)

- James

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



Re: [PHP] Need help Wth PHP

2011-10-09 Thread James Yerge
On 10/09/2011 08:41 PM, Rod Lindgren wrote:
 I have a hosting account and am trying to get a friend's website up and
 running. We downloaded his existing site from his current host and uploaded
 it to my host. It is currently under a subdomain, www.egypt.aragren.com
 http://www.egypt.aragren.com/ . When I go there, I get an error message
 that says, Error establishing a database connection. What causes this and
 how can I fix it? 


  

 Sensei Rod Lindgren

  

 Sent from my Gateway computer

  

  


This issue isn't related to PHP but the cause of the error is due to the
scripts' inability to make a connection to the database. The error looks
like it's coming from WordPress, I could be wrong but if that's the case
then you need to update the wp-config.php file to reflect the proper
credentials to log into the database.

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



Re: [PHP] What would you like to see in most in a text editor?

2011-09-13 Thread James Yerge
On 09/13/2011 08:40 PM, Jim Lucas wrote:
 On 9/13/2011 5:23 PM, tamouse mailing lists wrote:
 On Tue, Sep 13, 2011 at 3:35 PM, Robert Cummings rob...@interjinn.com 
 wrote:
 I'm a big fan of editors that work in the terminal.
 You'll get my emacs when you pry it out of my cold dead hands.

 +1

 mg too




I'd have to go agree with the exception of s/emacs/vi/ :P

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



Re: [PHP] dev to production server

2011-09-07 Thread James Yerge
On 09/07/2011 12:24 AM, Chris Stinemetz wrote:
 Does anyone have a procedure or know of any tutorials that explain how
 to take a mac/apache/php/mysql dev environment and converting it to
 production environment?

 Basically I want to host my own web site on my local machine now that
 I have finished developing it.

 Thanks in advance!


I'm not familiar with MAC, however, there are projects out there that
provide everything you need, for the most part. Look up XAMPP, I used to
use this in the past before I setup my own personal server.

http://www.apachefriends.org/en/xampp-macosx.html

This should provide you with an environment necessary for development
and production. I currently run Arch Linux on my personal server and
have installed Apache, PHP, MySQL and so on via the package manager. For
my dev/prod process, I'm using Boilerplate, which provides a default
HTML5/CSS3 template. However, the nice thing about it is, they've also
provided a small build process using ANT. I've modified the ANT build
script to my needs and simply build my production environment using
that, keeping my dev code in tact and readable :) They've integrated the
YUI Compressor into their build process is simply minifies all CSS and
JavaScript.

Anyway, enough about that, just an example of what can be done. There's
always the option of compiling everything from source as well :)

James


Re: [PHP] REQUEST and COOKIE

2011-09-06 Thread James Yerge
On 09/06/2011 05:47 PM, ALEJANDRO ZAPIOLA wrote:
 Seeing the $_REQUEST[] and it is a matrix that has the content of $_GET,
 $_POST and $_COOKIE, I think this can be used maliciously into the script.
 i.e.:
 request1.php
 ?php
 setCookie(name,alejandro);
 echo scriptlocation.href='request2.php'/script;
 ?

 In this case, I'm setting the variable 'name' with value 'Alejandro', then
 redirects to request2.php
 request2.php
 ?php
 print_r($_COOKIE);
 echo br;
 print_r($_REQUEST);
 echo br;
 if(@$_REQUEST['name'] == admin){
 echo I am admin;
 }else{
 echo You can not see this page;
 }
 ?

 Here's the problem. The variable called 'name' is into REQUEST context, and
 this is accessible by GET and POST methods, and it is accessible by the
 COOKIE matrix as well. In this case, use Request is unsafe because I can
 change the variable called 'name' via GET method and it's give me access as
 admin.

 Mi question is: I do not see the good practice of using COOKIE values into
 of REQUEST, what I mean is that it can become in a programming bug. Also I
 could not fin answers anywhere else.

 thoughts?
 Thanks!



Why would you use this method to for authentication or validation? By
default, $_REQUEST is populated with the $_GET, $_POST and $_COOKIE
contents, which could potentially be modified by the remote user, which
in turns makes the data not trustworthy.

Never trust input data, ever, it must be sanitized, scrubbed, etc before
even considering it trustworthy - in my opinion.

As for your question, it makes complete sense to populate $_REQUEST with
$_GET, $_POST and $_COOKIE contents by default because the three call in
the REQUEST category for the HTTP protocol. Since the cookie was sent by
the server, the COOKIE header is going to be evident in the REQUEST headers.

Therefore, the only way a bug is going to be introduced and security
breached is by the author of the code ;)

http://us.php.net/manual/en/reserved.variables.request.php

The PHP team even makes mention that the contents of $_REQUEST cannot be
trusted.

James


Re: [PHP] mysqli sql question

2011-08-31 Thread James Yerge
On 08/31/2011 05:23 AM, Peet Grobler wrote:
 Is it possible to get the actual sql that is being used to query or
 update the database?

 E.g
 $sth = $dbh-prepare (update table set field=?, field2=? where id=?);
 mysqli_bind_param ($sth, 'ssi', 'text1', 'text2', 10);
 $sth-execute();

 Something like $sth-sql? Or $dbh-sql?

 I want to see update table set field='text1', field2='text2' where id=10;


 Thanks in advance,
 Peet

Look up the EXPLAIN SQL function call.

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



Re: [PHP] Form Already Filled Out

2011-08-04 Thread James Yerge
On 08/05/2011 12:43 AM, wil prim wrote:
 Hello, S i created a simple login system, and I am using sessions 
 Everything 
 seems to work fine, however; when I upload my files to my server and type my 
 domain name my index.php page comes up and the form is automatically filled 
 out 
 with a username and password. How do i make it empty when I initially enter 
 the 
 site, and yes I did create a logout.php file that destroys a session. Please 
 help, it is hard to explain this when I cant show it in person. Thanks in 
 advance!

 Here is the login.php code, i didn't md5() the password yet:


 ?php

 if ($_SESSION['user'])
 {
 header(Location: error.php);
 exit();
 }
 include('connect.php');
 if ($_POST['login']){


 $user=$_POST['user'];
 $pass=$_POST['pass'];
 $sql=SELECT * FROM members WHERE username='$_POST[user]' and 
 password='$_POST[pass]';
 $result=mysql_query($sql, $con);
 $count=mysql_num_rows($result);
 if ($count==1){
 $_SESSION['user'] = $user;
 header('location: home.php');
 }
 else
 echo p style='color:red'Wrong Username or Password/p;
 }

 ?
 html
 head
 title/title
 link href=style.css rel=stylesheet type=text/css /
 /head
 body

 div id=main
 div id=menu
 ul
 li
 a href=#Home/a
 /li
 li
 a href=#Topix/a
 /li
 li
 a href=#Mission/a
 /li
 /ul
 /div
 div id='content'
 form method='post' action='index.php'
 Username: br/
 input type='text' name='user' maxlength='30'/br/
 Password: br/
 input type=password name='pass' maxlength='30'/br/
 input type=submit value=Log In! name=login/
 /form
 a href=register.html Register? /a

 /div
 /body
 /html

Your browser is more than likely filling in the username and password
fields for you, automatically. Most modern browsers offer this
functionality by default. What you're looking for isn't relative to PHP.

Have you tried visiting your page from multiple browsers, to see if you
get the same results?

You could set the value of the username and password fields in the form
to NULL.

e.g.;
input type='text' name='user' value='' maxlength='30'/
input type=password name='pass' value='' maxlength='30'/

I doubt your visitors are going to encounter the same issue you are,
unless they allow their browser or some other 3rd party software to
automatically fill in the form values for them.

Another method would consist of using JavaScript, once the DOM is ready
(all elements rendered), have JavaScript reset the form values.



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



Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote:
 The desired result is.

 Array
 (
   [0] =  On the;
   [1] =  course or in the;
   [2] =  of colver;
 );

 I am just not sure the delimiter can be an array in the Explode function.






 Richard L. Buskirk

 -Original Message-
 From: Marc Guay [mailto:marc.g...@gmail.com] 
 Sent: Tuesday, May 17, 2011 7:52 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Explode Question

 $one = array(0 ='golf', 1 = 'field');
 $two = array(0 = On the golf course or in the field of clover);
 $array_exp = explode($one, $two);
 What's the desired result?

 array('golf' = On the golf course or in the field of clover,
 'field' =  On the golf course or in the field of clover)); ?


 Marc


explode() takes three parameters; string, string, [int]. Where [int] is
optional.

Ex:
$ipList = '192.168.1.0,192.168.1.1,192.168.1.2';
$ipList = explode(',',$ipList);

Returns an array of strings:

Array
(
[0] = 192.168.1.0,
[1] = 192.168.1.1,
[2] = 192.168.1.2
);



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



Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote:
 The desired result is.

 Array
 (
   [0] =  On the;
   [1] =  course or in the;
   [2] =  of colver;
 );

 I am just not sure the delimiter can be an array in the Explode function.






 Richard L. Buskirk

 -Original Message-
 From: Marc Guay [mailto:marc.g...@gmail.com] 
 Sent: Tuesday, May 17, 2011 7:52 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Explode Question

 $one = array(0 ='golf', 1 = 'field');
 $two = array(0 = On the golf course or in the field of clover);
 $array_exp = explode($one, $two);
 What's the desired result?

 array('golf' = On the golf course or in the field of clover,
 'field' =  On the golf course or in the field of clover)); ?


 Marc


Here's something to mess around with, to fit to your liking.

?php
$one = array('golf','field');
$two = array(On the golf course or in the field of clover);
$result = array_explode($one,$two);

print_r($result);

function array_explode($delimiters,$array)
{
if ( !is_array($delimiters) || !is_array($array) ) {
//bail
return;
}
$string = $array[0];
$regex = @(.implode('|',$delimiters).)@;
return preg_split($regex,$string);
}
?

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



Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
On 05/17/2011 09:09 PM, ad...@buskirkgraphics.com wrote:
 That is exactly it.
 Thanks James I knew it was simple just forgot how it was done.





 Richard L. Buskirk

 -Original Message-
 From: James Yerge [mailto:ja...@nixsecurity.org] 
 Sent: Tuesday, May 17, 2011 8:51 PM
 To: ad...@buskirkgraphics.com
 Cc: 'Marc Guay'; php-general@lists.php.net
 Subject: Re: [PHP] Explode Question

 On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote:
 The desired result is.

 Array
 (
  [0] =  On the;
  [1] =  course or in the;
  [2] =  of colver;
 );

 I am just not sure the delimiter can be an array in the Explode function.






 Richard L. Buskirk

 -Original Message-
 From: Marc Guay [mailto:marc.g...@gmail.com] 
 Sent: Tuesday, May 17, 2011 7:52 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Explode Question

 $one = array(0 ='golf', 1 = 'field');
 $two = array(0 = On the golf course or in the field of clover);
 $array_exp = explode($one, $two);
 What's the desired result?

 array('golf' = On the golf course or in the field of clover,
 'field' =  On the golf course or in the field of clover)); ?


 Marc

 Here's something to mess around with, to fit to your liking.

 ?php
 $one = array('golf','field');
 $two = array(On the golf course or in the field of clover);
 $result = array_explode($one,$two);

 print_r($result);

 function array_explode($delimiters,$array)
 {
 if ( !is_array($delimiters) || !is_array($array) ) {
 //bail
 return;
 }
 $string = $array[0];
 $regex = @(.implode('|',$delimiters).)@;
 return preg_split($regex,$string);
 }
 ?




Not a problem, glad to be of help.


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