Jump to content

pranshu82202

Members
  • Posts

    125
  • Joined

  • Last visited

    Never

Everything posted by pranshu82202

  1. you are not getting me guyzz... i am saying that if my website is opened in any users X browser (but not doing anything on it from several hour) and user Y want to send a PM to user X only if Y knows that X can instanty reply to it...... then how would user Y came to know that user X is online..
  2. thanx mjdamato but what if the user is sleeping and he is online (means the website is open for an hour or two)....
  3. dude you really suck.... is anyone here other then flappy_warbucks....
  4. I want to know how can i check wether the user is online on my website or not....
  5. Yeah thats true.. whenever user leaves the site the session expires.... But what if the user opened the website and leave it... then for how much time session will be valid.... And how can i change its time.... that after 5 min when user will refreshed he logged in will he will be logged out.....
  6. If i use session in my php code then for how much time the session will be valid... And how can i change the length of the session...
  7. ya i got the answer, actually the error was in othe included file... Sorr for not marking the topic as solved Thanx for your assistance
  8. mat30000 its still their... I copie all my code in notepad++ and then ran it but the error was still their... What to do
  9. i Have a php code... <?php session_start(); if(@$_SESSION['ls']!=="loggedin" ) { header('Location: login.php'); die (" "); } if($_GET['via']=="pre_pass") { $prepass=$_POST['currentpassword']; $newpass=$_POST['newpass']; $renewpass=$_POST['renewpass']; /*$answer=$_POST['answer']; &newpassword=$_POST['newpassword']; */ if($prepass!=NULL && $newpass!=NULL && $renewpass!=NULL ) { if(strlen($prepass)==0 || strlen($newpass)==0 || strlen($renewpass)==0) { session_start(); $_SESSION['status']="Please fill out all the fields"; header('location:change_password.php?via=previous_password'); die(" "); } if(strlen($prepass)<6 || strlen($newpass)<6 || strlen($renewpass)<6) { session_start(); $_SESSION['status']="All fields must have atleast 6 characters"; header('location:change_password.php?via=previous_password'); die(" "); } if(strcmp($newpass, $renewpass)!=0 && strlen($prepass)>=6 && strlen($newpass)>=6 && strlen($renewpass)>=6 ) { session_start(); $_SESSION['status']="New password does not match with each other"; header('location:change_password.php?via=previous_password'); die(" "); } if(strcmp($prepass, $newpass)==0) { session_start(); $_SESSION['status']="New password and Previous Password must be different"; header('location:change_password.php?via=previous_password'); die(" "); } mysql_connect ("localhost:3306", "feadmin1","lycosanmamba" ) or die ('Error connecting database'); mysql_select_db ("fe_user_info"); $reguserpassword = stripslashes($prepass); $reguserpassword = mysql_real_escape_string($reguserpassword); $newpass = stripslashes($newpass); $newpass = mysql_real_escape_string($newpass); $sql = "select * from user_info where id='$_SESSION[id]' and password='$reguserpassword'"; $res=mysql_query($sql); $count=mysql_num_rows($res); if($count=='1') { $query= "UPDATE user_info SET password='".$newpass."' WHERE id='$_SESSION[id]'"; mysql_query($query); session_start(); $_SESSION['status']="Password Successfully Changed"; $_SESSION['mail']="positive"; include("mail/pasword_change_verify_mail.php"); header('location:change_password.php?via=previous_password'); die(" "); } if($count!='1') { session_start(); $_SESSION['status']="Password you entered does not match with our records"; header('location:change_password.php?via=previous_password'); die(" "); } } } if($_GET['via']=="sec_ques") { $answer=$_POST['answer']; $newpassword=$_POST['newpassword']; if($answer!=NULL && $newpassword!=NULL) { include('db_connectivity.php'); $sql2 = "select * from user_info where id='$_SESSION[id]' and security_answer='$answer'"; $res2=mysql_query($sql2); $count2=mysql_num_rows($res2); if(strlen($newpassword)<6) { session_start(); $_SESSION['status']="Password must have atleast 6 characters"; header('location:change_password.php?via=security_question'); die(" "); } if($count2=='1') {include('db_connectivity.php'); $newpassword = stripslashes($newpassword); $newpassword = mysql_real_escape_string($newpassword); $query= "UPDATE user_info SET password='".$newpassword."' WHERE id='$_SESSION[id]'"; mysql_query($query); session_start(); $_SESSION['status']="Password Successfully Changed"; $_SESSION['mail']="positive"; include("mail/pasword_change_verify_mail.php"); header('location:change_password.php?via=security_question'); die(" "); } else { session_start(); $_SESSION['status']="Answer to this security question is incorrect"; header('location:change_password.php?via=security_question'); die(" "); } } } ?> but when i run this code it shows me the error.. Warning: Cannot modify header information - headers already sent by (output started at C:.................................:2) in C:\...............................\verify_change_password.php on line 118 CODE BETWEEN LINE 110-120 is $newpassword = mysql_real_escape_string($newpassword); $query= "UPDATE user_info SET password='".$newpassword."' WHERE id='$_SESSION[id]'"; mysql_query($query); session_start(); $_SESSION['status']="Password Successfully Changed"; $_SESSION['mail']="positive"; include("mail/pasword_change_verify_mail.php"); header('location:change_password.php?via=security_question'); die(" "); } and code of tp 5 line is : <?php session_start(); if(@$_SESSION['ls']!=="loggedin" ) { header('Location: login.php'); die (" "); }
  10. I ahve a php page passwordchange.php.. I want that if a user goes to url passwordchange.php?via=security_question some html input fields will be shown And when user goes to url passswordchange.php?via=previous_password Some other input fields will be shown.. Basically i want to put a lot of html code in php's if statement <?php if($_GET['via']=="security_question") // LOT OF HTML DATA ?> <?php if($_GET['via']=="previous_password") // LOT OF HTML DATA ?> How sould i use html inside php...???
  11. Well i have a php script which i use to upload jpg or gif images only... I want that whenever user uploads an image of any resolution my script transforms it to 100*100 resolution.. What should i do... Here is my PHP Script... $_FILES["file"]["name"]=$_SESSION['id'].".jpg"; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { /* echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; */ if (file_exists("upload/" . $_FILES["file"]["name"])) { echo " You have already uploaded your profile pic..."; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); //rename("/upload/" . $_FILES["file"]["name"], "/upload/" . $_SESSION['id'] ); $_SESSION['result']="PROFILE SETUP SUCCESSFULL"; header('location:members.php'); } } } else { echo "Invalid file"; } }
  12. I am working with a insert query... $query="INSERT INTO user_info_more (website) VALUES ('".$website."') WHERE id='$_SESSION[id]'"; mysql_query($query) or die ('Unable to register an account with following details 1'); but the output is " Unable to register an account with following details 1" Basically i have a row with 6 cloumns in mysql database in which only the id column and name column is filled... Now i want to insert $website in the "website" column of the database... Neither i can update as the website column initially is null... I do not know what to do.... A lot of cnfusion
  13. // FILE uploading code if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { // $_FILES["file"]["name"]=$_SESSION['id']; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); $_SESSION['result']="SUCCESSFULLY UPDATED YOUR PROFILE"; header('location:members.php'); } } } else { echo "Invalid file"; } }
  14. I have a file upload script which is working fine but i want to change the name of the uploaded file to a session varible $_session['id']... WHat should i do... I tried to do it by writing the following the following code.... $_FILES["file"]["name"]=$_SESSION['id']; But by this i looses the file extension... File can be of nay type... (.pdf, .jpg, .gif, .png) -pranshu.a.11@gmail.com
  15. NO errors, but instead of the image file i am getting upload.php script in my upload folder..... :confused: :confused:
  16. Well the name on the server is in lowercase... I just writed down their inUppercase to highlight it....
  17. I using an upload script to upload image files... but the script is not working. I have created a folder named UPLOAD at same location where the file is present. But my upload script is just creating a copy of upload.php script only but not the actual image. My code is given below : if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000000)) { if ($_FILES["file"]["error"] > 0) { //echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { /* echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; */ // $_FILES["file"]["name"]=$_SESSION['id']; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); $_SESSION['result']="SUCCESSFULLY UPDATED YOUR PROFILE"; header('location:members.php'); } } } else { echo "Invalid file"; } } What should i do.... Do i need to have some folder to store temporary files.... ????
  18. @AyKay47 : I dont want to use a session because i am destroying the session at the end of page1.php but i want to take $var much more ahead.. And i dont think that their is a way to destroy only some session... As i will apply session_destroy() all running session will destroy.....
  19. KIRA i know these GET and POST method... But my question in little bit defferent... Suppose I have a php page page1.php with following code : <?php $var ="Hello WOrld" header('location : page2.php'); ?> ANd their is page 2 page2.php <?php echo $var; ?> This is not working and i dont want to initiate a session on page1.php .. What should i do >...
  20. Is their any way to take a variable (declared in a page 1) to another page... I dont want to use it as a session variable... -pranshu.a.11@gmail.com
  21. i Have two page login.php and verify.php In login.php user is entering Username and Password and in the action of the form i am writing verify.php. If verification is a success then i will start a session() session_start(); $_SESSION['ls']="loggedin"; // ls stands for login status $_SESSION['id']=$row['id']; $_SESSION['user_name']=$row['user_name']; $_SESSION['email']=$row['email']; header('location : members.php'); die (" "); and will redirect them to members.php .... Everything is working fine... But in login.php i have written a code on the top... <?php if(isset($_SESSION['ls']) && isset($_SESSION['id']) && isset($_SESSION['user_name']) && isset($_SESSION['email']) ) { header('location:members.php'); die(" "); } ?> I want if a session is started and if user will access login.php they will automatically go to members.php But this script is not working... Iam not getting whats the problem... also i m not getting any error login.php or anything CODE WRITTEN ON THE TOP OF members.php IS : <?php session_start(); if(@$_SESSION['ls']!=="loggedin" ) // Checks if the person has done stage one (Registration.php) { header('Location: login.php'); //If they haven't done it, it sends them back. die (" "); } ?>
  22. Yup cyberRobot as security point of view i am completely agree with you...
  23. mjdamto i am not storing password as md5 hash in my database because i wont be able to know that what the password was... And i dont think that their is something ANTI MD5
  24. Yup moderator... I tried it, the code written is correct ... Let me explain it to you.. The variable $userpass is already an md5 hash of the some string ... Now that string is stored in my databse.. Now to get the id associated with that string i need to write Select * from user_info where md5(user_pass)='$userpass'; And now my code is working fine i just made a silly mistake, the table name was actually user_info1 .. btw THANX everyone
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.