Jump to content

php Help


DNA

Recommended Posts

DNA
Member
(edited)

I am looking for someone that can help me writing a php script. I have the basic script done and it works but I am trying to add a part to it that would open a txt file and write in the persons name and then close and send the email that it has already been doing. So basicly creating a log of who has sent the phps...Anyone that can help me pleae let me know..

 

Cheers

Edited by DNA
Link to comment
Share on other sites

DNA
Member

It is a long code, the whole is a online submission form for one of my courses that students send to a instructor. I can but it is crazy long..... Here:

 

[<html>

<head>

 

<title>Thank You</title>

</head>

<body>

 

 

<?php

$myemail = "aallen@pima.edu";

 

 

$todayis = date("l, F j, Y, g:i a") ;

 

$subject = $subjectline;

 

$message = "$todayis [EST] \n

 

From: $studentname ($studentemail)\n

 

Part 1.\n

Question $qn1 In layperson's words, what is remote sensing? (0.6 pts): $q1 \n

Question $qn2 What were some of the downsides of using pigeons for aerial photography and military reconnaissance? (0.6 pts): $q2 \n

Question $qn3 What is the Montreal Protocol, and how did remote sensing technology assist in its development? (0.6 pts): $q3 \n

Question $qn4 What 1986 event, uncovered by U.S. and French remote sensing satellites, proved to have global consequences? (0.6 pts): $q4 \n

Question $qn5 In addition to more satellites with remote sensing capabilities being launched into orbit, what three other technological advancements have allowed wider use of remotely sensed data? (0.6 pts): $q5 \n

Question $qn6 As noted, remote sensing technology is being used for a range of issues. Drawing on the examples provided in this section, provide three examples of how you think remote sensing could be applied to regional issues in southern Arizona. (0.9 pts): $q6 \n

Part 2.\n

Question $qn7 What characteristic is the same for all forms of electromagnetic radiation? (0.6 pts): $q7 \n

Question $qn8 Regarding the electromagnetic spectrum, what is the relationship between wavelength and energy level? (0.6 pts): $q8 \n

Question $qn9 Look at the electromagnetic spectrum figure. Does visible light represent a large or small portion of the entire electromagnetic spectrum? What is the range of wavelengths (i.e., shortest to longest) of visible light? (use units!) (0.6 pts): $q9 \n

Question $qn10 Consider two objects made of the same material, mass and volume but at different temperatures. Which one will emit a longer peak wavelength of energy? (0.6 pts): $q10 \n

Question $qn11 What are the three things that may happen to electromagnetic energy when it encounters a surface or object? (0.6 pts): $q11 \n

Question $qn12 What is the basic concept behind multi-spectral remote sensing? (0.6 pts): $q12 \n

Part 3. \n

Question $qn13 What is the difference between passive and active remote sensing? (0.6 pts): $q13 \n

Question $qn14 What is the difference between a radiometer and a spectroradiometer? Both are examples of what “class†of remote sensing instrument? (0.6 pts): $q14 \n

Question $qn15 With respect to active remote sensing instruments, what is the difference between radar and lidar? (0.6 pts): $q15 \n

Question $qn16 You are a scientist and need to collect two different sets of remotely sensed data. First, you want data on daily weather patterns for just Arizona. Second, you need data for the amount of ozone in the upper atmosphere for the entire globe. Which kind(s) of satellite, polar orbiting and/or geostationary, would satisfy these requirements? (0.6 pts): $q16 \n

Part 4. \n

Question $qn17 What is the relationship between pixel size and resolution? (0.6 pts): $q17 \n

Question $qn18 Consider two remotely sensed images that cover the same 10km2 area of Tucson. The first image has a resolution of 1 meter and the second image has a resolution of 10 meters. What is the area of each pixel for the 1-meter resolution image? What is the area for each pixel for the 10-meter resolution image? How many pixels in the first image can fit into one pixel in the second image? (0.9 pts): $q18 \n

Question $qn19 What is the difference between spatial resolution and spectral resolution? (0.6 pts): $q19 \n

 

Comments: $c1 \n

 

Additional Info : IP = $ip \n

Browser Info: $httpagent \n

";

 

$from = "From: $studentemail\r\n";

 

if ($myemail != "")

mail($myemail, $subject, $message, $from);

 

?>

 

 

<p align=center>

Date: <?php echo $todayis ?>

<br>

Thank You : <?php echo $studentname ?>

 

<?php

chmod("/blc_php_scripts/submit_10527.txt", 01777);

$File = "/blc_php_scripts/submit_10527.txt";

$Handle = fopen($File, 'w+');

fwrite($Handle, $studentname);

fwrite($Handle, $todayis);

print "Data Written";

fclose($Handle);

?>

 

<br><br>

Warner Bair will be grading your Unit 7 Step 2 assignment. It will take him

a couple of days to get back to you by email about your assignment. Please keep

checking your Pima email to see his response. You can contact him at wbair@pima.edu

<p align=center>Please, please, please remember that there are <a href="../105/deadline.html">deadlines</a> for

this assignment.

<p align=center><a href="../105/507/step2/unit7_step2_home.htm">Return

to Bio 105 Unit 7 Step 2 homepage </a>

</body>

</html>]

 

But this is part that I can not get to work....

[<?php

chmod("/blc_php_scripts/submit_10527.txt", 01777);

$File = "/blc_php_scripts/submit_10527.txt";

$Handle = fopen($File, 'w+');

fwrite($Handle, $studentname);

fwrite($Handle, $todayis);

print "Data Written";

fclose($Handle);

?>]

 

Let me know.

Link to comment
Share on other sites

DNA
Member
Use 'a' instead of 'w+'? Or is the file not being written at all?

 

Ya the file is not being written at all....I am pretty sure i have the dir correct, but no file..:(

Link to comment
Share on other sites

$studentname = "test";
$todayis = "thursday";

chmod("file7.txt", 01777);
$File = "file7.txt";
$Handle = fopen($File, 'a');
fwrite($Handle, $studentname . "\n");
fwrite($Handle, $todayis . "\n");
print "Data Written";
fclose($Handle);

This is what I have and it works for me. If the file doesn't already exist, chmod gives an error.

Link to comment
Share on other sites

I know little of php. But I do know chmod doesn't accept 01777 as a legit value. Should be 3 numbers. Use 777 for all users to read write and execute. I'm lazy and generally do this when something is locked down.

Link to comment
Share on other sites

DNA
Member

Okay so it looks like the big reason this stupid thing was not working was because the permissions for the folder and file were not correct and under MX the permission is an extention that i did not have installed. So anyways it all works now, and THANK YOU FOR YOUR HELP!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...