Hi all,
The following script is giving me weird problems. I have in this
directory an index.php and hurricane.php.
If the script gets $i = 'on' it is supposed to back up the current
index into a file called normal.php and then copy hurricane.php into
index.php. This should create a backup of the index and then put the
hurrican alert in place.
When the script gets $i = 'off' it should replace the index with the
contents of normail.php.
What is happening is that at the end of running with $i = 'on' both
index.php and normal.php have the contents of hurricane.php.
Can anyone see why? copy() is returning a 1 every time.
if ($_GET['i'] == 'on') {
$result = copy('index.php ', 'normal.php');
if ($result == 1) {
$result .= copy('hurricane .php', 'index.php');
} else {
$result = 'File Copy Failed!';
}
} else if ($_GET['i'] == 'off') {
$result = copy('normal.ph p', 'index.php');
}
TIA
jg 2 1622
jerrygarciuh wrote:
Hi all,
The following script is giving me weird problems. I have in this
directory an index.php and hurricane.php.
If the script gets $i = 'on' it is supposed to back up the current
index into a file called normal.php and then copy hurricane.php into
index.php. This should create a backup of the index and then put the
hurrican alert in place.
When the script gets $i = 'off' it should replace the index with the
contents of normail.php.
What is happening is that at the end of running with $i = 'on' both
index.php and normal.php have the contents of hurricane.php.
Can anyone see why? copy() is returning a 1 every time.
if ($_GET['i'] == 'on') {
$result = copy('index.php ', 'normal.php');
if ($result == 1) {
$result .= copy('hurricane .php', 'index.php');
} else {
$result = 'File Copy Failed!';
}
} else if ($_GET['i'] == 'off') {
$result = copy('normal.ph p', 'index.php');
}
You do realize that after 2 pageviews all three files will contain the
content of the chosen condition?
I'd think this is an unusually complicated manner to get the desired result.
why not create an index.php, consisting only of:
<?php
if(!isset($_GET['i']) || $_GET['i']=='off'){
include('./normal.php');
} else {
include('./hurricane.php') ;
}
?>
Possibly getting your value for hurricane on/off from a database, an
ini-file, etc...
Grtz,
--
Rik Wasmus
Hi Rik,
Thanks for the reply! My problem is that the index file of the site
must be backed up and then replaced by a non-technical person with only
browser access to the site. What I could do is have my script write to
a text file a 1 or 0 and use an index like you describe but rather than
it depending on a query string it could look at my text file.
Thanks for the thoughts!
JG
Rik wrote:
jerrygarciuh wrote:
Hi all,
The following script is giving me weird problems. I have in this
directory an index.php and hurricane.php.
If the script gets $i = 'on' it is supposed to back up the current
index into a file called normal.php and then copy hurricane.php into
index.php. This should create a backup of the index and then put the
hurrican alert in place.
When the script gets $i = 'off' it should replace the index with the
contents of normail.php.
What is happening is that at the end of running with $i = 'on' both
index.php and normal.php have the contents of hurricane.php.
Can anyone see why? copy() is returning a 1 every time.
if ($_GET['i'] == 'on') {
$result = copy('index.php ', 'normal.php');
if ($result == 1) {
$result .= copy('hurricane .php', 'index.php');
} else {
$result = 'File Copy Failed!';
}
} else if ($_GET['i'] == 'off') {
$result = copy('normal.ph p', 'index.php');
}
You do realize that after 2 pageviews all three files will contain the
content of the chosen condition?
I'd think this is an unusually complicated manner to get the desired result.
why not create an index.php, consisting only of:
<?php
if(!isset($_GET['i']) || $_GET['i']=='off'){
include('./normal.php');
} else {
include('./hurricane.php') ;
}
?>
Possibly getting your value for hurricane on/off from a database, an
ini-file, etc...
Grtz,
--
Rik Wasmus
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe Laughlin |
last post by:
(file and class names changed to protect the innocent)
g++ -Wall -c file.cpp: In member function `std::string
Some_Class::get_member(const std::string&) const':
file.cpp:46: passing `const std::map<std::string,
std::string, std::less<std::string>, std::allocator<std::pair<const
std::string, std::string> > >' as `this' argument of `_Tp& std::map<_Key,
_Tp, _Compare, _Alloc>::operator(const _Key&) ' discards
qualifiers
|
by: sarah |
last post by:
I keep getting the following error:
g++ SortedList.cpp
SortedList.cpp:260: error: expected constructor, destructor, or type
conversion before '*' token
SortedList.cpp:260: error: expected `,' or `;' before '*' token
Line # 260 is ListNode *SortedList::copyList( ListNode *L ) {
towards the end of the .cpp file.
I have just put stubs in fr the code that I know works for readability
purposes. here is my code:
|
by: noureensyed |
last post by:
Hi there,
1. I have the following XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0">
|
by: Sahil Malik [MVP] |
last post by:
Okay so lets say I have a valuetype - lets say DateTime.
Look at this code .
List<DateTime> dt = new List<DateTime>() ;
dt.Add(new dateTime(1999,12,1))
dt.AddDays(1) ;
<--- This statement won't actually change the date time stored in the
List<T> dt.
|
by: queisser |
last post by:
Hi all,
I'm writing a C# app that uses copy/paste to put graphics in a window.
My copy/paste logic first looks for Metafile, then for bitmap.
Here's the problem: when I copy and paste a WMF clip from the organizer
(in Word or standalone) into my app I get a nice high-res image the
first time I copy a particular clip. The second time I get a very
low-res copy, presumably the same resolution as the thumbnail. In Word
or PowerPoint it...
| |
by: XYZ |
last post by:
I need to pass the address of a variableto some win32 API functions like
RTLMoveMemory
I noticed some weird behavior when pinning objects and using the handle's
pointer to write data to the memory location.
it seems as if after pinning an object the memory and the object are not
updated at the same time anymore
|
by: atv |
last post by:
at least to me it is. I can't figure out for the life what it is i'm
doing wrong here.
i have a function called assign_coordinate. usually, i pass a malloced pointer
to it, then individual pointers are malloced within that function. No
problem here.
Now i have a situation in this software, where i need to assign new coordinates
to all nodes in the list.
|
by: ongaro.admin |
last post by:
Hi,
I'm experiencing a strange problem with .mdb files.
We have two buildings connected by optical fiber (a single LAN).
Everything works perfect with any file, any size, any application
software. The hardware has been tested several times. Viruses, trojans
and so on: clean for sure.
The problem is that .mdb files (_only .mdb files_) often don't open,
are very slow, or even get crashed and corrupted.
The weird is that even copying them...
|
by: Adam Biser |
last post by:
My apologies if this has been discussed before, but using Google and
also searching the newsgroup has not given me any insight to this problem.
I'm experiencing some strange behavior when I copy and paste a
usercontrol. What happens is that the controls inside the usercontrol
are being created on the form in addition to the copy of the usercontrol.
I'm using VS 2008 Pro, v9.0.21022.8 with .NET 3.5.
Here's how I can duplicate the...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |