Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 09-03-2007, 02:16 AM session problem
rubadevi's Avatar
Experienced Talker

Posts: 36
Name: lakshmi
Trades: 0
hi, this coding work in localhost but not working in FTP the session variable not carring the page.

<?php
session_start();
if ((isset($_SESSION['username']) &&
$_SESSION['username'] != "") ||
(isset($_SESSION['password']) &&
$_SESSION['password'] != ""))
{
$name=$_SESSION['username'];
echo "<b>".$name."</b>";
echo "<a href='logout.php'>(Logout)</a>";
}

?><form action="logged.php" method="post">
<table align="left" style='margin-left:32.5%'>
<!-- START:Login form -->
<tr><td ><input type="text" name="username" size="20" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';"><br>
<input type="password" name="password" size="20" value="Password" onfocus="if (this.value == 'Password') this.value = '';">
</td>
<td align="center"><input type="submit" name="submit" value="Log In" src="image/go.gif"></td>
</tr>

</table>
</form>
<!-- END:Login form -->
rubadevi is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-03-2007, 01:10 PM Re: session problem
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Try changing the '&&' or a 'or'.
PHP Code:
<?php
session_start
();
if ((isset(
$_SESSION['username']) or $_SESSION['username'] != "") || (isset($_SESSION['password']) or $_SESSION['password'] != ""))
{
$name=$_SESSION['username'];
echo 
"<b>".$name."</b>";
echo 
"<a href='logout.php'>(Logout)</a>";
}

?><form action="logged.php" method="post">
<table align="left" style='margin-left:32.5%'>
<!-- START:Login form -->
<tr><td ><input type="text" name="username" size="20" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';"><br>
<input type="password" name="password" size="20" value="Password" onfocus="if (this.value == 'Password') this.value = '';">
</td>
<td align="center"><input type="submit" name="submit" value="Log In" src="image/go.gif"></td>
</tr>

</table>
</form>
<!-- END:Login form -->
I'm not sure why it would not work in your ftp, but on your localhost. I would assume because sessions tend not to be destroyed in localhosts.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 09-03-2007 at 01:11 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 09-03-2007, 01:11 PM Re: session problem
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
try this ur if isnt correct

PHP Code:
<?php
session_start
();
if ((isset(
$_SESSION['username']) &&
$_SESSION['username'] != "" ||
(isset(
$_SESSION['password']) &&
$_SESSION['password'] != "")
{
$name=$_SESSION['username'];
echo 
"<b>".$name."</b>";
echo 
"<a href='logout.php'>(Logout)</a>";
}

?><form action="logged.php" method="post">
<table align="left" style='margin-left:32.5%'>
<!-- START:Login form -->
<tr><td ><input type="text" name="username" size="20" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';"><br>
<input type="password" name="password" size="20" value="Password" onfocus="if (this.value == 'Password') this.value = '';">
</td>
<td align="center"><input type="submit" name="submit" value="Log In" src="image/go.gif"></td>
</tr>

</table>
</form>
<!-- END:Login form -->
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 09-04-2007, 01:12 AM Re: session problem
rubadevi's Avatar
Experienced Talker

Posts: 36
Name: lakshmi
Trades: 0
it isn't working. how to set the session path
rubadevi is offline
Reply With Quote
View Public Profile
 
Old 09-04-2007, 06:43 AM Re: session problem
Experienced Talker

Posts: 44
Name: Kuldeep Sahi
Trades: 0
You will find information about session path at

http://www.php.net/session_save_path
__________________

Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE
Kuldeep2195 is offline
Reply With Quote
View Public Profile Visit Kuldeep2195's homepage!
 
Reply     « Reply to session problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15493 seconds with 12 queries