import glob import os os.chdir("/home/suraj/Downloads/Reviewers/") filename_arr={} i=0 for files in glob.glob("*.php"): filename_arr[i] = files i= i+1 print i; c=0; for key,value in filename_arr.items(): e=open("Reviewers/"+filename_arr[c],"w") print "name of opened file for writing" print filename_arr[c]; f=open(value,"r") j=0 while True: l=f.readline() l1=len(l) e.write(l) if l1 >= 7: if l[1]=="/" and l[2]=="h" and l[3]=="t" and l[4]=="m" and l[5]=="l": print "end reached break run" break if j==7: e.write("$expireAfter = 30;\n //Check to see if our ""last action"" session\n//variable has been set.\nif(isset($_SESSION['last_action'])){\n//Figure out how many seconds have passed\n//since the user was last active.\n$secondsInactive = time() - $_SESSION['last_action'];\n//Convert our minutes into seconds.\n$expireAfterSeconds = $expireAfter * 60;\n//Check to see if they have been inactive for too long.\nif($secondsInactive >= $expireAfterSeconds){\n//User has been inactive for too long.\n//Kill their session.\nsession_unset();\nsession_destroy();\nheader(""Location: login_page.php"");\n}\n}\n//Assign the current timestamp as the user's\n//latest activity\nelse{\n$_SESSION['last_action'] = time();\n") # break if j==19: e.write("") j=j+1 # e.write("\n") # e.write(str(c)) # e.write("\n") e.close() f.close() c=c+1 print c