View Full Version : How would I..
Mr-Trainor
02-05-2010, 11:35 AM
..add a page to a php script which will allow you to update a block of text (which will be echo'd onto the main site).
-hopefully you know what I mean :P
Mickword
02-05-2010, 12:42 PM
TBH Luke if I was you I would download housekeeping guy and strip it to where you can post all you like.
Do you mean, you can edit the text of the page without actually altering the code? i.e. it takes it form a database or text file.
Mr-Trainor
02-05-2010, 03:51 PM
Yea, just so you know..
the reason I'm wanting to do this is to allow a values manager to update a recent changes text (I want it manual, not automatic) from the panel itself rather than giving them cpanel access.
Apolva
05-05-2010, 09:04 PM
Sorry it's late, here's some bodge code :)
<?php
if($_POST['pw']=="passwordCaseSentitive"){
$fp = @fopen('message.js', 'w');
@fwrite($fp, "document.write('".htmlentities($_POST['message'],ENT_QUOTES)."');");
@fclose($fp);
die("<b>Message changed :)</b>");
}
die("<h1>Change message</h1><form method='post'><table><tr><td><b>Password:</b></td><td><input type='password' name='pw' /></td></tr><tr><td><b>Message:</b></td><td><input type='text' name='message' /></td></tr><tr><td></td><td><input type='submit' value='Set message' /></td></tr></table></form>");
?>
Save that as setmessage.php. It will create a file called message.js containing some JS code to show the message.
Use this code to display the message:
<script src='message.js'></script>To change the message, just open setmessage.php in a browser, type in password + message and it will change.
I haven't actually tested the code, let me know if you have any problems :)
Mr-Trainor
06-05-2010, 08:32 AM
Thanks, I'll try that out later/soon and let you know how it goes :)
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.