chrishea 182 Nearly a Posting Virtuoso

There are a number of libraries that allow you to build a PDF file. What I wanted to do was to (dynamically) convert an existing (html) output into a PDF without having to do a bunch of additional work.

I found a way to do that using something called html2pdf. It isn't overly well documented and it isn't totally flexible but it works. I had to adjust my html a bit to get it to work but it now produces a pretty faithful PDF copy of my output report.

I think that providing a PDF option is often an add-on to producing a report on the screen. Using a utility like this to do the conversion makes a lot of sense to me.

chrishea 182 Nearly a Posting Virtuoso

I have done both of the things you want to do.

Screen Scraping
I have been using a screen-scraping class quite successfully for some time. It runs nightly, logs onto a website, navigates to a specific page and then extracts data from a table.
Get the class here

Text Messages
All of the cell phone companies allow you to send an email to a specific address for the phone and they turn it into a text message. The format is [email]tel_num@provider_address.com[/email]
Some of the US provider addresses can be found Here. There are lots of sources, (including your own cell phone provider) where you can get this info.

Chris

chrishea 182 Nearly a Posting Virtuoso

If you need a shopping cart because you want to sell something online, there are all kinds of open source (free) shopping carts that you can download and use. If you use PayPal you can even use their shopping cart. If you are doing it as a learning exercise, then you are probably still better off to download one and then rip it apart to figure how it works (and make it better if you have the time and interest. There are lots of sources. You could start with hotscripts.com.

chrishea 182 Nearly a Posting Virtuoso

It might depend on the level of PHP and/or how you have PHPMaker configured. It seems that you would have a better chance of a resolution by using the PHPMaker forum and /or support.

chrishea 182 Nearly a Posting Virtuoso

Assuming that you have a login module, it should be setting a Session variable for the user to indicate that he/she is properly logged in. You need to check this variable anywhere that you have functions that require a login. You may, in fact want to make this more than an on/off switch. You may want to have users with different levels of authority. You might have a moderator who has more authority than a normal user but not as much as the system administrator.

chrishea 182 Nearly a Posting Virtuoso

If Google Checkout works like PayPal and if the name of the module is any indication, then pay_success.php is the module you need to be looking at. This presumably receives the payment confirmation from Google and their specs for the facility should tell you what this module needs to do.

Chris

chrishea 182 Nearly a Posting Virtuoso

Here is a screenshot

chrishea 182 Nearly a Posting Virtuoso

Changing imagecopyresized (line 14) to imagecopyresampled (leave the parameters the same) in the resize_image function should give you somewhat better quality.

Chris

chrishea 182 Nearly a Posting Virtuoso

I had a look at the image generated by your program and I didn't see a problem with the quality. I also tried a version of your code and the image it produced also seemed fine. Other than using my own image, the only other significant change was to use arial.ttf If you have a problem, it would seem to be the rendering not the PHP code. My GD extension is php_gd2.dll version 5.2.0 dated 02/11/2006.

Chris

chrishea 182 Nearly a Posting Virtuoso

I used to use a text editor but I've been using NetBeans for a few weeks now and I'm quite happy with it. I used to use a number of separate tools that are now in one place with Netbeans.

Chris

chrishea 182 Nearly a Posting Virtuoso

There is a site named myweb.com but I presume that you mean your own domain. If you have a site on a virtual server (which most of them are) to set up a new sub-domain, you would normally have to go to the Control Panel provided by your web host and that will provide you with this function (assuming that you are allowed to create sub-domains under your plan. If you need help on this, you should be able to get it from your web host's support.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

The strtotime function is useful for this sort of thing. Here is a little routine that calculates the 2nd and 4th Saturdays in May (as an example):

<?PHP


	$wk = strtotime ("first saturday may 2009");
	
	if ($wk == false) {
		echo "<br>Not able to interpret the string ";
		exit;
	}
	
	$sat2	= $wk + (3600*24*7);				// add seven days  (in seconds)

	$sat4	= $sat2 + (3600*24*14);				// add 14 days

	$wk2 = date ("Y-m-d",$sat4);
	
	echo $wk2;

?>
chrishea 182 Nearly a Posting Virtuoso

if you change line 84 to

if (($rowcount % $picsperrow) == 0) {

it eliminates the error and hopefully gives you what you wanted.

Borderline commented: Many thanks +1
chrishea 182 Nearly a Posting Virtuoso

Not sure how you made it work even with a JPEG. I found a number of errors:
1. In one case you have used imagejpg instead of imagejpeg
2. You have a statement:

$src = $po($finalfilename);

which makes no sense to me. It seems that the source file should be referenced as $final_file:

$src = $po($final_file);

I had the original image in the same directory as the php module with the resulting file in a sub-directory called "share". That was how I interpreted what you did.

With those changes, it worked for me for a jpeg.

To make it work with a .gif, you need to get rid of the hard-coding for jpeg. I added a staement:

$c_create = "image".$ext_new;

and then I used $c_create in place of your imagejpeg as in:

$c_create($orgimage,$filename,100);

Having done all that, it worked for both jpeg and gif (and should work with anything else that PHP supports).

chrishea 182 Nearly a Posting Virtuoso

If you are still using AVG anti-virus Version 7 and you're about to install the latest version in response to the threats about end of support for Version 7, be aware that there are a couple of problems:

  • In Vista, the install can have a problem if User Account Control is turned on (as it normally is). I turned it off and the install worked the secoind time around.
  • If you let it install the Linkscanner feature, it uses Port 80 and that prevents Apache from starting if you use EasyPHP (and probably the same if you use WAMP). You can run the AVG install again and that allows you to de-install Linkscanner and then EasyPHP works again.

I just wasted some time on this so I thought that I'd share the info.

nav33n commented: Thanks for sharing the info :) +10
chrishea 182 Nearly a Posting Virtuoso

I haven't used Google Docs before but I signed in and it took me all of 5 minutes to create a test spreadsheet and to set the sharing option so anyone can view it. This has to be the simplest way to get a spreadsheet online in no time. Here is my very simple test spreadsheet:
Google test spreadsheet

You could add a link to your web site so anyone can link to the spreadsheet. You can set the sharing and editing options and provide a list of invitees who are allowed to read or edit it (any email address, doesn't have to be a google email address). If you want to let a bunch of people see it without editing, then you can provide universal access like I did. I believe there is an API that you can use from PHP if you want to get fancy and spend some more time at it. You can customize it and probably eliminate the need to invite them by email. You can also make it so that anyone who is sent the link automatically gets access (Read or Edit) priviledges. You could put this link on your website and limit access to that page to whoever you choose. You can also use that link on a restricted page of your site to encapsulate the Google spreadsheet page so it gets displayed like it is part of your site. The CMS that I use provides a "wrapper" function so …

chrishea 182 Nearly a Posting Virtuoso

Try this instead:

print ('<table style="border-width: thin; border-style: solid; cellpadding=1; border-width: 10px;">');

Don't know why you'd want a 1400 pixel border. I changed it to 10 pixels but you can modify it to whatever you really need.

chrishea 182 Nearly a Posting Virtuoso

You can find a discussion on this same topic at
http://bugs.php.net/bug.php?id=18000&edit=3

Within that discussion, one contributor suggested to pass the SID as part of the call and then you'll be able to re-connect to the original session. No confirmation that it worked but it sounds logical.

chrishea 182 Nearly a Posting Virtuoso

Apparently, when you use a full URL, the page is parsed outside of your environment so it doesn't know anything about your session. I don't really understand why you feel obligated to use full url's but if it can be architected so they aren't necessary, it will probably be simpler. If you have to keep them, maybe using cookies to store your login status rather than a session variable might be the right way to go.

chrishea 182 Nearly a Posting Virtuoso

You can have a look at this online service. They charge an annual fee:
http://www.toufee.com

chrishea 182 Nearly a Posting Virtuoso

I have used POMMO as a mailing list manager and it's pretty easy:
http://pommo.org/Main_Page

chrishea 182 Nearly a Posting Virtuoso

You may want to password protect the directory and then provide your own facility (for authenticated users) to access these files rather than let them access them directly through the file system. I think that it complicates it if you try use your own controls and system controls for user access. There are many free scripts that list directrories and allow files to be opened.

Chris

chrishea 182 Nearly a Posting Virtuoso

If you use the full path for the images in the subdomain instead of a relative (local) address, it should work ok.

chrishea 182 Nearly a Posting Virtuoso

You need a content management system and yes many/most of these are written in PHP. I use one called Website Baker because I find it is the easiest to understand and use, for me, and for those who maintain the websites that I build for them. If you want to check out what's out there, you can also look at Joomla, Drupal, Mambo and Workpress and a whole bunch of others that are less well known.
Chris

chrishea 182 Nearly a Posting Virtuoso

Responding to the thread got my interest up so I ended up spending a lot more time looking at IDEs. After doing some more searching and downloading I still found that Aptana Studio and Netbeans were the most full-featured free options. After some experimentation, I settled on Netbeans and I have started to use it.

I think the deciding factor for Netbeans over Aptana Studio was that it just seemed more obvious how to do things with it (although it still takes a little bit of time to learn). I got an immediate payback that it picked up a few cases where I had:
IF (a = b) { instead of IF (a == b) {

This error wasn't picked up as an error in PHP (but obviously it wouldn't work properly).

Netbeans has it's own internal versioning control that seems to work just fine so I didn't need to install any of the 3 other options that it supports (CVS, Mercurial or SubVersion). I was using CSRCS but I decided that I could use Netbeans' internal version instead. It allows you to define funtion keys for its existing functions but it doesn't seem to have a freeform function key option. I was using that option in the Context editor to integrate some external programs such as CSRCS and the PHP Help file. Since netbeans pops up format information, I have less need for the Help file but I would still prefer to have a function …

chrishea 182 Nearly a Posting Virtuoso

If you want to send the variables back to the first page then you can store them as session variables in the second module or you can include them in a form on the second page as hidden variables.
In the first module, every form variable would need a name and a value as:

"<input type="text" class="textInput" id="email" name="email" value=\"$email\"  /></td>

Thus the code at line 5 in the second module:

if(md5($number) != $_SESSION['image_value'])
{     
$_SESSION['formsubmit'] = "false";	
header("Location: contact.php");
}

would become:

if(md5($number) != $_SESSION['image_value'])
{   
$_SESSION['form_email'] = $email;
...
$_SESSION['formsubmit'] = "false";	
header("Location: contact.php");
}

If you take this approach, then you need to set all the form values in the first module (from the session variables) before you start the form.

-OR-
For the hidden variable approach:

if(md5($number) != $_SESSION['image_value'])
{   
echo "<br>You have an error in your input, click the button to return to the form to correct your input";  

echo "
<form action=contact.php method=post>
<input type=hidden name=email value=$email>
...
<input type=submit name=Correct>
</form>
";
...

Chris

chrishea 182 Nearly a Posting Virtuoso

I believe that the $_post should be $_POST

chrishea 182 Nearly a Posting Virtuoso

PHP doesn't seem to like <?PHP without a space after it. This was one of the problems in your original version. If you try nav33n's version and make sure that the second line doesn't get pushed up against the <?PHP without a space, then that version should be clean.

Chris

chrishea 182 Nearly a Posting Virtuoso

I downloaded Aptana and did a quick tour. Also seems pretty capable. A fairly detailed comparison of some popular IDEs, including Netbeans and Aptana can be found here:
http://spreadsheets.google.com/ccc?key=pV8XyUSUOM7ET07rn4n7NYA

As you will see, Aptana and Netbeans both have most of the features but Netbeans comes out ahead on some. Either one can do the job, it becomes a matter of spending the time to learn how to use the tool effectively.

Chris

darkagn commented: Good link providing a useful comparison IDE spreadsheet +3
chrishea 182 Nearly a Posting Virtuoso

If you do a search, you'll easily find info on this. One link that may be useful is:
http://www.faqts.com/knowledge_base/view.phtml/aid/9844/fid/51

chrishea 182 Nearly a Posting Virtuoso

You might want to look at netbeans http://www.netbeans.org/. This isn't just for Java, it supports a bunch of languages, including PHP and Html/xml, it has lots of features and its free. I haven't taken the time to figure it out yet (I'm still comfortable with my simple tools) but when I have some time, I will. It does seem to have templates and an FTP capability.

Chris

chrishea 182 Nearly a Posting Virtuoso

Why you want to do it is unclear but a little bit of research will probably provide you with the answer. There are previous posts on this topic such as:
http://www.daniweb.com/forums/thread162002.html

chrishea 182 Nearly a Posting Virtuoso

If they need to connect to your PC to do it, then they need a remote access utility that will let them log on to your PC and run the job. If it is really just intended to get something run on the server, give them a copy of the exec. It isn't clear where you think PHP fits in.

chrishea 182 Nearly a Posting Virtuoso

You need to use some Ajax. If you search the Ajax forum you will probably find the answer. You can also look at:
http://www.w3schools.com/ajax/default.asp

chrishea 182 Nearly a Posting Virtuoso

If you search the forum first you can often find previous posts with similar problems. Try this one as an example:
http://www.daniweb.com/forums/thread101948.html

chrishea 182 Nearly a Posting Virtuoso

You don't need to create your own scheduler as the ones that are available for free are quite adequate.

In terms of how to create an automation program, the same program can be run manually so forget about automation per se and just think in terms of a program that can run without screen input. It needs to work with info that it can get from a website, from parameters, a database or a file. If you want to change content on your web site, then the way in which the site is designed will make a big difference. If you have html or php with embedded text (assuming that the text is what you will want to change), then you will probably want to change the code to read in the text from a file or a database. The automation program would change the text in the file or database. If you wanted to change your background color/image on your site based on the day of the week (as a simple example), then the background color/image url would have to be a parameter in a file or the database that the automation program could change. I don't think that you would want to get into parsing html or php code to change text or parameters. That could be done for a simple php module with parameters but there are probably better ways.

Chris

chrishea 182 Nearly a Posting Virtuoso

In terms of basic tools, ISP's usually have CRON where you can schedule jobs. There is also a scheduler that you can implement yourself (phpjobscheduler) at
http://www.phpjobscheduler.co.uk/

They also have a database backup utility at:
http://www.dwalker.co.uk/phpmysqlautobackup/

For other automation tasks that can be scheduled using one of these tools, you will have to search for a utility that does what you need or build your own. I was just working on that very topic myself today. I built my own tools to screen-scrape info from another site (and update a db) and to send out reminders by email. These were very specific to my needs so they had to be custom designed and built. If you have a utility that you run manually now (that can work from parms - not from form input) then it's pretty easy to set it up to run automatically. If you don't have the utility, then you may need to do some development.

Chris

chrishea 182 Nearly a Posting Virtuoso

Try hotscripts.com as well.

chrishea 182 Nearly a Posting Virtuoso

If what you want is the end result: a working application, then you probably don't want to build it yourself unless you have lots of time, your really want to learn PHP and you're not in any rush to actually have it working and available. One of the advantages of PHP is that there are lots of Open Source applications that you can install and use. Have a look on http://hotscripts.com as a starting point.

Chris

chrishea 182 Nearly a Posting Virtuoso

You have to be more explicit. "It still doesn't work" doesn't help much. I ran a modified version of your code as follows and it worked correctly:

<?php
//opens connection to mysql server
$dbc=mysql_connect('localhost','root','');
if(!$dbc)
	{
	die('Not connected: ' . mysql_error());
	}

//select database
$db_selected = mysql_select_db("test",$dbc);
if(!$db_selected)
	{
		die("Cant connect: " . mysql_error());
	}

//test
$query="UPDATE test_table SET field1='hopethisworks' WHERE id='00001'";
$result=mysql_query($query);
?>

You may have a problem with your DB or the names / parms you are using for it.

Chris

chrishea 182 Nearly a Posting Virtuoso

It can be frustrating when you're first learning a language and trying to make something work. I think that this forum is intended to provide help and advice but you need some basic understanding of PHP or the advice may not even make any sense. There are lots of sources on the internet for tutorials. You can also find some info and examples for what you are currently trying to do. An example is at: One Example

Chris

chrishea 182 Nearly a Posting Virtuoso

Any output at all (even a blank line) before the Header will cause this error. As you say, this often doesn't show up as an error until you run from the server. I didn't notice any obvious echo statements so it is more subtle than that.

I seem to remember having a similar problem when I had a session_start before the headers (maybe because it was issuing an error message even though it was suppressed?). You may find it easier to use ob_start and ob_end_flush statements to catch whatever is being issued. It can save tearing out your hair trying to find the actual cause.

Chris

chrishea 182 Nearly a Posting Virtuoso

I'm going to assume that you know something about PHP otherwise you need to do a tutorial.

You can add a PHP section at the very start of the module enclosing it in <?PHP and ?> statements. You could include your variables there initially and then move them out to a separate included module when you have it working reasonably well.

In the html code, you will need to include PHP sections wherever you want to include one of your variables. each of those will look something like:

html...<?PHP echo $x ?>...html
an example:
background: url(../images/whitetop_728x4-80.png) no-repeat;
becomes:
background: url(<?PHP echo $back ?>) no-repeat;

if you want to include some logic based on your variables then you will need something like:

<?PHP
if ($var == "xxx") {
echo "<a href=... ";
} else {
echo "<a href= ... ";
}
?>

You must rename the module to have a .php suffix rather than .htm

Chris

chrishea 182 Nearly a Posting Virtuoso

It looks as if you have tried to embed a PHP statement within a section of PHP code. On the last Print statement you don't need:
...<?PHP echo ...?>...
try
...php?id=".$event["id"]."\"> ...

chrishea 182 Nearly a Posting Virtuoso

Start by changing the line if(!$db_selsected) -to- if(!$db_selected)

gangsta gama commented: Very helpful +1
chrishea 182 Nearly a Posting Virtuoso

You need to save the module as xxx.php If you saved it as a .htm it probably won't deal with the PHP section correctly when you run it.

Chris

chrishea 182 Nearly a Posting Virtuoso

It isn't really a PHP question but In reply to the first part, everyone will probably have a different opinion on which is the best CMS based on their own experience. I attempted some informal assessment of some of the more popular CMS's such as Joomla, Drupal and Wordpress along with the one I had been using Website Baker (WB). With ease of setup and use as one of my highest priorities, I found that Website Baker was more straightforward to understand and use than the other ones. Wordpress was also pretty good (and it can do more than just blog). I found Joomla and Drupla frustrating although lots of people have obviously figured them out.

If you want something that you can get working pretty quickly without a large learning curve try WB.

Chris

chrishea 182 Nearly a Posting Virtuoso

I didn't get an error with this code. It seems that you probably have a problem in the setup of your LAMP environment. Hard to know what that might be unless someone had a similar problem and managed to fix it.

chrishea 182 Nearly a Posting Virtuoso

I think you answered your own question correctly. Use mysql_num_rows and if there 0 records found then you can take the appropriate action.

Chris