I need help with my code please..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Alidad
Forum Commoner
Posts: 29
Joined: Thu Mar 29, 2007 12:42 pm

I need help with my code please..

Post by Alidad »

Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Please copy this code and run on your editor and see preview, as you can see when you type user name and it will show [b]text type writer [/b]after press enter, these code is under javascripts. 

Now I want to add or change to session variable in php code with this source code, for sample if person log in by type the user name in "log.php" and redirect to home page "index.php" to show "Welcome [user_name]", I need help with session variable in php with this javascript code to show [b]text type writer [/b]in home page after they log on?

please help!

see code in bottom:


[syntax="html"]<html> 
<head> 
<title>Decrypting Text Effect</title> 
<style> 
a:visited{color:black;font-family:verdana} 
a:link{color:black;font-family:verdana} 
a:hover{color:blue;font-family:verdana} 

td {color:black;font-family:verdana;font size:8pt} 
p {color:black;font-family:verdana;font size:8pt;text-decoration: none} 
h1 {color:black;font-family:verdana;font size:12pt;text-decoration: none} 
</style> 

<script language="javascript"> 
var got; 
var chars; 
function change() 
{ 
var randstring = ""; 
var rslength = chars.length - got.length; 

var decrypted = document.getElementById("decoded"); 
var encrypted = document.getElementById("encoded"); 

for(var x=0;x<rslength;x++) 
{ 
i = Math.floor(Math.random() * chars.length); 
randstring += chars.charAt(i); 
} 

if(randstring.charAt(0) == chars.charAt(got.length)) 
{ 
got += randstring.charAt(0); 
decrypted.innerHTML = got; 
} 
else 
{ 
encrypted.innerHTML = randstring; 
} 

if(chars.length > got.length) 
{ 
setTimeout("change()", 10); 
} 
else 
{ 
encrypted.innerHTML = ""; 
} 
} 
function startdecrypt() 
{ 
var decrypted = document.getElementById("decoded"); 
var encrypted = document.getElementById("encoded"); 
decrypted.innerHTML = document.getElementById("firstN").value; 
chars = decrypted.innerHTML; 
decrypted.innerHTML = ""; 
got = ""; 
setTimeout("change()", 10); 
} 
</script> 
</head> 
<body> 
Enter your name here: <input type="text" id="firstN"> 
<input type="button" onClick="startdecrypt()" value="Start"> 
<p> 
<span id="decoded">Your text goes here.</span><span id="encoded"></span> 
</p> 
</body> 
</html> 


AM


Everah | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

WOW, add some PHP tags...

No, wait a second...

That isn't PHP is JAVASCRIPT!!!!!

Wrong forum dude.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Client side pages have zero control over session variables.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Use Something Like This In Yout Php Code

Code: Select all

<input type="hidden" id="hid_usr_name" name="hd_usr_name" value="<?php echo $_SESSION['usr_name'] ?>" />
And then Track the Data on this hidden field with Javascript
Post Reply