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. -
function createNewFile($name,$mail,$subject,$comments,$count,$date,$other="",$up="0") {
-
global $settings;
-
$header=implode('',file('header.txt'));
-
$footer=implode('',file('footer.txt'));
-
$content='
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
<html>
-
<head>
-
<title>PKC - Forums - '.$subject.'</title>
-
<meta content="text/html; charset=windows-1250">
-
<link href="'.$settings['mboard_url'].'/../basic-1.css" type="text/css" rel="stylesheet">
-
<META HTTP-EQUIV="Expires" CONTENT="-1">
-
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
-
<script language="Javascript" src="'.$settings['mboard_url'].'/javascript.js"><!--
-
//-->
-
</script>
-
</head>
-
<body>
-
<div id="body">';
-
$content.=$header;
-
-
$content.='<div class="title frame e">
-
'.$settings['mboard_title'].'<br><a href="../index.php">Main Menu |
-
<a href="'.$settings['mboard_url'].'/mboard.php">'.$settings['mboard_title'].'</a></a></div>
-
-
<div align="center"><center>
-
<table border="0" width="95%"><tr>
-
<td>
-
-
<p align="center"><a href="?new">Post a reply</a></p>
-
<hr>
-
<p><div class="e"><?php
-
if ($_SESSION[\'status\'] == \'admin\') {echo(\'<p><a href=\"'.$settings['mboard_url'].'/mboard.php?a=delete&num='.$count.'&up='.$up.'\"><img
-
src='.$settings['mboard_url'].'/images/delete.gif" width="16" height="14" border="0" alt="Delete this post"></a><hr>\'); \?>
-
<p><b>'.$subject.'</b><span style="float:right;">Submitted by <span class="'.$_SESSION['status'].'">'.$name.'</span> on '.$date.'</span><hr>';
-
$content .= '</p>
-
-
<p><b>Message</b>:</p>
-
-
<p>'.$comments.'</p>';
-
-
if ($settings['display_IP']==1) {$content .= '<hr><font class="ip">User\'s IP: '.$_SERVER['REMOTE_ADDR'].'</font>';}
-
-
$content .= '</div>
-
-
<p align="center" class="e"><b>Replies to this post</b></p>
-
<ul>
-
<!-- zacni --><p class="e">No replies yet</p>
-
</ul>
-
<hr></td>
-
</tr></table>
-
</center></div><?php
-
-
if ($_GET[\'new\']) {
-
echo(\'
-
-
<div class="e"><p align="center"><a name="new"></a><b>Reply to this post</b></p>
-
<div align="center"><center>
-
<table border="0"><tr>
-
<td>
-
<form method=post action="'.$settings['mboard_url'].'/mboard.php" name="form" onSubmit="return mboard_checkFields();">
-
<p><input type="hidden" name="a" value="reply"><b>Name:</b><br><input type=text name="name" size=30 maxlength=30><br>
-
E-mail (optional):<br><input type=text name="email" size=30 maxlength=50><br>
-
<b>Subject:</b><br><input type=text name="subject" value="Re: '.$subject.'" size=30 maxlength=100><br><br>
-
<b>Message:</b><br><textarea cols=50 rows=9 name="message"></textarea>
-
<input type="hidden" name="orig_id" value="'.$count.'">
-
<input type="hidden" name="orig_name" value="'.$name.'">
-
<input type="hidden" name="orig_subject" value="'.$subject.'">
-
<input type="hidden" name="orig_date" value="'.$date.'"><br>
-
Insert styled text: <a href="javascript:insertspecial(\'B\')"><b>Bold</b></a> |
-
<a href="javascript:insertspecial(\'I\')"><i>Italic</i></a> |
-
<a href="javascript:insertspecial(\'U\')"><u>Underlined</u></a><br>
-
<input type="checkbox" name="nostyled" value="Y"> Disable styled text</p>
-
\');} else{} ?>';
-
-
if ($settings['smileys']) {
-
$content.='
-
<p><a href="javascript:openSmiley(\''.$settings['mboard_url'].'/smileys.htm\')">Insert smileys</a>
-
(Opens a new window)<br><input type="checkbox" name="nosmileys" value="Y"> Disable smileys</p>
-
';
-
}
-
-
$content.='
-
<p><input type=submit value="Submit reply">
-
</form>
-
</td>
-
</tr></table>
-
</center></div>
-
</div>';}
-
-
$content.=$footer;
-
$content.='</div>
-
</body>
-
</html>';
-
-
$newfile="msg/".$count.".".$settings['extension'];
-
$fp = fopen($newfile,"wb") or problem("Couldn't create file "$newfile"! Please CHMOD the "msg" folder to 666 (rw-rw-rw)!");
-
if (flock($fp, LOCK_EX)) {
-
fputs($fp,$content);
-
flock($fp, LOCK_UN);
-
} else {
-
echo "Error locking a file, please try again later!";
-
}
-
//end new file
-
fclose($fp);
-
-
unset($content);
-
unset($header);
-
unset($footer);
-
as i said, its not creating the new file, and i chmodded the folder its supposed to write to 777. any ideas?
5 3509
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]
I think you disabled error_reporting.
i had the "s written as " but the TSDN forums see that and change iit to ", so, that fix might not work.
@%#&! 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.
problem still stands, can you help me with it?
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |