473,545 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

eragon
431 Contributor
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 3526
mwasif
802 Recognized Expert Contributor
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 Recognized Expert Contributor
I think you disabled error_reporting .
Jul 8 '07 #3
eragon
431 Contributor
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 Contributor
@%#&! 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 Contributor
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
4939
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or...
7
1898
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 x : eval('obj.'+x), l) but I get an error saying that obj isn't defined. As I understand it eval has access to the current local namespace, which...
3
425
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 functions. Important is, that the object A.o has to be created BEFORE B can be compiled. I am sure that sounds confusing but A.cpp is part of a library that...
26
3097
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 code will not be idiomatic C. GCC has an extension to ISO C that permits nested functions:...
1
1428
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 cryptuiapi.h header file even though the documentation states it should be. I have tried creating my own header file with the definitions that are in the...
3
4115
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 PERCENT dbo.PACZKI.ID_PACZKI, dbo.PACZKI.ID_AKCJI, dbo.PACZKI.NR_PACZKI, dbo.PACZKI.ILOSC_KUPONOW, LOG_1.Login AS LOGIN1,
6
1746
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
8174
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 Printer in this equation as I am not sure I am getting the correct "raw" image from the file. However, when I print what I think is the raw data, I ...
7
7131
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 Silverlight 2.0. To get these tools please visit this page Get Started : The Official Microsoft Silverlight Site and follow Step 1. Occasionally...
0
7409
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7921
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3465
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.