Walkere 19 Junior Poster in Training

Some of that (changing the colors of the text and whatnot) you can do with CSS styles. The rest (changing the actual text) requires that you use a scripting language like Javascript.

For the styling (changing text color, background color, etc) you can apply a style to input buttons. With pseudo classes, you can have that style change based on whether it's being targeted (in focus) or not.

For example, put this in the <head> section of your page, and test it out with an <input type="text"> element...

<style type="text/css">
  input { color: #ccc; background-color: #eee; }
  input:focus { color: #000; background-color: #fff; }
</style>

The style applied to input:focus will only be applied when the input class is selected. The rest of the time, it will display what is declared for all inputs, and so it looks like it's inactive.

To alter the text inside the input, you'll need to use javascript. Posting in the javascript forum might get you some more specific help, but here's a nudge in the right direction.

Get a javascript framework, like jquery, to make it easier to select elements from the DOM.

jQuery has two methods to help you. The focus() method will trigger when an item is selected, and at that point you could clear the input and alter its style. The blur() method will trigger when the focus leaves the input, and at that point you could replace the text with "E-mail" and alter the …

Walkere 19 Junior Poster in Training

I'm a bit confused as to why all of the replies so far are about whether or not the site is a Flash site. The OP already stated that it is driven by Flash - he wants to know how to produce something similar on a Linux machine.

To that end, I can't say I have a lot of experience. And unfortunately I don't have my Linux machine for development stuff anymore, so I can't test anything out. But there certainly is some software available for handling Flash in a Linux environment.

For playing Flash movies (and presumably accessing Flash sites), you can use Gnash. It's not 100% functional, but if I recall it can play a lot of Flash stuff.

You can also get a Flash player plug-in for Firefox. Although it doesn't fit into the philosophy of open source software, sometimes you need a proprietary solution... =(

You may also want to watch the development of gameswf. It's an open source library for compiling .swf files, and presumably it could be useful for developing interactive flash sites. It's also the backbone for Gnash.

There's a long list at osflash.org of open source Flash-related software. The list includes 4 different Flash IDE alternatives.

I don't have any experience developing Flash products in Linux (or in Windows for that matter), but I'm pretty sure you can get it done in Linux. You just gotta dig a little deeper …

Walkere 19 Junior Poster in Training

where are i am waiting .......

Well, if you're waiting for someone to do your homework for you... you'll probably keep waiting.

Here's a hint, though. Use a loop that will continue to execute until you get to the last person.

Find a data structure than can hold the 'n' number of friends, iterate through one person each time the loop goes around, and every x times (the # of words), remove someone from your data structure.

- Walkere

Walkere 19 Junior Poster in Training

I would deffintly look into using PHP to create a forum. Although HTML coding is much easier, it would probally be a lot more difficult in this situation.

Actually, using HTML would make the project impossible, not more difficult.

HTML (along with CSS) is just a way to mark-up and present information. It helps you organize content on a website.

In order to have a dynamic content-driven site (like a forum), you need to have a backend script that takes user input, processes the input, places it in a storage point (like a database), and then retrieves it from the storage when someone makes the proper request.

While PHP is probably the most popular scripting language today (and a good one to look for free forum scripts), there are alternative languages you could use. It would be possible to make a forum backend with both Perl and Python to name a couple.

- Walkere

Walkere 19 Junior Poster in Training

That's great, thankyou (although still having great difficulty!!) Sorry to be a pain, but is there a quick simple way I can display a static page on the URL whilst I figure this out? My boss isn't too pleased.. oops

Thankyou!

You can dynamically check to see whether or not the file was included, and then automatically display the regular page or some other content.

First thing you'll want to do (at least when you're not testing it) is turn off error-reporting.

This will prevent the errors from showing up and telling your users that something is broke. You can do this by adding this line to the top of the file.

ini_set("display_errors", "Off");

Then, you can add a conditional statement to check if the file was included or not. If include() successfully finds the file, it returns "True." Otherwise, it will return false.

Seeing as you're including a lot of files, I'd create an error flag, set that flag to "True" if any of the files aren't included, and then at the end of the includes check whether or not the flag was set. Like this...

$error = false;
if ( !include("exampleFile.php")) {
  //  There was an error, exampleFile.php wasn't found
  $error = true; }

if ( !include("exampleFile2.php")) {
  //  There was an error, exampleFile2.php wasn't found
  $error = true; }

if ($error == true) {
  //  There was an error
  //  Include your alternate info here
  //  Or use header("Location: http://domain.com/static-page.html"); to redirect …
Walkere 19 Junior Poster in Training

So Guys How can i Fix this issue so as to get through to my wprk

Well, the best way to do that would be to remember the password you used.

In lieu of that, you can log in as the root user and modify the password for the user 'pma' to something new.

Here's how you do this in phpmyadmin, once you're logged in as the "root" account.

  • Click on "Privileges" tab
  • Find username 'pma' in the list
  • Click on the "Edit Privileges" icon all the way to the right
  • Scroll down to where it says "Change Password"
  • Select "Password" and enter a new password

If you don't know the password for the "root" account, you can re-set the password and then use the root account to reset the 'pma' account. Here's the relevant section of the mySQL documentation on re-setting the root password.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

See there are some wrong thing in security with your code but now I am going to tell you syntax errors only (cause security is very deep....)

What he's trying to say, is you should never insert user input directly into the database. There are a number of ways a malicious user can use that type of insert statement to hack into your database and screw things up.

Instead, you should always validate the input to make sure that it won't harm your database.

The easiest way to clean code for use in a mysql query is to use the "mysql_real_escape_string()" function.

Like so...

$name = mysql_real_escape_string($_POST['name']);
$roll = mysql_real_escape_string($_POST['roll']);

//  Create mysql query, using $name and $roll

Incidentally, this may also be causing another error for you. You can't include an array value (like $_POST) directly inside of a string. You need to either wrap the entire array variable in brackets {} or reference the variable outside the quotes using a string concatenation.

For example...

$query = "insert into submit(name,roll) values('{$_POST['name']}','{$_POST['roll']}')";
//  Or...
$query = "insert into submit (name, roll) values ('" . $_POST['name'] . "', '" . $_POST['roll'] . "')";

- Walkere

Walkere 19 Junior Poster in Training

see.. no visitor came from yahoo search. I stil don't know why..
And.. still Google is the best search engine for people like us.

This may be true. But your Yahoo Backlinks can be used as a measure of site popularity - good for advertisers and such. TNX, for example, looks at both Yahoo backlinks and Google pagerank.

Both PageRank and Yahoo Backlinks seems to me to be more about advertising than traffic anyway - so use the resources as best you can.

- Walkere

Walkere 19 Junior Poster in Training

Hi Walkere :-)
Thanks very much for your timely response. Thanks to your help, I managed to fix the problem and learned something new while I was at it. Great! :-)

:Keith/ZenMartian:

No problem. Always glad to help =)

- Walkere

Walkere 19 Junior Poster in Training

I see nofollow on link tag on all our signatures in this forum (From Page source), it's mean Google would not follow all our signatures links on this forum.
:D (Please web master remove this nofollow)

You may have noticed that the "Visit XYZ's Homepage" link attached to your name is not nofollow.

However, I don't blame the webmaster for trying to limit spam on the forums. If sig links are "nofollow," that encourages relevant signature links and good posting habits. People do click-through signature links, if it's relevant and if the poster contributes something useful to the board.

Also, note that nofollow links are still indexed by Yahoo and added to your list of Yahoo backlinks. Not entirely worthless.

- Walkere

Walkere 19 Junior Poster in Training

is it possible to obtain information from websites like this one if they do not provide RSS Feed?

I don't think so. Flash does a good job of wrapping up all the information so that you can't easily manipulate or edit it.

Is there another site for Korean showtimes (like Fandango in the US)? Unless they're printed in HTML or XML, you're not going to be able to extract them from a site and re-use them.

As for sites that get the info directly from the movie theaters, they most likely have access to a central database. Sites with lots of info (like Amazon.com) give out read-access to parts of their database, so that developers can integrate the information into their site.

I'd assume there's some kind of high-level database for cinemas, and that's where sites like Fandango, Enjoytheshow, etc. get the movie times.

- Walkere

Walkere 19 Junior Poster in Training

Thanks
i wanted to know whether python installed as default package in all flavors of linux.

Well, then time for you to do a little data collection and research. =)

I'm sporting Ubuntu Gutsy Gibbon, and it came with Python pre-installed (although I had to install the mysqlDB package myself).

- Walkere

Walkere 19 Junior Poster in Training

Not even sure if this does belong in this section, but please redirect me if it doesn't. For those of us that have affiliate sites, most affiliates provide us with data feeds or specific data feed url with whcih we can link and extract information for our websites.

If by "data feed" you mean an xml feed/file, then you can access it through PHP using either an XML parser or a pre-built package like SimpleXML.

I'd suggest reading through the section in Practical PHP Programming on using SimpleXML. Basically, you create an object using the xml file. This loads all of the xml data into an object structured like the xml tree.

If you had an example of one of these data feeds, it would be easier to illustrate.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

I recently installed wordpress to make it easier for me to update the site. Then I noticed I wasn't getting anymore traffic from google. So I typed both my name and separately the full url into google and in both cases google does not return even one result within my webpage!

What did you do with all of the pages when you switched to Wordpress?

Presumably the posts now have new URLs. Did you use a 301 redirect to tell Google where to go? It might have crawled your site, found a bunch of 404 errors, and then wiped your site from the index for some reason.

I'd also suggest signing up for Google Webmaster Tools so you can see errors that the crawler encounters. This would let you know if the problem is something crawl related.

If it's simply an SEO problem (although it sounds like you disappeared from the index altogether for some reason), you could try getting the All-in-One SEO plugin for Wordpress. Helps get the meta tags set up properly for SEO.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

Hi Folks! This is probably an easy one for most of you php people :-)
I've got a PHP form that's working fine, yet after I SEND the form, it goes to a web page with a "Thank You" message on it (ala the php {print} command), ok... what I need to know is (on the backend script following the Thank You message) how can I add a 'link' that when clicked on, the Thank You page will switch back to the main FORM page? Right now, the form stops on the Thank You page and I need to go back to the main area where you fill out info. :-) Thanks!

Zen!

The easiest way would be to just add an html link to the page. Note that you can easily mix and match php and html on the same page. Just end your php block with a ?> and then print html.

For example...

<?php
  //  Do some form processing here
?>

<a href="index.php">Go back to the Main Page</a>.

You can also use echo (or print I suppose) to output HTML from inside a php code block. To do so, just put the regular HTML in your string.

While doing this, remember that if you quote your string in single quotes, you'll need to escape single quotes that you use in HTML.

For example...

<?php
  //  Do some form processing here
  echo '<a href="index.php">Go back to the main page</a>.';
?>

Good luck,
- …

Walkere 19 Junior Poster in Training

I recieve the following at the w3c validate page:

Validation Output: 2 Errors

Line 1, Column 22: character "“" invalid: only minimum literal and parameter separators allowed.
<!DOCTYPE html Public “-//w3c//DTD XHTML 1.0 Transitional//EN”

You need to change the quotes around your doctype stuff. Notice how they slant in and out? That's a special type of quote (probably created an an escape sequence), that doesn't work for quoting attributes.

Write over it with a regular ".

If you copied and pasted your HTML from a word processor, that could cause the problem. Word Processors love to auto-change quotes to special characters. It's much better practice to type your HTML up in a simple text editor (a-la Notepad, Notepad++, or Gedit) or some kind of programming IDE (Dreamweaver, Quanta, etc). That would prevent problems like this.

- Walkere

Walkere 19 Junior Poster in Training

I am new to PHP oop. I was wondering when and why should we use the following:

1) Public
2) Protected
3) Private
4) are there any other???

The link that Naveen posted has a good overview of these OOP concepts.

No, there are no other types - just these three.

As for when to use them... you should always try to use the most restrictive definition for a variable/function. This is an OOP "best practice," and helps ensure your code is easier to maintain in the long run.

As a general rule of thumb, variables should be private or protected - depending on whether inherited classes will be able to access them directly. There are very few variables that should be public - instead, you should write public functions to fetch and change them.

Methods should be public if (and only if) they need to be called from the main script. If they're called from other methods of the class, then they should be private or protected.

- Walkere

Walkere 19 Junior Poster in Training

ok may be i'll try and create a new login in page from scratch.thank you for your time

That would be your best bet. It's particularly hard to help someone that doesn't understand the code at all - so I would always suggest learning the basics before you try and implement someone else's script.

If you're looking for a resource to learn php, check out Practical PHP Programming. It's a great, free book - the same one I used to learn a while back.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

what I would like to do is to be able to offer a drop down list of values to select from ( which will come from a table in oracle) instead of the user remembering n entering a value, how can i achieve that ?

In HTML, what you're looking for is the <select> tag. This creates a dropdown list, like...

<select>
    <option value="value">Text</option>
    <option value="value">Text</option>
</select>

So what you need to do is get the result set from your database, loop through the result set, and create an <option> tag for each item in the result set.

I'm not familiar with the Oracle functions, so you'll have to create the query and what not yourself, but here's the idea.

$query = "SELECT value, text FROM table WHERE condition = TRUE";
$result = oci_execute($query, OCI_DEFAULT);

echo '<select>';

while ($row = oci_fetch_array($result)) {
   echo '<option value='" . $row['value'] . '">' . $row['text'] . '</option>';
}
echo '</select>';

Hopefully you get the concept out of that, and you can fill in the right query/oracle functions to get it to work.

The steps are basically...

  • Write query
  • Execute query
  • Open the <select>
  • Loop through query results
  • Print an option for each value in the query result set
  • Close the <select>

Good luck,
- Walkere

Dukane commented: nice explanation +2
Walkere 19 Junior Poster in Training

There will be only one user...
So that worked for me

Ahh, I thought that you were going to store a bunch (or at least a handful of users).

If you tried to add more records to the file, it would get more complicated to parse the variable names, make sure you didn't use the same name twice, etc.

But for one user, I suppose it's simple enough. Definitely a strange way to do it, but if it works, who cares? Kudos for thinking outside the box.

- Walkere

Walkere 19 Junior Poster in Training

Glad that you solved your problem. But still it isnt safe :( Anyways, All the best!

Should be plenty safe. No one will be able to see the password details, because it will be parsed by the php interpreter. Just like how your mySQL user/password information is floating around somewhere in a config.php file...

Are you just saving one password in there? Or are there more users?

- Walkere

Walkere 19 Junior Poster in Training

My idea is to store username and password in a php file and update them.

I'm not sure if this would be the best way to do it...

However, the basic functions you'll need to use are PHP's file functions. The simplest way to do it would be...

$fileContents = file_get_contents($filename);

//  Do something with the contents

file_put_contents($filename, $newFileContents);

file_get_contents() takes a filename (string) and returns the contents of the file in a string.
file_put_contents takes a filename (string) and contents (string) and writes them to the file.

For storing usernames and passwords, the best solution is probably to use a mysql database. You could read the databases section of Practical PHP Programming for an overview of mysql and the related php functions.

Another option would be to use an xml file to store the usernames and the hashed passwords (after they've been processed with md5 or crypt). This is a simpler option if you don't have access to or don't want to use a database.

PHP has some great built in functionality with xml now using SimpleXML. You could read the SimpleXML section of Practical PHP Programming for an overview on how to use it to read, write, and modify xml data.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

dzone.com has similar concept

DZone seems to be more geared towards programmers/developers than simple web designers.

With that in mind, I love DZone and go there far more than any other social bookmarking site. The rest are just a pot luck mix of crap, while at DZone I know I'll get stuff that I'm interested in.

So if you can get it going, then I think there's surely some traffic to be made. Niche bookmarking sites are far better in my opinion than general ones... but the problem is you need to get a critical mass of traffic before they get to be useful.

- Walkere

Walkere 19 Junior Poster in Training

I've been working building the links to my sites. More often than not, it does help in term of PR gain. But not really that much on getting the desired traffic. :-|

I guess to get traffic, I ought to look more into "social networking" sites and be interaction with others more often...just a thought, yet to find out about it as to "how?".

Yup. Most link directories (and article submission sites) are just good for juicing up your pagerank and backlinks. They get few visits by people that are actually looking for information - so you won't get many click-throughs.

A few things I've found that work...

Write articles on Associated Content with links to your site. You can write a brief targeted article that will get a bit of traffic on its own - and some users will follow through to your site. In this case, your site is your "reference" - so they're clicking through to get more information. So you get backlinks + a little bit of traffic.

Some niche article sites do get traffic. For example, I've been using Good Tutorials with pretty good luck - each new posting gets at least 1-200 clicks in the first day. Gimp Tutorials is also pretty good, and Good PHP Tutorials is ok.

Social bookmarking seems to be a popular trend, too, but be sure to be a little active in the community - or else you might get marked as …

Walkere 19 Junior Poster in Training

Any one know how I can write a php statement to call the last 4 entires from tbl_accounts by userID?

You need to do two things here.

First, order the results in descending order, so that the latest entry is first in the list. For this, you can use "ORDER BY userID DESC".

Then, you need to grab only the first four entries (the latest four additions). For this, use "LIMIT 4".

Altogether, it should look like this...

$query = "SELECT * FROM tbl_accounts ORDER BY userID DESC LIMIT 4";
Walkere 19 Junior Poster in Training

umm.. my question is, do you really need this complicated code to generate random password ? The user is going to reset it anyway. Well, for small purposes like this one, I would rather use something like this. This will generate random password. Send a link to the user with this random password.

I agree. That script is entirely unnecessary unless you're locking down Fort Knox.

One simple way to generate a random password would be...

$pw = md5( time() );
$pw = substr($pw, 0, 8);
$hashToStore = md5($pw);

First, you create a more or less random hash by using time() as your string. Then, you take the first eight letters of the hash as your random password. Then you take the hash of that password ($hashToStore) to store in the database and e-mail the actual password ($pw) to the user.

If you really wanted to create a password with truly random characters, you could use this. It loops eight times, each time adding a random character (0-9, a-z, A-Z) to the string. At the end, you'll end up with a random 8-char string.

//  Start with a blank string
$pw = '';

//  Add eight random characters.
for ($x = 1; $x <= 8; $x++) {
	switch ( rand(1, 3) ) {
		
		//  Add a random digit, 0-9
		case 1:
		$pw .= rand(0, 9);
		break;

		//  Add a random upper-case letter
		case 2:
		$pw .= chr( rand(65, 90) );
		break;

		//  Add a …
Walkere 19 Junior Poster in Training

Parse error: parse error, unexpected T_INCLUDE_ONCE in /home/content/B/r/1/Hidden/html/-APPI-/NAV/allied_footer.php on line 26

This usually comes from having a missing semicolon. The previous statement was never closed, so PHP isn't ready to begin a new statement - like require_once.

Check that lines 25 and 26 look like this (taken from the code pasted earlier)...

$virtual_page = "Main_Page";
include_once "analyticstracking.php";

If there's no missing semi-colon, then there shouldn't be a reason for that error.

As for the <html> tags, they shouldn't be in the footer.

Generally the way the templating system works is...

  • * Header.php - includes opening html tag, head tags, and opening body tag

  • * Page.php - includes the main content - everything inside the body tag

  • * Footer.php - includes the closing body and closing html tags, along with any footer info

In fact it seems rather strange that the analytics page (which you are including) contains all those tags. Since it's in the middle of an existing page, that might screw up the html.

- Walkere

Walkere 19 Junior Poster in Training

1.) What different types of attacks are there against websites besides brute force attacks (been reading this thread on brute force attacks: http://www.daniweb.com/forums/thread82966.html&highlight=login+security)

You've also got to watch out for scripts that get uploaded to your server and give someone remote access to your file system, db, etc (like this shell script).

Basically, a hacker can write up a script like CPanel or DirectAdmin that gives them control of a lot of stuff - and add in functions that break passwords and what not to give them unlimited access.

An easy way for these things to end up on your server is if you allow users to upload files without taking some precautions. A couple things you could do to help prevent it are - limit uploads to certain file extensions (i.e. doc file extensions or image extensions) or tell Apache not to execute any php in the /uploads directory.

- Walkere

Walkere 19 Junior Poster in Training

I find that Google Analytics data is MORE reliable than server logs because, since it's initiated with JavaScript, it only tracks real users and not any of the bots or spiders.

I agree. The reason it appears to show lower numbers is because it shows actual, real visitors. Other scripts like webalizer or WP Slimstat will show any requests to your web server. If you're getting crawled by search engines, that can be a lot of hits/visits that really don't exist.

There's a chance it under-reports because people have javascript turned off, or bounce away from the page before it loads... but for the most part I find it far more reliable than other scripts. I love it.

I'd rather know how many people are coming to my site than revel in the number of search engine spiders I can entertain... =)

- Walkere

Walkere 19 Junior Poster in Training

I have been using PHP sparsely on my website for some time now, but I would like to become more efficient and therefore have a couple questions. They will stream in slowly, bu for right now...

Currently I use the <?php tag many times on a page. Is there a way to get rid of it?

Sometimes you can cut down on it. Other times it's necessary to open and close php tags a lot.

In your case, you can cut down significantly on the opening/closing brackets. In between the includes, you don't use any regular html. So you can cut them all down into one php segment like so...

<?php
require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs
?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>The Kudzu Gazette</title>

<?php
include("./header_home.php");

include("cutenews/show_news.php");

include("./footer.php");
?>

And if you wanted to make it all one big php block, you could do this...

<?php
require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs

echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">';
echo '<head>';
echo '<title>The Kudzu Gazette</title>';

include("./header_home.php");

include("cutenews/show_news.php");

include("./footer.php");
?>

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

yea it works fine when u register it inserts the md5 hash of the password u give it.

So if you were to add this line (#2) ...

$row = mysql_fetch_assoc($result); // note assoc
echo $password . '<br />' . $row['password'] . '<br />';
if ($row['password'] == $password) {
echo "Login successful <br />";

the two results match?

- Walkere

Walkere 19 Junior Poster in Training

ok i cant seem to log in with a regualr password. this code works fine without md5 but it doesnt work when i use md5. yes i've already connected and selected database.

How is the password stored in the database?

You say the code works fine without md5 but it doesn't work with md5. When you change the code to encrypt the password, do you also change the database entry (manually I suppose) to the md5 hash?

Remember that all md5 does is turn your password into a garbled bunch of characters. So you need to store that garbled bunch in the database, and use that to compare to the md5 hash you create of the user's input.

Other than that I don't see anything wrong with the script. Try echo-ing what you're pulling out of the database as $row - that could give you an idea of what's going wrong.

- Walkere

Walkere 19 Junior Poster in Training

$query=("SELECT w.name, k.id_teacher, k.class_name FROM walikelas w, kelas k WHERE w.id_teacher = k.id_teacher");

my question is how we get the value from w.name,k.id_teacher,k.class_name and then we can put it in the variabels. Thank you.

Now you need to execute the query, save the result, and get the values using one of the mysql_fetch functions (mysql_fetch_row(), mysql_fetch_assoc(), mysql_fetch_object() - go to php.net for more details).

To do that, you would do something like this...

$result = mysql_query($query, $db);

//  This loop grabs the output one row at a time,  until there is none
while ($data = mysql_fetch_object($result)) {
    echo "Name - " . $data->name . "<br />";
    echo "Class - " . $data->class . "<br /.";
}

The mysql_query saves the result in $result, then you fetch the results into an object one at a time.

That object contains all of the information from your mysql query, with a property named after the item in your query.

So $data->name is your "name," $data->id_teacher is your "id_teacher," and $data->class_name is your "class_name." In the example I just echo'ed them, but you could just as easily save them in another variable for later manipulation.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

Thank you for your reply, but what do I put for the smtp settings. Would it have something to do with my Internet service provider, would it be localhost? I'm confused :(

I've never set one up on a windows server, but I would assume you would use your ISP's SMTP server. This is usually "smtp.isp.com" or "mail.isp.com" or some such thing. For example, mine is "mail.optonline.net" for Optimum Online.

This would be the same server you'd use to set up an e-mail client... if you used one =)

- Walkere

Walkere 19 Junior Poster in Training

I'm afraid that didn't work, anyone else?

If you didn't set up the smtp settings in your php.ini file, it won't work. Check the SMTP and smtp_port settings.

If you're determined not to use the mail function or need something more advanced, try phpMailer.

Good luck,
- Walkere

iamthwee commented: thanx 4 lookin +13
Walkere 19 Junior Poster in Training

i'm new in this field.my lecturer want me to made up some project.i want to made an academic portal that have a forum inside that.how can i made it by use html,php or what?please help me?

Building a forum from scratch would be an interesting project... but long and unnecessary unless you're really interested in learning how to do it.

If you want to get something off the ground quickly, there are some great, free, open-source forum scripts that you can download and install on your own server pretty quickly.

In particular I'd recommend one of two:

I personally like phpBB better, but I've seen SMF come out well also.

If you're determined to create your own, I'd suggest reading Practical PHP Programming. It's a great free book to use to learn php, and there's an entire section (Chapter 21, Section 3) devoted to creating a message board script.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

If you want your websites to be handicap-accessible, do not use hover images.

I think that paints the problem with far too broad a brush. Why would you have to get rid of all hover images in order to be handicap accessible?

Example. A hover image could be used to change the background of a link, simply to show that it is "hovered." Same way you would change the color of a link to show your mouse is over it. Purely visual, doesn't effect the functionality of the site. No reason it'll impair use by someone that won't be able to see the hover image.

Example. If you use a css-hover menu, you can use an alternate style sheet to make all of the links displayed, rather than not displayed until moused over.

There may be some cases where using hover images might impair the use of your website by someone using a screen reader - but there are plenty of situations where you can accommodate handicap users by making accessibility modifications.

We didn't make the world flat for people with wheelchairs. We built ramps.

- Walkere

ndeniche commented: excellent +3
Walkere 19 Junior Poster in Training

can we similarly include the multiple files for a class...??? ( i cant do this. please help) just as ... one member function of a class in a separate file ...

I'm not sure if it's the best idea to just copy and paste a set of functions into a class. Doesn't quite live up to the most rigorous notions of OOP...

More to the point, I don't believe this is possible. I've attempted to do it a number of ways and none of them appear to work.

You can include a file within a function, but you can't include a file within a class declaration but outside of the declaration of a method.

So one thing you could do (I think) is declare the method in the class declaration and then include a file with the contents of that method.

However, your class should be in one, nice, self-contained file. If your class is too bloated for that, you should consider breaking it into sub-classes with inheritance to keep standard functionality across different sub-classes.

- Walkere

Walkere 19 Junior Poster in Training

I'm not getting it to work. I guess i didn't explain correctly that i'm using a fieldset tag. From what i can find, i can manipulate what goes inside the fieldset, but not the border itself, is this still done with a css? I'm seeing that if the fieldset does not have a border, my browser doesn't support it, but thats all its saying about the border. I see a border but can't seem to find how to change its color or thickness.

I was able to create a border and style a fieldset fine with Firefox. What browser are you using?

If there's a problem with compatibility with a fieldset, you can wrap all of the form elements inside of a div and make the fieldset invisible. Create a fieldset, fill that with a div, then fill that div with the form elements...

<form><fieldset>
    <div id="form-container">
        <input type="text" name="Blahblah" value="Testing" />
    </div>
</fieldset></form>

You could then just style the div to get the border that you want.

#form-container {
    border: 5px solid black; }

- Walkere

Walkere 19 Junior Poster in Training

what do you mean by this "mail.optonline.net"?

That's the name of the smtp server that I would use (for Optimum Online). You can find the name of the server from your ISP. If you use some kind of pop3 e-mail browser (like Outlook or Evolution), you used that to set up your e-mail account.

As for xampp, I've never used it so I'm not sure where the config files would be. Maybe somebody else can point that out.

- Walkere

Walkere 19 Junior Poster in Training

hi to everyone.. can anyone here in the forum an teach me hoe to configure "SMTP"
and "smtp_port"

There are a couple of ways to do this.

The most direct, permanent and effective way is to edit the php.ini file. If you're running php on a local server (i.e. your computer), then this should be somewhere in a folder created by php. With my default installation on Ubuntu, it's in "/etc/php5/apache2/php.ini"

If you don't know where the php.ini file is, you could try searching for it and editing it. In it you'll see a line that says SMTP = value . Change the "value" to what you need it to be. Same for smtp_port.

If you can't find the php.ini file, you can set the value on a per-script basis. If you use the mail functions a lot, you may want to put this in a common file and include it at the top of all your scripts.

Use the ini_set() function to set the value for each parameter. Like so...

ini_set("SMTP", "mail.optonline.net");
ini_set("smtp_port", "25");

You can use ini_set to change most of the php.ini parameters for the duration of a single script.

If you want to confirm that this was successful, use echo phpinfo() to print a complete listing of php's settings.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

Thanks for your reply.
If use $cypher = crypt( time() ) as my salt, I would have to remember the value generated by time(). This will allow me check their password during login. Am I right?
I am working on an existing site. I myself don't know why crypt was used.

Yes... and no.

Take a look at the output of this snippet.

$cypher = crypt ( time() );
echo $cypher . '<br />';
echo crypt('password', $cypher) . '<br />';
echo crypt('password1', $cypher) . '<br />';
$1$wq9DJoxw$BXWWXppH8uBry2NKaD3uF.
$1$wq9DJoxw$NuwqVpY4.7rcmllLROImH.
$1$wq9DJoxw$G.a0Gd1vbp4SAaQcCxj3c.

Notice how the first 11 characters of each line ($cypher, the crypt of 'password', and the crypt of 'password1') are all the same?

When you make the initial crypt() call, it automatically generates a salt for you. On my server, that automatically generated salt is based on an md5 hash - and is formatted as $1$xxxxxxxx$.

The crypt function always pre-pends the salt used to the output. So when you later encrypt 'password,' you're saving the salt inside that encryption. So you don't have to save the $cypher variable we created, you just need to save the outcome of crypt('password', $cypher) and use that as your new salt.

Like this example...

$cypher = crypt ( time() );
$password = crypt('password', $cypher);

if (crypt('password', $password) == $password)
	echo "Match!";
else
	echo "No match!";

So when you initially encrypt 'password,' you can use any md5 hash salt - including a random one based on time. Just save …

Walkere 19 Junior Poster in Training

Hi, don't ask me why but my client wants to display certain text as bold and a smiley face within a dropdown option.

Not sure if there's any way to do this in a real drop-down menu, but you achieve something similar with a little out-of-the-box thinking.

Instead of using a dropdown form item, build a css menu - like you would for site navigation. Each link in the css menu would equate to one option in your old dropdown.

Then, format the links to submit the form, re-populate the form with whatever was already entered, and create a hidden element to hold the information sent by the link.

Since the dropdown is now a regular css menu, you should be able to format the contents of the <li> however you like - including selective <strong> tags and smiley faces.

- Walkere

Walkere 19 Junior Poster in Training

I was bored, so I wrote up a simple php class to do this type of thing. You can get the source code and some documentation here.

Walkere 19 Junior Poster in Training

So, after all that, we realize that there is no class ab which is what you were looking for, since it is looking for the b tag inside the a tag.

And to take this one step further and answer the original question...

I'm thinking you need to change

.ivt ab:hover {

to...

.ivt a:hover b {

In the original example, you're looking for a <b> tag inside of an <a> tag (as Shawn pointed out). So now you want to look for a <b> tag inside of an <a> tag with the psuedo-class hover. Hence a:hover b .

Walkere 19 Junior Poster in Training

I'd been trying to do date range comparisons all day, and found that using sql was the only way to find out if a date (inside a table) was between a range (assigned by me)

You should be able to do this with some php.

You can use the strotime() function to turn the date from the table into a timestamp. Then use strotime to turn your start and end dates into a timestamp. Then do a simple if statement comparison - if the start date is less than the table date and the table date is less than the end date... you're good.

You could create an array, with four elements. Each one of those elements would be its own array - with a start date, end date, and quarter name.

Then loop through the entire array, do the if comparison, and when you have a match save the quarter name.

Here's a working script to get you started. You'd just need to punch in your data from the db table and add the correct date ranges in.

<?php
$test_date = strtotime("21 June 2008");

$quarters = array();

$season['start'] = strtotime("1 January 2008");
$season['end'] = strtotime("1 April 2008");
$season['name'] = 'First';

$quarters[] = $season;

$season['start'] = strtotime("1 April 2008");
$season['end'] = strtotime("1 July 2008");
$season['name'] = 'Second';

$quarters[] = $season;

$active_quarter = '';
foreach ($quarters as $one)
{
	if (($one['start'] < $test_date) && ($test_date < $one['end']))
		$active_quarter = $one['name'];
}

if ($active_quarter != '')
	echo "Match: …
Walkere 19 Junior Poster in Training

Hello,
I just used the crypt command on 'password' and 'password1' and got identical output!! What are the rules concerning the crypt function? Am I not allowed to use numbers? EXACTLY what am I allowed to use? Many thanks in advance.

According to this comment on php.net, certain situations will cause crypt() to only look at the first eight characters.

For example, in this situation, they seem to return the same thing and only compare the first eight characters...

<?php
echo crypt('password', 'blablabla');
echo crypt('password1', 'blablabla');
?>

One way to this doesn't happen is to use a md5 hash as the encryption salt. For example, this will automatically generate an md5 hash for the salt, and use that for the encryption (at least the way my server is set up).

<?php
$cypher = crypt( time() );
echo crypt('password', $cypher);
echo crypt('password1', $cypher);
?>

That will return two different strings like it is supposed to.

Random question... why use crypt? Why not just check the md5 hash of the password (saved in the db) against the md5 hash of the user input?

- Walkere

Walkere 19 Junior Poster in Training

Although I still don't see the benefit I have found an explanation of public, protected and private visibility properties.

Properly using private and public properties helps you make better, abstracted OOP code. In simple projects that don't have a heavy dose of OOP, this isn't going to make much difference.

However, if you're coming from another OOP environment (like C++), or you're developing a large project that makes use of classes, then you'll appreciate the abstraction and integration you get when you make as many variables as possible private.

The general idea is that most of a class's essential properties should be private. Instead of accessing the properties directly, you should go through methods that either fetch or modify that property for you.

Then, if you integrate that class into a project and later change the structure of the class, you don't have to alter the whole project. You can simply change the way the methods work with the class or keep older methods around for backwards compatibility.

It's similar to the way that it's generally better to abstract a large script into individual functions - passing variables and values back and forth - rather than using a whole bunch of global variables.

To some extent it's just a matter of form and "proper" coding, but it does have advantages in certain projects.

- Walkere

Walkere 19 Junior Poster in Training

sometimes the location:header part has a problem, since it is supposed to be set before any html. the way around this is to put <?php ob_start(); ?> at the very top of the page, before the <html> tag and <?php ob_flush(); ?> after the last line </html>.

Looks like this is already solved, but here's a related thing to think about.

Do you have php's display_errors flag on? If so, you would have seen an error message, "Headers already sent" or something like that.

Since you just got a blank screen, I'm guessing display_errors is off. The recommended php.ini file turns this off for production purposes - because you don't want your users to see error messages. However, if you're still developing stuff (or trying out a new script), it helps a lot to have the errors shown.

I think you can set it at runtime using

ini_set("display_errors", "On");

I recently switched to the recommended php.ini file (turning off errors), and it can be really frustrating when testing stuff out. So I always switch the errors back on when I'm trying something new - that feedback really helps.

Good luck,
- Walkere

Walkere 19 Junior Poster in Training

Most of your code seems to be fine, but I'm a little confused as to what the $week_cycle is supposed to do.

I took your code and worked out the example script (at the bottom of this post).

It starts with a beginning date - I entered the first day (Monday) of the first week of this year (12/31/2007). Remember that Week #1 will usually start in the previous year (unless the first day of the year is Monday).

It then loops through and saves the date of the Monday of each week ($week_data) and the date of the Sunday ($week_data).

I also didn't understand why you added a full week to get the week's end. Doesn't the week end on Sunday (6 days)? If you wanted it to be Monday to Monday, you could easily switch the ("+6 Days") back to ("+1 Week").

Script loops through 53 times, creating an entry for each week and saving it in an array indexed by the Week No.

Then you can simply loop through the array to output each week (like I did), or look up a specific week by it's Week No and echo that.

It seems to me this does what you need, unless I misunderstood what you were looking for...

Good luck,
- Walkere

<?php

$increment = 1;		//  # of weeks to increment by

//  First day of the first week of the year
$startdate = strtotime("31 December 2007"); …