Re: [PHP] Get Parameters in Includes [SOLVED!!!]

2008-01-10 Thread Liam

mike wrote:

yeah - well you said you can't issue an http request

although it depends - if your reporting is
javascript/browser-executable, or if it's a server-side increment. if
it's javascript, no worries, the curl request won't execute it.

On 1/10/08, Liam <[EMAIL PROTECTED]> wrote:

mike wrote:

you're still issuing an HTTP request to get it, or executing perl on
the command line...

if it's a true non-profit 503(c)(3), you could offer someone the
chance to write off their services... non-profits may not have a lot
of money to spare but they do typically have money to fund things in
the organization's interests... hopefully.

Well, heh, I am really the only person behind my organization, and I'm
under 18, so I can't get a PayPal account or whatever and accumulate
donations either.

However, I did find a cURL solution: this is the code behind it for
anyone else who had/has this problem:

http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks";);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result
?>

Now, I just need to look into parsing the text.

Thanks everyone for your assistance, I'll be sure to come back here and
frustrate you with any future problems I have.  :] :P

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



It's a server side log thing.

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



[PHP] Get Parameters in Includes [SOLVED!!!]

2008-01-10 Thread Liam

mike wrote:

you're still issuing an HTTP request to get it, or executing perl on
the command line...

if it's a true non-profit 503(c)(3), you could offer someone the
chance to write off their services... non-profits may not have a lot
of money to spare but they do typically have money to fund things in
the organization's interests... hopefully.


Well, heh, I am really the only person behind my organization, and I'm 
under 18, so I can't get a PayPal account or whatever and accumulate 
donations either.


However, I did find a cURL solution: this is the code behind it for 
anyone else who had/has this problem:


curl_setopt($ch, 
CURLOPT_URL,"http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks";);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result
?>

Now, I just need to look into parsing the text.

Thanks everyone for your assistance, I'll be sure to come back here and 
frustrate you with any future problems I have.  :] :P


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



Re: [PHP] Re: Scratch that

2008-01-09 Thread Liam
My non-profit setup makes that 'Pay Someone' alternative.  What I am 
planning on doing:


When the script is called, it is equivilent of using the want=ssilinks 
GET parameter.


So therefore, all I need to do is get the HTML returned from the script, 
not the contents of the script itself.  Can anyone help now?


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



Re: [PHP] Re: Scratch that

2008-01-09 Thread Liam

OK, what I meant was
1) Not dump the contents to a file, as the cgi will dynamically show 
different links every time, (it's a reciprocal linking script)
2) Not count as though the user manually navigated to that page (for my 
sanity when checking the site statistics!)

and
3) I also need to know how to run a expression-ish thing so that when I 
'parse' the text, it returns all text between x and y, but parse it 
BEFORE it gets 'included'.


Note: fOpen is NOT enabled, and I CAN'T enable it.

Thanks in advance
P.S. Sorry mike for my previous ungracious answer.

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



[PHP] Rephrase

2008-01-09 Thread Liam

OK, what I meant was
1) Not count as though the user manually navigated to that page (for my 
sanity when checking the site statistics!)

and
2) I also need to know how to run a expression-ish thing so that when I 
'parse' the text, it returns all text between x and y, but parse it 
BEFORE it gets 'included'.


Note: fOpen is NOT enabled, and I CAN'T enable it.

Thanks in advance
P.S. Sorry mike for my previous ungracious answer.

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



[PHP] Re: Scratch that

2008-01-09 Thread Liam

Liam wrote:
How can I display the returned HTML contents of a cgi (Perl) script, 
without get parameters?

Oh, this means that
1: It mustn't count as a http hit,
and 2: I need to only get what is between the  tags.

Thanks in advance.

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



[PHP] Scratch that

2008-01-09 Thread Liam
How can I display the returned HTML contents of a cgi (Perl) script, 
without get parameters?


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



Re: [PHP] Get Parameters in Includes?

2008-01-09 Thread Liam

On 1/9/08, Liam <[EMAIL PROTECTED]> wrote:

mike wrote:

that is a horrible method.

Thanks for the nice positive, refreshing and most helpful response.


read the sentence below it.


in my opinion i would say "redesign it properly."

Well what the hell do you suggest I do???  The script is MEANT to be
used this way, as it has an admin panel inside etc.


provide more details. like what is the .cgi? perl? or is it PHP as
well for some reason?


Oh, by the way, nice grammar.


i gave you an opinion and my personal experience trying to support the
same method you're attempting here. i did not only reply to say "don't
do it"

i assume the .cgi is in perl, and you're trying to call this in PHP?

if it is all PHP, you can define a variable and just call the include
without having to deal with a query string. probably not the case.

if not, then pre-generate the navigation items in a flatfile and call
that in using include(). otherwise you can waste a web request each
time back to your webserver to execute the CGI with the proper
environment and parameters.

i could give a rip about capitalization here, and the grammar being
used is good enough to be understood. either way, you'll skip past the
meat of the message anyway and look for other things to reply about.


The cgi script IS perl.  Oh, RE: the sentence below it: I'm running 
apache, and it DOESN'T work.  The reason I am trying to call it in php 
is to include it on a webpage.  So, tell me, how am I supposed to 
pre-generate the contents in a flatfile (whatever that is)?  Or if I 
can't do that, then what I am supposed to do?


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



Re: [PHP] Inclusion with Get Parameters?

2008-01-09 Thread Liam

Jim Lucas wrote:

Liam wrote:

Hi!

I have a cgi script that returns a particular value when I call it as 
x.cgi?want=ssilinks.  I need to call it like that, but whenever I put 
the GET parameter into the include path, I get a warning saying that 
the file could not be found.  Any help?


Thanks,
Liam



I would look into calling it from exec() or system(). That might work 
better.


Or, I would look into calling it with cURL.  This way you call it like 
you would in your browser.  That will work the best.


Jim
Thanks for your reply, but I don't understand you.  PHP is not my mother 
tongue :P  Could you please give me examples?  It seems I forgot to 
mention that that is an include.


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



Re: [PHP] Get Parameters in Includes?

2008-01-09 Thread Liam

mike wrote:

that is a horrible method.

Thanks for the nice positive, refreshing and most helpful response.

in my opinion i would say "redesign it properly."
Well what the hell do you suggest I do???  The script is MEANT to be 
used this way, as it has an admin panel inside etc.


Oh, by the way, nice grammar.

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



[PHP] Inclusion with Get Parameters?

2008-01-09 Thread Liam

Hi!

I have a cgi script that returns a particular value when I call it as 
x.cgi?want=ssilinks.  I need to call it like that, but whenever I put 
the GET parameter into the include path, I get a warning saying that the 
file could not be found.  Any help?


Thanks,
Liam

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



[PHP] Get Parameters in Includes?

2008-01-09 Thread Liam

How do I use a get parameter in a include?

e.g.


I can't modify the cgi file though, and HTML includes don't work on my 
server.


Thanks in advance.

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



Re: [PHP] Help Defending against Email Injection Attacks

2006-02-06 Thread Liam Delahunty
> On 2/6/06, Jim Moseby  wrote:
> Is it time to abandon using mail() for all user contributed data?

Sort of. Don't write any user input to the headers.

Send the data to a default address, don't include anything in the
subject or the headers from the input and you'll avoid the problems.


--
Kind regards,
Liam

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



Re: [PHP] Store a variable name in a database field.

2005-10-13 Thread Liam Delahunty
On 10/10/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> > $email_body is a free form text field, and he wants to be able to type
> > in anything he desires and have it pulled from the contact table.
> >

Firstly please accept my aplogies for the deay in responding to your
questions, I;ve had the most terrible flu.

pseudo code (ish), as I've completely bastardised what I had when I
posed the question.

// insert newsletter into newsleter_tbl in database ...
from a form, body in a textarea field, client wants to type in
whatever he likes with database column names as varibles, eg $email,
$first_name


this is the newsletter write on newsletter_new.php

if ($submit){
// removed error checking etc

$email_subject = htmlentities(addslashes($email_subject));
// tried various combintions of htmlentities, addslashes and nothing
when writting field to DB
if ($email_style == "1"){
  $email_body = htmlentities(addslashes($email_body));
}else{
  $email_body = addslashes($email_body);
}
$email_style = htmlentities(addslashes($email_style));

$query = "INSERT INTO newsletters_tbl (email_subject, email_body,
email_date, email_style) VALUES ('$email_subject', '$email_body',
NOW(), '$email_style')";
if ($result = mysql_query($query, $connection)) {
  $newsletter_id= mysql_insert_id($connection);
  print ("Success Add newsletter (# $newsletter_id)
successful. \n");
  print ("CLICK
HERE TO TEST\n");
} else {
  printf ("Error: %s\n", mysql_errno () . "");
  printf ("%s\n", mysql_error () . "");
  print ("$query\n");
}
  }
}

// BTW the contact details are in another table in database already.

// Sending out the newsletter
$nquery=" SELECT c.id, first_name, email FROM contact_tbl c LEFT OUTER
JOIN newsletters_contacts_tbl nct ON nct.contact_id =c.id AND
newsletter_id = '$this_nid' WHERE nct.contact_id IS NULL AND
newsletter = '$email_style' GROUP BY email LIMIT 1";
if ($nresult = mysql_query($nquery, $connection)){
  if (mysql_num_rows($nresult) > 0){
while ($myrow = mysql_fetch_row($nresult)) {
  $uid=$myrow[0];
  $first_name=stripslashes($myrow[1]);
  $email=stripslashes($myrow[2]);

  $query = "SELECT * FROM newsletters_tbl WHERE id = '$this_nid' ";
  $result = mysql_query($query, $connection);
  if($result){
while ($myrow = mysql_fetch_row($result)){
  $newsletter_id = $myrow[0];
  $email_subject = stripslashes($myrow[1]);
  $email_body = stripslashes($myrow[2]);
  $email_date = $myrow[3];
  $email_style = $myrow[4];
  $email_status = $myrow[5];
}
if ($email_status == "0"){
  print ("Requires Confirmation");
}elseif($email_status == "1"){

  /*
  // NOW USING {{ }} as in many templating systems
  // so familar to those sorts of users.
  // would prefer if I could just use $columnName from
  // contact_tbl.
  // Why doesn't it just know the var as we've already
  // got it above...?
  */

  $email_body = ereg_replace ("\{\{uid\}\}", $uid, $email_body);
  $email_body = ereg_replace ("\{\{email\}\}", $email, $email_body);
  $email_body = ereg_replace ("\{\{first_name\}\}",
$first_name, $email_body);

  if ($email_style == "1"){
// INSERT PLAIN TEXT HEADER
  }elseif ($email_style == "2"){
// INSERT HTML MIME HEADERS
  }

  $outquery="INSERT INTO newsletters_contacts_tbl
(newsletter_id, contact_id, sent_date) VALUES ('$newsletter_id',
'$uid', NOW())";
  if ($outresult = mysql_query($outquery, $connection)) {
// SEND IT CODE
  } else {
// ERROR CODE
  }
  }
}
  }
}else{
  // ERROR CODE
}


Many thanks for your help on this mater.

--
Kind regards,
Liam

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



[PHP] Store a variable name in a database field.

2005-10-10 Thread Liam Delahunty
I'm sure this is a pretty basic question, but I have searched for a
decent answer and can't find one.

I have a client that want to be able to write newsletters
(newsleters_tbl.email_body) and use fields from his contact table, so
as we grind through the contact list for newsletters subscribers it
may pull out $first_name, or $last_name, or perhaps the address and so
on, and send an individual email and have it in the $email_body field
from another table.

$email_body is a free form text field, and he wants to be able to type
in anything he desires and have it pulled from the contact table.

I've tried with and without addslashes, and htmlentities. Is there a
solution or I will I have to resort to getting him to use
{{$first_name}} etc.

Lastly, if I have to use {{whatever}} then what's the reason I can't
use $field_name in the database?

--
Kind regards,
Liam Delahunty

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



Re: [PHP] Image copying

2005-01-07 Thread Liam Gibbs
Richard, thanks. This made it much clearer. I read this, then stepped away
and thought about it later and it makes so much more sense. Basically, I
guess I ended up with the result  in my HTML.
Man, I thought I was telling it to print the results of the resource ID, but
it was printing it on its own. Now the problem is solved! Thanks so much.

And Jason's little bit helped as well. That was my jumping off point.

Thanks so much, guys! Now onto the next brow-beating

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



[PHP] Image copying

2005-01-05 Thread Liam Gibbs
Hello,

I'm having a real frustrating time with my problem here, which is to copy one 
JPEG to another resource. I'm not even sure where I'm going wrong, or how to 
find it out, because it seems that I'm getting all my resource IDs fine (when I 
echo them, I get 'resource ID #x'), and no error message pops up. Just a broken 
image is produced. I've been racking myself for so long now that my problem may 
be right under my nose, but my brain is so baked it's just not working. And 
I've tried to leave and come back to it, but... you know how it is. Here's what 
I'm doing.

What I'm trying to do is copy one JPEG to another JPEG (as mentioned) on the 
fly. I don't want to have a new file produced, just a modified JPEG (a few 
circles here and there) held in a resource. Here's how I call my function and 
how I display the image via HTML:

print("");

So I'm calling the function straight from the SRC attribute of the IMG tag. 
Here's what's in my function:

function copy_pic($sourcepic) {
   if(file_exists($sourcepic)) {
  $destinationpic = imagecreatetruecolor(imagesx($sourcepic), 
imagesy($sourcepic));
  imagecopy($destinationpic, $sourcepic, 0, 0, 0, 0, imagesx($sourcepic), 
imagesy($sourcepic));
   }

   return $destinationpic;
}

After this, I'm going to be tampering with the pic, but I just wanted to make 
sure I'm getting something, which I'm not. All I get is a broken image. No 
error message, no nothing. Please tell me I'm not overlooking some really 
idiotic thing, but I'm just having one heckuva time with this.

Thanks, everyone.

[PHP] Weird search and replace

2005-01-05 Thread Liam Gibbs
I'm trying to do a search-and-replace for a certain string (#1) from a bigger 
string (#2), take that string (#1), do an SQL search, then do a little fiddling 
to make another string (#3), and put that string (#3) back into the big string 
(#2) to replace the certain string (#1).

Here's what I need. I have a string such as this:

"Yadda yadda yadda yadda '32'(l) yadda yadda yadda '2'(l) yadda '419'(l)." (#2)

I need to find the strings like '32'(l), '2'(l), and '419'(l), including the 
single quotes. Basically a '[0-9]*'(l). This is #1.

Take that string, look up a record in an SQL table based on the number in the 
single quotes. Take a field in the record (#3) and replace #1 with it. So 
basically, we have:

"Yadda yadda yadda yadda supplanted-string yadda yadda yadda supplanted-string 
yadda supplanted-string." (#2)

I really hope I'm explaining this properly, and after a few attempts, I have no 
clue where to restart. Does anyone have any ideas how to do this?

Re: [PHP] Passing of querystrings

2004-02-01 Thread Liam
The variable is infact created, but rather than being $id
the variable will be $_GET['id']

because it is part of the $_GET array,
so if  you had output2.php?name=fred

the variable to acsses the word fred would be $_GET['name']

Hope that helps
Liam
- Original Message -
From: "Ryan Francis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 01, 2004 6:12 PM
Subject: [PHP] Passing of querystrings


> Hi,
>
> I am new to php and trying to learn it for some university work.  The
> problem I am having is this:
>
> I have read on a webmonkey tutorial that when you call a php file and
> name-value querystrings are automatically created into variables in your
> script.
>
> I have a example url :  http://localhost/output2.php?id=1
> Which I hoped would make a variable, $id, and set the value to 1.  However
> it doesnt work, the variable is not created.
>
> Any help would be greatly appreciated.  I have Appache 2.0.48, MySQL
4.0.17,
> and PHP 4.3.4
>
>
> Many Thanks
>
>
> Ryan Francis
>
> --
> 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] stristr

2004-02-01 Thread Liam
I've been trying to make this error logger for hours now,

I get my webserver to forward all errors to error.php?message=404 etc.. 

The source can be found here
http://the-bronze.me.uk/ID/error.txt

Now Im at my wits end, I want all errors that come internaly eg from the-bronze.me.uk 
to be put into onserver.txt and all other ones to be put into 404.txt 

Unfortuantly I seem to be a little lost and confusded, can anyone see where im going 
wrong as far as my stristr(); usage is and if so what is the problem?

Liam 


Re: [PHP] HTML equivalents of accented characters

2003-08-14 Thread Liam Gibbs
> I have no idea what might be the problem, what does your translation table
> look like?

Mine is still coming out as a single character. Here's my code, in case
anyone can spot any stupid human error blunder I'm making:

 $translationtable = get_html_translation_table(HTML_ENTITIES);
 $string = htmlspecialchars($string);

Also, here's my setup, just in case:
PHP 4.3.1
Linux 2.2.19 #1 i586
Apache 1.3.27
MySQL 3.23.49 (don't know what this has to do with it, but just in case
there has been some interference with PHP and MySQL)
GD 2.0 compatible


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



Re: [PHP] array looping

2003-08-14 Thread Liam Gibbs
> I get all the content of file, so everything is in array 0.  I need to
> somehow break up the array by the comma.

Wouldn't it be $file_contents = explode(",", $file_contents[0]);

as in you've forgotten the array element?

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



Re: [PHP] HTML equivalents of accented characters

2003-08-14 Thread Liam Gibbs
> I bet they do, did you check the HTML source as well? My guess is that the
> source is reading the actual expected output, but your browser views "é",
as
> it should of course.

Sorry, should have mentioned. The source code reads the actual character,
not the é.


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



Re: [PHP] HTML equivalents of accented characters

2003-08-14 Thread Liam Gibbs
> I think php.net/htmlentities will do this.

Apparently it *is*, but it won't for me. Any problems with this code?

$result[] = "é";
$result[1] = htmlspecialchars($result[0]);
$result[2] = htmlentities($result[0]);

Both return the accented E unchanged.


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



Re: [PHP] Simple cookie question

2003-08-14 Thread Liam Gibbs
> This may be a stupid question, but I'm trying to set up a system where I
can
> take a poll from visitors to my website and then set a cookie so that they
> can't vote more than once (until they clear their cookies at least).
> Problem is, I don't want to put it at the top of my page, because what if
> somebody opens up a poll but decides not to vote, then later changes his
> mind.  The cookie will prevent him from voting.  I want the cookie to be
set
> right after the user clicks the vote button, but every time I do that, I
get
> an error about headers already being sent.  Is there any way around this?

Does it have to be a cookie? I use the IP address and store that somewhere.


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



[PHP] HTML equivalents of accented characters

2003-08-11 Thread Liam Gibbs
I don't think this has been discussed, although I'm not really sure what you would 
call these accented characters, so I haven't been able to do a complete search of the 
archives, so apologies if this has been previously discussed.

Is there a function that not only turns & into &, " into ", and the like, but 
also turns é into é and likewise with other accented characters? I know I could 
easily write one, but why if one already exists?


Re: [PHP] Problem with MySQL Query

2003-07-23 Thread Liam Gibbs
> >   $dbqueryshipping1 = "select * from tempuserpurchase where
> > (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and
> > type<>'Meal Plans'
> >
>
> Tryed both methods and it is still not excluding anything matching Meal
> Plans

Been a short while since I used SQL with my PHP, but try putting NOT instead
of <>.


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



Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread Liam Gibbs
<>

Do a query, sorting by the field you need alphabetized. Then do this (and
tidy it up as you need):

echo "";
while($result = mysql_fetch_row$(query)) {
   if(substr($result, 0, 1) != $previousfirstletter) {
  $previousfirstletter = substr($result, 0, 1);
  echo "$previousfirstletter";
   }
   echo "$result";
}

echo "";

It's untested, but I believe it will work.


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



[PHP] Does PHP have vb's 'mid' function (or similar)?

2003-06-05 Thread Liam
I'm trying to find a function, similar to vb's 'mid' function that you can
return X amounts of characters at position Y from string Z. And I can't seem
to find one.

Any help?
I'm sure it's simple... so a little helper would be grand!
Cheers, Liam



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



[PHP] Object-Oriented PHP with MySQL

2003-06-03 Thread Liam Gibbs
Is it efficient to load objects with data from MySQL for PHP? I'm looking into the 
OO-ness of PHP, and I have an idea of making objects, but would like the data loaded 
from a SQL source. Is this a good idea?


Re: [PHP] ^M

2003-04-04 Thread Liam Gibbs
> It looks like you are viewing a dos/windows file on unix. The ^M is
> carriage return, which is needed as part of a dos/window end of line
> sequence (carriage return, line feed) whereas unix uses just line feed.

Nope. They're UNIX-created and UNIX-modified. Does it matter if I downloaded
them onto my PC and then back onto the server? I don't think it should,
since I did a global search-and-replace of all those suckers.

> On unix (well, a full install of linux) there are the conversion
> programs dos2unix and unix2dos. If transferring by ftp, use ASCII not
> BINARY transfer.

Yeah, I had this problem a little while ago, and it's back, but doesn't seem
to be solvable this time for some reason. Someone suggested that last time,
as well, and I haven't been able to get onto it (the server isn't under my
control right now, and I'm still trying to get a gd/imagemagick on there).

Someone suggested posting some example code so I can show what's going on.
I'm going to do that when I have a little more time.


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



[PHP] ^M

2003-04-03 Thread Liam Gibbs
So which is it that will keep my files from having ^M after PHP is finished fopen(), 
fputs(), and fclose() with them? \n, \r, and \n\r all seem to reinsert ^M at the ends 
of all my lines.


[PHP] 4 or 5 Fridays this month

2003-04-01 Thread Liam Gibbs
Is there any easy way of figuring out if there are 4 or if there are 5 Fridays in a 
given month? I have it figured out using a loop, but I was just wondering if there was 
a way that date() or strtotime() could do it.


Re: [PHP] Stylesheets, are they run?

2003-04-01 Thread Liam Gibbs
Cool. Thanks to all with the help on stylesheet running. I've gotten a few
responses to think about.


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



[PHP] Stylesheets, are they run?

2003-04-01 Thread Liam Gibbs
Here I go again with the stylesheets. ;) Anyway, if a user has stylesheets turned off, 
is a stylesheet file even run? Like, if I have them turned off and I have a 
stylesheet, say, SS.php. Will SS.php run or will it be ignored altogether?


[PHP] Humour in programming?

2003-04-01 Thread Liam Gibbs
Sorry if this is OT, but... heheheh... has anyone taken a look at the PHP site? Check 
out the upper-left corner. Who is that? Nice to know the guys at PHP can have a laugh.


Re: [PHP] Is_readable()

2003-04-01 Thread Liam Gibbs
> Check that whole path leading up to the file is accessible (+x) and
readable
> (+r) by the webserver.

No. I'm positive. I did the whole chmod 777 * -R at the public_html
directory, and did the proper grouping and ownership in the same way (with
the appropriate commands).


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



[PHP] Is_readable()

2003-03-31 Thread Liam Gibbs
Is there anything I should know about is_readable? It seems to find a file unreadable 
whether the permissions are 000 or 777.


[PHP] Question on response time, SQL vs. PHP

2003-03-31 Thread Liam Gibbs
I'm trying to do a count(*) in SQL. Would it be faster to do a or b below?

a: just do a simple query, and use mysql_num_rows() to return the row count; or
b: do the count(*) and use mysql_fetch_row() to return the result.

I guess it would have to do more with SQL response time (is it faster to grab the 
count and then the row, or all rows in question and then do a count in PHP).


Re: [PHP] Date Problem - Last Day Of Month

2003-03-31 Thread Liam Gibbs
> Hi there, can anyone tell me how to fix my code so that on the last day of
> the month, my code doesn't repeat the months...

I'm not sure what you mean by this, but I can be a moron on this list
sometimes and the clear answer usually comes to me about 2 seconds after I
hit the send button. Do you mean that you don't want any months in the
SELECT control when it's the last of the month? Or you don't want the
SELECTED attribute in the OPTION tags? As far as I can tell, you're not
repeating any months, but you're only listing them once.

Try this (and IMHO a *slight* *slight* improvement in clarity, but again,
that's my HO):


" . date("F",mktime(0,0,0,$counter,date("d"),date("Y"))) .
"";
}
}


I adjusted it so that you only print out the SELECTED attribute if it's the
current month, and I called $i as $counter, because, to me anyway, it makes
it clearer what is the $counter. If $i works for you, though, there's
nothing wrong with that, and it's not that it's unclear anyway, what with it
in the FOR loop only a few lines earlier. (I'll shut up now about $counter.)

Anyway, I added a comparison above that said if the current date is less
than the last day of the month, then print SELECTED. That's assuming I have
your question right in that you don't want to select the current month if
it's the last day of that month. Otherwise, if I'm wrong, you can take that
comparison and put it just about anywhere.

Help? Doesn't? Am I a complete goof?


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



Re: [PHP] Parsing CSS files

2003-03-31 Thread Liam Gibbs
> Yeah... the same way you made your web server parse files with a .php
> extension. Just repeat the same procedure for a .css extension.

> if you have cpanel you can add the extension from there.

Yeah, I need to find out where to add the CSS extension to my list of
parsable files. I tried just sticking regular PHP code into a CSS file, and
it didn't come out properly. I can't find the place where I can specify what
files to parse, though.


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



[PHP] Parsing CSS files

2003-03-30 Thread Liam Gibbs
Is there any way of making PHP parse files with a CSS extension?


Re: [PHP] Theme selector?

2003-03-29 Thread Liam Gibbs
> Hello, can anyone help me with a php theme selector? I want it like when
> the seletect a theme ?theme=green that it will go into a directory and
> load green.php or somthing like that please help. Thankyou

I'd store your themes in stylesheets instead.


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



Re: [PHP] gd library + animated gif

2003-03-28 Thread Liam Gibbs
> > Can GD library produce animated gif's?

Sorry. Maybe I should read more carefully. I skipped 'animatd' for some
reason? Still, no, GD won't produce animated GIFs.


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



Re: [PHP] gd library + animated gif

2003-03-28 Thread Liam Gibbs
> Can GD library produce animated gif's?

The PHP manual will tell you this. I'll save you the trouble, but next
time... well... the PHP manual will tell you stuff like this:

Since a certain version of PHP, GIFs are unsupported. I'm told they can be
read, but as far as producing new ones (resizing, changing, etc.) there's a
copyright issue over its encryption method. To use GD completely, go wtih
JPG or PNG. But, there is ImageMagick(?). Check that out. Anyone got a URL?


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



[PHP] Strtotime weirdness

2003-03-26 Thread Liam Gibbs
When I have a date, March 31, 2003, and I want to subtract 1 month using strtotime, I 
find it will literally subtract a month, so March 31, 2003 minus one month will result 
in February 31, 2003, or rather, March 3, 2003. Is there any way of making March 31, 
2003 minus one month equal February 28/29, 2003?


Re: [PHP] Default setting garbage

2003-03-26 Thread Liam Gibbs
> I'll guess that you're trying to access $frequency outside of the
> function, after you've called it, right? If so, read up on variable
> scope in the manual.

No, I'm trying to access it inside the function. This is what I have (or an
example, since I don't have it right in front of me right now):

function func($a = 1, $b = 2) {
print("[$a]");
}

>From the above example, I get [] as output.


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



Re: [PHP] Default setting garbage

2003-03-25 Thread Liam Gibbs
<>

No, no. Not insulting at all. That's often my problem. But not in this case.
I even went to the 'trouble' of copying and pasting $frequency wherever I
needed.


Original problem:
> Why is it that when I send call this function:
> function GetNextDate($whichfriday, $month = "", $frequency = 1, $basedate
=
> "")
>
> with this line:
> GetNextDate("4", "2003-03", "5");
>
> that $frequency ends up ""? Whether I set it myself when I call the
> function, or I leave it blank and let the function set it itself, it ends
up
> with nothing in it. empty() returns 1, while isset() returns nothing on
> this.


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



[PHP] Default setting garbage

2003-03-25 Thread Liam Gibbs
Why is it that when I send call this function:
function GetNextDate($whichfriday, $month = "", $frequency = 1, $basedate = "")

with this line:
GetNextDate("4", "2003-03", "5");

that $frequency ends up ""? Whether I set it myself when I call the function, or I 
leave it blank and let the function set it itself, it ends up with nothing in it. 
empty() returns 1, while isset() returns nothing on this.


Re: [PHP] Isset

2003-03-21 Thread Liam Gibbs
Responding to myself:

<>

Conversely, what about empty(). Is that a better test for if a value could
be 0 or 1 or 2 or ABC?



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



[PHP] Isset

2003-03-21 Thread Liam Gibbs
Is isset() better than $ != ""?

Often, I may have a 0 as values. While $ != "" doesn't recognize 0s (as in, that if 
would be false), isset() seems to work. Should I change all my $ != "" to isset()s, or 
are there other factors I should check?


[PHP] Carriage returns in e-mail

2003-03-21 Thread Liam Gibbs
I think I might have had this problem a long time ago, but it wasn't resolved, because 
here it is again. My carriage returns (\r\n) aren't getting e-mailed.

I have some text:
The quick brown fox\r\n\r\n
jumped over the whateverwhateverwhatever\r\n\r\n
yadda yadda yadda.

I want to create double-spacing between paragraphs. This works out fine onsite (I've 
seen the output, and it does the proper double-spacing). However, when I e-mail it, 
it's all crunched down into single-spacing, so everything is all jumbled together and 
crowded.

Anyone have any idea why it's doing this?


Re: [PHP] Array_search wildcard

2003-03-21 Thread Liam Gibbs
> $found=array();
> foreach($array as $key => $value) {
> if(ereg('RE.+',$value)) {  // optionaly use eregi for case 
> insensitiveness
>$found[$key]=$value;
> }
> }

Thanks, Marek. With some minor adjustments, this worked out fine!


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



[PHP] Array_search wildcard

2003-03-21 Thread Liam Gibbs
Is there such a thing as an array_search wildcard? Say I want to find anything 
beginning with RE and having zero or more characters following it, how would I do that?


Re: [PHP] Mail attachment

2003-03-18 Thread Liam Gibbs
> It may be that the mail receiver expects some content after you put this
in
> the header:
>  Content-Type: text/ascii; charset=iso-8859-1\n
> If you're sending plain text, and no special (read: non-western)
> characters, i don't think you need that part.

That was the fix. Yer a goldmine. Thanks!


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



[PHP] Mail attachment

2003-03-18 Thread Liam Gibbs
I'm not sure why, but I get an attachment when sending out a mail with the following 
(see below). Well, I shouldn't say an attachment, but in Outlook I get that little 
paperclip, saying there is an attachment. But when I go to open the attachment, there 
is nothing there.I'm trying to send it to my Yahoo account, but it's not coming 
through there yet.

mail("[EMAIL PROTECTED]", "Website Notice",  "[messagebody]", "From: Liam [EMAIL 
PROTECTED]:[EMAIL PROTECTED]: text/ascii; charset=iso-8859-1\n");

If need be, I can post the message body, but I'm hoping someone can figure it out 
without the extra few K in everyone's mailbox.


[PHP] Re: Which is quicker, if-else statements

2003-03-18 Thread Liam Gibbs
> If you want clarity, why not:
>
> if($r == 0) {
>  ...
> } else { // $r != 0
> }

Hmm. That's a good idea. Yeah, I was sure the else-if method wasn't faster.
I just wasn't sure if it was slower, or if that really mattered. But your
method seems fine, and I have no idea why I didn't think of that.


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



[PHP] Which is quicker, if-else statements

2003-03-18 Thread Liam Gibbs
Is it just as quick to do:

if($r == 0) {
} else if($r != 0) {
}

than to do:

if($r == 0) {
} else {
}

The reason I like the former method is because, in a large IF-ELSE block, it's clear 
what belongs to what IF and what's going on. But does this make it lag? And, if so, is 
it really all that noticeable?


Re: [PHP] Ereg sass

2003-03-18 Thread Liam Gibbs
> try two backslashes to escape php special characters

Tried that with the same result.



> I'm not sure why, but I can't include a period in my eregi statement:
> 
> [A-Za-z0-9_-.]*
> 
> For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
> /home/website/public_html/Functions.inc on line 27
> 
> The same goes for [A-Za-z0-9_-\.]*
> 
> Anyone know why?
> 
> 
> 


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



[PHP] Ereg sass

2003-03-18 Thread Liam Gibbs
I'm not sure why, but I can't include a period in my eregi statement:

[A-Za-z0-9_-.]*

For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in 
/home/website/public_html/Functions.inc on line 27

The same goes for [A-Za-z0-9_-\.]*

Anyone know why?


Re: [PHP] What's this _FILE junk?

2003-03-17 Thread Liam Gibbs
> Is your form enctype set?

That might be it and I think it's it and OH yes that was it. Thanks.



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



[PHP] What's this _FILE junk?

2003-03-17 Thread Liam Gibbs
This line: 


when clicking submit, produces nothing. I print_r $_FILES["imprintpicture"], I try to 
echo $_FILES["imprintpicture"]["name"] or ["tmp_name"] and nothing comes up. Any 
reason?


[PHP] Function/globalizing

2003-03-16 Thread Liam Gibbs
I have a function, such as this:

function encryptPassword($password, $salt = $encryptiontechnique) {
}

$encryptiontechnique is defined, obviously outside the function. How is it possible to 
make $encryptiontechnique global so that this will work?


Re: [PHP] checking $_POST variables

2003-03-14 Thread Liam Gibbs
> That's generally not a good idea because depending on the type of control
> empty input fields will not be available in the $_POST array (e.g.
> unchecked checkboxes are _not_ sent by the browser).
>
> You should rather have a list of input variables that need to be filled
and
> compare $_POST against this.

I'd agree with this, but just in case this is an absolute necessity, and a
sure thing, have you tried:

foreach($_POST as $key=>$value) {
...
}

I haven't tried that, but it may work.


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



Re: [PHP] ^M in PHP

2003-03-13 Thread Liam Gibbs
> Use a decent text editor that'll save the files in Unix format... even
> if you're on a PC.

Yeah, I could use a decent text editor, but not everyone who uses my site
will use it. I need something that can edit them out after download.


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



Re: [PHP] If 1 IF fails, do the rest anyway...

2003-03-13 Thread Liam Gibbs
> The more efficient compilers/parsers stop when one test fails, some do
> them all. I don't know which php does but surely it is irrelevant? If
> test1 fails, because of the "and" the "if" statement will not be
> executed. I wonder what the reason is for your wanting it to do test2
> and test3, maybe I'm missing something?

Upon downloading a file, I wanted to chmod, chgrp, and chown it. I wanted to
do it this way:

if((chmod) && (chgrp) && (chown)) {
print("Success!");
} else {
print("Failure!");
}

but I wanted it to at least attempt all of them, so at least I can get most
of the work done there.

Someone metioned just to do them separately and if the results, so I did
that.


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



[PHP] If 1 IF fails, do the rest anyway...

2003-03-13 Thread Liam Gibbs
I know that in a case like this

if((test1) && (test2) && (test3)) {
...
}

if test1 fails, dear PHP won't bother doing test2 and 3. Am I correct? Is there a 
syntax that will make it carry on with test2 and 3 anyway, regardless of how test1 
came out?


[PHP] ^M in PHP

2003-03-13 Thread Liam Gibbs
I'm downloading a file from Windows to Linux through PHP. Understandably, there are 
^Ms at the end of my lines. Is there a PHP function I can use to delete them?


Re: [PHP] table cell space under image in IE

2003-03-13 Thread Liam Gibbs
> I know this is not exactly on topic but I produce all html by php and I
> don't want to go out and add myself to an html list (if there is such a
> thing).

There must be, but don't worry. Try stylesheets. Even if your Web site isn't
designed with them, I would suggest it. But there is also the image border.
I'm not sure if these two will solve your problem, but they may. Take note
that IE seems buggy with spacing, especially with stylesheets.


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



Re: [PHP] how to force a refresh?

2003-03-12 Thread Liam Gibbs
<>

There is an HTML solution, but I can't remember offhand what it is. HTML
would be the only way to go, I'd say, since once the page is in the
browser's hands, PHP can't do anything about it.


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



Re: [PHP] Adding dates

2003-03-11 Thread Liam Gibbs
> http://www.php.net/manual/en/function.strtotime.php

Thank you, Sebastian. I never even took a look at this function before. This
was a complete lifesaver!


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



[PHP] Adding dates

2003-03-11 Thread Liam Gibbs
Does anyone know a link to find the recent discussion on this list about adding dates 
in PHP? I can't seem to find it in the archives, and the simple act of adding one week 
to a date seems to be a mindblowing headache using PHP mktime() and date().


Re: [PHP] fopen and PHP 4.3.x

2003-03-10 Thread Liam Gibbs
> This is the code around line 30.
> $local_file = $feed;
> $fp = fopen($local_file, "r");
>
> Anyone have any ideas?  I have looked over the manual and the only thing I
> could find similar to this is in the comments.  Apache was restarted.

I get the same thing so I'm working through it. But here are some ideas that
may work for you: What are the permissions of the file in question? And do
you know the exact path of the file? Also, is the first line above (line
29?) needed? Why not just use $feed as the filename?


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



[PHP] true, false

2003-03-09 Thread Liam Gibbs
Why is it the following code produces nothing?

$responsesubmitted = FALSE;
print($responsesubmitted);

I have an if statement that says if($responsesubmitted), but it doesn't work.


Re: [PHP] variable string names

2003-03-08 Thread Liam Gibbs
You could probably do this. Set up a $$where variable, which would contain
"where" . $i, $i being the iterator of your loop.


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



Fw: [PHP] Resizing Images Uploaded to Web Page

2003-03-08 Thread Liam Gibbs
> You'll need to either use the gd functions, or my recommendation, get
> the imagick module and use it. Both should do an excellent job. iMagick
> is in PEAR.

How is PEAR making out? What makes it better than using the GD extension? I
will need to do image manipulation (much like the original question, I'll
have to make thumbnails of images on upload) and I want to know which is the
better option, in what circumstances, etc.


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



Re: [PHP] Resizing Images Uploaded to Web Page

2003-03-08 Thread Liam Gibbs
> I have users uploading images to a server and need to have those files
> resized on upload. I looked under filesystem, but found nothing like that.
> Anyone?

Check the GD extension. You'll need that installed, and the images can't be
GIFs (must be JPEGs or TIFs, something like that). Anyway, there should be a
function in there called imagecopyresized() you'll want to check out.


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



[PHP] $PHPSESSID

2003-03-07 Thread Liam Gibbs
First of all, thanks all who helped with the min and max functions (that works) and 
the dollar sign bit (which also works). Kudos. Couldn't have done it without y'all!

Here's the newest brain teaser: I have cookies disabled (well, I have IE set to the 
highest security mode, where it disables cookies). I understand that with cookies 
enabled, $PHPSESSID will return nothing when it works. However, it will return a value 
when cookies are disabled and the page is refreshed after a cookie is attempted. I'm 
still getting nothing either way. Anybody know why?


Re: [PHP] Min and max of array

2003-03-07 Thread Liam Gibbs
>you can sort it and get the values.

I would, but I need the array in the same order. I can't sort it.


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



[PHP] Min and max of array

2003-03-07 Thread Liam Gibbs
Is there a way to find the minimum and maximum values of an array? min() and max() 
don't take arrays.


Re: [PHP] Stupid Question

2003-03-07 Thread Liam Gibbs
> How do you make a command not return a warning... I thought it was the
> @ sign, but i think i'm wrong, and everything i've tried hasn't worked,
> i want this for a switch command if that matters.

It's the @ sign. Put it right before the command, as in @fopen(). Show us
the line that is giving you the error message.


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



Re: [PHP] javascript

2003-03-07 Thread Liam Gibbs
> If you want to validate form data before sending it, javascript is the
> choise.

Yeah, before sending it. Just wondering what the advantage is in validating
before sending.


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



Re: [PHP] javascript

2003-03-07 Thread Liam Gibbs
> in my php script registration1.php, i have written
> javascript for form validation i.e. for checking if
> the mandatory fields are filled correctly or not.
> but on clicking the submit button, i get connected to
> the next page without the form getting validated!!

What's wrong with using PHP to validate?


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



Re: [PHP] Dollar signs in values

2003-03-06 Thread Liam Gibbs
> I'll try the single quotation mark method first, though.

Single quotations didn't seem to work either.


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



Re: [PHP] Dollar signs in values

2003-03-06 Thread Liam Gibbs
> Could you show some code to illustrate the unpredictable results that you
get?

Here's what I have in my file:

[EMAIL PROTECTED]@#%:[EMAIL PROTECTED]@[EMAIL PROTECTED]|#:~December, 2003~on~fjskl

It's first exploded() by ~, then those values are produced by print("")
statements, like this one:

print("\"" .
$information[1] . "\"");

I'll try the single quotation mark method first, though.


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



Re: [PHP] Dollar signs in values

2003-03-06 Thread Liam Gibbs
> Escape them with a backslash:
>
> $text = "The amount is \$400.-";

All that does is print \$ in my HTML.

What's going on is that it will put, say, RR$T into a file when that's typed
into a textbox or any typable form control. That's properly saved in the
file.

So the file will contain RR$T.

When it's output, it could be RR, or RR$T, depending on some unpredictable
factors (haven't figured it out).

By adding a slash, what gets saved in the file is RR\$T, but what gets
output could be RR\ or RR\$T, depending on those same factors.


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



[PHP] Dollar signs in values

2003-03-06 Thread Liam Gibbs
How is it I can properly get PHP to represent dollar signs when putting it into HTML?

I know that dollar signs denote the beginning of a variable, like $reference or 
$ftpstream or whatever. However, I have a text file that contains (or can contain) 
values with $ in them. When I open the file and grab those values, then stick them 
onto my HTML page, they get unpredictable results. Is there a way I can escape them or 
such?


Re: [PHP] Modifying a string

2003-03-06 Thread Liam Gibbs
> I need to modify a string that contains image links like  src="http://www.somedomain/directory/graphics/filename.jpg";> to
> image links like 

Maybe something like with str_replace()?


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



Re: [PHP] updating pages with php

2003-03-05 Thread Liam Gibbs
<>

Escape them by putting a slash in front of them. If you have a line of text
that says 'This is the problem area I don't want to screw up', put 'This is
the problem area I don\'t want to screw up'.


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



Re: [PHP] updating pages with php

2003-03-05 Thread Liam Gibbs
> $Query = "UPDATE $TableName SET Intro_Title = '$Intro_Title', Intro =
> '$Intro' WHERE ID = '$ID'";

But what's being sent to SQL? What's contained in $TableName, $Intro_Title,
etc.? And what data types are all those fields?


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



Re: [PHP] updating pages with php

2003-03-05 Thread Liam Gibbs
> What I have discovered is that I can manually type it in the mysql server
> with whatever characters I want, but when I try to update it with a sql
file
> or via the webpage I created with the comma's it gives me errors. I take
> them out of the sql text and webpage and it works fine.

The problem can't be with the commas. Post the query here, or try an SQL
list.


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



Re: [PHP] updating pages with php

2003-03-05 Thread Liam Gibbs
<>

Don't forget to escape apostrophes and double quotation marks where needed.
Also, check the actual MySQL. If it contains things like double quotation
marks or greater- or less-than tags, it may be misinterpreted by your
browser when output. A line like:



could come out like:

<>$%#$" there
it is">

or even in non-form tags.

Try checking both MySQL and the output code in your browser.


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



Re: [PHP] crontab

2003-03-04 Thread Liam Gibbs
> Can I run a php script in crontab?
> Do I echo or print?
> Anyone doing it?

Well, why don't I just completely misunderstand the question. Sorry,
everyone.


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



Re: [PHP] crontab

2003-03-04 Thread Liam Gibbs
> Can I run a php script in crontab?
> Do I echo or print?
> Anyone doing it?

This is a serious security hazard. However, what you could do is have a PHP
page set cron settings (such as name of file, location, frequency, and
importance), then have another cron job (running at a decent frequency) do
the organization. However, this is still a security flaw, as hackers can
just take a look at your cron jobs and get in and run their own in place of
yours. Probably no more a flaw than normal, though, as if a hacker can get
in to replace your cron job, they can get in and run any number of things
anyway. Make sure to hard code your cron jobs, as having a downloadable page
is a bigger security hazard. You don't want the PHP page to do this itself,
because it will have to run as root.

I did this one time, and if I'm allowed some time to get my page up, I can
e-mail you some instructions. What you'll need is a PHP page, a txt file
(for the settings) and a cron job that will read the file and do the
necessary steps to arrange the cron jobs itself.



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



Re: [PHP] Number of rows

2003-03-04 Thread Liam Gibbs
> I am using the folling code to list all of my tables in a database:
> however, i would like to show the user how many rows there are in each
table
> (where i have put numrows), how could i do this?

This will be costly on process time, but you could just do a SELECT COUNT(*)
on all the tables. If you find a way to do it with a simple PHP command
(without a self-made function), I'd love to know.


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



Re: [PHP] file uploads

2003-03-04 Thread Liam Gibbs
> 1) Do the temp files automatically delete, or do I
> need to put something in the code to delete them?

They do, and I believe it's until the end of the currently-running PHP
script.


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



[PHP] ICQ # validation

2003-03-03 Thread Liam Gibbs
Maybe I'm off my rocker, but I don't see how this can't work. I'm trying to validate 
an ICQ number, and assuming a valid one is between 7 and 9 numbers. My line of code is 
this:

if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) {
print("a-okay!");
} else {
print("error msg");
}

I've submitted the ICQ # 2264532680, but it validates. Any ideas?


[PHP] htmlentities()

2003-02-27 Thread Liam Gibbs
I seem to be having trouble with htmlentities(). Maybe someone has a clue I can 
borrow. Here's my function:

function FitForHTML($string) {
$asciitable = get_html_translation_table(HTML_ENTITIES);
$string = htmlentities($string, ENT_COMPAT);
$string = str_replace($asciitable[chr(255)], "ÿ", $string);

return $string;
}

When calling this function with the following data: é[a club]+  <>
I get: é♣+  &

(I didn't send this as Unicode. The ♣ was originally a club character.)

Maybe I'm not looking in the correct area, but when I do a search in Google Groups, I 
get one message (well, two: one in English and one in German or some language that 
uses a lot of z's and c's), but that doesn't solve the problem.


[PHP] MySQL Madness

2003-01-29 Thread Gibbs, Liam - SXIA
First off, when executing this command:

$connection = mysql_connect("localhost", "root", "");

I get this error msg:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
'root@localhost' (Using password: NO) in
/home/superpage/public_html/index.php on line 49

I've gone and read some information on the Internet (understanding almost
nothing from the technical stuff--I'm a MySQL/server admin newbie), but I
gathered some information.

Now, a lot of what I read pertains to MySQL and not running it with PHP, but
what I did gather from my own gruntwork file-searching and stuff on the Web
was that I changed php.ini so that mysql.default_user = root and
mysql.default_password = my password. Not a smart idea to run MySQL as root,
but I'm trying to make headway. I restarted Apache. That didn't work. I
didn't touch mysql.default_port, .default_host, or .default_socket (don't
know if I should; didn't find anything that said I should), but I'm really
stuck on this. Any other information on MySQL pertained strictly to MySQL
and not PHP, and when I included PHP in my search criteria, it just came up
with a bunch of pages that had PHP as an extension or a directory name.
Searching the PHP-dev archives seems to bring up two search results which
are the same conversation, and only really mention it in passing from what I
understand. Any clues?

I can access MySQL through the command ./mysql -u root -p mysql, but
obviously that doesn't help when I'm supposed to access it through PHP. I've
executed commands there fine.

Not sure if it matters, but I have PHP 4.3.0 and MySQL 11.18 Distrib 3.23.54
for pc-linux (i686).

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




[PHP] Chmod funk

2003-01-24 Thread Liam . Gibbs
This line of code:

if(!is_readable("Constants.inc")) chmod("Constants.inc", 0644);

Produces this error:

Warning: chmod() [function.chmod]: Operation not permitted in
/home/mastersite/public_html/index.php on line 6

What I'm trying to do is determine if Constants.inc is readable. If not, I
want to change its permissions. At this point, I'm not worried about if it
exists or not.

I'm not sure why I can't set it. The owner and group for the file are both
'mastersite', and my PHP is running as 'root' (I know, I know, not a good
idea, but I'm in the testing phase right now, and if it's hacked at the
moment, it's not a problem). Does anyone have a possible explanation? The
file perms for Constants.inc are currently set at executable for all.

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




  1   2   3   4   >