php-general Digest 11 Jun 2004 10:56:22 -0000 Issue 2815
Topics (messages 188075 through 188096):
Re: choosing another smtpserver with PHPs mail function
188075 by: Justin Patrin
Re: Webyog releases SQLyog 3.71 & SJA 2.0
188076 by: electroteque
188077 by: Ryan A
Re: Simple cms type system
188078 by: Justin French
188079 by: Ryan A
Re: SQL Query Statement for MySQL... (DataType --> TEXT vs BLOB)
188080 by: Dennis Seavers
Binary mah
188081 by: Mark
188082 by: Justin Patrin
188089 by: Knightking
188090 by: Justin Patrin
Undiscovered Firefox...
188083 by: John Nichel
188084 by: Justin Patrin
188085 by: John Nichel
188087 by: Justin Patrin
188088 by: Curt Zirzow
Improving my Regex?
188086 by: Gerard Samuel
junk after document element
188091 by: Richard Davey
Limit the number of characters in a string
188092 by: Russell Curtis
Limit number of characters in a string
188093 by: Russell Curtis
188094 by: Torsten Roehr
188095 by: Russell Curtis
Gd Library and Special Chars
188096 by: news.php.net
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
O�v as&��nsson wrote:
Hello everybody :).
I having a little problem with PHPs build in function mail().
The mailserver isnt located on the webserver, its on another machine.
I have tryed ini_set("SMTP", "ipaddress"); with no result.
The system I'm on runs on an Linux box.
Can this be done or must I write an own mail function, with sockets?
_________________________________________________________________
L�ttare att hitta dr�mresan med MSN Resor http://www.msn.se/resor/
The smtp settings are only for PHP on Windows. You don't have to write
your own, though, it's been done for you. :-)
PEAR's Mail package has an smtp backend which will do all of it for you.
http://pear.php.net/package/Mail
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
> A php tool that converts code to binary
This I would love to see ..
>
> WHO CARE`S? you are one of their customers, you might. If you
> signed up for
> their newsletter and you recieve their updates good
> for you, the rest of us (most of us) do not care. Most (good) sites have a
> newsletter system for just this thing.
>
I actually got work to buy me a licence, unfortunately because of the price,
they cannot afford tobuy licences for 3 other developers so i'm the only one
with it.
> Fair enough, thats your opinion and we all respect it. But how would you
> like it if you started getting frequent updates
> in your mail everytime phpmyAdmin was updated? now wouldnt that be sweet?
LOL no that would annoy me totally, I know what you are getting at though,
it was technically spam, his application is pretty good though,
unfortunately the mysql control is terribly limited.
--- End Message ---
--- Begin Message ---
Hey,
> > A php tool that converts code to binary
> This I would love to see ..
Yep, can hardly wait myself....check out www.roadsend.com , looks promising
and they need volunteers to help out.
(I have no connection at all to the roadsend.com company/website NOR do i
get anything (money or otherwise) for sending you there)
:-)
> I actually got work to buy me a licence, unfortunately because of the
price,
> they cannot afford tobuy licences for 3 other developers so i'm the only
one
> with it.
Yep, checked out their prices, its a bit steep, but if you make the software
you have the right to name your price. ;-)
If people buy it or not...thats another issue.
> > Fair enough, thats your opinion and we all respect it. But how would you
> > like it if you started getting frequent updates
> > in your mail everytime phpmyAdmin was updated? now wouldnt that be
sweet?
> LOL no that would annoy me totally, I know what you are getting at though,
> it was technically spam...
Great! Now you see my point.
Cheers,
-Ryan
--- End Message ---
--- Begin Message ---
On 10/06/2004, at 4:29 AM, Ryan A wrote:
Anyway, it seems that the client has a control panel where he can make
changes to the site (nothing major, just add products, edit paragraphs
etc...NO shopping cart) he wants the same kind of functionality for
his new
pages. Have not seen his "control panel" but I dont think its anything
major.
Instead of programming this from scratch was wondering if anybody can
recomend any package/open source project etc that can do this, I'm
sure this
must have come up before with other clients...
My fav PHP-CMS is textpattern <http://www.textpattern.com>, but it's
not quite ready for prime-time yet (for my needs - but it may be fine
for yours). Everything follows a blog-like section > category >
article metaphor, but it can be used for a lot more than blogs. This
model could quite easily be bent into shape for products, static pages,
etc as you need.
It's opensource, has a great support forum/community, and comes with
goodies like Textile <http://textism.com/tools/textile/> (an ASCI
shorthand HTML), templating, CSS-GUI and a lot more built in.
My knee-jerk reaction though is that the simplest way out of this would
be to build your own (that way you get want, without any dependancies
on anything but your own skills).
Searched google/phpresource/hot scripts/ script archive.... but most
cms's
are offering far far too much for my needs, and actually stripping
them down
would take as much as making a new one and some are just not worth it
(in
mho).
As mentioned here many times, http://www.opensourcecommerce.com/ let's
you try a bunch of them for free on the web before
downloading/installing.
---
Justin French
http://indent.com.au
--- End Message ---
--- Begin Message ---
> My fav PHP-CMS is textpattern <http://www.textpattern.com>, but it's
Hey,
Thanks for the link. Am still searching as nearly every system I looked at
is far far too much in features / price or my needs are just too small I
guess.
Just need something that will allow me to use my design and allow the client
to update/add/delete text and pictures.
Anything comes to mind? if not, tell me which one is best to strip to get
the above...
Thanks,
-Ryan
--- End Message ---
--- Begin Message ---
Probably a good question for a MySQL e-mail list.
> [Original Message]
> From: Scott Fletcher <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: 06/10/2004 12:49:07 PM
> Subject: [PHP] SQL Query Statement for MySQL... (DataType --> TEXT vs
BLOB)
>
> I'm wrestling over deciding on which data type to go with, TEXT or BLOB.
I
> have one table with one column of 400 characters, I was thinking that TEXT
> may be the way to go for that one.
>
> I also have another table that use 4 columns of 800 characters along with
5
> columns that use 250 characters. I'm thinking of using TEXT for 9 of
those
> columns.
>
> The reason is because I read the MySQL Manual there that say TEXT and BLOB
> are pretty much the same in many ways, the only thing different is that
BLOB
> use "VARCHAR" Binary while TEXT use "VARCHAR". But reading the article
> somewhere (not part of MySQL's Manual) say this...
>
> --snip--
> If it doesn't have to be searchable then a BLOB might be more efficient
and
> you shouldn't have to worry about size (Like size is important? ). The
> reason being that BLOB information is stored seperate from the table data
> and is related by a reference number in the table. This keeps the table
> smaller and faster as I understand.
> --snip--
>
> So, I don't feel too sure what to decide on... Care for some advice or
> recommendation??
>
> Thanks,
> Scott Fletcher
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hey gang,
I've got a complex algorithm that I'm trying to work out. I'm trying
to store and retrieve a set of switches in a decimal representation
of a binary number. I have four checkboxes, call them A, B, C, and D.
They can be represented by a (decimal) number from 0 to 15 in binary
(0000 to 1111). I need to be able to store and retrieve this set of
data.
I've got the script to store it, and I thought I had the script to
retrieve the data, but I can't seem to get the checkboxes to actually
be checked (or not) depending on the value in the database.
I don't like dealing with the data this way, but the program I'm
interacting with requires it.
The script below is used to handle a number of data elements on the
page.
$pagevars is an array of the variables on the page, and the table
they are located in.
set_val(a,b) puts the values in array a into the variables listed in
array b.
form_element(a,b) is a function that returns a form element of type a
(CB, TB) with the variable a. So form_element("CB","var") returns the
following:
<INPUT TYPE="CHECKBOX" NAME="var" />
If the value is 1 or on, CHECKED will be added.
Here's the script:
--- START CORE.PHP ---
<?php
include("../functions.inc");
include("menu.html");
$pagevars=array("statistics"=>array("StatFlags","StatFiles","StatMail","STF_Hours","STM_Hours"));
if (isset($_POST['submit'])) {
$stat=$_POST['stat'];
for ($i=0;$i<4;$i++) {
$t[$i]=isset($stat[$i])?"1":"0";
}
$stat=implode("",$t);
$StatFlags=bindec($stat);
$_POST['StatFlags']=$StatFlags;
unset($_POST['stat']);
if (!set_val($_POST,$pagevars)) {
echo "data not written to database. Contact system administrator";
}
}
$page_var_vals=get_vars($pagevars);
if (is_array($page_var_vals)) {
extract($page_var_vals);
}
echo "StatFlags:$StatFlags<BR>";
$stat=preg_split('//', str_pad(decbin($StatFlags), 4, "0",
STR_PAD_LEFT), -1, PREG_SPLIT_NO_EMPTY);
for ($i=0;$i<4;$i++) {
$stat[$i]=($stat[$i]==1)?"on":"";
}
debug($stat);
?>
<H1>Statistics</H1>
<FORM METHOD="POST" ACTION="<?php echo $_SERVER['PHP_SELF'];
?>">
<p><?php form_element("CB","stat[0]"); ?>Save statistics to a
file periodically
Every <?php form_element("TB","STF_Hours"); ?>hours</p>
<p>Save in: <?php form_element("TB","StatFiles"); ?></p>
<p><?php form_element("CB","stat[1]"); ?>Email statistics
periodically
Every <?php form_element("TB","STM_Hours"); ?>hours</p>
<p>Send to: <?php form_element("TB","StatMail"); ?></p>
<p><?php form_element("CB","stat[2]"); ?>Automatically open
the statistics window at startup</p>
<p><?php form_element("CB","stat[3]"); ?>Collect statistics
about mail sent by local users</p>
<p>System Messages</p>
<p>System reporting level:
<SELECT NAME="">
<option value="0">
0 - No messages
</option>
<option value="1">
1 - Urgent messages
</option>
<option value="2">
2 - Significant messages
</option>
<option value="3">
3 - Normal messages
</option>
<option value="4">
4 - Informational messages
</option>
<option value="5">
5 - Debugging messages
</option>
</SELECT></p>
<p>Number of messages to store: <?php form_element("TB","");
?></p>
<p><?php form_element("CB",""); ?> Automatically open the
system messages window on startup</p>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Save" />
<INPUT TYPE="Reset" VALUE="Cancel" />
</form>
</body>
</html>
--- END CORE.PHP ---
=====
Mark Weinstock
[EMAIL PROTECTED]
***************************************
You can't demand something as a "right" unless you are willing to fight to death to
defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
--- End Message ---
--- Begin Message ---
Mark wrote:
Hey gang,
I've got a complex algorithm that I'm trying to work out. I'm trying
to store and retrieve a set of switches in a decimal representation
of a binary number. I have four checkboxes, call them A, B, C, and D.
They can be represented by a (decimal) number from 0 to 15 in binary
(0000 to 1111). I need to be able to store and retrieve this set of
data.
I've got the script to store it, and I thought I had the script to
retrieve the data, but I can't seem to get the checkboxes to actually
be checked (or not) depending on the value in the database.
I'm not sure what's wrong with the code you have, but for the 4-digit
one you have:
$packed = 4-bit var with ABCD encoded in it
$a = $packed & 1;
$b = $packed & 2;
$c = $packed & 4;
$d = $packed & 8;
I don't like dealing with the data this way, but the program I'm
interacting with requires it.
The script below is used to handle a number of data elements on the
page.
$pagevars is an array of the variables on the page, and the table
they are located in.
set_val(a,b) puts the values in array a into the variables listed in
array b.
form_element(a,b) is a function that returns a form element of type a
(CB, TB) with the variable a. So form_element("CB","var") returns the
following:
<INPUT TYPE="CHECKBOX" NAME="var" />
If the value is 1 or on, CHECKED will be added.
Here's the script:
--- START CORE.PHP ---
<?php
include("../functions.inc");
include("menu.html");
$pagevars=array("statistics"=>array("StatFlags","StatFiles","StatMail","STF_Hours","STM_Hours"));
if (isset($_POST['submit'])) {
$stat=$_POST['stat'];
for ($i=0;$i<4;$i++) {
$t[$i]=isset($stat[$i])?"1":"0";
}
$stat=implode("",$t);
$StatFlags=bindec($stat);
$_POST['StatFlags']=$StatFlags;
unset($_POST['stat']);
if (!set_val($_POST,$pagevars)) {
echo "data not written to database. Contact system administrator";
}
}
$page_var_vals=get_vars($pagevars);
if (is_array($page_var_vals)) {
extract($page_var_vals);
}
echo "StatFlags:$StatFlags<BR>";
$stat=preg_split('//', str_pad(decbin($StatFlags), 4, "0",
STR_PAD_LEFT), -1, PREG_SPLIT_NO_EMPTY);
for ($i=0;$i<4;$i++) {
$stat[$i]=($stat[$i]==1)?"on":"";
}
debug($stat);
?>
<H1>Statistics</H1>
<FORM METHOD="POST" ACTION="<?php echo $_SERVER['PHP_SELF'];
?>">
<p><?php form_element("CB","stat[0]"); ?>Save statistics to a
file periodically
Every <?php form_element("TB","STF_Hours"); ?>hours</p>
<p>Save in: <?php form_element("TB","StatFiles"); ?></p>
<p><?php form_element("CB","stat[1]"); ?>Email statistics
periodically
Every <?php form_element("TB","STM_Hours"); ?>hours</p>
<p>Send to: <?php form_element("TB","StatMail"); ?></p>
<p><?php form_element("CB","stat[2]"); ?>Automatically open
the statistics window at startup</p>
<p><?php form_element("CB","stat[3]"); ?>Collect statistics
about mail sent by local users</p>
<p>System Messages</p>
<p>System reporting level:
<SELECT NAME="">
<option value="0">
0 - No messages
</option>
<option value="1">
1 - Urgent messages
</option>
<option value="2">
2 - Significant messages
</option>
<option value="3">
3 - Normal messages
</option>
<option value="4">
4 - Informational messages
</option>
<option value="5">
5 - Debugging messages
</option>
</SELECT></p>
<p>Number of messages to store: <?php form_element("TB","");
?></p>
<p><?php form_element("CB",""); ?> Automatically open the
system messages window on startup</p>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Save" />
<INPUT TYPE="Reset" VALUE="Cancel" />
</form>
</body>
</html>
--- END CORE.PHP ---
=====
Mark Weinstock
[EMAIL PROTECTED]
***************************************
You can't demand something as a "right" unless you are willing to fight to death to
defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
On Thu, 10 Jun 2004 20:08:08 -0700, Justin Patrin
<[EMAIL PROTECTED]> wrote:
Mark wrote:
[snip]
I'm not sure what's wrong with the code you have, but for the 4-digit
one you have:
$packed = 4-bit var with ABCD encoded in it
$a = $packed & 1;
$b = $packed & 2;
$c = $packed & 4;
$d = $packed & 8;
Just as a side tip, I highly recommend using hexadecimal for bitwise
functions where possible, i.e.:
$a = $packed & 0x1;
$b = $packed & 0x2;
$c = $packed & 0x4;
$d = $packed & 0x8;
$e = $packed & 0x10;
$f = $packed & 0x20;
$g = $packed & 0x40;
$h = $packed & 0x80;
$i = $packed & 0x100;
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
Knightking wrote:
On Thu, 10 Jun 2004 20:08:08 -0700, Justin Patrin
<[EMAIL PROTECTED]> wrote:
Mark wrote:
[snip]
I'm not sure what's wrong with the code you have, but for the 4-digit
one you have:
$packed = 4-bit var with ABCD encoded in it
$a = $packed & 1;
$b = $packed & 2;
$c = $packed & 4;
$d = $packed & 8;
Just as a side tip, I highly recommend using hexadecimal for bitwise
functions where possible, i.e.:
$a = $packed & 0x1;
$b = $packed & 0x2;
$c = $packed & 0x4;
$d = $packed & 0x8;
$e = $packed & 0x10;
$f = $packed & 0x20;
$g = $packed & 0x40;
$h = $packed & 0x80;
$i = $packed & 0x100;
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
That's a lot easier to see the progression. Functionally no different
than using decimal, but easier to type and verify. ;-)
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
Okay, I'm sitting at home, writing a bit of code for one of my personal
sites, and I'm currently working on a function to detect different
browser types. Well, I think I have the URL to a page on one of my
boxes which echo's out the HTTP_USER_AGENT in my clipboard. However,
what I have there is....
elseif ( preg_match ( "/Firefox/", $_SERVER['HTTP_USER_AGENT'] ) ) {
Well, I paste this into Firefox's URL bar and hit enter before my brain
can tell my hands that this is not what I want to do. Do I get a "could
not find server" error from Firefox? Nope. It forwards me to this page....
http://itangersjack.com/oddball/cheese.htm
Nothing really special about the page, except it's revealing source code
to something I'm currently working on (not in the way I'm doing it, but
it's there). Okay, it's late, and I'm easily amused. ;)
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
John Nichel wrote:
Okay, I'm sitting at home, writing a bit of code for one of my personal
sites, and I'm currently working on a function to detect different
browser types. Well, I think I have the URL to a page on one of my
boxes which echo's out the HTTP_USER_AGENT in my clipboard. However,
what I have there is....
elseif ( preg_match ( "/Firefox/", $_SERVER['HTTP_USER_AGENT'] ) ) {
Well, I paste this into Firefox's URL bar and hit enter before my brain
can tell my hands that this is not what I want to do. Do I get a "could
not find server" error from Firefox? Nope. It forwards me to this
page....
http://itangersjack.com/oddball/cheese.htm
Nothing really special about the page, except it's revealing source code
to something I'm currently working on (not in the way I'm doing it, but
it's there). Okay, it's late, and I'm easily amused. ;)
BTW, you should really use
strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox');
or stristr
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
Justin Patrin wrote:
BTW, you should really use
strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox');
or stristr
I'm an old Perl guy. Me likes perl regular expressions. :)
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
John Nichel wrote:
Justin Patrin wrote:
BTW, you should really use
strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox');
or stristr
I'm an old Perl guy. Me likes perl regular expressions. :)
Sure, I love PREGs myself, but it's way overkill for such a simple
operation. ;-)
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
* Thus wrote Justin Patrin ([EMAIL PROTECTED]):
> John Nichel wrote:
>
> >Justin Patrin wrote:
> >
> >>BTW, you should really use
> >> strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox');
> >>or stristr
> >>
> >
> >I'm an old Perl guy. Me likes perl regular expressions. :)
> >
>
> Sure, I love PREGs myself, but it's way overkill for such a simple
> operation. ;-)
.0002 seconds overkill
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Looking for suggestions on if this bit of code can be improved..
The goal. To extract the conditions in the WHERE of an sql statement.
I would appreciate any pointers you may have...
Thanks
----
<?php
$hello = 'Hello';
$world = 'World';
$foo_bar = 'foo bar';
$sql = "SELECT FROM TABLE WHERE id = 1, greeting = '$hello', destination =
'$world', what = '$foo_bar' ORDER BY some_id";
header('content-type: text/plain');
$regex = '/([a-z0-9_]+)\s?=\s?(\d+|\'.*?\')/';
preg_match_all($regex, $sql, $match, PREG_SET_ORDER);
var_dump($sql, $regex, $match);
?>
--- End Message ---
--- Begin Message ---
Hi guys,
Does anyone know what the most common cause for the following error
from the XML parser built into PHP 4.3.6: "junk after document
element"
I am parsing data that has been returned to me via https, this is
stage 6 in a multi-step process and the first stages went okay
sending/receiving the data. Any ideas? I don't know if I can fix the
error my end or if it has to be done on the gateway?
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
--- End Message ---
--- Begin Message ---
Hi
Anyone know how to clip the number of characters in a string? For instance,
I have a string carrying a long piece of text, say, of 200 characters, but I
want to reduce this to just the first 100 characters.
Thanks in advance.
Russell
--
-----------------------------------
Russell Curtis
--- End Message ---
--- Begin Message ---
Hi
Anyone know how to clip the number of characters in a string? For instance,
I have a string carrying a long piece of text, say, of 200 characters, but I
want to reduce this to just the first 100 characters.
Thanks in advance.
Russell
--
-----------------------------------
Russell Curtis
--- End Message ---
--- Begin Message ---
"Russell Curtis" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> Anyone know how to clip the number of characters in a string? For
instance,
> I have a string carrying a long piece of text, say, of 200 characters, but
I
> want to reduce this to just the first 100 characters.
http://de2.php.net/manual/en/function.substr.php
Regards,
Torsten Roehr
--- End Message ---
--- Begin Message ---
Wow, that was fast - many thanks.
Cheers
Russell
--
-----------------------------------
Russell Curtis
M +44 (0) 7796268780
www.russellcurtis.com
www.buildingdetails.co.uk
"Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Russell Curtis" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi
> >
> > Anyone know how to clip the number of characters in a string? For
> instance,
> > I have a string carrying a long piece of text, say, of 200 characters,
but
> I
> > want to reduce this to just the first 100 characters.
>
> http://de2.php.net/manual/en/function.substr.php
>
> Regards,
>
> Torsten Roehr
--- End Message ---
--- Begin Message ---
Hi to all,
I need to do parsing of html data from one site for find nick , guild, and
some other infos...
The problem is that gd doesn't print correctly chars like trademark,
copyright, registered (which are contained in some nicks/guild names)...
Someone know a valid solution???
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---