php-general Digest 11 Jul 2004 01:50:22 -0000 Issue 2869
Topics (messages 190132 through 190163):
MySQL/PHP Tunneling
190132 by: Karam Chand
190139 by: Curt Zirzow
breadcrumb app...
190133 by: Verdon Vaillancourt
Re: get the month's last day
190134 by: Larry E. Ullman
odd refresh error
190135 by: Scott Taylor
190140 by: Curt Zirzow
usort e & � together
190136 by: John Taylor-Johnston
Login Verification
190137 by: Harlequin
190141 by: Jason Wong
190142 by: John Taylor-Johnston
190143 by: Harlequin
190144 by: Tim Van Wassenhove
190145 by: Marek Kilimajer
190147 by: Jason Wong
190148 by: Eric Schwartz
190149 by: Harlequin
Re: Help Formatting String into URL
190138 by: Curt Zirzow
mysql and session vars...
190146 by: bruce
190150 by: bruce
190151 by: Marek Kilimajer
190152 by: bruce
190154 by: Jason Wong
UPDATE...
190153 by: Harlequin
190155 by: Jason Wong
190156 by: Harlequin
190158 by: Jason Wong
190160 by: Harlequin
190161 by: Jason Wong
190162 by: Harlequin
190163 by: Jason Wong
mail problem
190157 by: Joao Gomes
190159 by: Jason Wong
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 ---
Hello,
Recently lot of MySQL clients try to overcome host
based privilege system of MySQL by using PHP tunneling
method.
In this method they call up a PHP file in the server
and the PHP file executes a query and sends the data
in XML format.
I am using C API() and I was just wondering if
somebody is working on such tunnels i.e. a PHP file
and its corresponding C/++ code that will fill up
MYSQL_RES structures correctly so that I can use them
to C API() without any problem. Otherwise, i guess i
have to write one for myself.
Regards,
Karam
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
First off, when starting a new topic, don't reply to message and
then change the topic.
* Thus wrote Karam Chand:
> Hello,
>
> Recently lot of MySQL clients try to overcome host
> based privilege system of MySQL by using PHP tunneling
> method.
>
> In this method they call up a PHP file in the server
> and the PHP file executes a query and sends the data
> in XML format.
This doesn't really explain much.
>
> I am using C API() and I was just wondering if
> somebody is working on such tunnels i.e. a PHP file
> and its corresponding C/++ code that will fill up
> MYSQL_RES structures correctly so that I can use them
> to C API() without any problem. Otherwise, i guess i
> have to write one for myself.
Now, I'm utterly confused. I have no idea what you're referring to
as C API() nor php tunneling.
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 ---
There's also a nice gpl class for this available at
http://www.phpclasses.org/browse/package/1192.html or
http://www.baskettcase.com/classes/breadcrumb/
It's easy to hack also if you need to add further function
On 10-Jul-04, at 9:45 AM, [EMAIL PROTECTED] wrote:
Subject: breadcrumb app...
Reply-To: <[EMAIL PROTECTED]>
hi...
has anybody seen a reasonably good/basic breadcrumb app that works...
new
pages are displayed to the user based upon the user's menu selection...
i'd like to be able to provide a trail at the top of the page, kind of
like..
home -> food -> fruit -> squash
were the user could then select one of the links of the trail, which
would
take the user to the earlier page...
searching google results in hundreds of results, but i'm not sure which
examples are good/poor!!
thanks
--- End Message ---
--- Begin Message ---
how can i retrieve the last day of the month?
like 31 - Jul, 30 - Jun , 28 - Feb
<?php
$month = 8;
$year = 2003;
$lastdayofmonth = mktime(12,0,0,$month+1,0,$year);
?>
You could also use the date() function with the t parameter. Of course,
that also requires a timestamp...
Larry
--- End Message ---
--- Begin Message ---
Some people are complaining that when the visit one of my pages that the
pages refeshes over and over again. One person said that it was only
when he typed something in on one of the forms. How could an error like
this be caused? Could this be a bug in a browser?
Scott
--- End Message ---
--- Begin Message ---
* Thus wrote Scott Taylor:
>
> Some people are complaining that when the visit one of my pages that the
> pages refeshes over and over again. One person said that it was only
> when he typed something in on one of the forms. How could an error like
> this be caused? Could this be a bug in a browser?
More like a End User malfunction.
Or that your form submision is causing an infinite redirect loop of
some sort.
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 ---
I think my problem lies in usort. I have a big honker of an array which I usort.
$ausenquiry = "e";
and
$ausenquiry = "e";
give a separate result.
I want to conjoin them. Possible? The same would be true for "a" and "�".
usort distinguishes between � and e. Any way around this? I don't see any inspiration:
http://ca2.php.net/manual/en/function.usort.php
John
-------snip----------
while ($mydata = mysql_fetch_object($news))
{
$mydata->AUS = str_replace(" ;", ";", $mydata->AUS);
$mydata->AUS = str_replace("; ", ";", $mydata->AUS);
$tempauthors = explode(";", $mydata->AUS);
foreach ($tempauthors as $singleauthor)
{
if ($singleauthor <> "")
{
array_push($authors, $singleauthor);
$author_list[$singleauthor][] = $mydata->id; // use an associative array...
}
}
}
usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
foreach (array_count_values ($authors) as $author=>$count)
{
if((strtolower(substr($author, 0, 1)) == $ausenquiry))
{
echo "<tr>";
echo "<th align=\"left\" colspan=\"2\"><a
href=\"".$SCRIPT_NAME."?searchenquiry=".urlencode($author)."\">".$author."</a>
<small>[<--Search Entire Database]</small></th>";
echo "<th align=\"right\" width=\"5%\" nowrap>(".$count." ";
if($count > 1)
{echo "records found/trouv�s)";}
else{echo "record found/trouv�)";}
echo"</th></tr>\n";
echo "<tr><td> </td>";
echo "<td align=\"left\">";
$temp = "";
foreach ($author_list[$author] as $ausid)
{
$temp .= "<a target=\"printwindow\"
href=\"".$SCRIPT_NAME."?id=".urlencode($ausid)."&searchenquiry=".urlencode($author)."\">".$ausid."</a>,
";
}
$temp = substr("$temp", 0, -2);
echo "$temp</td>";
echo "<td> </td>";
echo "</tr>\n";
}
}
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."
' ' ' Coll�ge de Sherbrooke:
��� http://www.collegesherbrooke.qc.ca/languesmodernes/
- Universit� de Sherbrooke:
http://compcanlit.ca/
819-569-2064
--- End Message ---
--- Begin Message ---
Hi everyone.
I have a quick question regarding the above. currently I have a form that
posts to another page. However, rather than wait until they get to that page
to verify their login are there conventions that are recognised for this
process currently...?
For example, my code for the form's header is:
echo "<form action='login_verified.php' method='post' name='Login Form'
title='Login Form'>";
How can I ensure that only once a user has been verified that they can see
the page in my form's action field...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 03:47, Harlequin wrote:
> I have a quick question regarding the above. currently I have a form that
> posts to another page. However, rather than wait until they get to that
> page to verify their login are there conventions that are recognised for
> this process currently...?
>
> For example, my code for the form's header is:
>
> echo "<form action='login_verified.php' method='post' name='Login Form'
> title='Login Form'>";
>
> How can I ensure that only once a user has been verified that they can see
> the page in my form's action field...?
At the most basic level a login system would work something like this:
1) User submits login credentials
2) A login script checks credentials, if OK, send user a token (via
session/cookie). In your backend, associate that token with that user and
note that they're logged in.
3) At the start of all your protected pages, you need to check for the token
and whether it's valid.
I'm surprised that you're asking this because I thought that you had your
login system all sussed out!
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
And miles to go before I sleep.
-- Robert Frost
*/
--- End Message ---
--- Begin Message ---
It sounds like you are afraid they will see login_verified.php? If they surf to
http://www.foo/login_verified.php you could verify that a field exists ...
echo "<form action='login_verified.php' method='post' name='Login Form'
title='Login Form'>
<input type="hidden" name="something">";
<?php
if ($something)
{
#add the contents here
}else{
echo " ";
}
?>
Harlequin wrote:
> Hi everyone.
>
> I have a quick question regarding the above. currently I have a form that
> posts to another page. However, rather than wait until they get to that page
> to verify their login are there conventions that are recognised for this
> process currently...?
>
> For example, my code for the form's header is:
>
> echo "<form action='login_verified.php' method='post' name='Login Form'
> title='Login Form'>";
>
> How can I ensure that only once a user has been verified that they can see
> the page in my form's action field...?
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."
' ' ' Coll�ge de Sherbrooke:
��� http://www.collegesherbrooke.qc.ca/languesmodernes/
- Universit� de Sherbrooke:
http://compcanlit.ca/
819-569-2064
--- End Message ---
--- Begin Message ---
I did Jason but am reworking all the pages and tidying the syntax up and one
of the things I never sorted out was the fact that users logging in would be
taken to the logged in page although their user data was not displayed and
an error told them they logged in incorrectly.
This, from a users perspective, can seem confusing because although they
haven't been verified they are looking at what appears to be a members page.
But the message tells them otherwise and the PHP code never retrieves their
data from the database because they were not successfully verified.
I suppose I'm over egging the pudding but I'd like it to be slick that's
all.
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 11 July 2004 03:47, Harlequin wrote:
>
> > I have a quick question regarding the above. currently I have a form
that
> > posts to another page. However, rather than wait until they get to that
> > page to verify their login are there conventions that are recognised for
> > this process currently...?
> >
> > For example, my code for the form's header is:
> >
> > echo "<form action='login_verified.php' method='post' name='Login Form'
> > title='Login Form'>";
> >
> > How can I ensure that only once a user has been verified that they can
see
> > the page in my form's action field...?
>
> At the most basic level a login system would work something like this:
>
> 1) User submits login credentials
> 2) A login script checks credentials, if OK, send user a token (via
> session/cookie). In your backend, associate that token with that user and
> note that they're logged in.
> 3) At the start of all your protected pages, you need to check for the
token
> and whether it's valid.
>
> I'm surprised that you're asking this because I thought that you had your
> login system all sussed out!
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> And miles to go before I sleep.
> -- Robert Frost
> */
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, Harlequin wrote:
> I did Jason but am reworking all the pages and tidying the syntax up and one
> of the things I never sorted out was the fact that users logging in would be
> taken to the logged in page although their user data was not displayed and
> an error told them they logged in incorrectly.
Meaby you can have a look at pear::auth ?
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
--- End Message ---
--- Begin Message ---
Harlequin wrote:
I did Jason but am reworking all the pages and tidying the syntax up and one
of the things I never sorted out was the fact that users logging in would be
taken to the logged in page although their user data was not displayed and
an error told them they logged in incorrectly.
This, from a users perspective, can seem confusing because although they
haven't been verified they are looking at what appears to be a members page.
What makes it look like a members page? Put in a condition that will
modify the page look or whatever you need.
But the message tells them otherwise and the PHP code never retrieves their
data from the database because they were not successfully verified.
I suppose I'm over egging the pudding but I'd like it to be slick that's
all.
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 04:46, Harlequin wrote:
> I did Jason but am reworking all the pages and tidying the syntax up and
> one of the things I never sorted out was the fact that users logging in
> would be taken to the logged in page although their user data was not
> displayed and an error told them they logged in incorrectly.
WHy *would* they get an error? You wrote the app, so under what coonditions
would you output an error?
> This, from a users perspective, can seem confusing because although they
> haven't been verified they are looking at what appears to be a members
> page. But the message tells them otherwise and the PHP code never retrieves
> their data from the database because they were not successfully verified.
Sounds like you have a fatal flaw with your system. I strongly suggest that
you read a few of the many login system tutorials out there and maybe
consider using one of the many ready made login systems.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I didn't get sophisticated -- I just got tired. But maybe that's what
sophisticated is -- being tired.
-- Rita Gain
*/
--- End Message ---
--- Begin Message ---
On Sat, 10 Jul 2004 20:47:47 +0100, Harlequin
<[EMAIL PROTECTED]> wrote:
> Hi everyone.
>
> I have a quick question regarding the above. currently I have a form that
> posts to another page. However, rather than wait until they get to that page
> to verify their login are there conventions that are recognised for this
> process currently...?
>
> For example, my code for the form's header is:
>
> echo "<form action='login_verified.php' method='post' name='Login Form'
> title='Login Form'>";
>
> How can I ensure that only once a user has been verified that they can see
> the page in my form's action field...?
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------
Why not skip that step by adding a login redirect page? It checks the
form values against the database and if all is good hands out
credentials and sends the user on their way, and if they supply the
wrong information they are sent to another page.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Jason, John, Tim, Eric.
Thanks for your patience. Which along with persistence is it's own reward
:).
I got it working OK and am reasonably happy with the results.
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi everyone.
>
> I have a quick question regarding the above. currently I have a form that
> posts to another page. However, rather than wait until they get to that
page
> to verify their login are there conventions that are recognised for this
> process currently...?
>
> For example, my code for the form's header is:
>
> echo "<form action='login_verified.php' method='post' name='Login Form'
> title='Login Form'>";
>
> How can I ensure that only once a user has been verified that they can see
> the page in my form's action field...?
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------
--- End Message ---
--- Begin Message ---
* Thus wrote Ryan Schefke:
> Hi,
>
>
>
> Can someone help me write a short code snippet to format a string to add:
>
>
>
> http://www <http://www/> -- if the string is "google.com" and doesn't have
> http://www <http://www/> in front of it
This is really not a good idea to do blindly, what if I was
submitting a site that was like say.. news.php.net?
you will simply break things.
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 ---
hi...
if i create a site that hits a back mysql db...
i don't want to do a mysql_connect for every page that has to access the db.
so the question is where should the mysql_connect occur. also, if i were to
do it once when the app starts, is the connection more or less maintained
throught the life of the app.
an additional question. the resource identifier is required to initiate a
given php mysql function. i would assume that the resource identifier should
probably be stored in some session var....
searching mysql/php/google didn't result in clarfification for these
issues...
comments/criticisms/thoughts are welcome...
thanks
-bruce
--- End Message ---
--- Begin Message ---
update...
as a short test... i created a resource -->
$link = mysql_connect(foo.....)
and used the $link to process a query against my mysql db...
i then attempted to create a session var consisting of the $link value...
$_SESSION['db'] = $link, and verified that it actually contained the
resource value.
the issue i have is that when i call the same page, the value in the session
var is no longer what it was. the other test session vars are still the same
values...
it appears that it's not possible (or i'm missing something) to
store/maintain mysql database resource information as a session variable...
i'm using php -v 4.2.2
am i missing something...
anybody have any idea as to why i might be seeing this kind of behavior..
thanks
-bruce
-----Original Message-----
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 10, 2004 2:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql and session vars...
hi...
if i create a site that hits a back mysql db...
i don't want to do a mysql_connect for every page that has to access the db.
so the question is where should the mysql_connect occur. also, if i were to
do it once when the app starts, is the connection more or less maintained
throught the life of the app.
an additional question. the resource identifier is required to initiate a
given php mysql function. i would assume that the resource identifier should
probably be stored in some session var....
searching mysql/php/google didn't result in clarfification for these
issues...
comments/criticisms/thoughts are welcome...
thanks
-bruce
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Please do not hijack threads.
bruce wrote:
hi...
if i create a site that hits a back mysql db...
i don't want to do a mysql_connect for every page that has to access the db.
so the question is where should the mysql_connect occur. also, if i were to
do it once when the app starts, is the connection more or less maintained
throught the life of the app.
You have to connect to mysql on every page, it's not possible to store
the connection in session. That's how it works.
an additional question. the resource identifier is required to initiate a
given php mysql function. i would assume that the resource identifier should
probably be stored in some session var....
searching mysql/php/google didn't result in clarfification for these
issues...
comments/criticisms/thoughts are welcome...
thanks
-bruce
--- End Message ---
--- Begin Message ---
not sure what you mean by hijacking...
simply did a cut/past for a new topic..
but thanks for the reply... guess i'll have to investigate persistent
connections.. but i'm still confused as to why a value that i put into the
session variable seems to get reset to '0' when i use the session var in
another page....
ideas/comments welcome..
thanks..
-bruce
-----Original Message-----
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 10, 2004 4:42 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] mysql and session vars...
Please do not hijack threads.
bruce wrote:
> hi...
>
> if i create a site that hits a back mysql db...
>
> i don't want to do a mysql_connect for every page that has to access the
db.
> so the question is where should the mysql_connect occur. also, if i were
to
> do it once when the app starts, is the connection more or less maintained
> throught the life of the app.
You have to connect to mysql on every page, it's not possible to store
the connection in session. That's how it works.
>
> an additional question. the resource identifier is required to initiate a
> given php mysql function. i would assume that the resource identifier
should
> probably be stored in some session var....
>
> searching mysql/php/google didn't result in clarfification for these
> issues...
>
> comments/criticisms/thoughts are welcome...
>
> thanks
>
> -bruce
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 07:59, bruce wrote:
> not sure what you mean by hijacking...
FYI:
You have started a new thread by taking an existing posting and replying to
it while you changed the subject.
That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a "References:" header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view ("tree view") of the postings.
With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.
Always do a fresh post when you want to start a new thread. To achieve this,
click on "New message" instead of "Reply" within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
You'd like to do it instantaneously, but that's too slow.
*/
--- End Message ---
--- Begin Message ---
Hi again. I know I should be in bed but if I leave this I'll just go mad...!
I have a page that successfully calls data from the database based on userID
& Password combo. No Problems there eh... I display the information in a
form, the user is supposed to be updating this information and then hitting
submit to update their particular record. But guess what...? No Juice...!
On the 1st page I have this:
$UserID=$row["UserID"];
--->> the UserID should be limited to one single row by this stage in the
code as the user has been validated.
Later on the page I have this:
echo "<input type=\"hidden\" name=\"TXT_UserID\" value=\"$UserID\" />";
--->> The variable "$UserID" is sent to page 2 no...?
On the 2nd page I have this:
$UserID= $_POST['TXT_UserID'];
$Comments= $_POST['TXT_Comments'];
$FurtherComments= $_POST['TXT_FurtherComments'];
$UserMail= $_POST['TXT_UserMail'];
$CV= $_POST['TXT_CV'];
$sql = "UPDATE RegisteredMembers SET Comments=$Comments,
FurtherComments=$FurtherComments, $UserMail=UserMail, DocumentData=$CV
WHERE UserID=$UserID";
I'd really appreciate any help as I feel like this is the penultimate hurdle
for me. Data in - data out.....!
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 08:20, Harlequin wrote:
> I have a page that successfully calls data from the database based on
> userID & Password combo. No Problems there eh... I display the information
> in a form, the user is supposed to be updating this information and then
> hitting submit to update their particular record. But guess what...? No
> Juice...!
Please elaborate on what you mean by "No Juice".
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
A bachelor is an unaltared male.
*/
--- End Message ---
--- Begin Message ---
Sorry Jason.
I'm hitting the submit button at the bottom of the page and getting
redirected OK to the next page with no errors but when I query the database
directly it isn't updating.
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 11 July 2004 08:20, Harlequin wrote:
>
> > I have a page that successfully calls data from the database based on
> > userID & Password combo. No Problems there eh... I display the
information
> > in a form, the user is supposed to be updating this information and then
> > hitting submit to update their particular record. But guess what...? No
> > Juice...!
>
> Please elaborate on what you mean by "No Juice".
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> A bachelor is an unaltared male.
> */
>
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 08:33, Harlequin wrote:
> I'm hitting the submit button at the bottom of the page and getting
> redirected OK to the next page with no errors but when I query the database
> directly it isn't updating.
Should you be getting errors if there is a problem? IOW *are* you putting in
any error checking code?
In the code that you posted you are not performing any validation checks on
the data sent by the user - this is BAD. You should fix that before you go
live with your site.
You assigned your query to $sql - this is good, but did you print it out so
that you can verify the query is what you expected it to be? One of the first
rules of debugging is to gather as much info as possible. Which means
printing out every variable of significance.
When developing your code ALWAYS enable full error reporting and display
errors (or if you prefer log them and read the log).
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Clothes make the man. Naked people have little or no influence on society.
- Mark Twain
*/
--- End Message ---
--- Begin Message ---
Jason.
Thanks for pointing out the obvious - I should have trapped errors. Thanks
you.
I did as you suggest and I get a rather generic response:
Sorry, Your Request Could Not Be Executed: You have an error in your SQL
syntax. Check the manual that corresponds to your MySQL server version for
the right syntax to use near 'Little About Me..., FurtherComments=Nothing To
Tell about me.,
My code now on the 2nd page (once the submit button has been hit) is:
<?php
$UserID= $_POST['TXT_UserID'];
$Comments= $_POST['TXT_Comments'];
$FurtherComments= $_POST['TXT_FurtherComments'];
$UserMail= $_POST['TXT_UserMail'];
$CV= $_POST['TXT_CV'];
$sql = "UPDATE RegisteredMembers SET Comments=$Comments,
FurtherComments=$FurtherComments, $UserMail=UserMail, DocumentData=$CV
WHERE UserID='$_POST[TXT_UserID]'";
$result = mysql_query($sql) or die ("Sorry, Your Request Could Not Be
Executed: " . mysql_error());
echo "$sql";
?>
Any ideas Jason...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 11 July 2004 08:33, Harlequin wrote:
>
> > I'm hitting the submit button at the bottom of the page and getting
> > redirected OK to the next page with no errors but when I query the
database
> > directly it isn't updating.
>
> Should you be getting errors if there is a problem? IOW *are* you putting
in
> any error checking code?
>
> In the code that you posted you are not performing any validation checks
on
> the data sent by the user - this is BAD. You should fix that before you go
> live with your site.
>
> You assigned your query to $sql - this is good, but did you print it out
so
> that you can verify the query is what you expected it to be? One of the
first
> rules of debugging is to gather as much info as possible. Which means
> printing out every variable of significance.
>
> When developing your code ALWAYS enable full error reporting and display
> errors (or if you prefer log them and read the log).
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Clothes make the man. Naked people have little or no influence on
society.
> - Mark Twain
> */
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 09:00, Harlequin wrote:
> I did as you suggest and I get a rather generic response:
>
> Sorry, Your Request Could Not Be Executed: You have an error in your SQL
> syntax. Check the manual that corresponds to your MySQL server version for
> the right syntax to use near 'Little About Me..., FurtherComments=Nothing
> To Tell about me.,
>
> My code now on the 2nd page (once the submit button has been hit) is:
>
> <?php
> $UserID= $_POST['TXT_UserID'];
> $Comments= $_POST['TXT_Comments'];
> $FurtherComments= $_POST['TXT_FurtherComments'];
> $UserMail= $_POST['TXT_UserMail'];
> $CV= $_POST['TXT_CV'];
> $sql = "UPDATE RegisteredMembers SET Comments=$Comments,
> FurtherComments=$FurtherComments, $UserMail=UserMail, DocumentData=$CV
> WHERE UserID='$_POST[TXT_UserID]'";
> $result = mysql_query($sql) or die ("Sorry, Your Request Could Not Be
> Executed: " . mysql_error());
> echo "$sql";
> ?>
The obvious first thing to do is to put quotes (') around the data when you're
using a text field.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Seeing is deceiving. It's eating that's believing.
-- James Thurber
*/
--- End Message ---
--- Begin Message ---
Laugh...? I nearly wet mesen...!
Jason. Thanks very much. Truly...! I looked at it, stared at it, growled at
it and then finally realised about 30 seconds before I raed your post:
SET Comments='$Comments',
What an idiot...!
Hey - thanks for your patience mate.
I don't suppose you'd care to help me with controlling document types for
uploading would you...? I have a field that accepts files but don't want
some idiot uploading an executable - I doubt my hosting provider would be
too chuffed with that at all.
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 11 July 2004 09:00, Harlequin wrote:
>
> > I did as you suggest and I get a rather generic response:
> >
> > Sorry, Your Request Could Not Be Executed: You have an error in your SQL
> > syntax. Check the manual that corresponds to your MySQL server version
for
> > the right syntax to use near 'Little About Me...,
FurtherComments=Nothing
> > To Tell about me.,
> >
> > My code now on the 2nd page (once the submit button has been hit) is:
> >
> > <?php
> > $UserID= $_POST['TXT_UserID'];
> > $Comments= $_POST['TXT_Comments'];
> > $FurtherComments= $_POST['TXT_FurtherComments'];
> > $UserMail= $_POST['TXT_UserMail'];
> > $CV= $_POST['TXT_CV'];
> > $sql = "UPDATE RegisteredMembers SET Comments=$Comments,
> > FurtherComments=$FurtherComments, $UserMail=UserMail, DocumentData=$CV
> > WHERE UserID='$_POST[TXT_UserID]'";
> > $result = mysql_query($sql) or die ("Sorry, Your Request Could Not Be
> > Executed: " . mysql_error());
> > echo "$sql";
> > ?>
>
> The obvious first thing to do is to put quotes (') around the data when
you're
> using a text field.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Seeing is deceiving. It's eating that's believing.
> -- James Thurber
> */
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 09:28, Harlequin wrote:
> Jason. Thanks very much. Truly...! I looked at it, stared at it, growled at
> it and then finally realised about 30 seconds before I raed your post:
>
> SET Comments='$Comments',
You also have the date and column-name switched:
... $UserMail=UserMail ...
> I don't suppose you'd care to help me with controlling document types for
> uploading would you...? I have a field that accepts files but don't want
> some idiot uploading an executable - I doubt my hosting provider would be
> too chuffed with that at all.
Post details of your problem on a NEW thread.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"I'm a mean green mother from outer space"
-- Audrey II, The Little Shop of Horrors
*/
--- End Message ---
--- Begin Message ---
Hi,
I am a beginner in php and I am trying to send emails from my machinne, I
dont have any mail server installed in my computer (e.g. sendmail), btw i am
running Windows XP, i wrote this script:
<?
$name=$HTTP_POST_VARS['name'];
$email=$HTTP_POST_VARS['email'];
$feedback=$HTTP_POST_VARS['feedback'];
$toaddress = '[EMAIL PROTECTED]';
$subject = 'Feedback from web site';
$mailcontent = 'Customer name: '.$name."\n"
'Customer email: '.$email."\n"
"Customer comments: \n".$feedback."\n";
$fromaddress = 'From: [EMAIL PROTECTED]';
mail($toaddress, $subject, $mailcontent, $fromaddress);
?>
and changed the php.ini to:
[mail function]
; For Win32 only.
SMTP = [EMAIL PROTECTED]
smtp_port = 25
; For Win32 only.
sendmail_from = [EMAIL PROTECTED]
Why it doesnt work? I am really lost here... if some nice-php-coder could
help me I would really appreciate.
thanks.
--- End Message ---
--- Begin Message ---
On Sunday 11 July 2004 08:33, Joao Gomes wrote:
> I am a beginner in php and I am trying to send emails from my machinne, I
> dont have any mail server installed in my computer (e.g. sendmail), btw i
> am running Windows XP, i wrote this script:
[snip]
> and changed the php.ini to:
>
> [mail function]
> ; For Win32 only.
> SMTP = [EMAIL PROTECTED]
SMTP (ie SMTP server) should be of the form: xxx.domain.tld, ie you should not
have "smtp@" in there.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Death is God's way of telling you not to be such a wise guy.
*/
--- End Message ---