KrisNz
-
Posts
271 -
Joined
-
Last visited
Posts posted by KrisNz
-
-
You've practically written the answer in your topic!
if (copy(....)) { echo "success"; unlink("..."); } else { echo "unable to move file"; }
If you're just moving a file from one path to another, use rename().
If you're moving an uploaded file, use move_uploaded_file().
-
you haven't closed this tag
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
-
That's not a very nice thing to do, now is it?
-
You aren't using strtotime correctly. If you want to add 28 days to a TIMESTAMP its
$now = time(); $tsTwentyEightDaysLater = strtotime("+28 day",$now); /*note that by default strtotime uses the current time() as the second argument. I'm just putting that in for clarity. */ //In your case, you want to first convert your mm/dd/yyyy date to a TIMESTAMP $tsUserDate = strtotime($tse_start); //gives us a timestamp $tsTwentyEightDaysLater = strtotime("+28 day",$tsUserDate); //gives us a timestamp $mdyTwentyEightDaysLater = date("m/d/Y",$tsTwentyEightDaysLater); //gives us an m/d/Y formatted date
-
Is your php info file in the htdocs directory of apache? By default its something like C:\Program Files\Apache Software Foundation\Apache2.2\htdocs
-
As Teng mentioned, you might be looking for the date function. The php equivalent of now() is
date("Y-m-d H:i:s");
-
You can use file() to read the file into an array, where each line is an entry in the array. If count() of array == 30 then array_shift() to remove the first entry, implode() the array back into a string, append your new line, rewrite the file.
-
You should read this
Protect Your Code and Graphics - Or Not
If you think the information you have is so exclusive/valuable then you perhaps you should be looking at ways of generating revenue by allowing access to that information rather than trying to discourage people from stealing it.
-
This is dangerous
exec($_POST['user_command']);
-
-
While I realize there's educational value in this, I thought I'd point out that there's already grease monkey scripts that allow you to do this
-
If all you want to know is how many files are included then use the get_included_files() function.
-
attach everything as a zip file under "additional options".
-
1) No.
2) Yes, in that case you'll need to use strpos()
e.g
if (strpos($event_id,"foo") === 0 ) { //does event id begin with "foo"...
-
You can treate strings as arrays so
if ($event_id[0] == 'T') { ....
-
Theres also the strtotime() function
e.g
//assuming $tse_start is a timestamp $tse_estlive = strtotime("+28 day",$tse_start); //if its not... $tse_estlive = strtotime("+28 day",strtotime($tse_start));
-
try putting ©=1 and see what happens! & is the html entity for & and the correct way to put an ampersand in an html document, it wont validate if you don't.
-
Theres a modify headers add-on for firefox, I haven't tried it.
https://addons.mozilla.org/en-US/firefox/addon/967
-
the beginning of the string should be {$row3['property_type']} - any hash key you access inside a string has to be inside {}. You can get around some of the messiness by using heredoc syntax (though the rule about {} I just mentioned still applies) or by breaking out of php like so
<?php while($row3 = mysql_fetch_array($results3)) { ?> <tr> <td class="bodytext"> <?php echo $row3['property_type'] ?> <input type="checkbox" name="<?php echo $row3['property_type'] ?>" value="<?php echo $row3['property_type'] ?>" /> </td> </tr> <?php } //end while ?>
I use a keyboard shortcut for <?php echo
-
separate each item with &
e.g
<a href="www.example.com/welcome.php?id=Chinese&anotherarg=somethingelse">Text</a>
-
I don't really understand this..
Note that globaling the $classes variable isn't an option since I'm going to be loading classes dynamically.
But you might like to investigate the Registry pattern - this can be used to hold or retrieve a reference to your $classes hash.
-
If I understand correctly, you've got a file that has a hash of class names and their associated file name? Doesn't this mean that every time you write a class you have to go and update that file? To me that somewhat defeats the purpose of having autoload. If you use a naming convention for your classes and their associated filenames you can avoid this altogether.
If you camelcase your class names e.g
<?php class ThisIsMyClass { //.... } ?>
Then name the file this_is_my_class.php
You can convert the camelcase to the underscored version with this
<?php function camelToUnderscore($s) { //http://www.regular-expressions.info/refadv.html //this translates to //look behind(to the right of) the first character for any upper case //character and replace it with an underscore + the matched character return strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $s)); } ?>
That way you can convert $class_name to its matching file name without needing to keep a reference of it.
-
If you want that to all happen on the same page, You'll need to send the email before you output the pdf. Your pdf library will almost certainly have a method for outputting directly to the browser.
-
note that the variable is $yesOrNo not $yesorNo (i.e the capital O)
[SOLVED] if copy() failed dont continue
in PHP Coding Help
Posted
What is it you're trying to do? move_uploaded_file() moves files uploaded through a form, from the tmp directory to the destination you give. If that's not the case, use rename which moves the file from $source to $destination.