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 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]
mwasif 802
Recognized Expert Contributor
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 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...
|
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...
|
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...
|
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:...
|
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...
| |
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,
|
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 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 ...
|
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...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |