beboo002 Posted August 21, 2007 Share Posted August 21, 2007 A problem facing i am made some php scripting in localhost(IIS) all the scripting runing but now we install apache server in my machine here php session value are not pass to another page and not giving output here i paste my login scripting <?php ob_start(); session_start(); if($_POST["submit"]!="") { $adminame = 'admin@technologies.com'; $adminpass= 'mypassword'; $a=$_POST['username']; $p=$_POST['password']; if($adminame==$a && $adminpass==$p) { header("location:admin.php"); } else { $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); if($_POST["submit"]!="") { $username1=$HTTP_POST_VARS['username']; $password1=$HTTP_POST_VARS['password']; $sql="select username,password from login where username=='".$_POST['username']."' and password=='".$_POST['password']."' "; $result=mysql_query($sql,$link); $row = mysql_fetch_array( $result ); $username = $row['username']; $password = $row['password']; header("location:bookentry.php"); //$tot=mysql_num_rows($result); if($username!=$username1 && $password!=$password1) { $msg="invalid username or password "; //z<hr> //include "notmember.php"; header("Location:memberlogin.php"); } if($username==$username1 && $password==$password1) { $_SESSION['username'] = mysql_result($result, 0, 'username'); echo $_SESSION['username']; //include "untitled-4.php"; header("location:bookentry.php"); } } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/ Share on other sites More sharing options...
vijayfreaks Posted August 21, 2007 Share Posted August 21, 2007 Hi.. first remove "==" from db query.. and if your page has redirected then check msg will be printed or not? if not then check for whether session_start() on that page or not..? Regards, Vijay Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329547 Share on other sites More sharing options...
beboo002 Posted August 21, 2007 Author Share Posted August 21, 2007 thanks for5 reply still not working Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329550 Share on other sites More sharing options...
suma237 Posted August 21, 2007 Share Posted August 21, 2007 try this <?php ob_start(); session_start(); $adminame = 'admin@technologies.com'; $adminpass= 'mypassword'; $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); if($_POST["submit"]!="") { $a=$_POST['username']; $p=$_POST['password']; if($adminame==$a && $adminpass==$p) { header("location:admin.php"); } }//end of submit if($_POST["submit"]!="") { $username1=$HTTP_POST_VARS['username']; $password1=$HTTP_POST_VARS['password']; $sql="select username,password from login where username='".$_POST['username']."' and password='".$_POST['password']."' "; $result=mysql_query($sql,$link); $row = mysql_fetch_array( $result ); $username = $row['username']; $password = $row['password']; header("location:bookentry.php"); //$tot=mysql_num_rows($result); if($username!=$username1 && $password!=$password1) { $msg="invalid username or password "; //z//include "notmember.php"; header("Location:memberlogin.php"); } if($username==$username1 && $password==$password1) { $_SESSION['username'] = mysql_result($result, 0, 'username'); echo $_SESSION['username']; //include "untitled-4.php"; header("location:bookentry.php"); } }//end of http submit ?> Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329560 Share on other sites More sharing options...
beboo002 Posted August 21, 2007 Author Share Posted August 21, 2007 i am login and bo to another page but there i am unable to print name of username which is same table in database 3 columns are (1 username 2 password 3 name ) now i am printing name code is <?php ob_start(); session_start(); echo $_SESSION['username']; $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); /////////////////////////////////////////fetch///////////////////////////// $sql1="select name from login where username='".$_SESSION['username']."' "; $result1=mysql_query($sql1,$link); $query1=mysql_fetch_array($result1); ?> and want to print here name <form><input name="name" type="text" value=" <?=query1[2]; ?>" size="25" readonly="true"></form> Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329575 Share on other sites More sharing options...
suma237 Posted August 21, 2007 Share Posted August 21, 2007 echo this statment $sql1="select name from login where username='".$_SESSION['username']."' "; check whether the select statment is working or not. Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329595 Share on other sites More sharing options...
beboo002 Posted August 21, 2007 Author Share Posted August 21, 2007 Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\abhishek\timesheet\testse.php on line 17 <?php ob_start(); session_start(); $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); /////////////////////////////////////////fetch///////////////////////////// $sql1="select name from login where username='".$_SESSION['username']."' "; $result1=mysql_query($sql1,$link); $query1=mysql_fetch_array($result1); echo "<table border=1> <tr> <th>YOUR NAME</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo $row['name']; echo "</td></tr>"; } echo "</table>"; mysql_close($link); ?> Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329623 Share on other sites More sharing options...
beboo002 Posted August 21, 2007 Author Share Posted August 21, 2007 above my fualt its woking result gives beboo Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-329627 Share on other sites More sharing options...
beboo002 Posted August 22, 2007 Author Share Posted August 22, 2007 plz help as soon as possible <?php ob_start(); session_start(); $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); /////////////////////////////////////////fetch///////////////////////////// $sql1="select name from login where username='".$_SESSION['username']."' "; $result1=mysql_query($sql1,$link); //$query1=mysql_fetch_array($result1); echo "<table border=1> <tr> <th>YOUR NAME</th> </tr>"; while($row = mysql_fetch_array($result1)) { echo "<tr><td>"; echo $row['name']; echo "</td></tr>"; } echo "</table>"; mysql_close($link); ?> gives result beboo Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-330590 Share on other sites More sharing options...
jcanker Posted August 22, 2007 Share Posted August 22, 2007 If it's not keeping session data and this is a new php install on apache, you need to make sure that the account that the internet guest is using has write access to the location of the session data that is specified in the php.ini. That will keep you from saving any session data. Have you set reporting errors to the highest level in php.ini to help determine additional error output for this? Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-330617 Share on other sites More sharing options...
beboo002 Posted August 22, 2007 Author Share Posted August 22, 2007 this is my my php ini setting plz check [session] ; Handler used to store/retrieve data. session.save_handler = files ; Argument passed to save_handler. In the case of files, this is the path ; where data files are stored. Note: Windows users have to change this ; variable in order to use PHP's session functions. session.save_path = /tmp ; Whether to use cookies. session.use_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID ; Initialize session on request startup. session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 ; The path for which the cookie is valid. session.cookie_path = / ; The domain for which the cookie is valid. session.cookie_domain = ; Handler used to serialize data. php is the standard serializer of PHP. session.serialize_handler = php ; Percentual probability that the 'garbage collection' process is started ; on every session initialization. session.gc_probability = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 1440 ; Check HTTP Referer to invalidate externally stored URLs containing ids. session.referer_check = ; How many bytes to read from the file. session.entropy_length = 0 ; Specified here to create the session id. session.entropy_file = ;session.entropy_length = 16 ;session.entropy_file = /dev/urandom ; Set to {nocache,private,public} to determine HTTP caching aspects. session.cache_limiter = nocache ; Document expires after n minutes. session.cache_expire = 180 ; use transient sid support if enabled by compiling with --enable-trans-sid. session.use_trans_sid = 1 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-330665 Share on other sites More sharing options...
beboo002 Posted August 22, 2007 Author Share Posted August 22, 2007 no one :'( Quote Link to comment https://forums.phpfreaks.com/topic/65925-session-problem/#findComment-330752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.