|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Help with a simple CMS - a symbolic $ award given for assistance.
I don’t usually ask for assistance unless I am completely defeated, which sadly, seems to be the case in this project.
Firstly I needed to get the variables content into the text area in order for them to be editable. This was accomplished with no problem. However, I still have not succeeded in getting the content from the array variables inside the referred text area. I only seem to be able to fetch variables that are not in arrays. Also, I would like to know if there a possibility of instead of fetching the variables and placing them in a sequential numerical order in the select form, to make it possible for me to choose which variables do I want to fetch and which text do I want to display in the select form. Finally, and after all these changes are successfully applied , I want to save the changes and be redirected to a success page. P.S. I will gladly pay a small sum of money for this work. 15$ Only PAYPAL. __________________________________________________ Vars.php <? $text1 = "text text text <br> dsdsd"; $text2 = "text text textz <br> dsdsd"; $content_array["zonaimagemsos"] ="text text text <br> dsdsd array"; $content_array["zonaimagemsos"] ="text text text>"; $content_array["zonaimagemsos"] ="text text text"; ?> ___________________________________________________ Index.php <? if($cmd == "modify") { $newfile = "vars.php"; $fh = fopen($newfile, "r"); $newcontent = fread($fh, filesize($newfile)); fclose($fh); $newinfo = explode('$', $newcontent); $newnum = count($newinfo); $sumb = $sumb; $finalcontent = "<? "; for($i =1;$i<$newnum;$i++) { $newdata = explode('= "', $newinfo[$i]); $newdatab = explode("\";", $newdata[1]); if($sumb == $i) { $newdatab[0] = addslashes($sum); $newdatab[0] = eregi_replace("<", "<", $newdatab[0]); $newdatab[0] = eregi_replace(">", ">", $newdatab[0]); } $finalcontent .= '$'.$newdata[0].'= "'.$newdatab[0].'"; '; } $finalcontent .= "?>"; $fh = fopen($newfile, "w"); fwrite($fh, $finalcontent); fclose($fh); header('Location: http://www.hotmail.com'); } ?> <html><body> <head><title>Content Manager Update</title></head> <script type="text/javascript"><!-- function updatesum() { document.form.sum.value = (document.form.s1.options[document.form.s1.selectedIndex].value); document.form.sumb.value = (document.form.s1.options[document.form.s1.selectedIndex].text); } //--></script> <form name="form" action="?cmd=modify" method="post"> Select a variable number: <select name="s1" onChange="updatesum()"> <option value="" selected>Select One</option> <? $newfile = "vars.php"; $fh = fopen($newfile, "r"); $newcontent = fread($fh, filesize($newfile)); fclose($fh); $newinfo = explode('$', $newcontent); $newnum = count($newinfo); for($i =1;$i<$newnum;$i++) { $newdata = explode('= "', $newinfo[$i]); $newdatab = explode("\";", $newdata[1]); $newdatab[0] = eregi_replace("<", "<", $newdatab[0]); $newdatab[0] = eregi_replace(">", ">", $newdatab[0]); echo '<option value="'.stripslashes($newdatab[0]).'">'.$i.'</option>'; } ?> </select> <BR><TEXTAREA NAME="sum" WRAP="VIRTUAL" COLS="70" ROWS="10"></TEXTAREA> <input name="sumb" type="hidden" value=""> <td><BR><INPUT TYPE="submit" NAME="Submit" VALUE="udpate"></form> </body></html> ______________________________________________________________ |
|
#2
|
|||
|
|||
|
I've had some progress, but I still can't seem to edit and save the array variable scorrectly.
The vars.php file get's messed up after attempting to save the modifications. -------------- Vars.php <? $content_array["zonaimagemsos"] ="text text text <br> dsdsd array"; $content_array["zonaimagemddd"] ="text text text>"; ?> ---------------------------- index2.php <? if($cmd == "modify") { $newfile = "vars.php"; $fh = fopen($newfile, "r"); $newcontent = fread($fh, filesize($newfile)); fclose($fh); $newinfo = explode('$', $newcontent); $newnum = count($newinfo); $sumb = $sumb; $finalcontent = "<? "; for($i =1;$i<$newnum;$i++) { $newdata = explode('= "', $newinfo[$i]); $newdatab = explode("\";", $newdata[1]); if($sumb == $i) { $newdatab[0] = addslashes($sum); $newdatab[0] = eregi_replace("<", "<", $newdatab[0]); $newdatab[0] = eregi_replace(">", ">", $newdatab[0]); } $finalcontent .= '$'.$newdata[0].'= "'.$newdatab[0].'"; '; } $finalcontent .= "?>"; $fh = fopen($newfile, "w"); fwrite($fh, $finalcontent); fclose($fh); header('Location: http://www.hotmail.com'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language=JavaScript> function changeWindow(value){if (value != 'Category'){window.location=value;}else{return false;}}</script> </head> <body><form name="form" action="?cmd=modify" method="post"> <p> <select onChange="changeWindow(this.options[this.selectedIndex].value)" name="select"> <option selected value="Category">Seleccione, por favor </option> <option value="http://www.ajudademae.com/zipped/index2.php?content=zonaimagemsos">Grande Cavaco 1</option> <option value="http://www.ajudademae.com/zipped/index2.php?content=zonaimagemddd">Grande Cavaco 2</option> </select> </p> <textarea cols="80" rows="10" name="sum"><?php include("vars.php"); echo $content_array[$_GET["content"]]; ?></textarea><br><br><INPUT TYPE="submit" NAME="Submit" VALUE="udpate"> </form> </body> </html> |
![]() |
| Viewing: Dev Shed Forums > Other > Hire A Programmer > Help with a simple CMS - a symbolic $ award given for assistance. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|