Jump to content


Photo

Write in PHP


  • Please log in to reply
5 replies to this topic

#1 aldozapata

aldozapata
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 May 2006 - 11:18 PM

Hi i dont speak too much english.

I wish you can help me and understandme.

i have a problem when i want to change the properties of a page from a form online. I am trying it of several forms and this is the one that works, but dont work as I want.
----------------------------------------------------------------------------------------------
this is the page from where I make the changes online (admin.php)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>admin</title>
</head>

<body>
<p>
<?php

switch($mode)
{
case 'write':

if ($fp = fopen("system.php", 'w')) {
$data="<"."?php
// titulo
\$titulo_1='$titulo_1';
// imagen
\$img_1='$img_1';
// Resumen
\$resumen_1='$resumen:_1';
// Noticia
\$noticia_1='$noticia_1';
// Link
?".">";

fwrite ($fp, $data);
// chmod("system.php", 0777);

}

echo "<div style=\"font-family:arial, helvetica, sans-serif; color:red; font-size:10pt; font-weight:bold;\">";
echo "Settings Saved.....</div><p>";
break;
}

?>

<?php
if (file_exists("system.php"))
{
include("system.php");
}
?>
</p>
<p><form name="settingForm" action="<? echo "$PHP_SELF?mode=write";?>" method="post">

<table border="0" cellspacing="10" cellpadding="0" style="font-family:arial, helvetica, sans-serif; color:#336666; font-size:10pt; font-weight:bold;">
<tr>
<td colspan="3" bgcolor="#EBEBEB"><font color="#336699">Noticia 1 </font></td>
</tr>
<tr>
<td>Titulo</td>
<td colspan=2> <input type="text" name="titulo_1" size="50" value="<? if ($titulo_1) { echo $titulo_1; } else { echo ""; } ?>">
</td>
</tr>
<tr>
<td>Imagen</td>
<td colspan=2> <input type="text" name="img_1" size="50" value="<? if ($img_1) { echo $img1; } else { echo ""; } ?>">
</td>
</tr>
<tr>
<td>Resumen</td>
<td colspan=2> <input type="text" name="resumen_1" size="50" value="<? if ($resumen_1) { echo $resumen_1; } else { echo ""; } ?>">
</td>
</tr>
<tr>
<td>Noticia</td>
<td colspan=2> <textarea name="noticia_1" cols="50" rows="5"><? if ($noticia_1) { echo $noticia_1; } else { echo ""; } ?>
</textarea>
</td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" value="Save Changes"></td>
</tr>

</table> </p>
</form>
</body>
</html>
---------------------------------------------------------------------------
this is the page of the variables system.php


<?php
// Noticia 1
$titulo_1='El titulo';
$img_1='../../img2/1.gif';
$resumen_1='hola, este es el resumen';
$noticia_1='Esta es la noticia completa';
$link_1='<a href="noticia1.php">Noticia completa</a> ';

?>
--------------------------------------------------------------------------
this is the page that reproduces the info index.php


<?PHP include ("system.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link rel="stylesheet" href="menu.css">
<style type="text/css">
<!--
.Estilo1 {
font-size: x-large;
font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="4" height="63" valign="top" background="1.gif"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td width="670" valign="top"><img src="2.gif" width="670" height="63" /></td>
<td width="100%" valign="top" background="1.gif"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="29" bgcolor="#666666"></td>
<td valign="top" bgcolor="#666666"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td bgcolor="#666666"></td>
</tr>
<tr>
<td height="6"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td valign="top"><span class="Estilo1"><?php echo $titulo_1 ?></span></td>
<td></td>
</tr>
<tr>
<td height="21"></td>
<td valign="top"><img src="<?php echo $img_1 ?>"/></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td valign="top"><em><?php echo $resumen_1 ?></em></td>
<td></td>
</tr>
<tr>
<td height="17"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="43"></td>
<td valign="top"><?php echo $noticia_1 ?></td>
<td></td>
</tr>


<tr>
<td height="18"></td>
<td valign="top"><div align="right"><?php echo $link_1 ?></div></td>
<td></td>
</tr>
<tr>
<td height="381"></td>
<td>&nbsp;</td>
<td></td>
</tr>
<tr><td height="2"><img src="spacer.gif" alt="" width="4" height="1" /></td>
<td><img src="spacer.gif" alt="" width="670" height="1" /></td>
<td></td>
</tr>
<tr>
<td height="1"><img src="spacer.gif" alt="" width="4" height="1" /></td>
<td><img src="spacer.gif" alt="" width="670" height="1" /></td>
<td></td>
</tr>
</table>
<!-- /Footer -->


<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menu_items.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<script language="JavaScript">
</script>
</body>
</html>

the site where I test is

[a href=\"http://digital-arts.myftp.org/usuarios/codemaster/\" target=\"_blank\"]http://digital-arts.myftp.org/usuarios/codemaster/[/a] the site
[a href=\"http://digital-arts.myftp.org/usuarios/codemaster/admin.php\" target=\"_blank\"]http://digital-arts.myftp.org/usuarios/codemaster/admin.php[/a] the admin.


I hope can help me


the bad php coder

#2 Carth

Carth
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationUK

Posted 12 May 2006 - 11:31 PM

[!--quoteo(post=373350:date=May 13 2006, 12:18 AM:name=N0T_PHP)--][div class=\'quotetop\']QUOTE(N0T_PHP @ May 13 2006, 12:18 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I am trying it of several forms and this is the one that works, but dont work as I want.[/quote]
And how do you want it to work? :)

Or does it not work at all?

#3 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 13 May 2006 - 12:05 AM

And what is your first language? Maybe one of us can help you in your native tounge via private message. :-)

I speak a couple of languages & might be able to decipher what it is you are trying to do.
PHP Ninja

#4 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 13 May 2006 - 12:50 AM

according to his code, I would assume its spanish. I could be horribly wrong though [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

#5 aldozapata

aldozapata
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 13 May 2006 - 06:17 AM

[!--quoteo(post=373354:date=May 12 2006, 06:31 PM:name=Carth)--][div class=\'quotetop\']QUOTE(Carth @ May 12 2006, 06:31 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
And how do you want it to work? :)

Or does it not work at all?
[/quote]

Dont work, if it opens, but dont save the changes.

[!--quoteo(post=373361:date=May 12 2006, 07:05 PM:name=Caesar)--][div class=\'quotetop\']QUOTE(Caesar @ May 12 2006, 07:05 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
And what is your first language? Maybe one of us can help you in your native tounge via private message. :-)

I speak a couple of languages & might be able to decipher what it is you are trying to do.
[/quote]


i speak spanish. :D

the problem with this code, Work the form ------ YES
Open the variables ----- YES
Save The changes ------- NO ----- This is the problem

the bad php coder

#6 aldozapata

aldozapata
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 13 May 2006 - 06:50 AM

It works ! ! !

CHMOD permissions are incorrect. Duh

TNX everyOne
the bad php coder




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users