I'm having the strangest problem, and can't seem to understand why.
I have implemented a mkdir() function into my script and can't
understand why it executes properly one some occasions, and not on
others. When it does not execute properly, I get the following error
message:
Warning: mkdir(): No such file or directory
in /home/u3/myftpuserid/html/test/processuserinfo.php on line 32
Error: Could not make propertyid directory.
It stops working correctly if I remove the newly created directories
from the Web server. However, even if I do not make any changes, the
script eventually starts executing properly again. In fact, from
that point forward it continues to work several times consecutively
if I do not remove any of the newly created directories from the Web
server.
The entire code I am using is as follows:
1.) /* Create the following myISAM table in a mySQL database */
CREATE TABLE property(
propertyid int(7) NOT NULL AUTO_INCREMENT,
username varchar(10) NOT NULL,
pass varchar(10) NOT NULL,
firstName varchar(25) NOT NULL,
lastName varchar(25) NOT NULL,
PRIMARY KEY (propertyid)
);
2.) /* The following code should be saved as userinfo.html */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>User Info</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1">
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<body>
<br><center>
<form name="getuserinfo" action="processuserinfo.php"
method="POST" />
<input type="text" name="username" id="username" value="" /><br>
<input type="password" name="pass" id="pass" value="" /><br>
<input type="text" name="firstName" id="firstName" value="" /><br>
<input type="text" name="lastName" id="lastName" value="" /><br><br>
<input type="submit" name="submit" value="Submit Form" />
</form>
</center>
</body>
</html>
3.) /* The following code should be saved as processuserinfo.php */
<?php
include("connectmeinc.php");
$connection = mysql_connect($host,$user,$password)
or die ("Couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
$username = $_POST['username'];
$pass = $_POST['pass'];
$firstName = addslashes($_POST['firstName']);
$lastName = addslashes($_POST['lastName']);
$query = "INSERT INTO property
(username,pass,firstName,lastName)
VALUES
('$username','$pass','$firstName','$lastName')";
$result = mysql_query($query)
or die ("Could Not Insert Record
Into Database.");
$query2 = "SELECT * FROM property WHERE username
= '$username'";
$results = mysql_query($query2)
or die ("Could Not Retrieve User's
Information From Database.");
while ($row = mysql_fetch_array($results))
{
extract($row);
}
{
mkdir($propertyid, 0777) or die("<b>Error:</b> Could
not make propertyid directory.");
copy ("/home/u3/myftpuserid/html/about.html" ,
$propertyid.'/about.html');
}
header("Location: http://www.mysiteaddress.com/test/userinfo.html");
exit();
?>
Can anybody see what the problem is and offer the solution? Thanks
in advance for any helpful feedback.
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/