Re: [PHP] Decoding Barcode Images

2011-10-10 Thread Shaun J. Farrell
zxing has a java commandline app that you can run.. simple to use great results.

http://code.google.com/p/zxing/

Shaun
www.brewerydb.com

On Oct 10, 2011, at 2:47 PM, Matthew Pounsett wrote:

> 
> On 2011-10-10, at 14:42, Floyd Resler wrote:
> 
>> I've been trying to find a solution for decoding barcode images in PHP but 
>> haven't had much luck so far.  Does anyone have any suggestions?
> 
> I'm not familiar with a way to do it directly in PHP, but you could shell out 
> to something like zbar to do it.
> 
> 
> 
> 
> --
> 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



[PHP] PHP5 cgi Suexec htaccess rewrite issue

2011-09-29 Thread Shaun Morrow
I am running a server with cPanel  on and want to have php run as a cgi with
Suexec enabled

I cannot seem to rectify an issue, when I set the handler to cgi, my rewrite
rules on one of my sites stop working

Sample url: http://examplesite.com/ad/123-abcde/

The rewrite rule for this is below;


RewriteEngine on
RewriteBase /

RewriteRule ^ad/([0-9]+)(.*)$
./index.php/ads/ads/action/viewAd/frmAdsID/$1/adTitle/$2 [L]


Currently the php 5 handler is dso, and the rewrite rule works perfectly.

If the handler is set to cgi, the rewrite rule does not work and I the site
just displays the home page.

I am at a loss and would appreciate some help.

Thanks in advance!


Re: [PHP] text insertion

2011-08-10 Thread Shaun Farrell
You could try using markdown too. 

Sent from my iPhone

On Aug 10, 2011, at 3:57 PM, Ashley Sheridan  wrote:

> 
> 
> Chris Stinemetz  wrote:
> 
>> How do I preserve text formatting when text is inserted into a database
>> table?
>> 
>> For example: I am using a textarea to allow users to leave comments
>> into the database and I am using:
>> 
>> '" . mysql_real_escape_string($_POST['store_comments']) . "',to
>> prevent SQL injection;
>> 
>> But when I call the data with php from the database the format it was
>> inserted is not preserved. Is there a way to make sure when a user
>> adds new paragraphs or indentation it will be preserved?
>> 
>> Thank you,
>> 
>> Chris
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> Are you sure its not preserved? When you output text in a browser, by default 
> its output as html, not plain text. Html ignores extraneous whitespace, and 
> doesn't use a monospaced font, so formatting text into columns in a textarea 
> won't work either. Look at the html source code to see what is actually being 
> output.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
> 
> -- 
> 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



[PHP] call_user_func_array how to use on object php >= 5.3

2010-06-28 Thread Shaun Morrow
I am working on code that implements a delegate design pattern, this makes
use of the call_user_func_array function.

I am having trouble with this particular line in PHP 5.3
return call_user_func_array(array($delegate, $methodName), $parameters);

$delegate is an object, and not simply the class name in a string.

This works in versions of PHP lower than 5.3, but it seems as though the
behaviour of this function was changed in 5.3, requiring you to pass the
class name, meaning that the method will always be called statically.

So my question is, is there any way that I can emulate the functionality of
call_user_func_array that was present in PHP < 5.3?

I would prefer not to use eval, but would like to retain the ability to call
methods within objects dynamically.

Sorry if I am not making myself clear, advice and input would be
appreciated.


[PHP] Delete File With Any File Extension

2010-06-15 Thread Shaun Thornburgh

Hi,

I need to delete a file with any file extension where i know the name of the 
file, is it possible to use regular expressions with the unlink function?

Thanks
  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now

[PHP] W3C Validator and Post Arrays

2009-04-02 Thread Shaun Thornburgh

Hi,

We are getting errors when trying to vaildate our HTML due to the [ character 
when using Post Arrays:

Line 173, Column 65:
character "[" is not allowed in the value of attribute "id"

…e="filters[calling_url]" id="filters[calling_url]" value="categories-bulk-ear

Does anyone know of a way around this?

Thanks


_
View your Twitter and Flickr updates from one place – Learn more!
http://clk.atdmt.com/UKM/go/137984870/direct/01/

RE: [PHP] Problems sending $_POST vairable to an ASP page

2008-08-28 Thread shaun thornburgh


> Date: Thu, 28 Aug 2008 16:24:58 -0500> From: [EMAIL PROTECTED]> To: [EMAIL 
> PROTECTED]; php-general@lists.php.net> Subject: RE: [PHP] Problems sending 
> $_POST vairable to an ASP page> > [snip]> Unfortunately I don't have curl 
> installed on my server.> [/snip]> > Unless you can open a socket or a curl 
> session you will not be able to> post values to a remote page. Curl is your 
> best bet, can it be> installed?> > -- > PHP General Mailing List 
> (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> 
It appears I was wrong, I do have cURL installed!
_
Win New York holidays with Kellogg’s & Live Search
http://clk.atdmt.com/UKM/go/107571440/direct/01/

RE: [PHP] Problems sending $_POST vairable to an ASP page

2008-08-28 Thread shaun thornburgh




> Date: Thu, 28 Aug 2008 16:21:19 -0500> From: [EMAIL PROTECTED]> To: [EMAIL 
> PROTECTED]; php-general@lists.php.net> Subject: RE: [PHP] Problems sending 
> $_POST vairable to an ASP page> > [snip]> I need to send post variables to an 
> ASP page. I have the following code> which isn't producing any errors but 
> isn't working either:> > foreach($_POST['newsletter-group'] as $key => 
> $value){> $_POST['addressbookid'] = $value; $out = "POST /signup.ashx"; $fp 
> => fsockopen("dmtrk.net", 80, $errno, $errstr, 30); if (!$fp) { echo> 
> "$errstr ($errno)\n"; } else { fputs($fp, $out . "\r\n"); }> 
> fclose($fp); }> > Can anyone tell me what I am doing wrong please?> [/snip]> 
> > http://www.php.net/curl> > > there was just a thread on this within the 
> past week.> > -- > PHP General Mailing List (http://www.php.net/)> To 
> unsubscribe, visit: http://www.php.net/unsub.php> 
 
Hi Jay,
 
Unfortunately I don't have curl installed on my server.
 
 
_
Make a mini you on Windows Live Messenger!
http://clk.atdmt.com/UKM/go/107571437/direct/01/

[PHP] Problems sending $_POST vairable to an ASP page

2008-08-28 Thread shaun thornburgh
Hi guys,
I need to send post variables to an ASP page. I have the following code which 
isn't producing any errors but isn't working either:
 
foreach($_POST['newsletter-group'] as $key => $value){ $_POST['addressbookid'] 
= $value; $out = "POST /signup.ashx";  $fp = fsockopen("dmtrk.net", 80, $errno, 
$errstr, 30); if (!$fp) {  echo "$errstr ($errno)\n"; } else {   
fputs($fp, $out . "\r\n");  }  fclose($fp); }
 
Can anyone tell me what I am doing wrong please?
_
Get Hotmail on your mobile from Vodafone 
http://clk.atdmt.com/UKM/go/107571435/direct/01/

RE: [PHP] Re: Sending a POST variable to an ASP page

2008-08-28 Thread shaun thornburgh


Date: Wed, 27 Aug 2008 15:07:53 -0600From: [EMAIL PROTECTED]: [EMAIL 
PROTECTED]: Re: [PHP] Re: Sending a POST variable to an ASP page
well that would constitute a particular reason :)
On Wed, Aug 27, 2008 at 2:55 PM, shaun thornburgh <[EMAIL PROTECTED]> wrote:



> Date: Wed, 27 Aug 2008 14:45:42 -0600> From: [EMAIL PROTECTED]> To: [EMAIL 
> PROTECTED]> CC: php-general@lists.php.net> Subject: Re: [PHP] Re: Sending a 
> POST variable to an ASP page 


> > On Wed, Aug 27, 2008 at 2:41 PM, shaun thornburgh <> [EMAIL PROTECTED]> 
> > wrote:> > > > To: php-general@lists.php.net> Date: Wed, 27 Aug 2008 
> > 14:07:31 -0500>> > From: [EMAIL PROTECTED]> Subject: [PHP] Re: Sending a 
> > POST variable to> > an ASP page> > shaun thornburgh wrote:> > Hi,> > > > I 
> > need to send a post> > variable to an ASP page, can I do this within my PHP 
> > script?> > > > I don't> > need to view the page, or get any acknowledgment 
> > back, just send the single> > POST variable...> > > > Thanks for your 
> > advice> >> > 
> > _> > Get> > 
> > Hotmail on your mobile from Vodafone > >> > 
> > http://clk.atdmt.com/UKM/go/107571435/direct/01/> > If you don't mind> > 
> > building the headers yourself in the code, it's just a > matter of using> > 
> > fsockopen() and then fputs().> > -Shawn> > -- > PHP General Mailing List (> 
> > > http://www.php.net/)> To unsubscribe, visit: 
> > http://www.php.net/unsub.php>> >> > Hi Shawn, I have tried the following 
> > but it doesnt seem to work:> > foreach($_POST['newsletter-group'] as $key 
> > => $value){> > $_POST['addressbookid'] = $value; $out = "POST 
> > /signup.ashx"; $fp => > fsockopen("server-url", 80, $errno, $errstr, 30); 
> > if (!$fp) { echo> > "$errstr ($errno)\n"; } else { fputs($fp, $out . 
> > "\r\n"); }> > fclose($fp); } Am I building the headers incorrectly?> > 
> > _> > Make a 
> > mini you on Windows Live Messenger!> > 
> > http://clk.atdmt.com/UKM/go/107571437/direct/01/> > > > dude, honestly, why 
> > would you take that approach unless you had a particular> reason for it? 
> > especially when you can knock it out in 2 minutes w/ curl...> > btw, google 
> > is pretty key as usual, try googling 'php curl post' ;)> > -nathan Hi 
> > Nathan, Unfortunately I can't install CURL on my server.

Win £3000 to spend on whatever you want at Uni! Click here to WIN!Hi guys, Can 
anyone help with how I need to add the headers to the following code 
please?foreach($_POST['newsletter-group'] as $key => $value){  
$_POST['addressbookid'] = $value;   $out = "POST /signup.ashx";   $fp = 
fsockopen("server-url", 80, $errno, $errstr, 30);   if (!$fp) { echo 
"$errstr ($errno)\n";   } else { fputs($fp, $out . "\r\n");   }  
fclose($fp); }Many thanks
_
Win a voice over part with Kung Fu Panda & Live Search   and   100’s of Kung Fu 
Panda prizes to win with Live Search
http://clk.atdmt.com/UKM/go/107571439/direct/01/

RE: [PHP] Re: Sending a POST variable to an ASP page

2008-08-27 Thread shaun thornburgh




> To: php-general@lists.php.net> Date: Wed, 27 Aug 2008 14:07:31 -0500> From: 
> [EMAIL PROTECTED]> Subject: [PHP] Re: Sending a POST variable to an ASP page> 
> > shaun thornburgh wrote:> > Hi,> > > > I need to send a post variable to an 
> ASP page, can I do this within my PHP script?> > > > I don't need to view the 
> page, or get any acknowledgment back, just send the single POST variable...> 
> > > > Thanks for your advice> > 
> _> > Get 
> Hotmail on your mobile from Vodafone > > 
> http://clk.atdmt.com/UKM/go/107571435/direct/01/> > If you don't mind 
> building the headers yourself in the code, it's just a > matter of using 
> fsockopen() and then fputs().> > -Shawn> > -- > PHP General Mailing List 
> (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> 
 
Hi Shawn, I have tried the following but it doesnt seem to work: 
foreach($_POST['newsletter-group'] as $key => $value){   
$_POST['addressbookid'] = $value;   $out = "POST /signup.ashx";$fp = 
fsockopen("server-url", 80, $errno, $errstr, 30);   if (!$fp) {echo 
"$errstr ($errno)\n";   } else { fputs($fp, $out . "\r\n");}
fclose($fp);  } Am I building the headers incorrectly?
_
Make a mini you on Windows Live Messenger!
http://clk.atdmt.com/UKM/go/107571437/direct/01/

RE: [PHP] Sending a POST variable to an ASP page

2008-08-27 Thread shaun thornburgh




> Date: Wed, 27 Aug 2008 14:13:23 -0400> To: php-general@lists.php.net> From: 
> [EMAIL PROTECTED]> Subject: Re: [PHP] Sending a POST variable to an ASP page> 
> > At 5:54 PM + 8/27/08, shaun thornburgh wrote:> >Hi,> >> >I need to send 
> a post variable to an ASP page, can I do this within > >my PHP script?> >> >I 
> don't need to view the page, or get any acknowledgment back, just > >send the 
> single POST variable...> > The point is not IF php can send a POST (it can), 
> but rather can ASP > receive a POST?> 
 
Hi Tedd, The ASP script has been set up to receive POST variables from a form.> 
Cheers,> > tedd> > -- > ---> http://sperling.com http://ancientstones.com 
http://earthstones.com> > -- > PHP General Mailing List (http://www.php.net/)> 
To unsubscribe, visit: http://www.php.net/unsub.php> 
_
Win New York holidays with Kellogg’s & Live Search
http://clk.atdmt.com/UKM/go/107571440/direct/01/

[PHP] Sending a POST variable to an ASP page

2008-08-27 Thread shaun thornburgh
Hi,
 
I need to send a post variable to an ASP page, can I do this within my PHP 
script?
 
I don't need to view the page, or get any acknowledgment back, just send the 
single POST variable...
 
Thanks for your advice
_
Get Hotmail on your mobile from Vodafone 
http://clk.atdmt.com/UKM/go/107571435/direct/01/

[PHP] Variable Names

2007-11-29 Thread Shaun
Hi,

I seem to be having a problem in assigning a value to an array where the
array is called dynamically.

e.g. the physical name for the array is "my_array", so:
my_array[1] = "test";
works fine.

$array_name = "my_array";
$array_name[1] = "test";
does not work.

I have tried $$array_name[1] = "test"; but to no avail.

Here is my code

/**
 * Adds any posted values from the application form to the session
 */
 function add_form_to_session() {
  foreach ($_POST AS $key => $value) {
   if (is_array($value)) {
foreach ($value AS $subkey => $subvalue) {
 $_SESSION['ses-app-form']->$key[$subkey] = $subvalue;
 //echo "value: ".$key."";
}
   }

   else {
$_SESSION['ses-app-form']->$key = $value;
//echo "value: ".$key." = ".$value."";
   }
  }
 }


Any Ideas?

Cheers,

Shaun

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



[PHP] Removing PHPSESSID - CGI Install

2007-05-31 Thread Shaun
Hi,

I have PHP installed as a CGI module on my server. I want to stop PHPSESSID 
from appearing in the URL when a users cookies are turned for just one 
account. My hosting company says that this is impossible - they would have 
to change php.ini and that would affect every account on the server. Also if 
PHP is changed to an Apache module then they won't support it. Is there no 
other way around this? Removing PHPSESSID is very important for SEO 
purposes...

Thanks for your advice. 

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



Re: [PHP] Including files from another site

2006-04-17 Thread Shaun

""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Mon, April 17, 2006 5:45 am, Shaun wrote:
>> I have created a CMS where all sites on our server are administrated
>> from
>> one central site, and HTML content is stored in the CMS database.
>>
>> I want users to all control their sites database functions from the
>> CMS
>> site, but I want to keep the database and database admin scripts in
>> the
>> individual website account to keep things simple. So I need want to be
>> able
>> to include these scripts within the CMS site but keep them secure. I
>> have
>> tried using frames but I can't keep a session going in the database
>> admin
>> scripts, is there a better way to do this?
>>
>> Any advice would be greatly appreciated.
>
> If you trust the source, you could just do:
>
>   include 'http://example.com/central_core_files_shared_by_all.inc';
> ?>
>
> Or, if all these sites are on the same box, you don't even need to use
> HTTP for the include...
>
> Exactly what are you trying to secure against?
>
> You make it sound like "keep them secure" is an absolute. It's not.
> It's relative.
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm

Hi Richard,

The security issue is important because I don't want anyone to be able to 
use the websites database admin scripts without logging into the CMS first. 
Otherwise anyone who happened to type in www.oneofmywebsites.com/cms would 
be able to make unwanted changes to that particular sites database.

In answer to your second question both sites will be on the same box... 

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



Re: [PHP] Including files from another site

2006-04-17 Thread Shaun
Thanks Wolf,

Will there be a problem keeping 2 sessions from 2 websites running in one 
browser?

I will need one to validate the CMS login and one running in the other 
website to ensure that $_SESSION['my_site'] is set?

BTW I'm sure you know, but image phising can be resolved with  mod_rewrite.


"Wolf" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Personally I would use it as part of the session and verify it that way...
>
> ie: check to see if the $PHP_SELF is www.mycms.com, if not refresh the
> page to that URL automatically and then make them do the login.  Only
> after logging in does the session key get the "mysite=true" key or
> whatever you want to check for.
>
> That SHOULD keep it from getting hacked, as your basically verifying at
> the beginning that you are only allowing entry from your location.
>
> You should also be making sure that your server does not allow others to
> host primary images so that nobody could phish your site.  Paypal and
> chase are really lamely set up which is making phishing easier for
> people who use them.
>
> My $.02
>
> Wolf
>
> Shaun wrote:
>> Hi,
>>
>> Thanks for your reply, just had a thought: How secure would it be if I 
>> made
>> sure that the URL of the browser was www.mycms.com and only allow access 
>> to
>> pages in the /cms folder if true?
>>
>> Is this safe or an easy hack?
>>
>>
>> "Wolf" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>> So, swap your CMS logins to use the same access code for the user, then
>>> use sessions to swap the mysql stuff in where needed.
>>>
>>> Or make it use a mysql call from the CMS login to access their mysql
>>> information from another table and do it that way.
>>>
>>> 1 login, 1 password, very user friendly.
>>>
>>> And only 1 place to have to worry about changing files.
>>>
>>> HTH,
>>>
>>> Wolf
>>>
>>>
>>> Shaun wrote:
>>>> I see your point, the only problem is that the user will have already
>>>> logged
>>>> once into the CMS, logging in again would be a little frustrating and 
>>>> not
>>>> very user friendly...
>>>>
>>>>
>>>> ""Weber Sites LTD"" <[EMAIL PROTECTED]> wrote in message
>>>> news:[EMAIL PROTECTED]
>>>>> I think that you are looking at this from the wrong angle.
>>>>> What you should do, is password protect all CMS directories
>>>>> And then, anyone that needs access has to punch in a valid
>>>>> Username and password.
>>>>>
>>>>> Have a look at : http://sourceforge.net/projects/modauthmysql/
>>>>>
>>>>> Sincerely
>>>>>
>>>>> berber
>>>>>
>>>>> Visit the Weber Sites Today,
>>>>> To see where PHP might take you tomorrow.
>>>>> PHP code examples : http://www.weberdev.com
>>>>> PHP & MySQL Forums : http://www.weberforums.com
>>>>>
>>>>>
>>>>>
>>>>> -Original Message-
>>>>> From: Shaun [mailto:[EMAIL PROTECTED]
>>>>> Sent: Monday, April 17, 2006 2:52 PM
>>>>> To: php-general@lists.php.net
>>>>> Subject: Re: [PHP] Including files from another site
>>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks for your reply, sorry I should have been a little clearer in my
>>>>> explanation. Here goes...
>>>>>
>>>>> I have a dedicated UNIX server with many websites on it. On this 
>>>>> server
>>>>> I
>>>>> have also created a Content Management System which has a database 
>>>>> which
>>>>> I
>>>>> use to store HTML content for all the other websites. Each website has 
>>>>> a
>>>>> database connection to the CMS database to retrieve the HTML for its
>>>>> pages.
>>>>>
>>>>> Each website that uses its own database has a folder called /cms and 
>>>>> in
>>>>> here
>>>>> I keep all the database admin scripts for that website. I want these
>>>>> pages
>>>>> to only be accessible from within the CMS website and nothing else. So
>>>>> when
>>>>> the user is in the CMS they can click on database admin and it will
>

Re: [PHP] Including files from another site

2006-04-17 Thread Shaun
Hi,

Thanks for your reply, just had a thought: How secure would it be if I made 
sure that the URL of the browser was www.mycms.com and only allow access to 
pages in the /cms folder if true?

Is this safe or an easy hack?


"Wolf" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> So, swap your CMS logins to use the same access code for the user, then
> use sessions to swap the mysql stuff in where needed.
>
> Or make it use a mysql call from the CMS login to access their mysql
> information from another table and do it that way.
>
> 1 login, 1 password, very user friendly.
>
> And only 1 place to have to worry about changing files.
>
> HTH,
>
> Wolf
>
>
> Shaun wrote:
>> I see your point, the only problem is that the user will have already 
>> logged
>> once into the CMS, logging in again would be a little frustrating and not
>> very user friendly...
>>
>>
>> ""Weber Sites LTD"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>> I think that you are looking at this from the wrong angle.
>>> What you should do, is password protect all CMS directories
>>> And then, anyone that needs access has to punch in a valid
>>> Username and password.
>>>
>>> Have a look at : http://sourceforge.net/projects/modauthmysql/
>>>
>>> Sincerely
>>>
>>> berber
>>>
>>> Visit the Weber Sites Today,
>>> To see where PHP might take you tomorrow.
>>> PHP code examples : http://www.weberdev.com
>>> PHP & MySQL Forums : http://www.weberforums.com
>>>
>>>
>>>
>>> -Original Message-
>>> From: Shaun [mailto:[EMAIL PROTECTED]
>>> Sent: Monday, April 17, 2006 2:52 PM
>>> To: php-general@lists.php.net
>>> Subject: Re: [PHP] Including files from another site
>>>
>>> Hi,
>>>
>>> Thanks for your reply, sorry I should have been a little clearer in my
>>> explanation. Here goes...
>>>
>>> I have a dedicated UNIX server with many websites on it. On this server 
>>> I
>>> have also created a Content Management System which has a database which 
>>> I
>>> use to store HTML content for all the other websites. Each website has a
>>> database connection to the CMS database to retrieve the HTML for its
>>> pages.
>>>
>>> Each website that uses its own database has a folder called /cms and in
>>> here
>>> I keep all the database admin scripts for that website. I want these 
>>> pages
>>> to only be accessible from within the CMS website and nothing else. So
>>> when
>>> the user is in the CMS they can click on database admin and it will
>>> include
>>> the pages in that websites /cms folder.
>>>
>>> My Question is how can I ensure that the CMS is the only website that 
>>> can
>>> access these scripts securely?
>>>
>>> Thanks for your advice.
>>>
>>>
>>> ""Weber Sites LTD"" <[EMAIL PROTECTED]> wrote in message
>>> news:[EMAIL PROTECTED]
>>>> I'm not sure I understand what you are trying to do.
>>>> What is the connection between frames and security?
>>>>
>>>> In general, assuming that all users have access to The same scripts,
>>>> you need to include in all of your Scripts some kind of security logic
>>>> that tells the Script which user can do what.
>>>>
>>>> Usually you would want to also allow group access Rather then user
>>>> access for easier maintenance.
>>>>
>>>> You should keep a user table with user, password And privileges. There
>>>> are endless ways to do this And you need to choose what is best for
>>>> your site.
>>>>
>>>> Have a look at some relevant code examples:
>>>> http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=aut
>>>> h
>>>>
>>>> berber
>>>>
>>>> -Original Message-
>>>> From: Shaun [mailto:[EMAIL PROTECTED]
>>>> Sent: Monday, April 17, 2006 12:46 PM
>>>> To: php-general@lists.php.net
>>>> Subject: [PHP] Including files from another site
>>>>
>>>> Hi,
>>>>
>>>> I have created a CMS where all sites on our server are administrated
>>>> from one central site, and HTML content is stored in the CMS database.
>>>>
>>>> I want users to all control their sites database functions from the
>>>> CMS site, but I want to keep the database and database admin scripts
>>>> in the individual website account to keep things simple. So I need
>>>> want to be able to include these scripts within the CMS site but keep
>>>> them secure. I have tried using frames but I can't keep a session
>>>> going in the database admin scripts, is there a better way to do this?
>>>>
>>>> Any advice would be greatly appreciated.
>>>>
>>>> --
>>>> 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
>> 

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



Re: [PHP] Including files from another site

2006-04-17 Thread Shaun
I see your point, the only problem is that the user will have already logged 
once into the CMS, logging in again would be a little frustrating and not 
very user friendly...


""Weber Sites LTD"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I think that you are looking at this from the wrong angle.
> What you should do, is password protect all CMS directories
> And then, anyone that needs access has to punch in a valid
> Username and password.
>
> Have a look at : http://sourceforge.net/projects/modauthmysql/
>
> Sincerely
>
> berber
>
> Visit the Weber Sites Today,
> To see where PHP might take you tomorrow.
> PHP code examples : http://www.weberdev.com
> PHP & MySQL Forums : http://www.weberforums.com
>
>
>
> -Original Message-
> From: Shaun [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 17, 2006 2:52 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Including files from another site
>
> Hi,
>
> Thanks for your reply, sorry I should have been a little clearer in my
> explanation. Here goes...
>
> I have a dedicated UNIX server with many websites on it. On this server I
> have also created a Content Management System which has a database which I
> use to store HTML content for all the other websites. Each website has a
> database connection to the CMS database to retrieve the HTML for its 
> pages.
>
> Each website that uses its own database has a folder called /cms and in 
> here
> I keep all the database admin scripts for that website. I want these pages
> to only be accessible from within the CMS website and nothing else. So 
> when
> the user is in the CMS they can click on database admin and it will 
> include
> the pages in that websites /cms folder.
>
> My Question is how can I ensure that the CMS is the only website that can
> access these scripts securely?
>
> Thanks for your advice.
>
>
> ""Weber Sites LTD"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I'm not sure I understand what you are trying to do.
>> What is the connection between frames and security?
>>
>> In general, assuming that all users have access to The same scripts,
>> you need to include in all of your Scripts some kind of security logic
>> that tells the Script which user can do what.
>>
>> Usually you would want to also allow group access Rather then user
>> access for easier maintenance.
>>
>> You should keep a user table with user, password And privileges. There
>> are endless ways to do this And you need to choose what is best for
>> your site.
>>
>> Have a look at some relevant code examples:
>> http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=aut
>> h
>>
>> berber
>>
>> -Original Message-
>> From: Shaun [mailto:[EMAIL PROTECTED]
>> Sent: Monday, April 17, 2006 12:46 PM
>> To: php-general@lists.php.net
>> Subject: [PHP] Including files from another site
>>
>> Hi,
>>
>> I have created a CMS where all sites on our server are administrated
>> from one central site, and HTML content is stored in the CMS database.
>>
>> I want users to all control their sites database functions from the
>> CMS site, but I want to keep the database and database admin scripts
>> in the individual website account to keep things simple. So I need
>> want to be able to include these scripts within the CMS site but keep
>> them secure. I have tried using frames but I can't keep a session
>> going in the database admin scripts, is there a better way to do this?
>>
>> Any advice would be greatly appreciated.
>>
>> --
>> 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 

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



Re: [PHP] Including files from another site

2006-04-17 Thread Shaun
Hi,

Thanks for your reply, sorry I should have been a little clearer in my 
explanation. Here goes...

I have a dedicated UNIX server with many websites on it. On this server I 
have also created a Content Management System which has a database which I 
use to store HTML content for all the other websites. Each website has a 
database connection to the CMS database to retrieve the HTML for its pages.

Each website that uses its own database has a folder called /cms and in here 
I keep all the database admin scripts for that website. I want these pages 
to only be accessible from within the CMS website and nothing else. So when 
the user is in the CMS they can click on database admin and it will include 
the pages in that websites /cms folder.

My Question is how can I ensure that the CMS is the only website that can 
access these scripts securely?

Thanks for your advice.


""Weber Sites LTD"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I'm not sure I understand what you are trying to do.
> What is the connection between frames and security?
>
> In general, assuming that all users have access to
> The same scripts, you need to include in all of your
> Scripts some kind of security logic that tells the
> Script which user can do what.
>
> Usually you would want to also allow group access
> Rather then user access for easier maintenance.
>
> You should keep a user table with user, password
> And privileges. There are endless ways to do this
> And you need to choose what is best for your site.
>
> Have a look at some relevant code examples:
> http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=auth
>
> berber
>
> -Original Message-
> From: Shaun [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 17, 2006 12:46 PM
> To: php-general@lists.php.net
> Subject: [PHP] Including files from another site
>
> Hi,
>
> I have created a CMS where all sites on our server are administrated from
> one central site, and HTML content is stored in the CMS database.
>
> I want users to all control their sites database functions from the CMS
> site, but I want to keep the database and database admin scripts in the
> individual website account to keep things simple. So I need want to be 
> able
> to include these scripts within the CMS site but keep them secure. I have
> tried using frames but I can't keep a session going in the database admin
> scripts, is there a better way to do this?
>
> Any advice would be greatly appreciated.
>
> --
> 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



[PHP] Including files from another site

2006-04-17 Thread Shaun
Hi,

I have created a CMS where all sites on our server are administrated from 
one central site, and HTML content is stored in the CMS database.

I want users to all control their sites database functions from the CMS 
site, but I want to keep the database and database admin scripts in the 
individual website account to keep things simple. So I need want to be able 
to include these scripts within the CMS site but keep them secure. I have 
tried using frames but I can't keep a session going in the database admin 
scripts, is there a better way to do this?

Any advice would be greatly appreciated. 

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



[PHP] Common Files

2006-04-15 Thread Shaun
Hi,

We have a dedicated UNIX server running FreeBSD, is it possible to set a 
directory where we can place a set of common files that can be used by all 
of our web sites?

Thanks for your advice 

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



Re: [PHP] Include Problem

2006-04-15 Thread Shaun
$_SERVER['DOCUMENT_ROOT'] = /home

this isnt the correct path for the file!

""Chrome"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Try
>
> include($_SERVER['DOCUMENT_ROOT'] . "/cms/templates/footer.php");
>
> maybe?
>
> Dan
>
> ---
> http://chrome.me.uk
>
>
> -Original Message-
> From: Shaun [mailto:[EMAIL PROTECTED]
> Sent: 15 April 2006 20:05
> To: php-general@lists.php.net
> Subject: [PHP] Include Problem
>
> Hi,
>
> I am having problems with an include statement, i am using the following
> statement in an effort to include a footer file on my page:
>
> include("/cms/templates/footer.php");
>
> However I get the following error:
>
> Warning: main(/cms/templates/footer.php): failed to open stream: No such
> file or directory in /home/m/y/mysite/public_html/cms/news/index.php on 
> line
> 38
>
> Warning: main(/cms/templates/footer.php): failed to open stream: No such
> file or directory in /home/m/y/mysite/public_html/cms/news/index.php on 
> line
> 38
>
> Warning: main(): Failed opening '/cms/templates/footer.php' for inclusion
> (include_path='.:/lib/php') in
> /home/m/y/mysite/public_html/cms/news/index.php on line 38
>
> The file is definitely there, the script just doesn't seem to be picking 
> it
> up, has anyone else had this problem?
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> __ NOD32 1.1490 (20060415) Information __
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com 

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



Re: [PHP] Include Problem

2006-04-15 Thread Shaun

"Mark Charette" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Shaun wrote:
>> Warning: main(/cms/templates/footer.php): failed to open stream: No such
>> file or directory in /home/m/y/mysite/public_html/cms/news/index.php on 
>> line
>> 38
>>
> Most assuredly the file isn't there (do you have the include path set?) or 
> the permissions are not sufficient to open the file.

include_path = .:/lib/php 

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



[PHP] Include Problem

2006-04-15 Thread Shaun
Hi,

I am having problems with an include statement, i am using the following
statement in an effort to include a footer file on my page:

include("/cms/templates/footer.php");

However I get the following error:

Warning: main(/cms/templates/footer.php): failed to open stream: No such
file or directory in /home/m/y/mysite/public_html/cms/news/index.php on line
38

Warning: main(/cms/templates/footer.php): failed to open stream: No such
file or directory in /home/m/y/mysite/public_html/cms/news/index.php on line
38

Warning: main(): Failed opening '/cms/templates/footer.php' for inclusion
(include_path='.:/lib/php') in
/home/m/y/mysite/public_html/cms/news/index.php on line 38

The file is definitely there, the script just doesn't seem to be picking it
up, has anyone else had this problem?

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



[PHP] Include Problem

2006-04-15 Thread Shaun
Hi,

I am having problems with an include statement, i am using the following 
statement in an effort to include a footer file on my page:

include("/cms/templates/footer.php");

However I get the following error:

Warning: main(/cms/templates/footer.php): failed to open stream: No such 
file or directory in /home/m/y/mysite/public_html/cms/news/index.php on line 
38

Warning: main(/cms/templates/footer.php): failed to open stream: No such 
file or directory in /home/m/y/mysite/public_html/cms/news/index.php on line 
38

Warning: main(): Failed opening '/cms/templates/footer.php' for inclusion 
(include_path='.:/lib/php') in 
/home/m/y/mysite/public_html/cms/news/index.php on line 38

The file is definitely there, the script just doesn't seem to be picking it 
up, has anyone else had this problem? 

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



Re: [PHP] Sessions and Frames

2006-04-05 Thread Shaun

""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Wed, April 5, 2006 1:33 pm, Joe Wollard wrote:
>> If you can't avoid them, keep it simple - just store the ID in one
>> place,
>> like a session cookie. Doing so will make sure that if the session ID
>> gets
>> changed in one frame it will still be correct in all of the other
>> frames.
>
> No, it won't.
>
> That's the whole problem.
>
> Watch this slow-motion instant replay.
>
> HTTP Interaction #1
> Browser requests URL > Server sends out FRAMESET/FRAME/FRAME ---\
>
> Browser gets FRAMESET 
>
> HTTP Interaction #2A (starts)
> Browser requests FRAME #1 URL -->
>
> HTTP Interaction #2B (starts, in parallel, by browser)
> Browser requests FRAME #2 URL -->
>
> Server responds to #2A, with session_start() sending out Cookie
> headers, and setting up session #2A
>
> Server responds to #2B, with session_start() sending out *NEW* Cookie
> headers, and setting up session #2B, because the browser has *NOT* yet
> received, much less sent back, the Cookies from #2A
>
> The browser now has *TWO* parallel sessions.
>
> You  *MUST* *MUST* *MUST* get the session started in the FRAMESET, or
> this *WILL* happen, intermittently, between the frames.
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm

Thanks for your advice guys,

I have started the session for the main application in the main application 
frameset file, however every time I click the link to load the new 
application in the lower frame window the new application generates a new 
session_id. Obviously the new applcation can't maintain a session with this 
configuration, any ideas?

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



[PHP] Sessions and Frames

2006-04-05 Thread Shaun
Hi,

I have a site that uses frames. The frameset loads another site (both on the 
same server) in the lower frame window. Every time the page changes in the 
lower frame the session id changes, how can I stop this happening?

Thanks for your help 

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



[PHP] Blocking Values From an External Source

2005-12-16 Thread Shaun
Hi,

I have a script on my site for processing values sent from a contact form 
and emailing them to the webmaster. The script has been abused by spammers 
and my hosting company has recommended that I change the script to only 
accept information posted from my own URL. Could someone tell me how this 
can be done please?

Thanks for your advice. 

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



[PHP] foreach $_FILES

2005-12-14 Thread Shaun
Hi,

I have a form on my site with many file fields for users to upload files. I 
am trying to verify that for each file uploaded it corresponds with the name 
of the file field i.e.


   File_1.CSV:
   


   File_2.CSV:
   


However if I loop through the $_FILES array like this:

foreach( $_FILES as $key => $value ){
   echo '$key = '.$key.'';
   echo '$value = '.$value.'';
}

$key = File_1_CSV
$value['name'] = File_1.CSV
$key = File_2_CSV
$value['name'] = File_2.CSV

The . is replaced with an underscore in the $key value. I could get around 
this with a substr() but it seems a little inelegant, can anyone tell me why 
this is happening please?

Thanks for your advice. 

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



[PHP] Forwarding $_POST Values

2005-12-09 Thread Shaun
Hi,

I have a server with all my clients websites on. However I have some clients 
who have their own servers. I want to be able to have a form on my site that 
allows users to log into their webmail, however if the client has their own 
server I need to forward the $_POST values to a login script on a different 
server, is this possible?

Thanks for your advice. 

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



[PHP] Eval To String

2005-12-07 Thread Shaun
Hi,

Is it possible to return the result of eval function to a string rather than 
outputting directly to the browser?

Thanks for your advice 

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



[PHP] Re: GD Graph tutorial?

2005-12-06 Thread Shaun

"Gustavo Narea" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello, Ashley.
>
> Ashley M. Kirchner wrote:
>>Does anyone know of a good GD tutorial for creating graphs?
>
> I like this one: http://www.nyphp.org/content/presentations/GDintro/
>
> Regards.
>
> -- 
> Gustavo Narea.
> PHP Documentation - Spanish Translation Team.
> Valencia, Venezuela.

Try this one:

http://www.maani.us/charts/index.php

I have used it and would recommend it. 

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



Re: [PHP] Count and Preg_Replace Using Version 4.4.1

2005-12-04 Thread Shaun

"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Sun, Dec 04, 2005 at 07:00:00PM -, Shaun wrote:
>>
>> "comex" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > form'.$count.'...
>> You can use preg_replace_callback or the e pattern modifier to let you
>> run php code for the replacement:
>> http://us3.php.net/manual/en/function.preg-replace-callback.php
>> http://us3.php.net/manual/en/reference.pcre.pattern.modifiers.php
>>
>> Hi Comex,
>>
>> Thanks for your reply, I have modified the code so I have a call back
>> function:
>>
>> echo = preg_replace_callback( '/]*>(.*?)<\/p>/ms', "callback",
>> file_get_contents($_GET['file']) );
>>
>> function callback($matches){
>>   return
>>   '> ...
>>
>> But I still can't see how I can increment a value in each return string?
>
> function callback($matches) {
>  static $i = 0; // <-- maintains  counter within function scope
>  $i++;
>
>  return "";
> }
>
> btw, i've been meaning to mention this in the last few posts of
> yours, but have you considered using DOM to make this happen.  When
> ever I see a regex solution for parsing an html document, it makes
> me cringe.
>
> Curt.
> -- 
> cat .signature: No such file or directory

Hi Curt,

Thanks for your reply. So basically I do something like:

$doc = new DOMDocument();
$doc->loadHTML($file);

$p = $doc->getElementsByTagName('p');

How would then wrap the following around each  tag:



'.$matches[1].'


BTW if its not obvious I am trying to create a CMS that lets users edit 
anything within a  tag! 

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



Re: [PHP] Submit Form Values To Parent

2005-12-02 Thread Shaun

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [snip]
> I have made an example of this now. If you click on this link:
>
> http://www.assertia.com/iframe.html
>
> and then click on 'Click Here'. I am trying to display the form results in
> the parent window, but I am having no luck!
> [/snip]
>
> Actually it is working properly. You have no POST method in your form call
>
> form.html:
>  <---WHAT IS THE METHOD?
>  
>   onclick="document.myform.submit();">Click here
> 

Hi Jay,

Thanks for your reply, I'm not sure what is happening because I have added
the method yet it still isn't working...

Any ideas?



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



Re: [PHP] Submit Form Values To Parent

2005-12-02 Thread Shaun
Hi all,

I have made an example of this now. If you click on this link:

http://www.assertia.com/iframe.html

and then click on 'Click Here'. I am trying to display the form results in
the parent window, but I am having no luck!

Here is my code:

iframe.html:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>


Untitled Document






form.html:

  
  Click here


result.php:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>


Untitled Document






Any ideas?

"Terence" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
>
> Shaun wrote:
>> Hi,
>>
>> How can I get the form values submitted from an iframe where the target 
>> is the parent window?
>
> Use Javascript. Check out irt.org ->  Javascript
> They have lots of great examples. 

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



[PHP] Submit Form Values To Parent

2005-12-01 Thread Shaun
Hi,

How can I get the form values submitted from an iframe where the target is 
the parent window? 

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



[PHP] Problem with Frames and Sessions

2005-11-28 Thread Shaun
Hi,

I have a frameset with a left column and a main column. I have a login 
script with a form in the left column. When I log in I get a menu in the 
left column which targets to the main column. My problem is that when I 
click on links in the left column nothing appears in the main frame, however 
if I refresh the browser then the links work. I am sure this must be a PHP 
session problem but I don't have any experience using frames, does anyone 
have suggestions as to what the problem might be?

Thanks for your advice.

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



[PHP] Intersecting Dates

2005-11-26 Thread Shaun
Hi,

Given a start day and month and end day and month (i.e. 01-01 to 31-03) how 
can one check if another set intersects these dates?

Thanks for your advice 

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



[PHP] Adding links to HTML for a CMS

2005-11-26 Thread Shaun
Hi,

I am trying to create my own CMS. To being with I want to let users edit 
anything within a  tag.

I want to have a menu to the left and display the webpage in the rest of the 
page, and for each set of  tags I want the user to be able to click on 
the link to edit that paragraph.

My problem is how can I include a webpage in my CMS and for each  tag 
wrap an  tag araound it?

Thanks for your advice. 

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



[PHP] Uploading more than one file

2005-11-21 Thread Shaun
Hi,

I have a form on my page that has many file input fields:


   File A:
   
  

   File B:
   
  
...

I have looked on php.net and there is a way to upload an array of files but 
one would need to make the name of all the input fields are the same. I need 
to make sure that the file uploaded is correct by comparing the file name to 
the value requried by the form field name. Is there a way around this?

Thanks for your help.

Shaun 

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



[PHP] Convert Feet to Metres

2005-11-02 Thread Shaun
Hi,

I am trying to create a function that will convert metres to feet and vice 
versa. After searching Google I have found that 1 meters = 3.2808399 feet. 
However if someone enters 10.5 to mean 10 feet and 5 inches this is not the 
same as 10 feet and half a foot as there are 12 inches in a foot!

Is there a standard conversion for this problem? 

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



[PHP] Type of form element

2005-10-28 Thread Shaun
Hi,

I have some checkboxes on my page which correspond with boolean fields in my 
database - actually they are TINYINT's in which I store a 0 or 1 in for 
false and true values respectively.

Is it possible to loop through all $_POST values to see if it is a checkbox? 
If so then for that element if it is equal to 'on' then change it to 1 
otherwise change it to 0?

Thanks for your advice. 

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



[PHP] Help with a regular expression for 0,1 or 2 decimal places

2005-10-24 Thread Shaun
Hi,

I am trying to create a regular expression for a width of a room, the value 
can be a whole integer (up to 999) with up to 2 decimal places -when it is 
stored in the database mysql will pad the value accordingly.

/^[0-9]{1,3}.?[0-9]{0,2}?$/

The only problem I have found with above is that I can enter 1.

Is it possible to modify it so that I can only enter the decimal point if I 
enter at least digit after it?

Also is there any difference between [0-9] and \d

Thanks for your help 

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



Re: [PHP] Re: Inserting NULL Integer Values

2005-10-18 Thread Shaun
Hi all,

Thanks for your replies, rather than check each vaule by name I am trying to 
produce a more dynamic solution:

foreach ($_POST as $key => $value) {
  if ($value == '') {
$_POST[$key] == 'NULL';
  }
}

I was expecting $_POST[$key] to be the same as $key, however this isnt the 
case:

$key = city
$_POST[$key] = London
$value = London

Any ideas?

""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Tue, October 18, 2005 12:42 pm, [EMAIL PROTECTED] wrote:
>> That should work.  You can set it so you can't have NULL, but dont
>> know of anything that tells the database not to accept '' as a value
>
> Any database, other than MySQL, is *NOT* going to accept '' as an
> integer value.
>
> Because '' is not an integer by any stretch of the imagination.
>
> If you don't care about ever porting your application to something
> other than MySQL, then you can IGNORE the advice to not use '' on
> integers.
>
> If there's ANY possibility that some day somebody might maybe wanna
> use a different database with your application, then don't confuse
> strings with integers.
>
> Actually, it might be better for your own
> education/sanity/comprehension/documentation/code to not confuse
> strings and integers with '' around integers in the SQL, but if
> everything ELSE is good in your code, and it's "always going to be
> MySQL" then it's fine.
>
> Note that:
>
> $value2 = 'NULL'; //PHP $value2 is a string
>
> $query = "insert into (integer_field) values ($value2)";
> //PHP $query is a string, but...
>
> The place-holder in $value2 will be just: NULL
>
> No quotes.
>
> No apostrophes.
>
> Not a string.
>
> NULL
>
> SQL NULL value representing "no value"
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm 

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



[PHP] Re: Inserting NULL Integer Values

2005-10-18 Thread Shaun
Hi Ben,

Thanks for your reply, woudn't that insert a string with a value of'NULL';?

""Ben Litton"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Either cast your empty ints (which should make it zero) or do an if 
> (!isset($variable)) { $variable = 'NULL'; }
>
> Ben
>
> On Tue, 18 Oct 2005 12:15:41 -0400, "Shaun" <[EMAIL PROTECTED]> 
> wrote:
>
>> Hi,
>>
>> Up to this point in time I used to construct my insert statements like 
>> this
>>
>> $qid = mysql_query('INSERT INTO MYTABLE (
>> column1,
>> column2,
>>) VALUES (
>> "'.$value1.'",
>> "'.$value2.'"
>>)');
>>
>> However I understand it is better to remove the quote marks around an 
>> insert
>> if the column type is an integer. This is easy to do, however if the 
>> $value
>> is empty it causes a mysql error. Has anyone encountered this and found a
>> solution?
>>
>> Thanks for your advice
>
>
>
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ 

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



[PHP] Inserting NULL Integer Values

2005-10-18 Thread Shaun
Hi,

Up to this point in time I used to construct my insert statements like this

$qid = mysql_query('INSERT INTO MYTABLE (
column1,
column2,
   ) VALUES (
"'.$value1.'",
"'.$value2.'"
   )');

However I understand it is better to remove the quote marks around an insert 
if the column type is an integer. This is easy to do, however if the $value 
is empty it causes a mysql error. Has anyone encountered this and found a 
solution?

Thanks for your advice 

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



[PHP] Cross Tabulation

2005-09-24 Thread Shaun
Hi,

The following article describes cross tabulation within MySQL and ends with 
a Perl application that automates the process, does anyone know of a PHP 
version?

http://dev.mysql.com/tech-resources/articles/wizard/index.html

Thanks for your advice. 

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



[PHP] REGEX Help Please

2005-09-19 Thread Shaun
Hi,

I am trying to implement a regular expression so that I have a number 
between 0.00 and 1.00. the following works except I can go up to 1.99

$regexp = "/^[0-1]{1}.[0-9]{2}/";

Can anyone help here please?

Thanks 

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



[PHP] Encrypt Files

2005-09-09 Thread Shaun
Hi,

Is it possible to encrypt files that are being uploaded via the 
move_uploaded_file() method?

Thanks for your advice 

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



[PHP] Cleaning a resultset

2005-09-08 Thread Shaun
Hi,

I have a resultset from a query and need to remove some rows after doing 
some php processing then insert into another table i.e.

/** Get data**/
 $qid = mysql_query('SELECT ...);

 /** Clean data **/
 while( $r = mysql_fetch_object( $qid ) ) {

 }

How can i generate a new resultset / remove data from the existing resultset 
using this method?

Thanks for your help 

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



[PHP] Saturdays and Sundays

2005-09-01 Thread Shaun
Hi,

Is it possible to get the number of saturdays and sundays for a given month 
/ year?

Thanks for your help. 

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



[PHP] Problem With Inner Loop

2005-08-29 Thread Shaun
Hi,

The following code is attempting to display a list of work types for all the 
users in my database. However it only loops through the inner loop once and 
I can't work out why, can anyone help here please?

Thanks for your help





 
 
  Work_Type; ?>
 
 



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



[PHP] Re: Same sessions / different domains

2005-05-12 Thread Shaun
$_SERVER['HTTP_HOST']

"Mbneto" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Hi,

I need to access a website (written in php) using two different
domains (www.foo.com and www.bar.com). I must see the same content.

Since the site uses session and cookie variables I was wondering if
(and how) it's possible to create a session id that is valid for the
domains I'll be using...

regards. 

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



[PHP] Generate CSV File and force download

2005-05-12 Thread Shaun
Hi,

Is it possible to create a csv file from a query and force the user to 
download it by outputting it to the browser, I dont want it saved on the 
server!

Thanks for your advice 

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



[PHP] Re: How do I link to the root directory of the server?

2005-05-05 Thread Shaun
Sorry for double posting, these took an hour to appear in my newsreader and 
I thought there was a problem with the first one I sent

"Shaun" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I have a file called application.php and in this file I define all of the 
> directories in my site:
>
> class object {};
> $CFG = new object;
>
> $CFG->wwwroot = http://www.mydomain.com;
> $CFG->dirroot  = "/usr/home/myaccount/public_html";
>
> $CFG->admindir = "$CFG->wwwroot/admin";
> $CFG->claimsdir_adm = "$CFG->admindir/claims";
> $CFG->clientsdir   = "$CFG->admindir/clients";
> $CFG->cssdir = "$CFG->wwwroot/css";
> $CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
> $CFG->projectsdir   = "$CFG->admindir/projects";
> $CFG->shoppingdir  = "$CFG->wwwroot/shopping";
> ...
>
> This works very well and means if I change a directory name or move a 
> directory I only have to update this file. application.php is included on 
> every page so all I have to do to link to another directory would be 
> something like:
>
> Click here to add a category
>
> The problem with this is that the URL's include the 
> http://www.mydomain.com/ and are therefore not relative links. Is there a 
> way to link to the root directory from wherever I am within the directory 
> structure?
>
> Thanks for your advice 

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



[PHP] Linking to the Root Dir - LAMP

2005-05-05 Thread Shaun
Hi,

I have a file called application.php and this file I define all of the 
directories in my site:

class object {};
$CFG = new object;

$CFG->wwwroot = http://www.mydomain.com;
$CFG->dirroot  = "/usr/home/myaccount/public_html";

$CFG->admindir = "$CFG->wwwroot/admin";
$CFG->claimsdir_adm = "$CFG->admindir/claims";
$CFG->clientsdir   = "$CFG->admindir/clients";
$CFG->cssdir = "$CFG->wwwroot/css";
$CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
$CFG->projectsdir   = "$CFG->admindir/projects";
$CFG->shoppingdir  = "$CFG->wwwroot/shopping";
...

This works very well and means if I change a directory name or move a 
directory I only have to update this file. application.php is included on 
every page so all I have to do to link to another directory would be 
something like:

Click here to add a category

The problem with this is that the URL's include the http://www.mydomain.com/ 
and are therefore not relative links. Is there a way to link to the root 
directory from wherever I am within the directory structure?

Thanks for your advice 

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



[PHP] How do I link to the root directory of the server?

2005-05-05 Thread Shaun
Hi,

I have a file called application.php and in this file I define all of the 
directories in my site:

class object {};
$CFG = new object;

$CFG->wwwroot = http://www.mydomain.com;
$CFG->dirroot  = "/usr/home/myaccount/public_html";

$CFG->admindir = "$CFG->wwwroot/admin";
$CFG->claimsdir_adm = "$CFG->admindir/claims";
$CFG->clientsdir   = "$CFG->admindir/clients";
$CFG->cssdir = "$CFG->wwwroot/css";
$CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
$CFG->projectsdir   = "$CFG->admindir/projects";
$CFG->shoppingdir  = "$CFG->wwwroot/shopping";
...

This works very well and means if I change a directory name or move a 
directory I only have to update this file. application.php is included on 
every page so all I have to do to link to another directory would be 
something like:

Click here to add a category

The problem with this is that the URL's include the http://www.mydomain.com/ 
and are therefore not relative links. Is there a way to link to the root 
directory from wherever I am within the directory structure?

Thanks for your advice

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



[PHP] Call a Function Held in a $_GET Var

2005-04-06 Thread Shaun
Hi,

If I have a function name held in a $_GET variable for example 
...&func=print_user_list how can I call the function dynamically? ie. 
$_GET['func']()

Thanks for your help 

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



Re: [PHP] SSL & XML File Download Problem

2005-04-05 Thread Shaun
Hi Chris,

I have turned off friendly messages, but I get the same message...


"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Shaun <mailto:[EMAIL PROTECTED]>
on Friday, April 01, 2005 11:20 AM said:

> This was working fine until i added an SSL certificate to my site,
> now I get the following error message:
>
> Internet Explorer cannot download ..._download.php?id=4723 from
> www... .com
>
> Internet Explorer was not able to open this Internet site. The
> requested site is either unavailable or cannot be found...
>
> Any ideas?

IIRC you've got friendly error messages turned on. Turn it off to see
what's really happening.


Chris. 

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



[PHP] SSL & XML File Download Problem

2005-04-01 Thread Shaun
Hi,

I have a site that allows users to download xml files. I have the following 
php script which prints the results of the query to the browser. As the 
header is chaged to XML it forces the browser to ask the user if they want 
to download the file rather than outputting the results straight to the 
browser:

\r\n";
// add query results to $xml
echo $xml;
?>

This was working fine until i added an SSL certificate to my site, now I get
the following error message:

Internet Explorer cannot download ..._download.php?id=4723 from www... .com

Internet Explorer was not able to open this Internet site. The requested 
site is either unavailable or cannot be found...

Any ideas?

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



Re: [PHP] Create MDB File

2005-03-28 Thread Shaun
Thanks for your reply,

but this only works on Windows. I need a program that will create an MDB 
file on the fly from a query on the MySQL database...


"Johannes Findeisen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Sorry,
>
> i forgot that link:
>
> http://www.convert-in.com/sql2acc.htm
>
>
> On Monday 28 March 2005 22:46, Johannes Findeisen wrote:
>> Hello,
>>
>> i had the same problem some years ago. At this time i have set up all
>> tables in Access and wrote a script which reads from MySQL and inserts 
>> into
>> the MDB file via the ODBC connector. This works but is much work when 
>> your
>> database is very big.
>>
>> 2 Years ago i had the same problem but it must go as fast as possible so 
>> i
>> decided to buy a converteer since i didn't find anything free. They are
>> working very good. I don't know where i have buyed them but i think there
>> is only one company which delivers this software.
>>
>> Regards
>> Johannes
>>
>> On Monday 28 March 2005 22:08, Shaun wrote:
>> > Hi,
>> >
>> > Does anyone know if its possible to create an MDB file from a Mysql
>> > database using a PHP script, I have only managed to find Access to 
>> > Mysql
>> > conversion programs so far...
>> >
>> > Thanks for your help
>>
>> --
>> # Johannes Findeisen
>
> -- 
> # Johannes Findeisen 

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



[PHP] Create MDB File

2005-03-28 Thread Shaun
Hi,

Does anyone know if its possible to create an MDB file from a Mysql database 
using a PHP script, I have only managed to find Access to Mysql conversion 
programs so far...

Thanks for your help 

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



[PHP] Ensure only one instance of a script is running

2005-03-16 Thread Shaun
Hi,

I have a script that inserts data from files uploaded to our server. I need 
to make sure that only one instance of this script runs at anyone time, can 
anyone tell me how I can do this?

Many thanks 

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



[PHP] Help with REGEXP please

2005-03-04 Thread Shaun
Hi,

Please could someone tell me how i can extract the information from a string 
that is after 'ID_' and before '_FN'

Thanks for your help. 

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



[PHP] DB INSERT & CRON

2005-03-03 Thread Shaun
Hi,

I have a web based system that allows users to upload XML files and insert
them into the database, however some of these files are large and are
causing the webserver to timeout.

Is it possible to create a cron job that can insert the xml files say every
hour, then the users of the site would only have to upload the files and not
wait for the insert?

Any advice / examples here would be great as I am not a UNIX expert!

Thanks

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



[PHP] DB INSERT & CRON

2005-03-03 Thread Shaun
Hi,

I have a web based system that allows users to upload XML files and insert 
them into the database, however some of these files are large and are 
causing the webserver to timeout.

Is it possible to create a cron job that can insert the xml files say every 
hour, then the users of the site would only have to upload the files and not 
wait for the insert?

Any advice / examples here would be great as I am not a UNIX expert!

Thanks 

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



[PHP] Delete last 15 chars from a file

2005-03-02 Thread Shaun
Hi,

I am trying to create an XML file, it will be done in stages so if the file 
isn't present I will add the line:




Then for each line I add I add the following

data

But for various reasons the application won't know when the file is complete 
so it won't have the final:



To solve this I intend to add the following each time

data


and delete the  every time I add a new 
data. Can anyone tell me how I can delete the 
last 15 characters from a file every time I open the file?

Thanks for your help 

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



[PHP] Help with a query please - unable to error check!

2005-02-16 Thread Shaun
Hi,

I have a problem with a query, I get the following error message:

You have an error in your SQL syntax. Check the manual that corresponds to 
your MySQL server version for the right syntax to use near '' at line 23

If I echo the query to the screen and run the query to the database via SSH 
it executes correctly.

Does anyone have any ideas on what else I can check for here?

Thanks. 

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



Re: [PHP] Delete a file immediately after download

2005-02-15 Thread Shaun
Hi Marek,

Thanks for your reply, could you tell me how I would go about this please?


"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Shaun wrote:
>> Hi,
>>
>> I have a database that contains encrypted data using Mysql function 
>> ENCODE(). Certain users will be allowed to view this data and I will 
>> allow them to download a CSV file contain the decrypted data using the 
>> Mysql DECODE() function. However I don't want this file to be left on the 
>> server, is there a way to ensure that the file is deleted immediately 
>> after it has been downloaded?
>
> Don't put the file to a file at all, simply output the right header and 
> echo the content. 

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



Re: [PHP] Delete a file immediately after download

2005-02-15 Thread Shaun
Hi Matt,

Thanks for the reply, I know how to delete a file I just wanted to know if 
its possible to ensure that its deleted automatically as soon as the user 
has downloaded it.

Thanks...

"Matt M." <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> I have a database that contains encrypted data using Mysql function
>> ENCODE(). Certain users will be allowed to view this data and I will 
>> allow
>> them to download a CSV file contain the decrypted data using the Mysql
>> DECODE() function. However I don't want this file to be left on the 
>> server,
>> is there a way to ensure that the file is deleted immediately after it 
>> has
>> been downloaded?
>
> http://us4.php.net/unlink 

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



[PHP] Delete a file immediately after download

2005-02-15 Thread Shaun
Hi,

I have a database that contains encrypted data using Mysql function 
ENCODE(). Certain users will be allowed to view this data and I will allow 
them to download a CSV file contain the decrypted data using the Mysql 
DECODE() function. However I don't want this file to be left on the server, 
is there a way to ensure that the file is deleted immediately after it has 
been downloaded?

Thanks for your help. 

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



[PHP] Ensure a number is three digits long

2005-02-13 Thread Shaun
Hi,

I have am trying to create functions to convert strings to ascii and vice 
versa:

function string_to_ascii( $str ) {
 for( $i=0; $i < strlen( $str ); $i++ ) {
   $asc .= ord( substr( $str, $i ) );
  }
 return $asc;
}

This function works fine, however I need to ensure that the ASCII 
convertions are three digits long so that I know where to split the ASCII 
string when converting back to a normal string. i.e. 97 must be 097.

Thanks for any advice offered 

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



Re: [PHP] Convert a string to ASCII

2005-02-11 Thread Shaun

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
[snip]
Is it possible to create an ascii representation of a string with php, i
had
a look on the site but with no luck :(
[/snip]

You mean like this?

__

^(picture of a string, obvious).j/k

Do you mean the ascii values for a string? Yes it is possible, it only
requires that you use one of the regex or replace functions

Hi,

Thanks for your reply, yes for each character in the string I need to 
replace it with its ascii representaion 

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


[PHP] Convert a string to ASCII

2005-02-11 Thread Shaun
Hi,

Is it possible to create an ascii representation of a string with php, i had 
a look on the site but with no luck :(

Thanks for your advice 

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


Re: [PHP] Getting two queries into one result set

2005-02-02 Thread Shaun
Hi guys,

Thanks for your replies but neither UNION or REGEXP can be used with SHOW 
TABLES...

Any ideas?

"Jochem Maas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Marek Kilimajer wrote:
>> Shaun wrote:
>>
>>> Hi,
>>>
>>> I have a query where I select all table names where the table name has 
>>> PID_1 in i.e.
>>>
>>> SHOW TABLES LIKE '%PID_1%';
>>>
>>> However there may be cases where I need to search for tables where the 
>>> table name is PID_1 or PID_2. In MySQL this can't be done in one query, 
>>> so how can I do two queries and combine the result set so I can loop 
>>> through it?
>>>
>>> Thanks for your help
>>
>>
>> SHOW TABLES REGEXP 'PID_[0-9]+';
>>
>
> nice! :-) 

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



[PHP] Getting two queries into one result set

2005-01-26 Thread Shaun
Hi,

I have a query where I select all table names where the table name has PID_1 
in i.e.

SHOW TABLES LIKE '%PID_1%';

However there may be cases where I need to search for tables where the table 
name is PID_1 or PID_2. In MySQL this can't be done in one query, so how can 
I do two queries and combine the result set so I can loop through it?

Thanks for your help 

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



[PHP] Use a query twice

2005-01-20 Thread Shaun
Hi,

I have the following query:

$result = mysql_query("SELECT * FROM Users");
while( $r = db_fetch_array( $result ) ){
 echo $r['Name'];
}

Is it possible to use the same result set to loop through the values form 
the begining or do I have to create the $result varible again?

Thanks for your help 

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



[PHP] Data Enryption

2005-01-12 Thread Shaun
Hi,

I have site that allows users to upload private information to our server. 
We would like to encrypt the data for security reasons and only allow 
certain users to be able to un-encrypt the data and view it. I have looked 
at the PHP encryption functions and they appear to be one way algorithms - I 
am guessing this is the whole point of encrption ;)

Does anyone have any suggestions regarding this?

Many thanks

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



[PHP] Removing a return character

2004-12-10 Thread Shaun
Hi,

I have a system that scans through a CSV File and inserts each row into a 
database. I have just noticed that some rows have a return character in 
them - a small square - and this is causing errors in the mysql query.

Does anyone know how I can remove such chracters?

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



[PHP] Magic Quotes Issue

2004-12-07 Thread Shaun
Hi,

I have been investigating the problem of apostrphes in a mysql insert / 
update. I use a db_query function for all my queries:

function db_query($query) {
  $qid = mysql_query($query);
  return $qid;
}

It appears after some research that the best way around the problem is to 
check whether magic_qoutes_gpc is off and if so use addslashes(). I have 
altered the function to this:

function db_query($query) {
  if(!magic_quotes_gpc()){
$qid = mysql_query(addslashes($query));
  } else {
$qid = mysql_query($query);
  }
  return $qid;
}

But this adds too many slashes! Has anyone come to a better solution 
regarding this?

Thanks 

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



[PHP] Re: Problem with parameter count in strstr()

2004-11-30 Thread Shaun
Sorry,

I was confusing strstr with strtr!


"Matthew Weier O'Phinney" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>* Shaun <[EMAIL PROTECTED]>:
>> I am trying to ensure that all data added to each element of 
>> $my_data_array
>> has no commas, however I get an error message saying Warning: Wrong
>> parameter count for strstr()
>>
>> $my_data_array[] =
>>   strstr( $data[1], ",", " " );
>>   strstr( $data[2], ",", " " ).', '.
>>   strstr( $data[3], ",", " " ).', '.
>>   strstr( $data[6], ",", " " ).', '.
>>   strstr( $data[13], ",", " " ).', '.
>>   strstr( $data[14], ",", " " ).', '.
>>   strstr( $data[15], ",", " " ).', '.
>>   strstr( $data[16], ",", " " ).', '.
>>   strstr( $data[17], ",", " " ).', '.
>>   strstr( $data[18], ",", " " ).', '.
>>   strstr( $data[19], ",", " " ).', '.
>>
>> Could someone tell me what I am doing wrong here please?
>
> A couple things:
>
> * Syntax for strstr() is strstr(string $haystack, string $needle) --
>  you're passing it three arguments instead of two
>
> * What exactly are you concatenating, and where do you expect it to go?
>  If you're trying to create a joined list of $data elements 1-19 and
>  assign it to a variable, you're going to run into issues when you get
>  to that semicolon at the end of your second line ;-)
>
> Also, if you're simply trying to do the following:
>
>* Join a list of elements with a ,
>  * but only join the part of the element preceding a comma (or
>space? not sure of your intentions as you've got bad arguments)
>
> Then you may want to try the following:
>
>function subStr($n)
>{
>return strstr($n, ',');
>}
>
>$stripped = array_map('subStr', $data);
>$my_data_array[] = join(', ', $stripped);
>
>
> -- 
> Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
> Webmaster and IT Specialist   | http://www.garden.org
> National Gardening Association| http://www.kidsgardening.com
> 802-863-5251 x156 | http://nationalgardenmonth.org 

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



[PHP] Problem with parameter count in strstr()

2004-11-30 Thread Shaun
Hi,

I am trying to ensure that all data added to each element of $my_data_array 
has no commas, however I get an error message saying Warning: Wrong 
parameter count for strstr()

$my_data_array[] =
  strstr( $data[1], ",", " " );
  strstr( $data[2], ",", " " ).', '.
  strstr( $data[3], ",", " " ).', '.
  strstr( $data[6], ",", " " ).', '.
  strstr( $data[13], ",", " " ).', '.
  strstr( $data[14], ",", " " ).', '.
  strstr( $data[15], ",", " " ).', '.
  strstr( $data[16], ",", " " ).', '.
  strstr( $data[17], ",", " " ).', '.
  strstr( $data[18], ",", " " ).', '.
  strstr( $data[19], ",", " " ).', '.

Could someone tell me what I am doing wrong here please?

Thank you 

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



[PHP] Holding an array in a session

2004-11-19 Thread Shaun
Hi,

I have created an array of tables in my database and put it into a session 
using the following code:

  $_SESSION['ses_csv_files'][] = array();
  $qid = mysql_query("SHOW TABLES");
  $num = mysql_num_rows($qid);
  for ($i = 0; $i < $num; $i++) {
   $r = mysql_fetch_array($qid);
   $_SESSION['ses_csv_files'][$i] = $r[0];
  }

I would like to be able to print the current value of the session on various 
pages in my application, however I can only find reference to looping 
through an array in one go. I know I can use next() to increment the pointer 
in the array, is it possible for the session to hold the current pointer in 
the array, if so how can I display its value?

Thanks for any advice offered. 

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



[PHP] Getting the date of Monday from a week number and year

2004-11-03 Thread Shaun
Hi,

is it possible to get php to calculate the date of the monday given a week 
number and the year? I have looked http://uk.php.net/strtotime here and can 
find refererence to everything but this!

Thanks for your help, 

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



[PHP] List of Dates Grouped by Week

2004-10-26 Thread Shaun
Hi,

I am creating an online timesheet application. Most parts are done, however 
I have a problem displaying a list of unapproved timesheets.

Here is my timesheet table:

mysql> DESCRIBE Timesheets;
+---+-+--+-+++
| Field | Type| Null | Key | Default| Extra 
|
+---+-+--+-+++
| Timesheet_ID  | int(11) |  | PRI | NULL   | auto_increment 
|
| Type  | varchar(40) | YES  | | NULL   | 
|
| Project_ID| int(11) | YES  | | NULL   | 
|
| User_ID   | int(11) |  | | 0  | 
|
| Hours | float   |  | | 0  | 
|
| Date  | date|  | | -00-00 | 
|
| Status| varchar(40) | YES  | | Open   | 
|
+---+-+--+-+++

When a timesheet is submitted for approval the manager logs in and approves 
/ rejects the timesheets. How can I display a list of unapproved timesheets 
grouped by week and user? i.e.

Week 1 - Bill - 45 Hours
Week 1 - Fred - 40 Hours
Week 2 - Bill - 45 Hours
Week 2 - Fred - 40 Hours
Week 2 - Sam  - 12 Hours

Thanks for your help. 

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



[PHP] Substr

2004-10-25 Thread Shaun
Hi,

I have a string as follows: pid_1_date_2004_10_25

pid tells me the Project_ID and date tells me the date(!). I need to extract 
this information from the string so to get the date I need everything after 
'date_' as follows:

substr(strstr($key, 'date_'), 4)

However, to get the Project ID I need to extract everything after 'pid_' and 
everything before 'date_'. Can someone help me with this please as PHP 
doesn't seem to provide a function for extracting information from a string 
that occurs before the 'needle'? 

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



[PHP] Strange Array Error

2004-10-21 Thread Shaun
Hi,

I have been trying for the past two hours to understand why I get an error 
with the following code:

';
 }
?>

Fatal error: Unsupported operand types in 
/usr/home/expensesystem/public_html/test.php on line 5

I am trying to create a loop where $i is added to array element $i, and 
can't find any information relating to this on google or php.net...

Thanks for your advice. 

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



[PHP] 1st day of the Week

2004-10-20 Thread Shaun
Hi,

I am trying to use the strtotime function to get dates for the first and 
last days of a given week:

';
 echo date("Y-m-d", strtotime("sunday", strtotime("2004-10-18")));
?>

Using the code above works fine until the date input is a Monday then it 
outputs the date of the previous Monday. Does anyone know of another way?

Thanks for your help 

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



[PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Shaun
Hi,

Could anyone help me with a reugular expression for a UK mobile phone 
number?

So far I have tried this but with no success


$regexp = "/^447[0-9]{9}$/";
if(!preg_match( $regexp, $_POST[mobile_number] )){
 $error = "Invalid Mobile Number";


The number nust be 11 numbers long, be all numbers, have no spaces and begin 
with 447.

Any help would be greatly appreciated... 

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



Re: [PHP] User Defined Forms

2004-10-14 Thread Shaun

"Ed Lazor" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > I have interviewed a few users and it has become instantly
> > apparent that
> > they all work differently and record slightly different
> > information about
> > their clients making it impossible to produce a general set
> > of forms that
> > would encompass all users. I haven't done any other forms of
> > modelling as
> > yet.
>
> Create a global list of information that your users want to record about
> their clients.  Review it and generalize information as much as possible.
> Divide the information into groups based on who uses it.  Hopefully you'll
> end up with sets of information that are common to all with only a few
sets
> that are user specific.  Work with your customers a lot here, because it
> sounds like they are generally confused on how to organize their
> information.  Ie. They are relying on your help for that.  Also keep in
mind
> that, in many cases, there is general information that everyone wants to
> record about their clients and that anything else is usually considered
> "notes".  So, for example, if you create a table for the client's name,
> address, phone, etc. and then create a notes section, you've captured a
> majority of the information that your users want to track for their
clients.
>
> Ultimately, after all of that and if someone's willing to pay for the
> development time, you could theoretically setup a series of forms where
the
> first form prompts for general detail and then, based on who's logged in,
> you could present additional forms.  You could even design the logic
behind
> forms to respond based on information that's entered.  For example, if the
> first form asks for the client's city, follow-up forms may prompt for data
> specific to that city.
>
> Hope this helps,
>
> -Ed

Hi Ed,

User data like name age address etc will probably apply to all cases but
that is where it will end. The site is intended for use by Personal Trainers
and each personal trainer has their own way of recording information,
creating programs for gym users etc...

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



Re: [PHP] User Defined Forms

2004-10-14 Thread Shaun

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
I am creating a site where users record details of their clients and
record
their progress. The whole point of the system is to reduce the amount of
paper work and store everything online.
[/snip]


How much time have you spent with the users? How well do you understand
their needs? Have you done a flowchart or any other modeling?

Hi Jay,

I have interviewed a few users and it has become instantly apparent that
they all work differently and record slightly different information about
their clients making it impossible to produce a general set of forms that
would encompass all users. I haven't done any other forms of modelling as
yet.

Thanks for your help

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



[PHP] User Defined Forms

2004-10-14 Thread Shaun
Hi,

I am creating a site where users record details of their clients and record
their progress. The whole point of the system is to reduce the amount of
paper work and store everything online.

The problem here is that each user will have their own forms to fill in on
their clients, some will record different data to others and some will have
more forms than others. Therefore I believe I am correct in saying this
would be impossible to store in a database as each user would require their
own fields etc. One other solution I have thought of is to have each user
create a set of PDF forms when they sign up and each time they fill one in
they upload it to the server for storage.

I would be most grateful for anyone's input on this before I dive in head
first!

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



[PHP] Problem with a time comparison loop

2004-10-09 Thread Shaun
Hi,

I am trying to create an outlook style day view calendar. I loop through the 
hours in the day (00:00 - 23:00) and compare it to a diary table for the 
user. If the users 1st appointment isnt until 10:00 then the hours print out 
until that appointment then continue looking for the next appointment.

However if the user has no appointments in the day then the table layout 
doesnt work because of this line:



With no entries for that day this results in the following:

date("H:i", strtotime(@mysql_result($qid, $i, Booking_Start_Date))) = 00:00
$hours[$x].':'.$minutes[$y] = 00:00

My question is therefore how can i get this line ' date("H:i", 
strtotime(@mysql_result($qid, $i, Booking_Start_Date))) ' to output nothing 
if there is no entry in the database?

Thanks for your help 

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



[PHP] Using & before a variable

2004-09-03 Thread Shaun
Hi,

I have noticed that some of the functions in a tutorial I am studying have
an & in the variable parameters i.e.

function add(&$id) {
 /* function body */
}

I would be most grateful if some can shed some light on this as i cant fnd
any reference to this in the PHP manual...

Thanks

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



[PHP] $_SERVER['HTTP_HOST'] without the 'www.'

2004-08-31 Thread Shaun
Hi,

How can I get the URL of the page I am on without the 'www.' i.e. just
mydomain.com? I need to enurse this is correct in case the user types in the
domain without using the 'www.'.

I have looked at using substr but if the user leaves out the 'www.' then
substr($_SERVER['HTTP_HOST'], 4) would return 'main.com', is there a better
function to use in this instance?

Thanks for your help

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



Re: [PHP] Destroying a Session

2004-08-25 Thread Shaun

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >> function clear_orderinfo() {
> >>   global $_SESSION;
> >>   unset($_SESSION["orderinfo"]);
> >>  }
> >>
> >> However this function doesnt seem to work and the session remains
> >> active, is
> >> there another way to clear a session?
>
> I'm not triffically experienced, but I do have notes on the subject.
> You're wanting to clear the whole session, right?
>
> $_SESSION=array();
> session_destroy();
>
> For specific variables, try assigning FALSE to it
> ($_SESSION['name']=FALSE; or 'unset' works for versions >=4.2.2. Otherwise
> use session_unregister. For me under 4.1.2 I had to set to null.
>
> HTH
> J
>
>

Hi,

Thank you for your replies. I am using version 4.3.3 yet unset() doesn't
seem to work. To test this I have placed this line of code in my footer.php
file that appears at the bottom of every page:

echo 'load_orderinfo() = '.load_orderinfo();

Here is the load_orderinfo() function:

function load_orderinfo() {
  global $_SESSION;
  if (empty($_SESSION["orderinfo"])) {
   return false;
  } else {
   return $_SESSION["orderinfo"];
  }
 }

Before the $_SESSION["orderinfo"] is created the output in the footer reads:

load_orderinfo() =

When it has been created it reads:

load_orderinfo() = Object;

On the complete_order.php page where I call the clear_orderinfo() function
it goes back to:

load_orderinfo() =

but it on any subsequent page the output returns to:

load_orderinfo() = Object;

But after calling the clear_orderinfo() function surely the
$_SESSION["orderinfo"] should have been destroyed. I hope this makes sense!

Thanks for your help

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



[PHP] Communicate with Outlook

2004-08-25 Thread Shaun
Hi,

Is it possible for a PHP application to communicate with an Outlook
calendar? I would like to create a web based application that shows staff
availability...

Thanks for any advice offered.

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



[PHP] Destroying a Session

2004-08-25 Thread Shaun
Hi,

I am writing a shopping cart and am using a session called
$_SESSION["orderinfo"] to store the order information. I also have a
function I use to clear the session when the payment has been authorized:

function clear_orderinfo() {
  global $_SESSION;
  unset($_SESSION["orderinfo"]);
 }

However this function doesnt seem to work and the session remains active, is
there another way to clear a session?

Thanks for your help

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



[PHP] Holding links in a database

2004-08-07 Thread Shaun
Hi,

I have a table in my database that holds links for individual pages on my
site:

mysql> DESCRIBE Page_Links;
+---+--+--+-+-++
| Field | Type | Null | Key | Default | Extra  |
+---+--+--+-+-++
| Link_ID   | int(11)  |  | PRI | NULL| auto_increment |
| PHP_SELF  | varchar(100) |  | | ||
| Action| varchar(100) |  | | ||
| Link  | varchar(255) |  | | ||
| Link_Text | varchar(100) |  | | ||
+---+--+--+-+-++
5 rows in set (0.00 sec)

The links that appear on each page depend on PHP_SELF i.e./users/index.php
and $_GET[action] variable i.e. add_user.

This all works well until there is a problem with the form validation, for
example if I am on the add_user.php page and I click to add a user I am
taken back to the users list, the action is insert_user and I display the
links accordingly. However if there is a problem with the submission i.e.
the user leaves a field blank then they are redirected to the add_user.php
page, the action is still insert_user but I would not want the same links to
appear on this page.

Any help on this matter would be greatly appreciated

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



  1   2   3   4   >