nav33n 472 Purple hazed! Team Colleague Featured Poster

I have done that i replaced image with login button but still the problem is same . have u seen the file myindex.php file is code right that there are some td and tr in capital . Is there can be any problem or submit button having value like login2 and we are just checking it like $_SESSION. Is this can be probem for firefox or not.

If we will have to wait any another person who can solve our problem.
Thanks,
Gagan

No.. td and tr is not the cause of your problem. I am trying to create the exact scenario and I see your problem.. The problem is with
window.location="hoa.php?login=T";
Internet explorer is able to retain the sessions while firefox is failing to. I am not sure why it (Firefox) is able to save certain session variables and not all.. To see what I am talking about, check these scripts.
This is myindex.php (Don't overwrite your file. This is just a dummy file, so save it in a new location).

<?php 
session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Login -  Ward, Damon and Posner, P.A.</title>
<meta name="keywords" content="">
<meta name="description" content="">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="/stylie.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.inputbox {border:1px solid #dfdfe3}
.inputbox1 {border:1px solid #dfdfe3; height:22px;}
-->
</style>
</head>
<DIV class=statusmessage dir=ltr></DIV>
<script language="javascript">
<!--
function validate(form) 
{	if (form.user.value=="")
	{	alert("User Name cannot be blank. Please enter it.");
		form.user.focus(); return false;
	} …
nav33n 472 Purple hazed! Team Colleague Featured Poster

@vinothkumarc, The OP fixed the problem himself using the function number_format. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Try replacing the image button with a submit button. If that solves the problem, then you know where the problem is.. :S If that doesn't fix the problem, then, we should wait for someone with eagle's eye to find where the problem is.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$reg = '/<h2>(.*)<\/h2>/s';
$fulltext="<h1>Welcome</h1> <h2>Welcome to this website</h2> <p>Some text here. </p>";
preg_match($reg,$fulltext,$matches);
print $matches[1];
?>

This will do.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Woah! I asked for relevant code, not the whole code. But anyway, You can proceed step by step to check what is actually happening. You can start off by echoing the mysql query to see what the query returns and then what values are being assigned to the session variables.
Strangely, when I login, Internet explorer says Welcome : Versailles where as Firefox says Welcome : Deutsche Bank .
I am stumped too!

nav33n 472 Purple hazed! Team Colleague Featured Poster
if($_POST['list1']=='m2'  && $_POST['list2']=='m3') {
//show from table1
}
elseif($_POST['list1']=='m3' && $_POST['list2']=='m2') {
 //show from table1
} else {
 //some other option was selected
}

Unless you have some logic to know what to do on selection of particular option, you have to build your script with alot of if's and else.
And please, next time, use [code] tags to wrap your code.

Btw, Your form method is GET. $_POST will not work.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Without relevant code, it is next to impossible to know what is going wrong.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I don't think that this is the cluture here.
ppl here don't like you using pirate copies or rapidshare pirate downloads.

ppl in the different communities are behave very differently so this
is not a good community to share them in public. Go somewhere else if you wanna to find warez and cracks.

Does this post make any sense ? Who is trying to find warez and cracks ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

And how is that...

I asked the same question, on another forum, and i just got a pretty decent, and well explained reply.... Unlike yours...
What a sad misrepresentation you are for this awesome website....

Why don't you share that reply with the members of this awesome website ? Let serkan sendur and ShawnCplus also know what you were looking for.

nav33n 472 Purple hazed! Team Colleague Featured Poster

by the way you usually save my ass adding to my reputation points, rashakil fool needs to wait a week to deduce your one contribution.

Stop calling him Rashakil fool, maybe he will stop the 'war of words' too! ;)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Honestly, that is a very very badly written script. Get a good editor, like Netbeans, indent the code, see where it highlights error and most importantly, don't mix php and html. Then you would be able to fix the problems easily !
Again, Indent your code. It really helps.
Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Most of the time (like 99% of the time), people tend to forget how important it is to sanitize the user's input. Using mysql_real_escape_string will prevent sql injections by escaping ' and /.

nav33n 472 Purple hazed! Team Colleague Featured Poster
$result = mysql_query("select * from table where bookingid='blahblah'");
if(mysql_num_rows($result) > 0) {
//delete booking id
} else {
 //booking id doesn't exist
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Your Brain Usage Profile:

Auditory : 66%
Visual : 33%
Left : 58%
Right : 41%

Naveen, you are mildly left-hemisphere dominant while showing a slight preference for auditory processing. This overall combination seems to indicate a well-working blend of logic and judgment and organization, with sufficient intuition, perception and creativity to balance that dominance.

You will at times experience conflict between how you feel and what you think which will generally be resolved in favor of what you think. You will find yourself interested in the practical applications of whatever material you have learned or whatever situation you face and will retain the ability to refine whatever knowledge you possess or aspects of whatever position you are in.

By and large, you will orient yourself toward intellectual activities and structure. Though not rigid, you will schedule yourself, plan, and focus on routine and continuity of operations, rather than on changes and disruptions

When changes or disruptions occur, you are likely to consider first how to ensure that such disruptions do The same balance is reflected in your sensory preference. You will tend to be reflective and measured in your interaction style. For the most part, you will be considered objective without being cold and goal-oriented while retaining the capacity to listen to others.

Preferentially you learn by listening and maintaining significant internal dialogues with yourself. Nevertheless, you have sufficient visualization capabilities to benefit from using graphs, charts, doodles, or even …

nav33n 472 Purple hazed! Team Colleague Featured Poster

The simplest way to validate username and password is to query the table with both username and password and see how many rows it returns. For example,

$query = "select * from table where username='$username' and password='$password'";
$result = mysql_query($query);
if(mysql_num_rows($result) == 1) {
 //echo valid user
} else {
 //echo invalid user
}

In your script, I don't see a need why you need a while loop. Since the usernames are unique and 1 username returns only 1 record, there is no need for a while loop. The rest of the script looks okay..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Evolution according to Fat boy slim ;)

nav33n 472 Purple hazed! Team Colleague Featured Poster

The simplest answer to your question is, No. Its not possible to disable 'back' button of the browser.
As far your question is concerned, When the user logs in, you can set a session variable, say, $_SESSION['validuser'] = true; And on every page, check if $_SESSION is true. If its empty or anything but true, redirect him to the login page. When the user clicks logout button, unset the session.

nav33n 472 Purple hazed! Team Colleague Featured Poster

GAH! Just realized how old this thread is, how did it get resurrected?!:-O

;) Someone read the Book of the dead I suppose !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Pretty simple. Check this example.

<?php
if(isset($_POST['submit'])) {
	$string = nl2br($_POST['textarea']);
	echo $string."<br />";
	echo substr_count($string, "<br />");
}
?>
<html>
<body>
<form method='POST'>
<textarea rows="30" cols="30" name='textarea'>
</textarea>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

I am using nl2br function to convert newline to <br />. Then I am counting how many <br />'s are present in the sting. This would give the count of the "Enter" pressed by the user.
Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$con = mysql_connect("localhost","root");
mysql_select_db("test");
$string = "'this is an example with \ \ .... And It\'s working!";
echo mysql_real_escape_string($string);
?>

Try this example and see yourself :) While using mysql_real_escape_string, you don't have to strip the slashes. But yeah, If you want, you can convert the value using htmlspecialchars or htmlentities. This will convert >, <, etc to &gt; &lt; etc...

nav33n 472 Purple hazed! Team Colleague Featured Poster

mysql_real_escape_string does all the above. What exactly it does is, it will escape all the single quotes as well as slashes. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
<input type='text' name='name' value=<?php echo $_REQUEST['name']; ?>>

When the submit button is pressed and if the captcha is wrong, it will still show the posted values.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use error_reporting(E_ALL ^ E_NOTICE); on top of your script (after session_start).

nav33n 472 Purple hazed! Team Colleague Featured Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster

the submenu just stays out...

I tried your code and it works perfectly ! The only thing I changed was,

<script language="Javascript" type="text/javascript">

which earlier was,

<script language="Javascript" type="javascript/text">

I haven't seen anyone using javascript/text :-/

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi

I seem to be getting this error on the reply section of my forum. I've never had this problem before and have tried google but found nothing. So, now i turn to daniweb, surly someone must be able to help me here.

This is the error:
Warning: Wrong parameter count for mysql_query() in C:\wamp\www\Rhinos 2\2nd\reply.php on line 79

The code on like 79 is :
mysql_query($insertpost) or die(mysql_query());

And this is my full code:

<?php

print "<table class='maintables'>";

print "<tr class='headline'><td>Reply</td></tr>";

print "<tr class='maintables'><td>";

if(isset($_POST['submit']))

{
   $yourpost=$_POST['yourpost'];
   $id=$_POST['id'];

if(strlen($yourpost)<1)
{

print "You did not type in a post."; //no post entered

}
else
{

$thedate=date("U"); //get unix timestamp

$displaytime=date("F j, Y, g:i a");

//we now strip HTML injections
$name = @strip_tags($name);

$yourpost=strip_tags($yourpost); 

$name = $_SESSION['name'];
$insertpost="INSERT INTO forum(author,post,showtime,realtime,lastposter,parentid) values('$name','$yourpost','$displaytime','$thedate','$name','$id')";

mysql_query($insertpost) or die(mysql_query()); //insert post

$updatepost="Update forum set numreplies=numreplies+'1', lastposter='$name',showtime='$displaytime', lastrepliedto='$thedate' where postid='$id'";

mysql_query($updatepost) or die("Could not update post");
print "Message posted, go back to <A href='message.php?id=$id'>Message</a>.";

}
}
else
{
   $id=$_GET['id'];
   print "<form action='reply.php' method='post'>";
   print "<input type='hidden' name='id' value='$id'>";
   print "Your message:<br><br>";
   print "<textarea name='yourpost' rows='5' cols='40'></textarea><br><br>";
   print "<input type='submit' name='submit' value='Post Reply'></form>";
}
print "</td></tr></table>";
?>

end quote.

You are a member of Daniweb since July 2007 and you still don't use code tags. Think before you submit a post. Read the guidelines again if you have forgotten them.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Without submitting the page, You can't get the selected option's value in php. However, in Javascript, you can access it.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Instead of having separate names for checkbox, use checkbox array and assign different values to it. When you click on the submit button, only those checkboxes which were checked would be posted. You can then use a foreach loop to get what was checked.

print_r($_POST['checkboxname']) //will print the array of checkboxes checked.

The problem with naming them individually is, for every checkbox, you have to check if it is set and if it has a value !
ie.,

if(isset($_POST['tank'])) {
 //statements
}
if(isset($_POST['defcon'])) {
 //statements
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Yeah! Copy the script that I have posted above. It surely worked for me. In the script that you have posted, comments and 'non-comments' are totally mixed up.

nav33n 472 Purple hazed! Team Colleague Featured Poster

My first post was in Community Introduction forum. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Thats awesome! Cheers!

nav33n 472 Purple hazed! Team Colleague Featured Poster

well....I could do it..as you can see in my code
but
its not working in Firefox...

I can't. Your code doesn't seem to work on FF as well as IE on my computer. :-/ What do you mean by its working btw ?What is the script intended to do ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

[tex]

:)

nav33n 472 Purple hazed! Team Colleague Featured Poster

:S I don't think you can enable/disable a "div".

nav33n 472 Purple hazed! Team Colleague Featured Poster

I also assume the OP means showing and hiding of the div, but based upon the status of the checkbox.

I figured out that much though! And also I managed to make some quick changes to his existing script. It works on both IE and firefox! @OP, Is this what you were looking for ?

<html>
<head>
<script type="text/javascript">
		function disableAddressBook() 
		{
			toggleAddBook(document.getElementById("addBook"));
		}
		function toggleAddBook(abc) 
		{	//var abc.childNodes[0];
			if ((document.getElementById("chkRecipeBook").checked)&&(abc.style.display == 'none'))
			{
				abc.style.display = 'block';
				if (abc.childNodes && abc.childNodes.length > 0) 
				{
					for (var x = 0; x < abc.childNodes.length; x++) 
					{
						toggleAddBook(abc.childNodes[x]);
					}
				}
			}
			else if (!(document.getElementById("chkRecipeBook").checked)&&(abc.style.display == 'block'))
			{
				abc.style.display = 'none';
				if (abc.childNodes && abc.childNodes.length > 0) 
				{
					for (var x = 0; x < abc.childNodes.length; x++) 
					{
						toggleAddBook(abc.childNodes[x]);
					}
				}
			}
		}
	</script>
	</head>
	<body>
	<div id="rBookAddress">
		<h5 class="instructions">
		<input type="checkbox" name="chkRecipeBook" id="chkRecipeBook" onclick="javascript:disableAddressBook();" />Please enter your address details to receive your Free Recipe Book:
		</h5>
		<div style='display: none;' id="addBook">
		  <p>Something here!!!</p>
		</div>
</div>
</body>
</html>

P.S. I didn't bother to look at what those loops do in that function.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<html>
<head>
<script type="text/javascript">
function validateCB(loctext)
 {
  if(document.rec.loc.value=='')
   {
   	 loctext.innerHTML = "please select one option";
    return false;
   } 
   else
    return true;
  }


function validatePID(inputfield, helptext)
 {
  if(inputfield.value.length !=9){
    if(helptext != null)
     helptext.innerHTML = "please enter excatly 9 digits";
     return false;
   }
  else
   {
     if(helptext != null)
     helptext.innerHTML = "";
     return true;

  }
}

</script>

</head>

<form method = "post" action="rec.asp" id="rec" name="rec">
<table>
 <tr>
 <td>
  <input id='pid' name='pid' onblur="validatePID(this,document.getElementById('pid_help'))">
  <span id ="pid_help" class="help" > </span> <br> <br>
</td>
</tr>
<tr>
<td>
<select id='loc' name='loc' onblur="validateCB(document.getElementById('loc_help'))">
<option value = '' selected> select location </option>
<option value = 'abcd'> abcd </option>
<option value = '1234'> 1234 </option>
</select><span id="loc_help"> </span>
</td>
</tr>
</table>

</form>
</html>
nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

@OP, Is it even possible to disable/enable a div tag ?

<div class="extensiondatacapture" id="addBook">
toggleAddBook(document.getElementById("addBook"));
if ((document.getElementById("chkRecipeBook").checked == false)&&(abc.disabled == false))

nav33n 472 Purple hazed! Team Colleague Featured Poster

Before i propose any other solutions, did you try removing the <b></b> tags from this line: <input type="checkbox" name="chkRecipeBook" id="chkRecipeBook" onclick="javascript<b></b>:disableAddressBook();" /> ?

mschroeder, That is a bug with code-tags. I have even posted a thread for the same (<b></b>) here.

nav33n 472 Purple hazed! Team Colleague Featured Poster

It shouldn't. Can you post the table structure as well as some test data ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Then change $img_src to "./upload/image/";

nav33n 472 Purple hazed! Team Colleague Featured Poster

Sorry! I don't have a sample example. But this example is the closest I could find.
http://www.w3schools.com/php/php_ajax_suggest.asp
In the example, onkeyup event is used, which calls the ajax function whenever a key is pressed (and give suggestions). Instead, you can have onclick event, which will call the ajax function, which checks the user's IP and update the count.

nav33n 472 Purple hazed! Team Colleague Featured Poster

In the script (the url), check if the user is a unique user (by checking his IP address). If he is a unique user, update count. :-/ You can't call a javascript event (onclick) to update the table. You can try the same with Ajax though.
ie., Onclick, call the ajax function, check the user's IP and then update the table if he is a unique user.

nav33n 472 Purple hazed! Team Colleague Featured Poster

What if 2 people (authors) have the same name ? :S Its never a good thing to query the table on fields like name.
But anyway, you can do it this way (but I don't recommend it :) )

$query = "select * from authors where name='".$author."'";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0 ) {
//an entry for this name exists in the table
$row = mysql_fetch_array($result);
$id = $row['id'];
} else {
$query = "insert into authors (name) value ('".$author."')";
mysql_query($query);
$id = last_insert_id(); //get the last inserted id from an auto increment field
}
echo "ID is: ".$id;

Again, there can be more than 1 person with the same name.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Where have you placed your script ? Which folder is it in ? Give the exact path.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Where have you placed your script ? In which folder ?

Did you check the above script I gave you ? Did you try replacing $img_src="./images/"; with your path ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Now I need to check whether the user must enter minimum 6 letters in the box.

Use length .

if(form.username.length < 6) {
 alert('Username less than 6 characters..');
}

Btw, I don't understand your code. What will with (contact) { will do ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome.. Cheers man!

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php	include 'dbcon.php';?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>DISPLAY IMAGES</title>
</head>
<body>
<form action="display.php" method="post">
<?php 
include 'aindex.php';
$qry = "select * from tbl_album order by 'image_name'";
$rst=mysql_query($qry,$con);
$img_src="./images/";
//$dir ="../display/uplaod/";  
$filename=basename($_FILES['uploadfile']['name']);        
$handle = opendir ("$img_src");?>
<table width="70%" cellpadding=" 5px " cellspacing="45" align="center" id="index">
<?php
$cnt=0;
while (false !== ($file = readdir($handle))) {
	if($file != "." && $file != ".." && $file != basename(__FILE__)) {
	  if(preg_match('/.*\.(.*)/',$file,$result)){
   		$ext = $result[1];
	  }
	  if($file != ""){
		if($ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png'){
	    	if($cnt == 0){
				 echo '<tr>';						
			}
			echo '<td><img src="'.$img_src.$file.'"/><br/>'.$file.'</td>';
			if($cnt == 2){
				 echo "</tr>";
				 $cnt=0;
	 		} else {
				 $cnt++;
			}
		}
	}
	if($filename != "")				 
		echo '<img src="'.$img_src.$filename.'"/>';            
	}
}
?>
</table>
<?if(!rst){
 die("error"  .mysql_error());
 }
mysql_close($con);
?>
</form>
</body>
</html>

:icon_rolleyes: Change $img_src to the folder which has images. And make sure you have given the right path.
I have this script in www folder and images is a folder in www.

P.S It works for me. So, if it doesn't work for you, then it has to be the path.

nav33n 472 Purple hazed! Team Colleague Featured Poster

i have a code like this

select * from tableX group by fieldA order by fieldB

this code sort according to fieldA. but i need to sort according to fieldB.

please help me ??

You should have started a new thread. But anyway, Your query is fine and it should sort on fieldB. Try using ASC or DESC with the query to double check. :)
ie.,

select * from tableX group by fieldA order by fieldB ASC