Log in

View Full Version : phpBB & php Stuff



SJ McAbney
09-09-2004, 06:00 AM
I've finally -after months - found myself some time to work on my website.

The only problem is there are things I'd like to do that I don't know how to do yet. The people who host my site also provide loads of OpenSource applications that are automatically installed should you require them but - when I try to use them they just don't seem to meet my needs or, as is more often the case, I simply haven't got a clue as to how to use them.

For example, there's an install for phpWiki and TikiWiki - I thought this would be great to install but I can't work out what to do with either's admin section or how to change anything.

Would someone be willing - preferably one of the guys who codes the site here - be willing to look at one of these wikis and see if they can work out how the hell these work?

Thanks

SJ McAbney
09-09-2004, 01:17 PM
Ach, sod it; on second thoughts I can do without it.

If anyone can help with phpBB, though, I'd appreciate it. :)

mark007
09-10-2004, 05:16 AM
I'm happy to take a look though I warn you I'm incredibly busy at the moment so could be slow at times. If you have specific questions though let me know. Email is best I guess mark007@.....here

Mark
:)

SJ McAbney
09-10-2004, 06:01 AM
Thanks Mark,

Currently I'm in a dilemna situation. Either I:


Stick with my phpBB forum (although change the template) and get loads of hacks put into it. I have a test forum that I've tried to add one hack to it and it didn't work out well. :(
Hold fire for a month and purchase a vBulletin license and a Subdreamer (http://www.subdreamer.com) license and then worry


I'm swaying toward the latter; I'm just impatient. :D

Zack Barresse
09-10-2004, 09:20 AM
Having worked with both (albeit very little), imho the vBulletin is a better software. There are far more Mod's for phpBB, sure. But it seems to me that the power and versatility that vBull offers is far superior. I just feel that it's easier to work with. But Mark and Suat are the two that would know the best here. Anne I'm sure has some good info to offer.

And I'd offer to help Stew, but in light of my last php mishap you may not want my help; not to mention I'm busy as heck right now anyway. :)

SJ McAbney
09-13-2004, 03:48 PM
Thanks Zack, :p

I'm just going to wait until next month and purchase the vBulletin3 license. In the meantime I'll work on the site's content (which I suppose I should have been doing for the last few months :rolleyes: )

If anyone wants to give feedback and suggestions on the site as I develop it then I'd be happy to take on board ideas...Home Page (in development) (http://talk-history.com/index1.htm) :)

Adaytay
09-14-2004, 06:09 AM
And I'd offer to help Stew, but in light of my last php mishap you may not want my help; not to mention I'm busy as heck right now anyway. :)

Zack... :cool:

It wasn't *that* much of a mishap!! :roll: It's all working now - and then some - check it out (http://forum.adaytay.com)!!

Ad

SJ McAbney
09-15-2004, 03:14 PM
Hopefully, a quick question that someone can answer.

I've got a mySQL database with just one table (called tblNewsletters) - it has four fields: EmailAddress (pk), DateSubscribed, DateUnsubscribed, Reason.

I'm wanting to be able to hit the Go button next to the newsletter textbox here (http://www.talk-history.com/index1.htm) but don't know which way to go or what the hell I'm doing. ASP or PHP?

I've had a mess about with PHP - this is the code that appears in the newsletter.php file: (I found it on another site and changed it slightly)
I get a parse error on line 8 with the SQL.


<?php
if ($email) {
$username="";
$password="";
$database="linguami_lnks1";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
INSERT INTO tblNewsletters (EmailAddress) VALUES ($email);
mysql_close();
}
?>

Is this difficult to fix?

smozgur
09-16-2004, 06:45 AM
Try this corrected one:



<?php
if (isset($email))
{
$username="";
$password="";
$database="linguami_lnks1";
mysql_connect("localhost",$username,$password);
mysql_select_db($database) or die( "Unable to select database");
mysql_query("INSERT INTO tblNewsletters (EmailAddress) VALUES ('$email')") or die("failed");
mysql_close();
}
?>


Of course you have to make sure if submitted form data field name is "email" for this code (input element name that stores the email address).

A complete working sample to write an email address into the database is below. It might help to figure out how it is working. You can save it as test.php and test.



<?php
if (isset($email))
{
$username="";
$password="";
$database="linguami_lnks1";

mysql_connect("localhost",$username,$password) or die("Could not connect");
mysql_select_db($database) or die("Could not select database");
$query = "INSERT INTO tblNewsletters (EmailAddress) VALUES ('$email')";

mysql_query($query) or die("Query failed");
mysql_close();
echo "Done!";
}
else
{
$html = "<FORM method=post><INPUT type=textbox name=email>
<INPUT type=submit value=Submit></FORM>";
echo $html;
}
?>


I hope it helps.
Suat

SJ McAbney
09-16-2004, 06:57 AM
Thanks, I'm still a little hazy on it though.

So, if my textbox is called txtEmail, I replace $email with $txtEmail ?
Or, since the field is called EmailAddress do I change $email to $EmailAddress ?

mark007
09-17-2004, 01:38 AM
The key is the name of the textbox that the email is entered in. In Smozgur's exmaple this is:

name=email

So he uses $email

If your textbox has name:

name="EmailAddress"

Then you would use:

$EmailAddress

assuming registerglobals is on. A safer way would be to use:

$_POST['EmailAddress']

To make sure the variable was posted to the page. Otherwise someone could access the page using:

url/pagename.php?EmailAddress=myaddy

Just looking at your page your form has the following field:

<input name="txtEmail" type="text" id="txtEmail" maxlength="255" />

So you would use:

$txtEmail

or

$_POST['txtEmail']

Hope that helps.

:)

SJ McAbney
09-17-2004, 06:15 AM
Does not compute. :(

Maybe I should try ADO. Saying that, maybe I just haven't set the database properties correctly. Using phpAdmin I was unable to find how to set a password on my database. And have no idea about a username (I'm guessing it's just my name)

Zack Barresse
09-17-2004, 06:48 AM
I don't believe you can do that from your phpAdmin, but rather your site's Cpanel (or from your host server login page). From there you should have direct access to your files, MySQL, additional site features, etc.

SJ McAbney
09-17-2004, 08:15 AM
Thanks Zach, the password was the final bit. I though each database had to have a specific password.

The email address is now put into the database. I suppose this is the last I'll annoy you on this subject but how would I insert the current data into the DateSubscribed field at the same time?

$query = "INSERT INTO tblNewsletters (EmailAddress) VALUES ('$email')";

i.e. what function do I use and how?

And when I get paid I'll buy a big PHP book so that I can get a grip on this. :)

smozgur
09-21-2004, 07:56 AM
I assume you meant "date".

Try this:

$query = "INSERT INTO tblNewsletters (EmailAddress, DateSubscribed) VALUES ('$email',now())";

It stores the current server date & time as default.

Suat

SJ McAbney
09-21-2004, 11:35 AM
Thankyou. :)