Jump to content
Sign in to follow this  
rootKID

how to change text on username true with jQuery oO?...

Recommended Posts

Ok, so i still work with the whole thing, but this is what i try to figure out.

 

1.

LOOK AT UPLOADED PICTURE FOR SEEING MY DESIGN! :)

 

2.

as you see, i have only made the css/html part (a danish website (own project))

 

and the box to left (with the loading-bar), a simple image.

 

I was wondering if anyone in here knew how to change the html text under it like (Data OK) or something like that if the username we got back was true and OK before moving on to the index.php page?..

 

3.

just to clarifie, it's an user-login page i am trying to figure out here :)...

 

 

4.

This is my whole takelogin.php file:

<?phprequire_once ("include/core.php");require_once ("include/password_functions.php");require_once ("include/boxes.php");get_template();dbconn();$HTMLOUT = "";//starting var...$stdhead = array(// include css	'css' => array(		'side_boxes',		'boxes_signup'	));$stdfoot = array(// include js	'js' => array());$HTMLOUT .= "<div class='wrapper_signup_div'>";//MAIN INDEX WRAPPER START...//============================//START LEFT DIV CONTAINER...$HTMLOUT .= "<div class='left_signup_div'>";$HTMLOUT .= box_start("Sender data...");	$HTMLOUT .= "<center><img src='templates/".$PF['style']."/images/login_loader.gif'></center>";$HTMLOUT .= box_end();$HTMLOUT .= "</div>";//ENDING LEFT DIV CONTAINER...//============================//============================//START RIGHT DIV CONTAINER...$HTMLOUT .= "<div class='right_signup_div'>";$HTMLOUT .= box_start();	$HTMLOUT .= "Tjekker info i databasen og sender dig videre hvis det er korrekt...<br /><br />";		$HTMLOUT .= "Hvis intet sker inden 5 sekunder, klik <a href='#'>her</a>";$HTMLOUT .= box_end();//==========RUN LOGIN PROCEDURE===============	$uname = $_POST['username']; //Form Names...	$pass = $_POST['password']; //Form Names...	if(isset($pass) !== "")	{		$passhash = md_5($pass); //*Securing The Data...	}	$query = "SELECT * FROM users WHERE username = " . sqlesc($uname) . " AND passhash = " . sqlesc($passhash) . " AND enabled = 'yes' AND status = 'confirmed'";		//exit($query); // <-- debug if the query is as it should be	$query_result = mysql_query($query)or die(mysql_error());//Running query to the DB...//$HTMLOUT .= "Username = " . $uname . "<br />";//$HTMLOUT .= "pass = " . $pass . "<br />";//$HTMLOUT .= "MD5 pass = " . $passhash . "<br />";//$HTMLOUT .= "Query = " . $query . "<br />";//$HTMLOUT .= "Query Result = " . $query_result . "<br />";	if(mysql_num_rows($query_result) > 0)//if the DB returns somfthing, then run...	{		$row = mysql_fetch_array($query_result, MYSQL_ASSOC);				if(isset($_POST['cookie_login']))		{			//$HTMLOUT .= "Cookie Login...";			logincookie($row['u_id'], $row['passhash'], true);		}else{			//$HTMLOUT .= "Session Login...";			login_session($row['u_id'], $row['passhash'], true);		}//ending else statement...		header('Refresh: 3; url=index.php');//with time delay...	}	else//Error messeage...	{		$HTMLOUT .= "<hr /><center>Enten er kodeord forkert, ellers er brugernavnet forkert...</center>";		header('Refresh: 3; url=login.php');//with time delay...	}		//header("Location: index.php");	//header('Refresh: 3; url=index.php');//with time delay...//==========RUN LOGIN PROCEDURE===============$HTMLOUT .= "</div>";//ENDING RIGHT DIV CONTAINER...//============================$HTMLOUT .= "</div>";//MAIN INDEX WRAPPER END...print stdhead('Logger ind...' , $stdhead) . $HTMLOUT . stdfoot($stdfoot);?>

Note that the PHP-LOGIN part is still being developed.. i just need to know if anyone could be helpfull and give me a smaller clue about what or where to look for a peace of jQuery code that looks like the thing i am trying to do...

 

if you dont understand me as always (lol x)), then comment, and i will try to re-explain in details and best i can.

 

-Thanks in advance as always! :)

Share this post


Link to post
Share on other sites

Why do you want to use jQuery, instead of just output a message with PHP? You're already outputting an error message, so why not output a success message also?

Share this post


Link to post
Share on other sites

hmm, you got a point...

but how? I mean, as you see in the code, i have 2 different divs, and i am loading the php-login process on the right one, and i wish the message to appear on the left one... ideas? Oo...

Share this post


Link to post
Share on other sites

Move the login code to the top, and have variables that represent text on the left and text on the right. If it's an error then add to the variable that shows it on the right, if it's not an error then put it in the variable that shows on the left. You should try to separate the program logic from the output, don't mix the two. Do all of the logic and processing first, and fill out your variables, and then do the output part.

Share this post


Link to post
Share on other sites

so just to be sure i understand.

 

1.

i move the whole login part to the top of code (LOGIN-PROCESS).

 

And if login is true, will instead of output HTMLOUT code (same as echo out), and use for instance (error / succes) variables, and then simply use an HTMLOUT on those variables on the lower code correct?

Share this post


Link to post
Share on other sites

sorry for late reply, i will try later when i'm home again.

 

-thanks :)

 

EDIT:

 

One more question, might not be related, but still...

i have uploaded an attachment for my new-user signup page.

 

As you see, i have made an example box at the left, and there i have written if anything was (example) chosen for country, or if username has written and so on.

 

If i would like to use jQuery to that part, how would i check an username text box? and same on the country part... coz country part would be a select/option list.

 

Originally i would like to use fadein/out with jQuery for the text so the user could check see live if everything was done correctly...

but if i need to check avaiable username in the database, and with jQuery... any idea of what i could do there?

 

-thanks! :)

Edited by rootKID

Share this post


Link to post
Share on other sites

Use ajax requests to send the form data to PHP for validation. You can attach events to each field, like you can send an ajax request when the field loses focus to validate the data.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...