|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 30 Apr 2006 11:50:58 -0000 Issue 4101
php-general-digest-help
lists.php.net
Date: Sun Apr 30 2006 - 06:50:58 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 30 Apr 2006 11:50:58 -0000 Issue 4101
Topics (messages 235124 through 235141):
Re: php login
235124 by: Schalk
235136 by: Jochem Maas
converting REST result to SOAP object
235125 by: Anthony Ettinger
Re: [JOB] PHP developered needed in Largo, MD
235126 by: Jay Blanchard
Re: New Help with Javascript Navigation
235127 by: Gerry D
simplexml and serialize error
235128 by: Anthony Ettinger
235135 by: Richard Lynch
235137 by: Jochem Maas
Re: php <-> js (was Javascript Navigation)
235129 by: Jay Blanchard
Re: Multi-threaded port listener
235130 by: D. Dante Lorenso
Re: PHP Standard style of writing your code
235131 by: D. Dante Lorenso
235133 by: Richard Lynch
235134 by: Richard Lynch
Re: XML Parsing, starting out.
235132 by: Gonzalo Monzón
Re: undefined variable
235138 by: Smart Software
235139 by: Smart Software
problem with mktime
235140 by: Ross
235141 by: Ross
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
chris smith wrote:
> On 4/30/06, Schalk <schalk
volume4.com> wrote:
>> Greetings All,
>>
>> Where can I find a good tutorial on creating a login protected area
>> using php? I did a Google search and found a couple but, I would like to
>> get suggestions from the list. Thanks!
>
> Just found a good one.. it's a little more complicated than most
> because it has the userlevel stuff included.. but gives you some
> ideas.
>
> http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html
Thanks Chris, I will check it out.
--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers
attached mail follows:
Schalk wrote:
> Greetings All,
>
> Where can I find a good tutorial on creating a login protected area
> using php? I did a Google search and found a couple but, I would like to
> get suggestions from the list. Thanks!
here is a set of functions that allow you to mimick a .htaccess style of
protected area I use them occasionally when I need quick and dirty protection
(i.e. single user, no specified permissions, etc)
it's not so much a tutorial as a basic example of simple protection
- maybe it gives you some ideas/insight.
------------------------------------------------------------------------
you use them like so:
<?php
// sessions are required for this to work
session_start();
// a line like this should be in you global include file
setSimplePageProtectionDetails("YOUR_USER_NAME", "YOUR_PWD");
// then on any page that needs protection (can also be set in the same global include)
simplePageProtection("YOUR_REALM");
?>
here are the actual funcs:
<?php
function isCLI()
{
return (strtolower(php_sapi_name()) === 'cli');
}
function setSimplePageProtectionDetails($login, $pwd)
{
if (!defined('SIMPLE_MICROSITE_AUTH_PW') && !defined('SIMPLE_MICROSITE_AUTH_USER')) {
if (!$login || !$pwd) {
return 0;
}
define('SIMPLE_MICROSITE_AUTH_USER', $login);
define('SIMPLE_MICROSITE_AUTH_PW', $pwd);
}
return -1;
}
function simplePageProtection($bla = null)
{
if (isCLI()) {
return; // no point 'protecting' the CLI
}
if (!defined('SIMPLE_MICROSITE_AUTH_PW') || !defined('SIMPLE_MICROSITE_AUTH_USER')) {
die ('auth mechanism not setup properly');
}
if (($bla === null) || !$bla = strval($bla)) {
$bla = 'micrositedefault';
}
if (!isset($_SESSION['access_to_'.$bla.'_granted']) || !$_SESSION['access_to_'.$bla.'_granted']) {
$_SESSION['access_to_'.$bla.'_granted'] = false;
$login = isset($_SERVER[ 'PHP_AUTH_USER' ]) ? $_SERVER[ 'PHP_AUTH_USER' ]: false;
$pass = isset($_SERVER[ 'PHP_AUTH_PW' ]) ? $_SERVER[ 'PHP_AUTH_PW' ]: false;
if (strtolower(trim($login)) == strtolower(trim(SIMPLE_MICROSITE_AUTH_USER)) && $pass ===
SIMPLE_MICROSITE_AUTH_PW) {
$_SESSION['access_to_'.$bla.'_granted'] = true;
} else {
header('WWW-Authenticate: Basic realm="Please login '.SIMPLE_MICROSITE_AUTH_USER.'."');
header('HTTP/1.0 401 Unauthorized');
exit;
}
}
}
attached mail follows:
is there a easy way of converting an xml REST result to an object
returned by a SOAP call?
I know I can simply parse the REST and put it in a hash, curious if
there's a method of doing this.
simplexml_load_string() seems to give me simplexml objects inside my
multi-level hash, which isn't really what I want.
--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html
attached mail follows:
[snip]
Hey Jay! We run linux here... you could leave your Windows world again!
:)
[/snip]
Thanks, but I have to stay where I am for a while. Sounds like an
interesting project though...
attached mail follows:
Yah, and why are people still mindlessly clicking OK to install ActiveX plugins?
On 4/27/06, Porpoise <steve
srenterprises.co.uk> wrote:
>
> <""Gerry D"" <gdanen.spam
gmail.com> wrote in message
> news:aefa99550604270608x2e767e9dw6d25fdc468a63d60
mail.gmail.com...
> Interesting discussions... :)>
>
> I see two issues:
>
> 1. if you are exposing php scripts to the client, how does the server
> side processing know what it should do and what the client should see?
>
> 2. and why can't JS write to the client's file system? Or read from
> files? "Come to my website and let me first read all your private
> information, then trash it..." Hackers and other cyber vandals would
> love you to implement this "feature"... LOL
> </Gerry D>
>
> Isn't that "feature" called ActiveX??
attached mail follows:
Warning: var_dump() [function.var-dump]: Node no longer exists in
Foo.php on line 78
object(SimpleXMLElement)#86 (0) { } ["title"]=>
I turn an xml string into a simplexml object, and then ran serialize()
on it before caching the output locally. When I read it back in and
run unserialize() to do a dump, I get this error.
--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html
attached mail follows:
On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote:
> Warning: var_dump() [function.var-dump]: Node no longer exists in
> Foo.php on line 78
> object(SimpleXMLElement)#86 (0) { } ["title"]=>
>
> I turn an xml string into a simplexml object, and then ran serialize()
> on it before caching the output locally. When I read it back in and
> run unserialize() to do a dump, I get this error.
WILD GUESS!!!
Whatever class objects you had defined before you serialized the data,
are not defined when you unserialize the data.
You need to load all your class files in both serialize and
unserialize scripts -- The class definition is not stored in
serialized data, just the class 'data'
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Richard Lynch wrote:
> On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote:
>
>>Warning: var_dump() [function.var-dump]: Node no longer exists in
>>Foo.php on line 78
>>object(SimpleXMLElement)#86 (0) { } ["title"]=>
>>
>>I turn an xml string into a simplexml object, and then ran serialize()
>>on it before caching the output locally. When I read it back in and
>>run unserialize() to do a dump, I get this error.
>
>
> WILD GUESS!!!
>
> Whatever class objects you had defined before you serialized the data,
> are not defined when you unserialize the data.
>
> You need to load all your class files in both serialize and
> unserialize scripts -- The class definition is not stored in
> serialized data, just the class 'data'
>
A DIFFERENT WILD GUESS!!! :-)
I don't think thats the problem - rather I get the impression that
there are references (and or resources) inside these SimpleXML objects
(e.g. the owning 'document') that cannot be serialized. I would suggest
caching the xml string and read that from disk (or where ever your storing
stuff) and creating an object from that whenever you need it. I don't believe that
you gain much from serializing an object (as compared to creating a new object) -
when you unserialize you have pretty much the same overhead as when creating an object
(I may be very wrong on this! - I do know that cloning an object is _much_ faster than
creating one for instance).
attached mail follows:
[snip]
...interesting conversation...
[/snip]
Stateless applications, ain't they fun?
I did a little experiment before Ajax cam into vogue with a small PHP
script that essentially ran a while loop with some sleep cycles built
in. This was placed in an iframe and another page was placed in another
iframe with javascript to update the second iframe if data had changed
in the first iframe based on a query running while PHP cycled the loop.
OB functions were used and it worked.
Clear?
So that experiment lead to a meta-refresh of the page in the first
iframe which then ran some PHP code that output some JavaScript to
update the second iframe. It worked better, but had its moments.
The point was to make the user experience better, a manager could see
that certain things were happening without having to refresh a page
manually. Also, a smaller more efficient query could be run and if the
data had not changed the system would not have to endure the overhead of
the larger query.
The end result? A stateless application with simulated state....much
like what Ajax does today. Really, it was as Ajax as could be, just not
using the httpRequest doohickey, or whatever it is.
There is a wide gulf between stateless applications and applications
with state. Even Java uses a hacked stateless connection (by having
something run client-side sending info a to listener on the
server...what does that sound like?). Isn't the intent for client server
apps to be stateless? Applications with state typically share memory
resources.
attached mail follows:
René Fournier wrote:
> Anyone find any good tutorials, code samples, etc. on such a thing?
> Basically, I want to write server (in PHP) that listeners on a
> particular port, and spins off a thread/process (essentially, execute
> a separate script) for each incoming connection. There won't be a lot
> of data to process, but there will be many simultaneous
> connections—upwards of 1000s of connections (each spun off as seperate
> threads).
Building it yourself can be lots of fun and I have done this using
stream_select, fork, and other PCNTL and IPC functions. If you like
Pear, you can check out the Net Server package there. They have models
to do the forking for you for each client connection:
http://pear.php.net/package/Net_Server
Although I didn't use Net Server, I did review the code to get ideas on
how I'd like to build my server. It is useful.
Dante
attached mail follows:
>> So no matter what was actually typed, *I* would see:
>>
>> function foo ($x) {
>> //body
>> }
>>
>> but some heretic who doesn't know any better would see:
>> function foo($x)
>> {
>> //body
>> }
>>
>> Now *THAT* would be a feature worth paying for in an IDE! :-)
>>
Without caring what style you prefer, the correct reply to this request
is the following:
You seek a Code Beautifier for PHP.
I have found that only some IDE/Editor software contains such a beast.
The convention for most software code editing tools is to have Shift +
Ctrl + F do code formatting. I use PHP Eclipse to handle all my code
formatting. It will allow you to choose your preference for braces up
or down etc.
However...you may need to make a policy in your company. If you use
source control for your software, it may see changes in formatting as a
distinct major revision. Therefore, if you save code in "your" style
and another developer opens the file and resaves in "his style", then
you'll unnecessarily make version control a nightmare. Despite personal
preference, you MUST adhere to the style of the project. If you are the
sole developer, you define that style. If you are a coding monkey, then
you may have to suffer with the style that the architect before you
declared.
I can't work unless the code is formatted to my liking. I'm the OCD
type of programmer. Luckily I'm also in control of coding standards
within my company, whew! Get PHP Eclipse and do a general search for
PHP Code Beautifier then download some you like and try them out.
Beautiful code often contains fewer bugs.
Dante
attached mail follows:
On Sat, April 29, 2006 6:10 pm, Robert Cummings wrote:
> On Sat, 2006-04-29 at 10:56, Satyam wrote:
>>
>> A brace on its own line doesn't make sense to me.
>
> This begs the question... Where do you place the closing brace?
I think no matter which style one uses, the following statement is
correct:
The closing brace goes directly under the first character of the line
containing the opening brace.
THE REST OF THIS IS *WAY* OFF-TOPIC
Though, in Lisp, I would actually "collapse" closing parens on a
single line, and considered the closing parens "isomorphic" even
though the actual one closing any given paren would not be directly
under the opening line:
(let* ((x (+ xoffset 3))
(y (+ yoffset 4))
)
(do* ((x1 x (+ x 1))
(y1 y (+ y 1))
(while ...
(for ...
;;; body here
) ) ) ) ;;; just close all the damn things on one line...
4 lines in a row with one ')' each was just too much for me to deal
with...
I don't do that in PHP, but you don't generally have, like, 5 closing
braces in a row in PHP either.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Sat, April 29, 2006 10:36 pm, D. Dante Lorenso wrote:
> However...you may need to make a policy in your company. If you use
> source control for your software, it may see changes in formatting as
> a
> distinct major revision. Therefore, if you save code in "your" style
> and another developer opens the file and resaves in "his style", then
> you'll unnecessarily make version control a nightmare. Despite
> personal
> preference, you MUST adhere to the style of the project. If you are
> the
> sole developer, you define that style. If you are a coding monkey,
> then
> you may have to suffer with the style that the architect before you
> declared.
I believe I was quite clear when I suggested that the IDE should *NOT*
alter the actual code -- it should simply *DISPLAY* the style I
prefer.
For that matter, any new code I type should, by definition, be saved
in the style the rest of the file is in, no matter which style is
being displayed at the moment.
I don't think there are any IDEs on the market that do this.
They all seem to think they know how to align things better than I do,
and generally just screw it up, and, yes, make version control a
nightmare if you actually try to use their silly auto-format.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
sinai
simnet.is escribió:
>Hello, 1st msg here so im excited what results i will get :)
>
>Im a novice with php parsing and have been able to help myself quite well with what ive needed with xml_parse_into_struct and then echoing the fixed variable names but now im dealing with an xml document that is 1st quite large and 2nd changing gradually over time with either added data or changed information. (But not in large numbers)
>
>http://www.camelotherald.com/xml/spells-si.xml
>
>It is a spell listing for an online mmorpg. It has a "spell_list" that captures all other tags and a "spell_line" for each spell line. Within each spell line is a "spell" which has the detailed info for each spell with in the "spell_line"
>
>I could parse this by echoing the fixed variables but due to its size and the changes done over time its just to much work. This is why i come to a stop. Ive read some guides and tried some example code that should help me through this.
>
>What i hoped to get is an example with the xml i provided so i could work with it to complete the project.
>
>The example could look something like this:
>
>Header with the selected "spell_line" name ie. "Calefaction" and below that the spell info in some dummy table format. Then the next "spell_line" which is "Path of Earth" then with the spell info in some dummy table setup.
>
>Thanks for reading and i hope someone can show me the light of a real xml parse.
>
>
>
Hi,
Some months ago I was looking for some code for "loading" dynamic xml
data structures my php scripts. I didn't found anything simple and
flexible for my needs.
I found handy the PEAR XML_beautifier tokenizer, and then I write a
simple function to extract all the data with the right array structure
as needed for my project. A recursive function to extract tag elements
data from the tokenized arrays (attached below)
Have a look at the code below. In some lines I process part of the
contents from your xml sample file, so you can have something to get
started, it you find handy my approach.
I've attached a partial output from the data extracted by this code too.
To run the code you need PEAR and XML_Beautifier and dependencies (if
any, now don't remember if XML_parser is in the PEAR base install or not).
Have fun, :-)
Gonzalo Monzón
<?php
ini_set('include_path',"./pear;../");
require_once 'PEAR.php';
require_once 'xml/Beautifier/Tokenizer.php';
$xmlsrc = "http://www.camelotherald.com/xml/spells-si.xml";
$data = XML_tokenize($xmlsrc,True);
$spell_list = _gxml_bds_extract_tag('spell_list','children',$data);
// Extract spell_lines attribute data:
$spell_lines_attr =
_gxml_bds_extract_tag('spell_line','attribs',$spell_list,1,-1);
// Extract spell_lines children data:
$spell_lines_data =
_gxml_bds_extract_tag('spell_line','children',$spell_list,1,-1);
// Extract spell data and attributes from spell_lines:
foreach($spell_lines_data as $k => $val) {
$spells_attr[$k] =
_gxml_bds_extract_tag('spell','attribs',$val,1,-1);
$spells_data[$k] =
_gxml_bds_extract_tag('spell','children',$val,1,-1);
// Extract data from all spells in $k spell_line:
foreach($spells_data[$k] as $k2 => $val2) {
$tmp = _gxml_bds_extract_tag('level','children',$val2);
$spells_data_val[$k][$k2]['level'] = $tmp[0]['data'];
$tmp = _gxml_bds_extract_tag('damage_type','children',$val2);
$spells_data_val[$k][$k2]['damage_type'] = $tmp[0]['data'];
}
}
/*****
(A)
******
*/
echo $spell_lines_attr[0]['name']."</br>";
foreach($spells_attr[0] as $k => $val) {
echo $k."</br>";
_print_bDS($val);
_print_bDS($spells_data_val[0][$k]);
echo "</br>";
}
/*****
(B)
******
*/
_print_bDS($spells_data[0][0]);
/*
******
Output: (A)
******
Calefaction
0
name => Minor Shield of Magma
desc => Creates a field that damages anyone who attacks the target in
melee.
id => 22
target => Realm
level => 1
damage_type => Matter
1
name => Shield of Magma
desc => Creates a field that damages anyone who attacks the target in
melee.
id => 23
target => Realm
level => 5
damage_type => Matter
2
name => Greater Shield of Magma
desc => Creates a field that damages anyone who attacks the target in
melee.
id => 24
target => Realm
level => 9
damage_type => Matter
...
******
Output: (B)
******
0
type => 1
data =>
depth => 3
1
type => 2
tagname => level
attribs
contains => 1
depth => 3
children
0
type => 1
data => 1
depth => 4
2
type => 1
data =>
depth => 3
3
type => 2
tagname => range
attribs
contains => 1
depth => 3
children
0
type => 1
data => 1000
depth => 4
4
type => 1
data =>
depth => 3
5
type => 2
tagname => damage
attribs
contains => 1
depth => 3
children
0
type => 1
data => 0.7
depth => 4
6
type => 1
data =>
depth => 3
7
type => 2
tagname => damage_type
attribs
contains => 1
depth => 3
children
0
type => 1
data => Matter
depth => 4
...
*/
function XML_tokenize($data,$file=False) {
$p = &new XML_Beautifier_Tokenizer("iso-8859-1");
return $p->tokenize($data,$file);
}
// Recursive function to extract an element when found the tag
// from XML tokenized data
// If offset supplied, search for the N occurrence of the element
// Default will return only one tag struct, or you can use a -1 count
// as to get all the occurrences of that tag, in the whole data
function
_gxml_bds_extract_tag($tag,$elem,$data,$offset=1,$count=1,$fromself=False) {
global $_extract_offset_cnt;
global $_extract_occurrence_cnt;
global $_extract_data;
// If not a recursive call: set offset counter
if (!$fromself) {
$_extract_offset_cnt = 0;
$_extract_occurrence_cnt = 0;
$_extract_data = array();
}
// Search for tokenized tags in this level:
$found = False;
do {
$key = key($data);
$val = $data[$key];
// Value is an array, recusive call to itself
if (is_array($val)) {
$found =
_gxml_bds_extract_tag($tag,$elem,$val,$offset,$count,True);
// If we have any data,
if (is_array($found))
// If reached needed count: return
// Ckeck with equal, as <= comparison will fail if -1
if (($count == $_extract_occurrence_cnt) || ($count == 1))
return $found;
} elseif (($key == "tagname") and ($val == $tag)) {
$_extract_offset_cnt +=1;
if ($count == 1) {
// We only want one tag occur., return it
// Check anyway if we succed the initial offset,
// otherwise continues...
if ($offset == $_extract_offset_cnt) {
return $data[$elem];
}
} else {
// Want more than one tag (count > 1 or -1 for all)
// Chek first for initial offset to increment occur. counter
if ($offset <= $_extract_offset_cnt) {
$_extract_occurrence_cnt +=1;
// Did we reached desired count?
// if count is minor than occurences, add it,
// else return all the data.
if ($count <= $_extract_occurrence_cnt) {
$_extract_data[] = $data[$elem];
} else {
// We did reached the count:
return $_extract_data;
}
}
}
}
// Check if do we can stop tokens iteration:
// Case only one occurence: if found, solved
// Case more occurences: we will continue looping
// til get data, if count reached, yet solved.
} while(next($data));
if ($count == 1) {
// Not fount in this level, ok.
return False;
} else
// Maybe have got some occurences, but didnt reach counter.
// In the case, would return all data in global if any
if (sizeof($_extract_data) > 0)
return $_extract_data;
else
return False;
}
/**
* Debug helper function, print data struc recusively in HTML
*/
function _print_bDS($data) {
foreach($data as $k => $v) {
if (is_array($v)) {
echo "<br><b>".htmlentities($k)."</b><ul>";
_print_bDS($v);
echo "</ul><br>";
} else {
echo htmlentities($k)." => ".htmlentities($v)."<br>";
}
}
}
?>
attached mail follows:
thanx all for the reply.
Yes, i am new to PHP
I am a c++ programmer and now i am trying to learn php.
i guess i did not explain the problem correct.
the code is generating an textbox for each record.
while(query )//here the query is opened
{
<table ">
<tr>
<td ><?php query->name ?> </td> // record from database
<td > Please fill in your age:</td> //text
<td "><input name="age" type="text" </td> //textbox,
<td ><a href="<? echo
"otherform.php?age=PLACE_HERE_THE_VALUE_FROM_QUANTITY_TEXTBOX&name=query->name";
?> "</td>
</tr>
</table>
}
how can i get the value from the textbox? i don't have form tag
if i have 50 records, there are 50 textboxes named "age" right?
""Smart Software"" <info
smart-software.org> schreef in bericht
news:11.4A.18514.B0343544
pb1.pair.com...
> code below shows all records from products table with an textbox and an
> order button for each record
>
> <? $query1 = mysql_query("SELECT * FROM products ");
> while ($rowType = mysql_fetch_array($query1))
> { ?>
> <table width="500" border="0">
> <tr class="largeheader">
> <td width="40%"><? echo "$rowType[0]"; ?></a> </td>
> <td width="10%"><?php echo "$rowType[1]"; ?></td>
> <td width="10%"><input name="quantity" type="text" value="1" size="1"
> maxlength="3"></td>
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&toevoegen=1&id=$rowType[7]"; ?>"><img
> src="images/bestel1.gif" border="0"></a></td>
> </tr>
>
> <?php
> }
> ?>
> </table>
>
>
>
> if someone presses the button, an item will be ordered.
>
> How can i add the content of the textbox?
> i tried this:
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]";
> ?>"><img src="images/bestel1.gif" border="0"></a></td>
>
> but all i get is an error telling me there is a undefined varable
>
>
>
> thanx for all help
> N. Karademir
attached mail follows:
thanx all for the reply.
Yes, i am new to PHP
I am a c++ programmer and now i am trying to learn php.
i guess i did not explain the problem correct.
the code is generating an textbox for each record.
while(query )//here the query is opened
{
<table ">
<tr>
<td ><?php query->name ?> </td> // record from database
<td > Please fill in your age:</td> //text
<td "><input name="age" type="text" </td> //textbox,
<td ><a href="<? echo
"otherform.php?age=PLACE_HERE_THE_VALUE_FROM_QUANTITY_TEXTBOX&name=query->name";
?> "</td>
</tr>
</table>
}
how can i get the value from the textbox? i don't have form tag
if i have 50 records, there are 50 textboxes named "age" right?
""Smart Software"" <info
smart-software.org> schreef in bericht
news:11.4A.18514.B0343544
pb1.pair.com...
> code below shows all records from products table with an textbox and an
> order button for each record
>
> <? $query1 = mysql_query("SELECT * FROM products ");
> while ($rowType = mysql_fetch_array($query1))
> { ?>
> <table width="500" border="0">
> <tr class="largeheader">
> <td width="40%"><? echo "$rowType[0]"; ?></a> </td>
> <td width="10%"><?php echo "$rowType[1]"; ?></td>
> <td width="10%"><input name="quantity" type="text" value="1" size="1"
> maxlength="3"></td>
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&toevoegen=1&id=$rowType[7]"; ?>"><img
> src="images/bestel1.gif" border="0"></a></td>
> </tr>
>
> <?php
> }
> ?>
> </table>
>
>
>
> if someone presses the button, an item will be ordered.
>
> How can i add the content of the textbox?
> i tried this:
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]";
> ?>"><img src="images/bestel1.gif" border="0"></a></td>
>
> but all i get is an error telling me there is a undefined varable
>
>
>
> thanx for all help
> N. Karademir
attached mail follows:
I am using this to compare todays date with dates retieved from a database.
The problem is it seem to retrun the same value for the $then variable
and can be seen ot working here....
http://nationalservicesscotland.com/cms/time.php
<?
session_start();
include ('../shared/connect.php');
$query= "SELECT headline, id, expiry, link FROM events";
$result= mysql_query($query);
while ($row =
mysql_fetch_array($result, MYSQL_ASSOC)){
$compare= explode("/", $row['expiry']);
$day = isset($compare[0]) ? $compare[0] : null;
echo "day is $day<br>br><br>";
$month = isset($compare[1]) ? $compare[1] : null;
echo "month is $month<br>br><br>";
$year = isset($compare[2]) ? $compare[2] : null;
echo "year is $year<br>br><br>";
$then = mktime(0,0,0,$month,$day, $year);
$now = mktime (0,0,0,date("m"),date("d"),date("Y"));
$diff = $now - $then;
echo "today is $today<BR>";
echo "expiry date is $ross<br>";
echo "now mktime value is is $now<br>";
echo "then mkvalue is $then<br><br>";
if ($diff < 0 ) {
/*$text = stripslashes ($row['headline']);
$newtext = wordwrap($text, 12, "\n", 1);
$link=$row['link'];
echo $newtext."<a href=\"$link\">...read more</a>"."<br /><br />";*/
}
}
?>
attached mail follows:
soted it ! Thanks.
R.
""Ross"" <ross
aztechost.com> wrote in message
news:AA.28.18514.C82A4544
pb1.pair.com...
>I am using this to compare todays date with dates retieved from a database.
>The problem is it seem to retrun the same value for the $then variable
>
> and can be seen ot working here....
>
> http://nationalservicesscotland.com/cms/time.php
>
>
> <?
>
> session_start();
> include ('../shared/connect.php');
>
> $query= "SELECT headline, id, expiry, link FROM events";
>
> $result= mysql_query($query);
>
>
> while ($row =
mysql_fetch_array($result, MYSQL_ASSOC)){
>
>
> $compare= explode("/", $row['expiry']);
>
>
> $day = isset($compare[0]) ? $compare[0] : null;
> echo "day is $day<br>br><br>";
> $month = isset($compare[1]) ? $compare[1] : null;
> echo "month is $month<br>br><br>";
> $year = isset($compare[2]) ? $compare[2] : null;
> echo "year is $year<br>br><br>";
>
> $then = mktime(0,0,0,$month,$day, $year);
>
> $now = mktime (0,0,0,date("m"),date("d"),date("Y"));
>
>
> $diff = $now - $then;
>
> echo "today is $today<BR>";
> echo "expiry date is $ross<br>";
> echo "now mktime value is is $now<br>";
> echo "then mkvalue is $then<br><br>";
> if ($diff < 0 ) {
> /*$text = stripslashes ($row['headline']);
> $newtext = wordwrap($text, 12, "\n", 1);
> $link=$row['link'];
> echo $newtext."<a href=\"$link\">...read more</a>"."<br /><br />";*/
>
> }
> }
> ?>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]