Author Topic: link php file which contains only html code to other files? here are d codes  (Read 608 times)

ara

  • New Member
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
I am trying to install an article manager and know very little of php. it looks like the login file is incomplete

how can i link the login php file which contains only html code to other files

here is the html code with the file

<form name="login" action="" method="post">
<b>Username:</b>
<input type="text" name="username" />
<b>Password:</b>
<input type="password" name="password" />
<input type="submit" name="login" value="login" />
</form>

this is the edit.php page is is to link with
<?php
session_start(); //start the session
include("../system.php"); //include the system
if(isLogged())
{
//make safe
$id = makeSafe($_GET["id"]);

if(!$id)
echo "No id found!";
else
{
$query = mysql_query("SELECT * FROM news_book WHERE news_id = '$id'");
$data = getObject($query);
}
?>
<form action="" method="post">
<b>Title:</b>
<input type="text" name="title" value="<?php echo $data->title;?>" cols="50"/>


<b>Content:</b>
<textarea name="content" cols="120" rows="15" id="editor1"><?php echo stripslashes($data->content);?></textare…

<b>Category:</b>
<?php displayCategoriesAsList(getCategory($a->… ?>



<input type="hidden" name="post_id" value="<?php echo $id; ?>" />
<input type="submit" name="updatenews" value="Update" />
</form>
<?php
}
else
echo "You must be logged in to add news";
?>
 

and this is the preceding index.php file

<?php
if(session_id() == '') {
  session_start();
}
/**
 * This page can be included into a page on your website, please read the readme.txt file to
 * find out how to get this script working.
 */

include("system.php"); //include the system
?>
<!DOCTYPE html>
<html>
   <head>
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
      <script type="text/javascript" src="<?=INSTALL_LOCATION;?>script/joverlay_1_0_0.js"> </script>
           <script type="text/javascript" src="<?=INSTALL_LOCATION;?>tinymce/jscripts/tiny_mce/tiny_mce.js" ></script>   
           <script>
             $(document).ready(function(){
                  $("a").jOvery({
                      //When popup loaded, load this function
                      onLoad: function(){
                          tinyMCE.init({
                                 // General options
                                mode : "textareas",
                                theme : "advanced",
                                plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

                                // Theme options
                                theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
                                theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                                theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
                                theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
                                theme_advanced_toolbar_location : "top",
                                theme_advanced_toolbar_align : "left",
                                theme_advanced_statusbar_location : "bottom",
                                theme_advanced_resizing : true,

                                // Skin options
                                skin : "o2k7",
                                skin_variant : "silver",

                                // Example content CSS (should be your site CSS)
                                content_css : "css/example.css",

                                // Drop lists for link/image/media/template dialogs
                                template_external_list_url : "js/template_list.js",
                                external_link_list_url : "js/link_list.js",
                                external_image_list_url : "js/image_list.js",
                                media_external_list_url : "js/media_list.js",

                                // Replace values for the template plugin
                                template_replace_values : {
                                        username : "Some User",
                                        staffid : "991234"
                                }
                        });
                      },
                      //Set trans value (90%)
                      trans: 0.9,
                      popWidth:"",
                      popHeight:"",
                      popLeft:"25%",
                      bcolour:"#222",
                      loadingText: "<center><img src='<?=INSTALL_LOCATION;?>/script/loading.gif' /><br /> Loading, please wait ...</center>"
                  });
             });
             
           </script>
           <?php
           //IS USE CSS TRUE? IF SO USE THE NEWSBOOK CSS SHEET
           if(USE_CSS){
           ?>
           <style>
           @import "<?=INSTALL_LOCATION?>style.css";
           </style>
           <?php
           }
           ?>
   </head>
   <body>
            <div id="content">
                <?php
                //If not logged in
                echo "<span id=\"header_controls\">";
                if(!isLogged()){
                   echo "<a href=\"".INSTALL_LOCATION."page/login.php\" rel=\"overlayable\"> Login </a> ";
                }else{
                   echo "<a href=\"".INSTALL_LOCATION."page/addpost.php\" rel=\"overlayable\"> Add News </a> ";
                   echo "<a href=\"".INSTALL_LOCATION."page/addcategory.php\" rel=\"overlayable\"> Add Category </a> ";
                   echo "<a href=\"".INSTALL_LOCATION."page/settings.php\" rel=\"overlayable\"> Edit Settings </a> ";
                   echo "<a href=\"?logout\"> Logout </a>";
                }
               
                echo "</span>";
               
                //DISPLAY CURRENT NEWS (WITH A LIMIT ON HOW MANY TO SHOW, THIS CAN BE CHANGED IN SYSTEM.php
                displayNews(WEBSITE_POST_LIMIT,INSTALL_LOCATION,$_GET["category"],$_GET["term"]);
                ?>
            </div>
            <div id="copyright"> &copy; Copyright <?=date("Y")?> - <b>Powered By </b> <a href="http://www.dalemooney.co.uk" target="_blank"> NewsBook </a> </div>
   </body>
</html>

Ojoshiro

  • Technocentror
  • Senior Member
  • ****
  • Posts: 150
  • Karma: 4
  • That is not dead which can eternal loop...
    • View Profile
Is it very smartass to reply : "Ask Dale Mooney" ? ( @ www.dalemooney.co.uk ) :P
T.A.N.S.T.A.A.F.L.
_______________________________/

ErnieAlex

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 1863
  • Karma: 32
    • View Profile
Well, your form code goes nohwere...  You need an "ACTION" argument to send it somewhere...
So, your code in the form:  <form name="login" action="" method="post">
Needs to be something like:
   <form name="login" action="" method="post" action="edit.php">
This would send your form info to the edit.php file.

And, that is the start...  Let us know if you have any further questions...

  To:  Ojoshiro, he posted this in the "Learning PHP" section, give him a break and don't waste our time with your crazy posts!  They are okay for experienced people like me, but, for learners and beginners you are wasting everyone's time!

Ojoshiro

  • Technocentror
  • Senior Member
  • ****
  • Posts: 150
  • Karma: 4
  • That is not dead which can eternal loop...
    • View Profile
To:  Ojoshiro, he posted this in the "Learning PHP" section, give him a break and don't waste our time with your crazy posts!  They are okay for experienced people like me, but, for learners and beginners you are wasting everyone's time!
:o

To: ErnieAlex, ah, it's PHP then ErnieAlex. Not 'Copy and paste off someone elses site and try to get someone else to get it to work"? Good, then I'm in the right place.
Look at the last line ErnieAlex.
PHP Code: [Select]

</div>
            <
div id="copyright"> &copyCopyright <?=date("Y")?> - <b>Powered By </b> <a href="http://www.dalemooney.co.uk" target="_blank"> NewsBook </a> </div>
   </body>
</html>

Good thing this is 'Learning PHP' so I simply pointed him to the sourse.
T.A.N.S.T.A.A.F.L.
_______________________________/

ErnieAlex

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 1863
  • Karma: 32
    • View Profile
Yes, Ojoshiro, I agree with you about the copyright comment.  But, are you not here to help all?  I am.
If Mr. Mooney is nice enough to give starting code to others, why would we not help someone get it working?
Perhaps I do not understand your side of this.  Sorry again if I offended you.

Ara, after fixing the action clause in your form, did your code work?

Dale Mooney

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
When the login button is pressed, it is processed by a JQuery script, which embeds that login form into the index page (within a new DIV, which is an overlay).

The reason why no action is provided is because the index page does the processing of the form, because it assumes that the form will be embedded into the index page.

The actual code that deals with the login is located within the system.php file.

ErnieAlex

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 1863
  • Karma: 32
    • View Profile
Thank you very much, Dale.   I have not had time to install this on my test system to resolve it for Ara.
Glad you saved me from having to do that.  I have way too many to clear out as it is...  LOL

Since that file was not posted, we would have never knew that was the answer.  Hope Ara can sort it out!

Thanks again!

Dale Mooney

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
No Problem

Happy to help :)

ara

  • New Member
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Thanks Dale and thank you very much ErnieAlex, am really gratefully. I don't full understand Dale's explanation but am really grateful you both took out time to respond to my question

ErnieAlex

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 1863
  • Karma: 32
    • View Profile
Well, Ara,  He is saying that the file "system.php" handles the login code, I think.

So, basically, Dale's project is a "canned" system.  It comes with everything already there for you.
You just have to alter some basic items.  Look in the documentation that came with it and it should
tell you what you need.  Or, go back to his site and read the FAQ's on this system.

Good luck!