nav33n 472 Purple hazed! Team Colleague Featured Poster

Line 179. $result = mysql_query->($sql); should be $result = mysql_query($sql); :)

Suetan commented: Good advice for debugging PHP script... thanks Nav33n +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

And, you don't need $_SERVER, since its just used to get the browser information.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Ah! i see. Thats wrong. You aren't fetching any record from the table. You are trying to assign null value to the session, because, there will be nothing in $loginFoundUser[0] and $loginFoundUser[1]. Use this instead of your query.

$LoginRS_query = "SELECT userid, firstname, username, password FROM adminprofile WHERE username='$loginUsername' AND password='$loginPassword'"; // Here, userid and firstname are the columns of the table. Change it to whatever columnnames you have in your table. 
  $LoginRS = mysql_query($LoginRS_query) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  $record_row = mysql_fetch_array($LoginRS);
  $_SESSION['user_id'] = $record_row[0];
  $_SESSION['first_name'] = $record_row[1];
nav33n 472 Purple hazed! Team Colleague Featured Poster

Strange! Are you sure, $loginFoundUser[0], $loginFoundUser[1], md5($_SERVER) have values ? I think nothing is assigned to session variables.

nav33n 472 Purple hazed! Team Colleague Featured Poster

So, session exists.

Redirect to a dummy page, for eg, page2.php and have print_r($_SESSION) in it. Check if session is being passed !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Have 2 pages.

<?php //page1.php
session_start();
$_SESSION['name']="test";
header("location: page2.php");
?>

In page2.php, write this.

<?php
session_start();
print_r($_SESSION);
?>

See if it prints test in page2.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Digital clock


yahoo or google ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

toss
moon
root

Reputation

nav33n 472 Purple hazed! Team Colleague Featured Poster

-703

nav33n 472 Purple hazed! Team Colleague Featured Poster

After session_start();

nav33n 472 Purple hazed! Team Colleague Featured Poster

in validated.php page, print out the session variables. print_r($_SESSION);

nav33n 472 Purple hazed! Team Colleague Featured Poster

Check if its entering if ($row) condition.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Open httpd.conf file in apache/conf and add the line (which I have posted above) in it.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Basically, SHA1, md5, password, encrypt, etc are the encrypting functions. If you encrypt a password field, your application will be more secure. That's all.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Are you running on a local system or on a server ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Great! You are welcome !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Try this.

<table width="1000" height="95" border="1">

<tr>

<td bgcolor="#0000FF">&nbsp;</td>

</tr>

</table>

<?php


include("connect.php");

//this is your validation in the form,put it here....

if (empty($_POST['name']))

{

$errors[] = 'Please enter a name';

}

if (empty($_POST['email']))

{

$errors[] = 'Please enter a valid e-mail address';

}

else if (!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",

$_POST['email']))

{

$errors[] = 'Please enter a valid e-mail address';

}

if (empty($_POST['contact']))

{

$errors[] = 'Please enter a valid contact with numeric value';

}

else if (!is_numeric($_POST['contact']))

{

$errors[] = 'Please enter a valid contact with a numeric value';

}

if (empty($_POST['person_attend']))

{

$errors[] = 'Please enter some word for person attend';

}

 

 

else if (strlen ($_POST['person_attend']) > 255)

{

$errors[] = 'person attend';

}


if (empty($_POST['comment']))

{

$errors[] = 'Please enter some comment';

}

else if (strlen ($_POST['comment']) > 255)

{
$errors[] = 'comment ';

}
$name = $_POST['name'];
$email = $_POST['email'];

$contact = $_POST['contact'];
$person_attend = $_POST['person_attend'];

$comment = $_POST['comment'];

if($name="" && $email="" && $contact="" && $person_attend="" && $comment="" ) {
	if(isset($errors))
	{
		foreach($errors as $val)
		{
			echo "Error: $val <br>";
		}
	}
} else {

$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$person_attend = $_POST['person_attend'];
$comment = $_POST['comment'];

$query = "INSERT INTO rsvp (id, name, email, contact, person_attend, comment)
VALUES ('', '$name', '$email', '$contact', '$person_attend', '$comment')";

$results = mysql_query($query) or die 
("Could not execute query : $query." . mysql_error());
echo "Thanks for join us.";
mysql_close();
}
?>


<a href="Index.php">View list attend</a>

One suggestion. Look at how loops, conditions, { } works. You have { } all over …

nav33n 472 Purple hazed! Team Colleague Featured Poster

Sorting non-alphabetical/non-numerical records is not possible AFAIK. But you can have one more field of type int in the table, eg, type. You can enter the order of title, then sort by type !

nav33n 472 Purple hazed! Team Colleague Featured Poster

guestbook to be on it ? How do you want to add it ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Do you have date field in table staff ? If yes, you can add the day field in the query. If you dont have it, try putting the for loop inside the 2nd while loop. So, for 1 staffmember, it will check all the days. (here, in this case, its checking for ($day = 1; $day <= $totaldays; $day++) { condition for each staff. )

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi striker_24 ! Welcome to Daniweb :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
$query="select * from table where date_column between date1 and date2";
nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Welcome to Daniweb Shakti!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi Pete.. Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Instead of passing the strings (your username is.. your password is..) in $message, pass the link. So the user gets the link from where he can update his password.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Great! :) Congrats..

nav33n 472 Purple hazed! Team Colleague Featured Poster
if($_POST['delete'])) { //delete button is pressed
echo '<meta http-equiv="refresh" content="1;url=yourpage.php">';
} // refresh only if delete button is pressed
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

No. My question is, are you storing the path in the table when the user uploads an image ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

It would be in the mail you send to the users.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Tellme what it prints if you execute only this part of your query.

SELECT a.strLodgeName, a.intLodgeNumber, a.strDistrictName, a.strLodgeWEB, a.strLodgeCounty, a.dtChartered, a.strLodgeMailingAddress, a.strLodgeMailingAddress2, a.strLodgeMailingCity, a.strLodgeMailingStateCode, a.strLodgeMailingPostCode, a.strLodgeEmail, a.strLodgePhone, a.strLodgeFax, a.strDrivingDirectons, a.dtMeetingTime, a.dtMealTime, a.strFloorSchool, a.strLodgeNews, b.strOfficerTitle, b.strFirstName, b.strLastName, b.BusinessPhone, b.PersEmail FROM tblLodges a LEFT JOIN tblOfficers b ON a.lngLodgeID = b.lngLodgeID

Then, to the above query, add your condition, WHERE a.intLodgeNumber=$id. Then check the result.

P.S. I m off to work. Be back in an hr.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

huh! maybe, a.intLodgeNumber=$id condition is wrong ? I am not sure.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Well, I dont have one. But it should be something like this.

$secure_id=md5($email).md5($password).md5("string"); // get $email, $password from the table for that username
$messages.="<a href='pass_update.php?sec=$secure_id&username=$username'>Update your password here! </a>"; 
...
?>

In pass_update.php,

$sec=$_GET['sec'];
//for that username, fetch his email and password from the table
$table_values=md5($email).md5($password).md5("string");
if($table_values == $sec ) { // valid link 
//show the fields to update the password
} else {
//  invalid link the user clicked on an expired link. 
echo "The link isn't valid anymore! ";
exit;
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Is this above query returning the required results ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Instead of sending him his username and password, why not send him a link pass_update.php followed by a string of encrypted key. For example,
pass_update.php?secure=hash(email).hash(prev_password_field)
When the user clicks on the link, check if hash of email and hash of previous_password is valid. If yes, then let him change his password. Once he changes his password, this link becomes inactive. You can add more hashes to the link to make it more secure.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Maybe your query is wrong ? Did you execute it in phpmyadmin/mysql ? Did you get the output which you desired ? I don't know what your query does. Umm.. Execute it first and change it ! limit 50 will show only 50 records! You are grouping the records by name. Maybe thats why you are getting only 1 record ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Nice! Modern art ? eh ? :P

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay.. I ll make it simple for you.. Here is an example of what you are doing.

<?php
mysql_connect("localhost",'root');
mysql_select_db("test");
$q="select * from table1";
$res=mysql_query($q); //result set of the query
while($row=mysql_fetch_array($res)){ //loop and get all the records for the above query
	echo "first loop".$row[0]."<br />"; 
} //by the end of this query, the internal pointer will be pointing towards the last record. 
while($row=mysql_fetch_array($res)){ //loop for the same resultset.
	echo "second loop".$row[1]."<br />";
} //prints nothing since the pointer is already pointing at the last record in the previous loop.
?>

To make that work, you need to execute your query again. Like this.

<?php
mysql_connect("localhost",'root');
mysql_select_db("test");
$q="select * from table1";
$res=mysql_query($q);
while($row=mysql_fetch_array($res)){
	echo "first loop".$row[0]."<br />";
}
$q="select * from table1";
$res=mysql_query($q);
while($row=mysql_fetch_array($res)){
	echo "second loop".$row[1]."<br />";
}
?>

Notice the difference. Well, Try this code.

<?php
$id = $_GET['id'];

$query = mysql_query("SELECT a.strLodgeName, a.intLodgeNumber, a.strDistrictName, a.strLodgeWEB, a.strLodgeCounty, a.dtChartered, a.strLodgeMailingAddress, a.strLodgeMailingAddress2, a.strLodgeMailingCity, a.strLodgeMailingStateCode, a.strLodgeMailingPostCode, a.strLodgeEmail, a.strLodgePhone, a.strLodgeFax, a.strDrivingDirectons, a.dtMeetingTime, a.dtMealTime, a.strFloorSchool, a.strLodgeNews, b.strOfficerTitle, b.strFirstName, b.strLastName, b.BusinessPhone, b.PersEmail FROM tblLodges a LEFT JOIN tblOfficers b ON a.lngLodgeID = b.lngLodgeID WHERE a.intLodgeNumber=$id GROUP BY a.strLodgeName LIMIT 50")or die(mysql_error());
while ($row = @mysql_fetch_array($query)) {
$variable1=$row["strLodgeName"];
$variable2=$row["intLodgeNumber"];
$variable3=$row["strDistrictName"];
$variable4=$row["strLodgeWEB"];
$variable5=$row["strLodgeCounty"];
$variable6=$row["dtChartered"];
$variable7=$row["strLodgeMailingAddress"];
$variable8=$row["strLodgeMailingAddress2"];
$variable9=$row["strLodgeMailingCity"];
$variable10=$row["strLodgeMailingStateCode"];
$variable11=$row["strLodgeMailingPostCode"];
$variable12=$row["strLodgeEmail"];
$variable13=$row["strLodgePhone"];
$variable14=$row["strLodgeFax"];
$variable15=$row["strDrivingDirectons"];
$variable16=$row["dtMeetingTime"];
$variable17=$row["dtMealTime"];
$variable18=$row["strFloorSchool"];
$variable19=$row["strLodgeNews"];
$variable20=$row["strOfficerTitle"];
$variable21=$row["strFirstName"];
$variable22=$row["strLastName"];
$variable23=$row["BusinessPhone"];
$variable24=$row["PersEmail"];

//layout for  Lodge Information results

echo ("<tr>");
echo "<center>\n";
echo "<p>GRAND LODGE OF LOUISIANA - LODGE LOCATOR RESULTS\n</p>";
echo "Lodge Name:$variable1</p>";
echo "<p><b>Lodge Number:</b> $variable2</p>";
echo "<p><b>District Name:</b> $variable3</p>";
echo "<a href=\"$variable4\">Click Here To Go …
nav33n 472 Purple hazed! Team Colleague Featured Poster

I think its printing twice because it has to go through 2 loops. 1 the for loop and the 2nd, while loop. I don't know how your query works, so I can't do much about it. for loop repeats $totaldays times. And a staffmember can have 'n' number of leaves. So, the resultset might be more than 1 ! What you can do is, put the whole thing (which you want to output) in an array, with $day being the key. If $day is already in the array, then don't insert, else, insert. Then print the output array.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Welcome to Daniweb Amanda!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb !

nav33n 472 Purple hazed! Team Colleague Featured Poster

As far as I can see, both are coming from the same query.

SELECT a.strLodgeName, a.intLodgeNumber, a.strDistrictName, a.strLodgeWEB, a.strLodgeCounty, a.dtChartered, a.strLodgeMailingAddress, a.strLodgeMailingAddress2, a.strLodgeMailingCity, a.strLodgeMailingStateCode, a.strLodgeMailingPostCode, a.strLodgeEmail, a.strLodgePhone, a.strLodgeFax, a.strDrivingDirectons, a.dtMeetingTime, a.dtMealTime, a.strFloorSchool, a.strLodgeNews, b.strOfficerTitle, b.strFirstName, b.strLastName, b.BusinessPhone, b.PersEmail FROM tblLodges a LEFT JOIN tblOfficers b ON a.lngLodgeID = b.lngLodgeID WHERE a.intLodgeNumber=$id GROUP BY a.strLodgeName LIMIT 50

. Check if your query is returning the rows you want to use. As far as I know, when you are using the resultset in the first while, the pointer will be pointing to the last record. So, I dont think in the second while loop, the recordset will remain the same.
Well, execute the query again before the second while. ie., $query=mysql_query("your query");
and use the while loop.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I think

if ($daybooked == 1){
      $mycol = '#FFFF00';
      }
      else{
      $mycol = '#FFFFFF';
      }
  print sprintf('<td align="center" bgcolor="'.$mycol.'">&nbsp;'.$day.'&nbsp;</td>',$day); 

should be inside the while loop. It will obviously show the recent entry, because, its executed only after the while loop is executed. So, it will have only the last $daybooked value. Put it inside while loop and try again..

nav33n 472 Purple hazed! Team Colleague Featured Poster

yea if nav33n can learn it anyone can

:P Thats so true! lol..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Are you storing the path of the uploaded image in the table? If yes, you can do as I have mentioned above. If you aren't storing the path in the table, then you need to opendir , readdir and then unlink the files. See example 2 of readdir. Instead of echo-ing, you can unlink.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Or, you have to make php parse the files with html extensions. Add AddType application/x-httpd-php .html to your httpd.conf file of apache. It will parse html files as php.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

But I wasn't sure if anyone can learn php without programming knowledge because a friend of mine said one needs programming knowledge to proceed to php learning. Thanks for clearing my doubt.

Well, You should know the basics of any programming language, like, loops, conditions, etc. But php is VERY easy to learn. Anyone can learn it !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Check this out. This isn't php refresh. But meta refresh. You can use this to refresh your page. Or even javascript location.href .