473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

function createNewFile() (user defined) isnt creating a new file...

eragon
431 256MB
I wrote this function to create a new file when the user posts in my forums, and its not creating a new file, can you help me? this script is not copyrighted as the last one.

Expand|Select|Wrap|Line Numbers
  1. function createNewFile($name,$mail,$subject,$comments,$count,$date,$other="",$up="0") {
  2. global $settings;
  3. $header=implode('',file('header.txt'));
  4. $footer=implode('',file('footer.txt'));
  5. $content='
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  7. <html>
  8. <head>
  9. <title>PKC - Forums - '.$subject.'</title>
  10. <meta content="text/html; charset=windows-1250">
  11. <link href="'.$settings['mboard_url'].'/../basic-1.css" type="text/css" rel="stylesheet">
  12. <META HTTP-EQUIV="Expires" CONTENT="-1">
  13. <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
  14. <script language="Javascript" src="'.$settings['mboard_url'].'/javascript.js"><!--
  15. //-->
  16. </script>
  17. </head>
  18. <body>
  19. <div id="body">';
  20. $content.=$header;
  21.  
  22. $content.='<div class="title frame e">
  23. '.$settings['mboard_title'].'<br><a href="../index.php">Main Menu |
  24. <a href="'.$settings['mboard_url'].'/mboard.php">'.$settings['mboard_title'].'</a></a></div>
  25.  
  26. <div align="center"><center>
  27. <table border="0" width="95%"><tr>
  28. <td>
  29.  
  30. <p align="center"><a href="?new">Post a reply</a></p>
  31. <hr>
  32. <p><div class="e"><?php
  33. if ($_SESSION[\'status\'] == \'admin\') {echo(\'<p><a href=\"'.$settings['mboard_url'].'/mboard.php?a=delete&num='.$count.'&up='.$up.'\"><img
  34. src='.$settings['mboard_url'].'/images/delete.gif" width="16" height="14" border="0" alt="Delete this post"></a><hr>\'); \?>
  35. <p><b>'.$subject.'</b><span style="float:right;">Submitted by <span class="'.$_SESSION['status'].'">'.$name.'</span> on '.$date.'</span><hr>';
  36. $content .= '</p>
  37.  
  38. <p><b>Message</b>:</p>
  39.  
  40. <p>'.$comments.'</p>';
  41.  
  42. if ($settings['display_IP']==1) {$content .= '<hr><font class="ip">User\'s IP: '.$_SERVER['REMOTE_ADDR'].'</font>';}
  43.  
  44. $content .= '</div>
  45.  
  46. <p align="center" class="e"><b>Replies to this post</b></p>
  47. <ul>
  48. <!-- zacni --><p class="e">No replies yet</p>
  49. </ul>
  50. <hr></td>
  51. </tr></table>
  52. </center></div><?php
  53.  
  54. if ($_GET[\'new\']) {
  55.     echo(\'
  56.  
  57. <div class="e"><p align="center"><a name="new"></a><b>Reply to this post</b></p>
  58. <div align="center"><center>
  59. <table border="0"><tr>
  60. <td>
  61. <form method=post action="'.$settings['mboard_url'].'/mboard.php" name="form" onSubmit="return mboard_checkFields();">
  62. <p><input type="hidden" name="a" value="reply"><b>Name:</b><br><input type=text name="name" size=30 maxlength=30><br>
  63. E-mail (optional):<br><input type=text name="email" size=30 maxlength=50><br>
  64. <b>Subject:</b><br><input type=text name="subject" value="Re: '.$subject.'" size=30 maxlength=100><br><br>
  65. <b>Message:</b><br><textarea cols=50 rows=9 name="message"></textarea>
  66. <input type="hidden" name="orig_id" value="'.$count.'">
  67. <input type="hidden" name="orig_name" value="'.$name.'">
  68. <input type="hidden" name="orig_subject" value="'.$subject.'">
  69. <input type="hidden" name="orig_date" value="'.$date.'"><br>
  70. Insert styled text: <a href="javascript:insertspecial(\'B\')"><b>Bold</b></a> |
  71. <a href="javascript:insertspecial(\'I\')"><i>Italic</i></a> |
  72. <a href="javascript:insertspecial(\'U\')"><u>Underlined</u></a><br>
  73. <input type="checkbox" name="nostyled" value="Y"> Disable styled text</p>
  74. \');} else{} ?>';
  75.  
  76. if ($settings['smileys']) {
  77.     $content.='
  78.     <p><a href="javascript:openSmiley(\''.$settings['mboard_url'].'/smileys.htm\')">Insert smileys</a>
  79.     (Opens a new window)<br><input type="checkbox" name="nosmileys" value="Y"> Disable smileys</p>
  80.     ';
  81. }
  82.  
  83. $content.='
  84. <p><input type=submit value="Submit reply">
  85. </form>
  86. </td>
  87. </tr></table>
  88. </center></div>
  89. </div>';}
  90.  
  91. $content.=$footer;
  92. $content.='</div>
  93. </body>
  94. </html>';
  95.  
  96. $newfile="msg/".$count.".".$settings['extension'];
  97. $fp = fopen($newfile,"wb") or problem("Couldn't create file &quot;$newfile&quot;! Please CHMOD the &quot;msg&quot; folder to 666 (rw-rw-rw)!");
  98. if (flock($fp, LOCK_EX)) {
  99.     fputs($fp,$content);
  100.     flock($fp, LOCK_UN);
  101. } else {
  102.     echo "Error locking a file, please try again later!";
  103. }
  104. //end new file 
  105. fclose($fp);
  106.  
  107. unset($content);
  108. unset($header);
  109. unset($footer);
  110.  
as i said, its not creating the new file, and i chmodded the folder its supposed to write to 777. any ideas?
Jul 8 '07 #1
5 3509
mwasif
802 Expert 512MB
Change line 97 code to

[PHP]$fp = fopen($newfile,"wb") or problem("Couldn't create file \"$newfile\"! Please CHMOD the \"msg\" folder to 666 (rw-rw-rw)!");[/PHP]
Jul 8 '07 #2
mwasif
802 Expert 512MB
I think you disabled error_reporting.
Jul 8 '07 #3
eragon
431 256MB
i had the "s written as &quot; but the TSDN forums see that and change iit to ", so, that fix might not work.
Jul 8 '07 #4
eragon
431 256MB
@%#&! it still dosnt wite the file. the whole purpose is to wirte the files with the names in increasing order, as based on the counter file count.txt. so, it will make 1.php 2.php and so on. and those are the ids for the threads. i cant find the error! ill check the script that calls the function again... check for case sensitive matching. Maybe i just need to restore the whole section to the origional version and start ALL over... i hope not.
Jul 8 '07 #5
eragon
431 256MB
problem still stands, can you help me with it?
Jul 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
7
by: robcarlton | last post by:
hi everybody I've written this function to make a list of all of an objects attributes and methods (not for any reason, I'm just learning) def list_members(obj) l = dir(obj) return map(lambda...
3
by: Jan-Henrik Grobe | last post by:
Hallo, I am coming to this newsgroup with a very strange Problem. I have two c++ files A.cpp and B.cpp....In A.cpp I am creating an openGL window and in B.cpp I have stored the callback...
26
by: Adam Warner | last post by:
Hello all, I'm very new to C but I have a number of years of Common Lisp programming experience. I'm trying to figure out ways of translating higher order concepts such as closures into C. The...
1
by: Brad | last post by:
I'm trying to write a utility to export user certificates without user intervention. I found a function CryptUIWizExport that should do the trick but it does not appear to be defined in the...
3
by: chreo | last post by:
I have user-defined function in MSSQL which returns Table (with 10 columns) (sorry for Polish names) CREATE FUNCTION PACZKI_Z_AKCJI (@AKCJA_ID int) RETURNS TABLE RETURN SELECT TOP 100...
6
by: daveyand | last post by:
Hey Guys, I've stumped. I created a function that does various things to select boxes. Namely Get All selected indexes, populate array with these values
7
by: RB0135 | last post by:
Hi All, I have some Windows BMP, 1BPP, monochrome files that I need to get the raw data from to load a graphics buffer on a Roll Printer (which I know can be done). Lets forget about the Roll...
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.