Results 1 to 2 of 2

Thread: JS / PHP - Logging into webpage and editing content

  1. #1
    Join Date
    Jul 2013

    JS / PHP - Logging into webpage and editing content

    Hey folks!

    I know posts like this can be found around the web, but for my bad the many solutions brother G gave me didn't work for me.

    I am currently working on my own little cms. I don't want anything huge, I just want my clients to be able to log in to their site, find an "Edit" button while in their session, be able to use NicEdit (that's just what I'm using right now, if someone got a better solution please tell me), save their changes to the site and log off. I've been using CSS and HTML a lot, so there shouldn't be any problems with these. PHP and JS are rather new to me though.

    What I did so far:

    My example website. There are no php Scripts on this site, just the JS for the wysiwyg editor:

    The registration / login form I found on html-form-guide.com

    I am planning on combining those two while removing the "registration" part of the form, because I don't want anyone besides the already existing users to have access to the page.
    Actually I would be happy to use a more simple log in form for users. I really just need a simple session for using the editor, but I don't know how to do so with php and mysql. Most solutions I found didn't work. So if you have any suggestions on what to use instead - go ahead.

    Here come the problems:
    1. I don't really know how to make the editor visible to logged in users only. I could use some php script to check if user is logged in and THEN display the scripts in the head tag + the two buttons (Show Editor, Save).
    2. How to I save the changes to the site once I played around with the wysiwyg - html editor? I asked brother G and found the following:
    wiki.nicedit.com - saving via ajax which didn't work though.

    If anyone could help me I would be very, very thankful. I don't know ho complex this may get, but I am pretty fast at learning and understanding if someone explains stuff to me.
    So it would be also kind if you told me what the code you post actually means ^^

    I'm using lampp (under ubuntu) so my database details are root@localhost (no password). I created a table called 'nina'.
            jquery.min.js (In case I need some  jquery)
            nicEdit.js (this is the wysiwyg content editor I use)
    Here the most important code lines:
    HTML Code:
    7	<script type="text/javascript" src="scripts/nicEdit.js"></script>
    8	<script type="text/javascript" src="scripts/toggle.js"></script>
    HTML Code:
    22			<button onClick="toggleArea1();">Show Editor</button>
    23			<button onClick="SaveFunctionHere();">Save</button>
    24			<div id="myArea1">
    25				<h2>First Blogpost</h2>
    26				<p>This is just some example content.</p>
    27				<ul>
    28					<li>an example list</li>
    29					<li>an example list</li>
    30				</ul>
    31			</div>
    toggle.js (this works just fine)
    1    var area1;
    3       function toggleArea1() {
    4	    if(!area1) {
    5	    	area1 = new nicEditor({fullPanel : true}).panelInstance('myArea1',{hasPanel : true});
    6	    } else {
    7		area1.removeInstance('myArea1');
    8		area1 = null;
    9	    }
    10     }
    I'm thankful for any help! Thank you already.
    Sincerely, Shaldos

  2. #2
    Join Date
    Jul 2013
    It depends on what you want to have happen here. First off, you're going to need a login script and a database.

    There are great pieces of documentation for this found online. I can't point you in any specific direction, but search for "php login script tutorial".

    Once you've got that, and have the logins registering a session you can do a conditional statement to say, if logged in, then show this, otherwise, show this. That would look something like this:



    code for your editor panel here

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles