David Powers Lesson08 forgotten.php problem
I have a strange problem when running forgotten.php. The program works alright initially with the setting of mail_connector.php as below. I managed to send and received email. Everything works fine intially. After sometime, I found problem running the same program again. This time it generates error message of 'Notice: Underfined index: [email protected] in c:\vhosts\phpcs5\lesson8\scripts\request_reset.php on line 25' and also message 'No connection could be made because the target machine actively refused it.'
Any idea why ?
Mail_Connector.php
<?php
$mailhost = 'mail.agri-organica.com';
$mailconfig = array('auth' => 'login',
'username' => '[email protected]',
'password' => 'password');
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
I changed the From header using agri-organica.com address and send to yahoo address. This time it shows:
'No connection could be made because the target machine actively refused it.'
Request Received
An email has been sent to your registered address with instructions for resetting your password.
Request_reset.php
<?php
$errors = FALSE;
$result = FALSE;
if ($_POST) {
require_once('library.php');
require_once('mail_connector.php');
try {
$val = new Zend_Validate_EmailAddress();
if (!$val->isValid($_POST['email'])) {
$errors = TRUE;
if (!$errors) {
$sql = $dbRead->quoteInto('SELECT user_id, first_name, family_name, email FROM users WHERE email = ?', $_POST['email']);
$result = $dbRead->fetchRow($sql);
if (!$result) {
$errors = TRUE;
} else {
// update database and send mail
$token = md5(uniqid(mt_rand(), TRUE));
$data = array('token' => $token);
$where = $dbWrite->quoteInto('email = ?', $_POST['email']);
$dbWrite->update('users', $data, "user_id = {$result['user_id']}");
$mail = new Zend_Mail('UTF-8');
$mail->addTo($result['email'], "{$result['first_name']} {$result['family_name']}");
$mail->setSubject('Instructions for resetting your password');
$mail->setFrom('[email protected]', 'Calvin');
$link = "http://phpcs5/lesson8/reset.php?id={$result['user_id']}&token=$token";
$message = "Use the following link to reset your password. This link can be used once only. $link";
$mail->setBodyText($message, 'UTF-8');
$mail->send();
} catch (Exception $e) {
echo $e->getMessage();
Similar Messages
-
David Powers cs5 with php...Zend
This one is aimed for David Powers. We are using your book for my advanved programming class. I continually have problems because they had us buy a domain instead of the one the book does it. At this point I'm on page 222ish, installing Zend. Obviously I'm using dreamweaver and my domain is with godaddy.com. I'm doing the section where you are are installing the library. I've got the library.php with no errors, I'm connected to my domain, and I have the zend file inside my local site folder. I've tried in the C drive but I cotinually get the same error:
Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in/home/content/79/7340479/html/library.php on line 4
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php:C:\Users\Becky\Desktop\colts\ZF\ZendFramework-1. 11.4-minimal\library') in /home/content/79/7340479/html/library.php on line 4
I've tried putting the zend folder in c, desktop, in side local site folder and same thing everytime. Any help would be appreciated.Re: David Powers cs5 with php...Zend
Ok I'm gonna try and help ya until David gets here. Since I use Zend and have read parts of his book.
First, are you trying to install zend at godaddy?
Your include file is odd. "include_path='.:/usr/local/php5/lib/php:C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library') in/home/content/79/7340479/html/library.php" - means PHP and Zend are located on 2 different machines
I appreciate it. the "C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library' is where the file path.I use Godaddy but I have it zend on my computer and am just trying to get it to run. I tried running it from desktop, C:(where it's at), andneven put it in the file manager on godaddy and tried that path...
the code I'm using is:
<?php
$library = 'C:\Users\Becky\Desktop\colts\ZF\ZendFramework-1.11.4-minimal\library';
set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
$loader = Zend_Loader_Autoloader::getInstance();
if ($loader) {
echo 'OK';
} else {
echo 'We have a problem';
I'm followed the book step by step but...
when i click autoloader.php in the tab bar it has a get option. but when i click it it says "operation failed because it is not on the remote site. -
Creating category lists with php (David Powers???)
I am creating a dynamic content website with numerous entries under various categories. The categories are kept in a seperate mysql that looks something like this (an example):
ID
Main
Sub
1
food
candy
2
food
meat
3
drink
coke
4
drink
snapple
5
drink
dr. pepper
6
food
bread
I have created a page where the user can see all of the main categories. In the above case, food and drink. I do not want 'food' and 'drink' to be repeated three times. So I have used php code which david powers gives in his recipe: http://cookbooks.adobe.com/post_Create_nested_lists_from_a_recordset__PHP_-16720.html.
The problem is that in the above case, the page will list: food, drink, food. This is because when the php passes through the 'drink's it then sees the last 'food' as being unique.
How do I get rid of this issue (without having to to continuosly reorder my mysql table)?
thanks
P.S. I am posting this here and not on the above recipe page because I am hoping for a quicker response.Re: David Powers cs5 with php...Zend
Ok I'm gonna try and help ya until David gets here. Since I use Zend and have read parts of his book.
First, are you trying to install zend at godaddy?
Your include file is odd. "include_path='.:/usr/local/php5/lib/php:C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library') in/home/content/79/7340479/html/library.php" - means PHP and Zend are located on 2 different machines
I appreciate it. the "C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library' is where the file path.I use Godaddy but I have it zend on my computer and am just trying to get it to run. I tried running it from desktop, C:(where it's at), andneven put it in the file manager on godaddy and tried that path...
the code I'm using is:
<?php
$library = 'C:\Users\Becky\Desktop\colts\ZF\ZendFramework-1.11.4-minimal\library';
set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
$loader = Zend_Loader_Autoloader::getInstance();
if ($loader) {
echo 'OK';
} else {
echo 'We have a problem';
I'm followed the book step by step but...
when i click autoloader.php in the tab bar it has a get option. but when i click it it says "operation failed because it is not on the remote site. -
David (php guru that you are
, this is directed to you as I have no
concept of this wee problem I have.
I signed up with a new unix host, so that I could set up a
link directory
script for testing purposes. According to the help doc, once
I typed in the
path to the install script, this "you bewt" script was
supposed to install
itself and away I'd go. I had the following from the host
after I asked why
I was getting an 'internal error' trying to run the scrip:
"the reason you are getting the internal server error is
because we do not
allow mod rewrites in the htaccess file. If you need to use
these we can
add them to your hosting container on the server. Please let
us know."
What does this mean exactly and would adding them for my use
cause problems
for my site or any other user on the server?
Nadia
Adobe� Community Expert : Dreamweaver
http://www.csstemplates.com.au
- CSS Templates | Free Templates
http://www.DreamweaverResources.com
- Dropdown Menu Templates|Tutorials
http://www.macromedia.com/devnet/dreamweaver/css.html
- CSS TutorialsThanks David,
I asked the new host (who were suprisingly quick to respond
to my initial
support ticket - considering the time differences) to add the
mod, which
they did within minutes of my request. Now however, I'm
getting a
"forbidden' error.
So off to email them again ;-)
PS: I even get a standard install of Wordpress with the host,
so will
definitely have to get to your book one day soon !
Nadia
Adobe� Community Expert : Dreamweaver
http://www.csstemplates.com.au
- CSS Templates | Free Templates
http://www.DreamweaverResources.com
- Dropdown Menu Templates|Tutorials
http://www.macromedia.com/devnet/dreamweaver/css.html
- CSS Tutorials
"David Powers" <[email protected]> wrote in message
news:[email protected]...
> .: Nadia :. *ACE* wrote:
>> David (php guru that you are
, this is directed to you as I have no
>> concept of this wee problem I have.
>
> That's very nice of you, Nadia, but mod_rewrite has
nothing to do with
> PHP; it's an Apache module.
>
>> "the reason you are getting the internal server
error is because we do
>> not allow mod rewrites in the htaccess file. If you
need to use these we
>> can add them to your hosting container on the
server. Please let us
>> know."
>>
>> What does this mean exactly and would adding them
for my use cause
>> problems for my site or any other user on the
server?
>
> It means you can't add a mod_rewrite command through
.htaccess, but the
> server administrator is willing to do it for you. If
it's set up
> correctly, it should have no impact on your current site
or anyone else's.
>
> Disclaimer: my knowledge of Apache is basically limited
to simple things,
> such as installing PHP, creating virtual hosts, and a
little maintenance.
> I leave things like mod_rewrite to the experts.
WordPress uses mod_rewrite
> to provide nice looking links to blog entries. I use it
on my site, but
> all the mod_rewrite stuff is handled by WordPress. I
haven't touched it
> myself.
>
> --
> David Powers
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "Foundation PHP 5 for Flash" (friends of ED)
>
http://foundationphp.com/ -
I've tried to figure this out with the posts (and some info
on David's site, etc), and I just can't seem to figure out the real
problem.
I'm working on a tutorial and I can't figure out if the error
message is correct and it's improper coding inserted by DW (and if
so, I can't figure out what to correct) or
If this is a problem with DW8.0.2 along the lines of what the
hotfix that seems to be so hard to get will fix, or
If this is along the lines of an example of why magic quotes
should be turned off, and if so, where/how do I turn them off, and
will that correct the code, and if not, how would it be properly
corrected?
Here is the error message:
Parse Error: parse error, unexpected '=', expecting ',' or
')' in <thefile> on line 34.
Here is the code it is referencing:
32 $Search_rsSearch = "abc";
33 if (isset(#txtSearch#)) {
34 $Search_rsSearch = (get_magic_quotes_gpc()) ? #txtSearch#
: addslashes(#txtSearch#);
35 }
36 mysql_select_db($database_dorknozzle, $dorknozzle);
37 $query_rsSearch = sprintf("SELECT * FROM EmployeeStore
WHERE ItemName LIKE CONCAT('%%', %s,
'%%')", GetSQLValueString($Search_rsSearch, "text"));
38 $rsSearch = mysql_query($query_rsSearch, $dorknozzle) or
die(mysql_error());
39 $row_rsSearch = mysql_fetch_assoc($rsSearch);
40 $totalRows_rsSearch = mysql_num_rows($rsSearch);
I'm using php4.4.4, mysql5.0.24, apache2.2.3
Thank You,
Jeff G.xViPERed wrote:
> If this is a problem with DW8.0.2 along the lines of
what the hotfix that
> seems to be so hard to get will fix,
That will fix part of your problem, but the error is caused
by something
else:
> Here is the error message:
>
Parse Error: parse error, unexpected '=', expecting ',' or
')' in
> <thefile> on line 34.
>
> Here is the code it is referencing:
> 32 $Search_rsSearch = "abc";
> 33 if (isset(#txtSearch#)) {
> 34 $Search_rsSearch = (get_magic_quotes_gpc()) ?
#txtSearch# :
> addslashes(#txtSearch#);
> 35 }
# is one of the PHP characters used to comment out part of a
script. I
suspect that you have got this from the Dreamweaver help
files, which
are particularly unhelpful on this point. The show the
runtime value
expression as #formFieldName#, which is ColdFusion style, not
PHP. You
need to replace #txtSearch# with something like
$_GET['search'] or
$_POST['search'].
What makes things worse is that the code inserted by 8.0.2
without the
hotfix is also incorrect. Line 34 should be something like
this:
$Search_rsSearch = $_GET['search'];
Line 37 is also wrong.
> 37 $query_rsSearch = sprintf("SELECT * FROM
EmployeeStore WHERE ItemName LIKE
> CONCAT('%%', %s,
> '%%')", GetSQLValueString($Search_rsSearch, "text"));
It should be this:
$query_rsSearch = sprintf("SELECT * FROM EmployeeStore WHERE
ItemName
LIKE %s", GetSQLValueString("%" . $Search_rsSearch . "%",
"text"));
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/ -
"Adobe Dreamweaver PHP Training from David Powers
“Adobe® Dreamweaver® CS5 with PHP Training from the Source David Powers
Lesson 7 Validating Input on the Server
I have reached page 445, and become completely stuck - I've been about three weeks trying to sort the problem but cant get anywhere. Not sure what to do from here so any advice would be really appreciated. The problem:
I have completed the script exactly as instructed, when I go live (local sever), I get a blank screen, OK, does not display. I am sure this is something simple but I have done all the fault finding and am out foxed. I know the local server works OK - I completed chapter 6 successfully - I can also run a php test page from the local folder that the file is stored in. i.e provictis/phpcs5. I have saved my ZendFraework in a separate location as advised. i.e. User/SPENNY/...
This is the basic code:
<?php
$library='/Users/SPENNY/ZendFramework/library';
set_include_path(get_include_path() . PATH_SEPARATOR .
$library);
require_once('Zend/Loader/Autoloader.php');
$loader=Zend_Loader_Autoloader::getInstance();
if ($loader) {
echo 'ok';
} else {
echo 'Huston we have a blinkin problem, but do not panic we will get things sorted';
GarethFIXED!!
1)
i finally did get the message problem was with:
$mailhost='ssl://mail.domain.com';
ssl:// was just nonsense and been removed
2)
'auth' => 'true' was changed to 'auth' => 'login'
3)
for bluehost i got information that it was tls secure connection protocol not ssl
'ssl' => 'tls'
4)
port used '25' not 465.
Didnt still tried 26 and 465 maybe they would work too. -
Using PHP to identify the current page - by David Powers
Hi There,
I'm trying to write a script so I can identify the sub-pages under "Gallery" in my website
Under Gallery I have more than hundred pages describing the photos but I want to identify them as the "Gallery" page.
How do I achieve that?
It would be tedious to write the "PHP if" statement for each photo link.
I trust there is a simpler solution.
In PHP solutions by David Powers, Ch.4 "Using PHP to identify the current page"
The script is:
<?php $currentPage = basename($_SERVER['SCRIPT_NAME']); ?>
<ul id="nav">
<li><a href="index.php" <?php if ($currentPage == 'index02.php') {echo 'id="here"';} ?>>Home</a></li>
<li><a href="journal.php" <?php if ($currentPage == 'journal.php') {echo 'id="here"';} ?>>Journal</a></li>
<li><a href="gallery.php" <?php if ($currentPage == 'gallery.php') {echo 'id="here"';} ?>>Gallery</a></li>
<li><a href="contact.php" <?php if ($currentPage == 'contact.php') {echo 'id="here"';} ?>>Contact</a></li>
</ul>
Let's say that the gallery pages contains hundreds of links gallery like gallery/photos1.php, gallery/photos2.php, gallery/photos3.php, gallery/photos4.php, gallery/photos5.php, gallery/photos6.php, gallery/photos7.php etc...
How would I identify the sub-pages so when we are there Gallery is highlighted?
Thank you!
Best,Hello Siddhardha,
To get the details of a process you need to use Locator class from BPEL api. You can locate your process by listInstances method which accepts WhereCondition parameter used to build a query on process instances. Once you've found the process you were looking for you can use getAuditTrail method to retrieve audit trail of a given instance. You can also use setStatus() method from a BPELX java exec tag within your process and later retrieve it from instance handle by getStatus method.
A sample snippet to retrieve instance handles to all child processes of a given process:
StringBuffer sb = new StringBuffer();
Locator locator = new Locator(domain,domainpassword);
WhereCondition wc = new WhereCondition();
String query = sb.append(SQLDefs.AL_ci_root_id).append(" = ? ").toString();
wc.append(query);
wc.setLong(1,parentInstance);
IInstanceHandle[] ih = locator.listInstances(wc);
You can read more about querying processes on http://blogs.oracle.com/matt/2006/06/27?print-friendly=true
Radoslaw -
Need help adapting David Powers PHP email form script please!
Hi all,
I'm fairly inexperienced with PHP and I'm trying to adapt the David Powers email form script from THE ESSENTIAL GUIDE TO DREAMWEAVER CS4 WITH CSS, AJAX, AND PHP.
I've created a basic form so that visitors to the site can request a telephone call back from the site owner. The form asks the visitor for their name, telephone number and to select a time of day suitable for the telephone call to be made using radio buttons selecting between morning and afternoon.
I'd like to achieve my goal with minimal validation error messages and would like to redirect to another page when a message is sent successfully. It is also important that in the spirit of the David Powers script I'm trying to work with, that it filters out suspect input, avoids email header injection attacks and blocks submission by spam bots.
There may be a really simple solution to this since I don't want users to be able to enter an email address at all but I don't know enough to be able to figure it out just yet.
I'd be grateful for any advice.
See below for the code for the form including PHP so far...
Thanks to everyone looking in in advance
Karl.GEAtkins wrote:
> I am using the redirect to a personal page from page 515
of The Essential
> Guide to DWCS3 in the following form:
$_SESSION[MM_Username].php in the "if
> login succeeds" field.
Thank you for reminding me. There's a mistake in the book,
which I
discovered over the Christmas period, so forgot to send to
friends of ED
for the errata page.
Don't use $_SESSION[MM_Username]. Use $loginUsername instead.
It then works.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
I have adapted a php contact form of David Powers tut
Hi I have slowly changed according to my research etc. I am
worried that since changing things that I have left some important
error checking.
Well here is the error checking and the form:
<h2><span class="black">contact us :
</span></h2>
<span class="errmsg1">
<?php
if ($error) {
echo 'Please complete the missing item(s) indicated.';
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep',
$value) : stripslashes($value);
return $value;
$_POST = array_map('stripslashes_deep', $_POST);
?>
</span>
<form name="option" id="option" method="post"
action="<?php $_SERVER['PHP_SELF']; ?>">
<label> </label>
<table width="70%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>Your Name</td>
<td><input name="name" type="text" class="search"
id="name" value="<?php if (isset($_POST['name'])) {
echo htmlentities($_POST['name']);} ?>" size="30"
maxlength="50" /></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['name'])) { ?>
<span class="errmsg1"><?php echo $error['name'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td><span class="subheader">Your Email
Address</span></td>
<td><span class="subheader">
<input name="email" type="text" id="email"
value="<?php if (isset($_POST['email'])) {
echo htmlentities($_POST['email']);} ?>" size="30"
maxlength="80" />
</span></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['email'])) { ?>
<span class="errmsg1"><?php echo $error['email'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td>Reason For Enquiry </td>
<td><label>
<select name="option">
<option value="">Please Select Option</option>
<option value="complaint"<?php
if (isset($error) && $_POST['option'] ==
'complaint') { ?>
selected="selected"
<?php } ?>>Complaints</option>
<option value="listbusiness"<?php
if (isset($error) && $_POST['option'] ==
'listbusiness') { ?>
selected="selected"
<?php } ?>>List My Business </option>
<option value="removelisting"<?php
if (isset($error) && $_POST['option'] ==
'removelisting') { ?>
selected="selected"
<?php } ?>>Remove My Listing</option>
<option value="upgradelisting"<?php
if (isset($error) && $_POST['option'] ==
'upgradelisting') { ?>
selected="selected"
<?php } ?>>Upgrade Listing</option>
<option value="banner"<?php
if (isset($error) && $_POST['option'] == 'banner') {
?>
selected="selected"
<?php } ?>>Banner Advertising</option>
<option value="agentenquiry"<?php
if (isset($error) && $_POST['option'] ==
'agentenquiry') { ?>
selected="selected"
<?php } ?>>Become An Agent</option>
<option value="other"<?php
if (isset($error) && $_POST['option'] == 'other') {
?>
selected="selected"
<?php } ?>>Other</option>
</select>
</label></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['option'])) { ?>
<span class="errmsg1"><?php echo $error['option'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td>Message</td>
<td><label>
<textarea name="message" cols="30" rows="3"
id="message"><?php if(isset($error)) {echo $messageBody;}
?>
</textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td><?php if (isset($error['message'])) { ?>
<span class="errmsg1"><?php echo $error['message'];
?></span>
<?php } ?> </td>
</tr>
<tr>
<td> </td>
<td><label>
<input name="send" type="submit" class="searchbutton"
id="send" value="Enquiry" />
</label></td>
</tr>
</table>
<label> </label>
<p><span class="subheader">
<label> </label>
</span></p>
</form>jjjhbj111 wrote:
> Hi I have slowly changed according to my research etc. I
am worried that since
> changing things that I have left some important error
checking.
I haven't gone through your script with a fine-tooth comb,
but your
email check uses a POSIX regular expression, which won't work
with
preg_match(). You could use eregi() instead, but there are
plans to
remove the ereg_ functions from PHP 6, so you would be better
advised to
stick with Perl-compatible regular expressions (PCRE).
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Dw CS & PHP - calling David Powers
David,
Does Dw CS treat php any differently - i.e does all / most of
the
information in your book still apply ?
thanks
Malcolm
~Malcolm N....
~<DUCK!>
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"David Powers" <[email protected]> wrote in message
news:f0lh51$ro$[email protected]..
> Steve Fleischer wrote:
>> That was a cover - he was really a secret agent,
code name OOP. They
>> based some films on his adventures...
>
> My cover blown at last! I did a degree in Russian, and
my first job was
> with the COI (Central Office of Information - UK
government publicity).
> Most of my friends thought it was a cover for the CIA!
Actually, it was,
> but now that I've told you... ;-)
>
> --
> David Powers, Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "PHP Solutions" (friends of ED)
>
http://foundationphp.com/ -
The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and PHP by David Powers
The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and
PHP by David Powers:
Would this book help me learn about Spry and Ajax and how
applications can be made with them, if I my e-commerce site runs on
a compiled C code shopping cart (ShopSite) but supports PHP
server-side scripts or is it only for shopping carts based on PHP
itself (like X-Cart)?
I am not sure. Someone please let me know so I can purchase
this book. Thanks.ahsenabro wrote:
> 1. Do I have to be a developer/programmer in order to
learn from this book or
> can a tech-savvy entrepreneur can also get some gems out
of it and direct his
> programmer?
You don't need any prior knowledge of Ajax or PHP, but you do
need to
know the basics of HTML and CSS. As I say in the
introduction, "You
don't need to be an expert, but you do need to have an
inquiring mind.
It doesn't teach the basics of web design, nor does it
attempt to list
every single feature in Dreamweaver CS3. There are plenty of
other books
to fill that gap. However, by working through this book,
you'll gain an
in-depth knowledge of the most important features of
Dreamweaver."
> 2. I am interested in purchasing this book mainly to
implement cool Ajax/Spry
> stuff on my e-commerce site. I am asking about PHP
because the book's content
> mentions making a PHP site. Now I realize this book is
not about shopping
> carts, but the Ajax/Spry stuff can be implemented on
e-commerce sites, right?
The book provides detailed coverage of the Spry 1.4 features
in
Dreamweaver CS3, which can be applied to any site. With minor
adaptation, you can also use Spry 1.6. It's important to
realize,
though, that the Spry/Ajax features in Dreamweaver CS3 do
*not* cover
asynchronous requests to the server. The ability to
communicate
asynchronously with the server was added in Spry 1.6. If it's
asynchronous server calls and responses that you're after,
your
programmer will need to dig around in the Spry 1.6
documentation on the
Adobe Labs site, and hand-code it.
The Spry features covered in the book are Spry Effects, Spry
UI widgets
(menu, accordion, tabbed panels, and collapsible panels),
Spry
Validation Widgets, and Spry XML Data Sets.
> I just want to know if I can learn and implement
Ajax/Spry apps on my
> simple HTML/CSS-based pages, on a server which allows
server-side PHP scripts
> but the pages themselves are not with .php extension. Is
this book still going
> to be applicable?
Yes. All the Spry techniques can be used on any web page. It
doesn't
need to be a PHP one.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
David,
Hope you having a good break from here - as you've not been
around for
a few days.
When you are back - I need a little help please
~Malcolm N....
~> Come to think about it - Murray seemed to make the move
to using php
> only a few months ago - and given his enthusiasm for
SSI's maybe this
> tells something about the next release - or maybe I'm
reading too much
> between the lines (:-))
You're looking for deep inner meaning in a shallow bowl, I'm
afraid! 8)
Templates are part of DW and will be for a long time. And
personally, I
have no problem with includes in DW templates.....
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Malcolm N_" <[email protected]> wrote in message
news:[email protected]...
> On Sat, 27 Jan 2007 19:38:04 +0000, David Powers
<[email protected]>
> wrote:
>>
>>I'll wait for the summary. The basic thing to
remember about include()
>>is that it expects a relative path, an absolute path,
or for the file to
>>be in the PHP include path.
>
> Thanks David - at the moment things are under control,
but I haven't
> altered much of the site with DW.
>
>> Things get complicated if you use includes
>>with Dreamweaver templates.
>
> Yes - well DW has been good at controlling some tricky
things to date,
> I hope that the next release makes using includes within
simple
> Template's a little easier.
>
> After all the Adobe Community Experts have been pushing
the use of
> SSI's very strongly in the last couple of years, telling
us to abandon
> tables, and complex templates (:-))
>
> Come to think about it - Murray seemed to make the move
to using php
> only a few months ago - and given his enthusiasm for
SSI's maybe this
> tells something about the next release - or maybe I'm
reading too much
> between the lines (:-))
>
> --
>
> ~Malcolm N....
> ~ -
I created this page using Dreamweaver, and following a php tutorial (thanks, David Powers). I'm not at all experienced with writing php and have run into problems trying to incorporate a recaptcha spam check. I've used the check successfully with forms which call a separate script, but need to incorporate the code on the actual page in this case and can't get it to work.
Can anyone help?
Here's the page: http://www.ukcountryradio.com/vote_artist2.php
And here's the php - I've included all of it so there's quite a lot... The page works correctly apart from the recaptcha check.
Thanks,
SW
<?php require_once('Connections/ukcr.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
mysql_select_db($database_ukcr, $ukcr);
$today = date('l');
$query_schedules = "SELECT `day`, `time`, short_title, presenter FROM schedules WHERE day='{$today}' AND time > '0700' ORDER BY time, short_title ASC";
$schedules = mysql_query($query_schedules, $ukcr) or die(mysql_error());
$row_schedules = mysql_fetch_assoc($schedules);
$totalRows_schedules = mysql_num_rows($schedules);
$errorurl = "http://www.ukcountryradio.com/error.php" ;
$my_recaptcha_private_key = '6LdAFb0SAAAAAP5qTVqEAfoycaImqp7-koT8tWlK' ;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if (strlen( $my_recaptcha_private_key )) {
require_once( 'recaptchalib.php' );
$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "vote_artist")) {
$insertSQL = sprintf("INSERT INTO vote_artist (`name`, `email`, artist, REMOTE_ADDR) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['artist'], "text"),
GetSQLValueString($_SERVER['REMOTE_ADDR'], "text"));
mysql_select_db($database_ukcr, $ukcr);
$Result1 = mysql_query($insertSQL, $ukcr) or die(mysql_error());
$insertGoTo = "vote_thanks_artist.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
?>Try the below. I've moved the if/else statment further up the php script:
<?php require_once('Connections/ukcr.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
if (!empty($_POST['address2'])) {
exit;
else {
mysql_select_db($database_ukcr, $ukcr);
$today = date('l');
$query_schedules = "SELECT `day`, `time`, short_title, presenter FROM schedules WHERE day='{$today}' AND time > '0700' ORDER BY time, short_title ASC";
$schedules = mysql_query($query_schedules, $ukcr) or die(mysql_error());
$row_schedules = mysql_fetch_assoc($schedules);
$totalRows_schedules = mysql_num_rows($schedules);
$errorurl = "http://www.ukcountryradio.com/error.php" ;
$my_recaptcha_private_key = '6LdAFb0SAAAAAP5qTVqEAfoycaImqp7-koT8tWlK' ;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if (strlen( $my_recaptcha_private_key )) {
require_once( 'recaptchalib.php' );
$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "vote_artist")) {
$insertSQL = sprintf("INSERT INTO vote_artist (`name`, `email`, artist, REMOTE_ADDR) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['artist'], "text"),
GetSQLValueString($_SERVER['REMOTE_ADDR'], "text"));
mysql_select_db($database_ukcr, $ukcr);
$Result1 = mysql_query($insertSQL, $ukcr) or die(mysql_error());
$insertGoTo = "vote_thanks_artist.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
?> -
David Powers, please help...
Hi David,
I have posted a similar message on the general DW forum but I
think this
might be the more appropriate place; besides which I'm not
getting much
traction there.
I'm creating a detail page to display records which contain
anywhere
from 1-12 images per record. I'm trying to make a small image
gallery
similar to what you have in your PHP DW8 book pg. 414, though
it will
only show the images for the current record. The problem is
all the
images are different sizes and orientations, so I need a way
to pass the
image width to the javascript function so it will display the
image in a
size that fits my container. I have been scratching my head
on this one
for a while and I'm hoping you can point me in the right
direction.
Here is what I have so far:
My scaling routine:
> $image2 = $maindir . $row_gallery_show['image2'];
> $image2Size = getimagesize($image2);
> if ($image2Size[0] > $image2Size[1]) {
> $ratio_1 = $maxsize/$image2Size[0]; $newWidth =
> round(($image2Size[0]*$ratio_1),0);}
> else {
> $ratio_1 = $maxsize/$image2Size[1]; $newWidth =
> round(($image2Size[0]*$ratio_1),0);}
>
>
> $image3 = $maindir . $row_gallery_show['image3'];
> $image3Size = getimagesize($image3);
> if ($image3Size[0] > $image3Size[1]) {
> $ratio_1 = $maxsize/$image3Size[0]; $newWidth =
> round(($image3Size[0]*$ratio_1),0);}
> else {
> $ratio_1 = $maxsize/$image3Size[1]; $newWidth =
> round(($image3Size[0]*$ratio_1),0);}
I have this for each of the images.
My markup:
> <li class="thumbs"><a href="<?php echo
$image2;
> ?>"onclick="showImage(this);return false;">
> <img src="<?php $pic2 = $thumbdir .
> $row_gallery_show['image2'];?>
> <?php $pos2 = strrpos($pic2, '.');
> $thumb2 = substr($pic2, 0, $pos2) . '_thb' .
> substr($pic2, $pos2);
> echo $thumb2; ?> " /></a>
> </li>
> <li class="thumbs"><a href="<?php echo
$image3;
> ?>"onclick="showImage(this);return false;">
> <img src="<?php $pic3 = $thumbdir .
> $row_gallery_show['image3'];?>
> <?php $pos3 = strrpos($pic3, '.');
> $thumb3 = substr($pic3, 0, $pos3) . '_thb' .
> substr($pic3, $pos3);
> echo $thumb3; ?> " /></a>
> </li>
also for each image.
And the javascript file:
> // JavaScript Document
> function showImage(elem) {
> if(!document.getElementById) {
> return false;
> } else {
> var bigPic = elem.getAttribute('href');
>
>
document.getElementById('mainpic').firstChild.setAttribute('src',bigPic);
> <?php echo "var newWidth = $newWidth"; ?>
>
>
document.getElementById('mainpic').firstChild.setAttribute('width',
> newWidth);
>
> }
> }
I have tried setting the width through $newWidth, but so far
it's not
working - instead of replacing the 'mainpic' it is opening
the selected
image in a new window, full size. What am I doing wrong here?
How can
I get this to work, or is there a better approach?
TIA
BrettBrett wrote:
> I have tried setting the width through $newWidth, but so
far it's not
> working
Of course it won't. PHP is a server-side language; the
JavaScript
function is client-side. You can't get PHP to change the
value of the
width, because the PHP script finishes working as soon as the
page is
sent to the browser.
I haven't checked through your width calculations, but what
you need to
do is to use PHP to echo the value of the width for each
image in the
call to showImage():
<a href="<?php echo $image2; ?>"
onclick="showImage(this, <?php echo
$newWidth; ?>);return false;">
Then change the showImage() function to apply the new width:
function showImage(elem, w) {
if(!document.getElementById) {
return false;
} else {
var bigPic = elem.getAttribute('href');
document.getElementById('mainpic').firstChild.setAttribute('src',bigPic);
document.getElementById('mainpic').firstChild.setAttribute('width',
w);
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions"
http://foundationphp.com/ -
Stuck in Tutorial 2 of David Powers tutorials "Build dynamic sites and web applications".
PLEASE NOTE - THIS IS ANEW SESSION! Apologies to those that have contributed already but I have been unable to reply unless by email on the original session!
========================================================================================== ==============================
I am very new to Dreamweaver and indeed to mySql. So, I am going through the the 3 David Powers Tutorials that are available for PHP & MySQL. I have successfully negotiated the 1st tutorial and am on the 2nd one and have got to a place where I am stalled!I am working on the file "manage_posts.php" and have got successfully "Building a simple recordset" - successfully built the Recordset via that dialog box which tests perfectly showing the contents of the news Table in MySQL. I can bind the recordset results in the page and save the file "manage_posts.php" but when I click Live View the live view fails and I get a 404 error - in other words manage_posts.php does not show the last entry of the news table! I have tried everything that I can think of including deleting manage_posts.php and starting over, but still no good!
Can anyone advise me on this please as to waht may be wrong and how perhaps to analyse what the error may be? I would appreciate any help as it is very frustrating not to be able to progress further.PLEASE NOTE - THIS IS ANEW SESSION! Apologies to those that have contributed already but I have been unable to reply unless by email on the original session!
========================================================================================== ==============================
I am very new to Dreamweaver and indeed to mySql. So, I am going through the the 3 David Powers Tutorials that are available for PHP & MySQL. I have successfully negotiated the 1st tutorial and am on the 2nd one and have got to a place where I am stalled!I am working on the file "manage_posts.php" and have got successfully "Building a simple recordset" - successfully built the Recordset via that dialog box which tests perfectly showing the contents of the news Table in MySQL. I can bind the recordset results in the page and save the file "manage_posts.php" but when I click Live View the live view fails and I get a 404 error - in other words manage_posts.php does not show the last entry of the news table! I have tried everything that I can think of including deleting manage_posts.php and starting over, but still no good!
Can anyone advise me on this please as to waht may be wrong and how perhaps to analyse what the error may be? I would appreciate any help as it is very frustrating not to be able to progress further.
Maybe you are looking for
-
Hey everyone, my wife's iBook has had the lost display for two weeks now. My wife described the screen as looking like it shorted out and has been black ever since. We were stressed out because my iBook's harddrive is full, and we were moving all of
-
Adding Property MetaData to Upload screen
Hi, I would like to add some Property Metadata for documents that I upload to the KM. I have managed to created a new tab with all my properties, but I would like to have some of these properties on the first screen of the upload process, meening, ne
-
RAW Plug-in Not Applicable???
Here's the scoop: I have been using CS4 with the RAW plug-in for a couple of years now. My computer crashed last week and while I saved all of my files and was able to migrate everything to an external hard drive, once I reformatted my disk and migra
-
History accelerator key behavior
Version 1.5.1 After posting the latest update the behavior of the ctrl-up arrow and down arrow has changed from replace to append in the sql worksheet. Can this be changed back to replace? Thanks Bob
-
For How long will the posting threads last
Hello Every One, I 'd like to know, if i am collection all the necessary links which has the corresponding thread ids mentioned along with them. What would be the duration of their lasting. please give complete details on this. Regards, karthik