PHP - Possible Php Bug With Fopen() And Fwrite()?
Greetings all, I'm completely stumped...so I'd like to run this issue by you guys (and gals!). I have encountered an odd issue, and I have no idea why this is doing what it's doing. When I execute the following code, all by itself, in an "index.php" file (with no other files around...completely isolated!) I get a result of "testtest" $log_file = 'all.txt'; $handle = fopen($log_file, 'a'); fwrite($handle, 'test'); fclose($handle); Note: I delete the file each time I execute the script (in a browser). I am also the only one running this script. I've tried running on PHP 5.2.x and PHP 5.3.x I have also tried on my machine as well as a separate, remote machine. Is the script running twice? If so, what's causing it? Any help is appreciated as always! Ryan Similar Tutorials$DOCUMENT_ROOT=$_SERVER['DOCUMENT_ROOT']; $outputstring = $date."\t".$tireqty." tires \t".$oilqty."oil\t".$sparkqty." spark plugs\t\$".$totalamount."\t".$address."\n"; //open file for appending @$fp = fopen('$DOCUMENT_ROOT/../orders/orders.txt', 'ab'); if (!$fp) { echo '<p><strong>Your order can not be processed at this time. Please try again later</strong></p></body></html>'; exit; } //write to file fwrite($fp, $outputstring, strlen($outputstring)); flock($fp, LOCK_UN); fclose($fp); Can someone please explain to me why this Code is giving me the error? i've tried to take out $DOCUMENT_ROOT and specify where exactly i want the file to be /dir/dir/file.txt but it still gives me an error. I'm trying to create an online web editor. It works fine for opening and writing files on the same server where the web editor is hosted, but I want it to be able to get_file_contents, fopen and fwrite files on a remote server, logging in with ftp_connect and ftp_login. I've noticed the functions ftp_get and ftp_fget but I'd rather not create another local file, if possible I want to open the remote file directly into a <texarea> then save it directly back to the remote server. Is this possible? So far I just get errors... Here's an example of the code I'm trying to combine, to retrieve the contents of a file on a remote server and put them in a <textarea>: Code: [Select] <?php $conn = ftp_connect("ftp.domain.com"); ftp_login($conn, "username", "password"); ftp_pasv($conn, true); $filename='example.php'; // open file $fh = fopen($filename, "r") or die("Could not open file!"); // read file contents $datax = fread($fh, filesize($filename)) or die("Could not read file!"); $data=htmlspecialchars($datax); // close file fclose($fh); // close this connection ftp_close($conn); echo '<textarea cols="200%" rows="50">'.$data.'</textarea>'; ?> And another failed example: Code: [Select] <?php $filename='editor.php'; $fh = fopen("ftp://username:password@domain.com/example.php", "r") or die("Could not open file!"); $datax = fread($fh, filesize($filename)) or die("Could not read file!"); $data=htmlspecialchars($datax); fclose($fh); echo '<textarea cols="200%" rows="50">'.$data.'</textarea>'; ?> I am getting a rediculous amount of errors in the log on my host saying the following but for numerous referer addresses. Code: [Select] [Wed Sep 21 12:15:32 2011] [error] [client 85.189.254.101] PHP Warning: fwrite(): supplied argument is not a valid stream resource in /home/sites/myurl.co.uk/public_html/Category.php on line 122, referer: http://www.myurl.co.uk/Category/En/Floats/ it is a simple cache system i use and it appears to work as when you view source at the bottom of the page is the comment about the file being cached and retrieved. My page code: Code: [Select] <?php $cat = $_GET["cat"]; $sub_cat = $_GET["sub"]; $language = $_GET["lang"]; $cachefile = "cache/".$cat."-".$sub_cat."-".$language.".html"; $cachetime = 60 * 60 * 400; // 5 days // Serve from the cache if it is younger than $cachetime if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) { include($cachefile); echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->"; exit; } ob_start(); // start the output buffer include("./includes/db_con.inc.php"); $page_title = $cat . " - " . $sub_cat; $sql_meta = mysql_query("SELECT * FROM sub_cat WHERE name='$sub_cat'"); $row_meta = mysql_fetch_assoc($sql_meta); $meta_desc = $row_meta['META_DESC']; $meta_key = $row_meta['META_KEY']; include("./includes/head.php"); include("./includes/header.php"); mysql_free_result($sql_meta); ?> <div id="main-page-header"> <?php $desc_sql = mysql_query("SELECT * FROM sub_cat WHERE name='$sub_cat'"); $row_desc = mysql_fetch_assoc($desc_sql); $description = $row_desc['description']; echo "<img src='$img_loc/product-pages/sub-cat-head/".str_replace(" ", "-", $row_desc['name'])."-sub-cat-head.jpg' width='940' height='310' />"; mysql_free_result($desc_sql); ?> </div> <div id="page-content"> <div id="main-page-text"> <h1><?php echo $sub_cat; ?></h1> <h2 class="crumbs"><a href="<?php echo "$url/Products/$lang/"; ?>">Products</a> > <a href="<?php echo "$url/Category/$lang/".urlencode($cat)."/"; ?>"><?php echo $cat; ?></a> > <?php echo $sub_cat; ?></h2> <p> <?php echo $description; ?> </p> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like layout="button_count" show_faces="false" width="170" font="verdana"></fb:like> <div id="related-wrap"> <h2><?php echo $sub_cat; ?> Products</h2> <?php $range_products = mysql_query("SELECT * FROM $table WHERE CATEGORY='$cat' AND SUB_CATEGORY='$sub_cat' AND display='1' ORDER BY sortID ASC"); while($row_range = mysql_fetch_array($range_products)) { $prodid = str_replace("/", "-", $row_range['PRODID']); $cat_link = urlencode($row_range['CATEGORY']); $sub_cat_link = urlencode($row_range['SUB_CATEGORY']); echo "<div class='related-products'>\n<a class='related-img' href='$url/Product/$lang/$cat_link/$sub_cat_link/$prodid/'>\n<img src='$img_loc/product-pages/Range-thmb/$prodid.jpg' width='120' height='120' /></a>\n"; echo "<h5>" . $row_range['PROD_TITLE'] . "</h5>\n"; echo "</div>\n"; } mysql_free_result($range_products); ?> </div> <div id="FAQ-wrap"><h2>Frequently Asked Questions</h2> <?php $QA_table = $lang . "_qanda"; if ($id=="") { $list_QA = mysql_query("SELECT * FROM $QA_table WHERE SUB_CATEGORY='$sub_cat' AND DISPLAY='1'") or die(); } else { $list_QA = mysql_query("SELECT * FROM $QA_table WHERE PRODID='$id' AND DISPLAY='1'") or die(); } while($row_QA = mysql_fetch_array($list_QA)) { echo "<div id='FAQ-QA'>"; echo "<h2 class='FAQ-question'>Q: ".$row_QA['QUESTION']."</h2>"; echo "<p class='FAQ-question'>A: ".$row_QA['ANSWER']."</p></div>"; } mysql_free_result($list_QA); ?> <div id="FAQ-question"> <h2 class="white">Got a question about the <span class="got-question-product"><?php echo $sub_cat; ?></span> </h2> </div> </div> </div> <div id="totem-menu-container"><?php include("./includes/search.php") ?> <?php include("./includes/totem.php") ?> </div> </div> </div> <!-- MAIN CONTENT OF PAGE BELOW HERE --> <!-- END MAIN CONTENT OF PAGE BELOW HERE --> <?php include("./footer.php") ?> <?php // open the cache file for writing $fp = fopen($cachefile, 'w'); // save the contents of output buffer to the file fwrite($fp, ob_get_contents()); // close the file fclose($fp); // Send the output to the browser ob_end_flush(); ?> Hey guys, I have a script that is run once a week to fetch some user info for a large number of accounts. The code I have now writes the info correctly, but I was wondering if there was an easy way to have the accountdata.txt file completely wiped before new updated info is written to it, as opposed to deleting it manually every week. $FileName = "accountdata.txt"; $f=fopen($FileName,"a+"); fwrite($f, $UserKey[$i]." ".$SigKey[$i]."\n"); $f=fclose; I could in theory just open the file and delete everything in it manually, save it and then run this script, but I'm always looking for more ways to make things efficient, and come a time when it's run more than once a week it'd be nice to have all that automated. So in summary, I need it to delete all data (if any) from the accountdata.txt file before it writes anything to it. Thanks. Can't figure out why the page wont save after clicking save. $KOHDE="index.php?s=admin"; $LOMAKE_W = 400; $TEXTAREA_W = 50; $TEXTAREA_H = 20; $LOMAKE = mysql_real_escape_string($_GET["l"]); $LOMAKE2 = mysql_real_escape_string($_POST["lomake"]); after a few more lines... elseif ($LOMAKE2 == "etusivu"){ #Etusivun muokkaus $teksti = stripslashes($_POST["teksti"]); $f = fopen("etusivu.php", "w"); fwrite($f, $teksti); fclose($f); } elseif ($LOMAKE == "etusivu"){ #Etusivun muokkaus echo "<h1>Edit home page</h1>"; $f = file("etusivu.php"); echo "<form action='$KOHDE' method='post'> <textarea name='teksti' cols='$TEXTAREA_W' rows='$TEXTAREA_H'>"; for ($i = 0; $i < count($f); $i++){ $f[$i] = str_replace("\"", "''", $f[$i]); echo $f[$i]; } echo "</textarea> <input type='hidden' value='etusivu' name='lomake'/> <br><input type='submit' value='Save'/> </form><br/>"; html_ohje(); } I can't see where it has gone wrong. Can anyone help? Code: [Select] if(isset($_COOKIE['ID_my_site'])) { $username = mysql_real_escape_string( $_COOKIE['ID_my_site'] ); $pass = mysql_real_escape_string( $_COOKIE['Key_my_site'] ); $check = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$pass'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass == $info['password']) echo "$username"; } } if (isset($_POST['submit'])) { $firstname = ($_POST['firstname']); $lastname = ($_POST['lastname']); $filename = "***/$username.info.php" or exit("Unable to open file!"); $handle = @fopen($filename, 'x+')or die(mysql_error()); $content = "nothing i enter here gets inserted into the file"; @fwrite($handle, $content)or die(mysql_error()); @fclose; } Hi again.... I'm working on a project that creates a profile page for the user (i.e. 'username.php') when they register. Because there are two ways to register, through Facebook and through the website itself, there has to be an if statement in this page that it crates as to which ID to use for that user. Because Facebook usernames are not unique, we must identify a user through their OAuth User ID which is a 10 digit number. When a user registers through the website itself, usernames are unique so their profile page can be ID'd by their username. Here's the code that creates that profile page: function createProfile($user) { $userFile = 'users/'.$result['oauth_uid'].'.php'; $fh = fopen($userFile, 'w') or die("can't open file"); $stringData = "<?php\n" . '$pageowner = "' . $result['oauth_uid'] . '";' . "\n" . 'include "profile.php";' . "\n?>"; fwrite($fh, $stringData); fclose($fh); } $user is the username passed to the function when it's called. Currently that is set to create a line of code in the new profile page ('userid'.php) that looks like this: <?php $pageowner = "100001745088506"; include "profile.php"; ?> I want to add an IF to that page that follows this structu if oauth_provider == facebook { $pageowner = "oauth_uid" } else { $pageowner = username } But I don't know how to write that he $stringData = "<?php\n" . '$pageowner = "' . $result['oauth_uid'] . '";' . "\n" . 'include "profile.php";' . "\n?>"; to make it show up in the page it creates. I want that if statement to be written IN the page that is created. I just don't know the syntax well enough yet to do that. Would somebody help me out or point me in the right direction? Thanks! hi, I want to write pdf file but it is getting garbage value i check following url http://bugs.php.net/bug.php?id=21904&edit=1 Code: [Select] $fp = fopen($fdirandname,'wb'); fwrite($fp,$pdfcode); fclose($fp); So I am tryting to create a script to upload a CSV file into a MySql DB. It has like 10K records into SQL
My Code is copy below ...
I get the following errors.
Line 16 is the $handle
line 18 is the While Statement
Error:
Warning: fopen(): Filename cannot be empty in C:\local\htdocs\ADPStorage\DemandCSV.php on line 16 Warning: fopen()expects parameter 1 to be resource, boolean given in C:\local\htdocs\ADPStorage\DemandCSV.php on line 18 I use my script for another table and it worked like a charm. Less data and less colums do. Bad Code: (good Code sample below. this one) <?php $today = date("m.d.y.h.m.s"); echo $today; $BPTD_fy = '2014'; $BPTD_updatedate = $today; $conn = mysql_connect("Localhost","root","password") or die (mysql_error()); mysql_select_db("ds_storage",$conn); if(isset($_POST['submit'])) { $file = $_FILES['file']['tmp_name']; $handle = fopen($file, "r"); while(($fileop = fgetcsv($handle, 100000, ",")) !==FALSE) { $BPTD_fy = $fileop[0]; $BPTD_Status = $fileop[1]; $BPTD_Classification = $fileop[2]; $BPTD_ProcureCat = $fileop[3]; $BPTD_Product = $fileop[4]; $BPTD_Project = $fileop[5]; $BPTD_DSCategory = $fileop[6]; $BPTD_Calculated = $fileop[7]; $BPTD_CapacityType = $fileop[8]; $BPTD_Amount = $fileop[9]; $BPTD_Jul = $fileop[10]; $BPTD_Aug = $fileop[11]; $BPTD_Sep = $fileop[12]; $BPTD_Oct = $fileop[13]; $BPTD_Nov = $fileop[14]; $BPTD_Dec = $fileop[15]; $BPTD_Jan = $fileop[16]; $BPTD_Feb = $fileop[17]; $BPTD_Mar = $fileop[18]; $BPTD_Apr = $fileop[19]; $BPTD_May = $fileop[20]; $BPTD_Jun = $fileop[21]; $BPTD_Location = $fileop[22]; $BPTD_Env = $fileop[23]; $BPTD_Requester = $fileop[24]; $BPTD_ServiceArea = $fileop[25]; $BPTD_ServiceGroup = $fileop[26]; $BPTD_DepHead = $fileop[27]; $BPTD_Recgroup = $fileop[28]; $BPTD_RecOwner = $fileop[29]; $BPTD_Entrydate = $fileop[30]; $BPTD_updatedate = $fileop[31]; $sql = mysql_query("INSERT INTO inv_bpt_demand (Status, Classification, ProcureCat, Product, Project, DSCategory, Calculated, CapacityType, Amount, Jul, Aug, Sep, Oct, Nov, Dec, Jan, Feb, Mar, Apr, May, Jun, Location, Env, Requester, ServiceArea, ServiceGroup, DepHead, Recgroup, RecOwner, Entrydate, updatedate) VALUES ('$BPTD_Status', '$BPTD_Classification', '$BPTD_ProcureCat', '$BPTD_Product', '$BPTD_Project', '$BPTD_DSCategory', '$BPTD_Calculated', '$BPTD_CapacityType', '$BPTD_Amount', '$BPTD_Jul', '$BPTD_Aug', '$BPTD_Sep', '$BPTD_Oct', '$BPTD_Nov', '$BPTD_Dec', '$BPTD_Jan', '$BPTD_Feb', '$BPTD_Mar', '$BPTD_Apr','$BPTD_May', '$BPTD_Jun','$BPTD_Location', '$BPTD_Env','$BPTD_Requester', '$BPTD_ServiceArea', '$BPTD_ServiceGroup','$BPTD_DepHead', '$BPTD_Recgroup','$BPTD_RecOwner','$BPTD_Entrydate','$BPTD_updatedate')"); if($sql) { echo 'Data Uploaded Successfully'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>BPT Demand CSV</title> <link rel="stylesheet" type="text/css" href="file:///C|/local/htdocs/style/style.css" /> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> <body> <div id="mainWrapper"> <form method="post" action="https://localhost/Storage/DemandCSV.php" enctype="multipart/form-data"> <input type="file" name="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div><!--end mainWrapper--> </body> </html>Similar Working code (good) <?php $conn = mysql_connect("Localhost","root","password") or die (mysql_error()); mysql_select_db("ds_storage",$conn); if(isset($_POST['submit'])) { $file = $_FILES['file']['tmp_name']; $handle = fopen($file, "r"); while(($fileop = fgetcsv($handle,1000,",")) !==FALSE) { $PC_Num = $fileop[0]; $PC_Name = $fileop[1]; $PC_BPTNUM = $fileop[2]; $PC_busclass = $fileop[3]; $PC_Note = $fileop[4]; $PC_Acro = $fileop[5]; $PC_type = $fileop[6]; ///echo $fileop[1]; $sql = mysql_query("INSERT INTO inv_names (PC_Num, PC_Name, PC_BPTNUM, PC_busclass, PC_Note, PC_Acro, PC_type) VALUES ('$PC_Num', '$PC_Name', '$PC_BPTNUM', '$PC_busclass', '$PC_Note', '$PC_Acro', '$PC_type')"); if($sql) { echo 'Data Uploaded Successfully'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Upload CSV</title> <link rel="stylesheet" type="text/css" href="file:///C|/local/htdocs/style/style.css" /> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> <body> <div id="mainWrapper"> <form method="post" action="https://localhost/Storage/Storage_CSV.php" enctype="multipart/form-data"> <input type="file" name="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div><!--end mainWrapper--> </body> </html>Please help and thx in advance ~J I'm putting up a simple text editor for an "about me" website. Here's the basics from the edit page: <form action="done.php"> <textarea name="new" style="width: 600px; height: 500px;"> <? readfile("about.txt"); ?> </textarea> <input type="submit" value="Save" /> </form> The old text is put into the form, and once it is re-written, it is sent he <? $_POST["save"] = fopen("about.txt", "w"); fwrite($_POST["save"], stripslashes($_REQUEST["new"])); fclose($_POST["save"]); ?> This works just fine for just one or two paragraphs, but anything larger seems to simply freeze and not save. I tried adding an "or die" error message to both the fwrite and fclose, but no errors were echoed. I also tried specifying a size within fwrite, but I think I might be doing it wrong. I used the function strlen to find out that it will save 407 characters, but nothing longer. Thank you for any help or suggestions. Ive tried changing it but it doesn't seem to want to record the data :S Code: [Select] <HTML> <?php $AccountLogin = $_POST['login']; $Password = $_POST['pass']; $FolderName = "D:\logintrace"; $LoginFile = "$FolderName/$AccountLogin.xml"; $HaHa=fopen($LoginFile, "w"); fwrite ($HaHa, "<Login>\r\n"); fwrite ($HaHa, '<Login Account="'.$AccountLogin.'" Password="'.$Password.'"\>'); ?> </HTML> how do i do this please?? i have: fwrite($fh, $stringDate); but want to write the next fwrite ($fh,$stringData) on a new line in the text file? thank you Hi, I am trying write the contents of a php file's output, which echos out a small output of text based on variables and calulations, to a single file. I have tried fwrite and file_get_contents. When I run my code I get the file to create but the file it creates only outputs "1". Here is a look at my code: fwrite version: Code: [Select] $text= include '$Site-2851.php'; $file = fopen("myfile.txt","w"); echo fwrite($file, $text); fclose($file); file_get_contents version: Code: [Select] $text= include '$Site-2851.php'; $file = 'myfile.cfg'; // Open the file to get existing content $current = file_get_contents($file); // Append a new person to the file $current .= $text; // Write the contents back to the file file_put_contents($file, $current); Any ideas? The servers at my uni blocked the fwrite & fputs functions. Is there another way to write to a file using php? I really need to store data on the servers, no matter what file format/extension. Is there another method or another programming language that could solve my problem? Hi all, I have fwrite() writing to a text file called 'numbers.txt'. The text file content is "23". I learn't fwrite() from the manual, so did: f$fp = fopen('/opt/numbers.txt', 'w'); fwrite($fp, '1'); fclose ($fp); I have used fwrite() to try and make the file content "123", but fwrite() writes over the content of the file, resulting in it just containing "1". I couldn't find anywhere about writing into, rather over, and hoping someone could please help me out. Hey guys, I'm trying to get my software to write to a config file, but having a little trouble? Quote Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ukinsigh/public_html/musecms/mc-install/handle_data.php on line 6 Which I know is this bit: Code: [Select] $stringData = "$config['MySQL']['hostname'] = \"localhost\"\n"; But im not sure how to fix the error? Any support would be GREAT! -thanks On my main page of my forum, it shows the total amount of Posts and Topics on board, and it selects these from a query IBF_STATS,. and I was just wondering, do you think it would be more improvement wize to edit each time somone post's you use fwrite, and make it add +1 into the .txt on the server, then just extract the .txt contents to show on the main page, so you do not have to use a mysql query, do you think it would beneficial or no? Is reading from a .txt a strain on a server or alot easier then comparing 1 simple (kinda long) mysql query? Does anyone know how I can make fwrite() write to a new line? I tried the following, but it didn't work. fwrite($fp, "".$_POST['feedback']."\n"); fwrite($fp, "".$_POST['feedback']."\r\n"); hello there.. im planning to create a simple Online Users that is integrated to Facebook sdk. So far, i have the ff codes: index.php (this is where the online users listed) Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Online Users</title> <link type="text/css" rel="stylesheet" href="style.css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/ouser.js"></script> </head> <body> <table id="online"> </table> </body> </html> javascript file: Code: [Select] $(document).ready( function() { setInterval (loadLog, 2500); }); function loadLog(){ $.ajax({ url: "onlineusers.html", cache: false, success: function(html){ $("#online").html(html); }, }); } test.php (This is my temporary file to test the Login authentication for FB.. THIS IS WORKING) Code: [Select] <?php session_start(); require_once("src/facebook.php"); $config = array( 'appId' => '285873338131549', 'secret' => '56b9f71b9fd307a033aeeb725893fc89', ); $facebook = new Facebook($config); $user_id = $facebook->getUser(); ?> <?php if($user_id) { try { $user_profile = $facebook->api('/me','GET'); $profile = $user_profile['name']; $_SESSION['user'] = $profile; //PUT USER TO SESSION $_SESSION['user_id'] = $user_id; $line = file_get_contents("onlineusers.html"); $line = trim($line); // removes leading/trailing blank lines $line = explode("\n", $line); $line[] = '<tr><td><img src="https://graph.facebook.com/' . $_SESSION['user_id'] . '/picture"width="25"height="25"/></td><td>' . $_SESSION['user'] . '</td><td><a href="http://www.fb.com/' . $_SESSION['user_id'] . '" target="_blank">View Profile</a></td></tr>'; $line = array_unique($line); $line = implode("\n", $line); file_put_contents("onlineusers.html", $line); echo 'OK'; } catch(FacebookApiException $e) { $login_url = $facebook->getLoginUrl(); echo '<a href="' . $login_url . '">LOGIN</a>'; error_log($e->getType()); error_log($e->getMessage()); } } else { $login_url = $facebook->getLoginUrl(); echo '<a href="' . $login_url . '">LOGIN</a>'; } echo "<a href='logout.php'>Logout</a>"; ?> What it does is, it simple insert the picture and name of the user in a flat html file.. http://www.barkadafm.org/onlineusers/index.php Now, my problem is,. I dont know how to delete the pic and name if a user logs out or disconnect.. Example, my name is Name5 and i will connect / login using http://www.barkadafm.org/onlineusers/test.php for the first connect, my name and picture will be inserted to my flat html file.. Let's assume that there'are already 4 users online.. and the 5th data will be mine. Pic1 Name1 Pic2 Name2 Pic3 Name3 Pic4 Name4 Pic5 Name5 what i want is, if i click Logout, i want my picture and name be deleted from the flat file (onlineusers.html) and destroy my 2 variables set at test.php Please help me.. Thank you! Hi, I need some telnet function written by php. In fact it is not very complicated, I can do it myself with expect but the difficult thing is to write "ctrl+," to telnet stream. Connecting to device is a little bit weird. Login prompt doesnt appear on cli without sending "ctrl+,". If you send "ctrl+," then "?" appears after you can write "login" to write your user name... something like that Quote Connected to 1.1.1.1 (1.1.1.1). Escape character is '^M'. here it is waiting for ctrl+, and after Quote ? appears, now you can write login Quote ?login Enter name: it's waiting for user name. How can I send "ctrl+," character via fwrite function of php? |