Questions about building a website - php

Just a couple questions about building websites. I know the basics of building a website, but there are a few things I was wondering about. The first thing is about posting on the main page. What I mean is if I want to set up an admin page where me or the other admin want to login and fill in the box and click post, how do you post to another HTML page? Can I just use php and if so how do you make it continually post the same way every time someone makes a post. The second thing is that when someone normally sets up an admin page or any kind of login page do they store the username and password in a mysql page? These may seem basic to some, but I have never had to do these types of things yet.

I suggest that you download and install Wordpress. This will take care of all the admin editing, security and posting to the front page for you. It's written in PHP and very easy to get started with. You can dip your toes into these deep waters! :)
good luck,
JD

You should learn PHP and Mysql. Mysql is a database, all your username/password/posting info will be stored there. And your PHP will do the updating or query content/posting from database to display in any page.
Read more at : http://www.freewebmasterhelp.com/tutorials/phpmysql

Related

How should I build a website for someone else who wants to embed their own Youtube links?

first post here.
I am making a site for someone who wants to embed their own youtube links. I am relatively new to web development and this is my first commission so I was wondering how I could hand over the site to the client and allow them to upload their links without me having to edit the mark up for him.
I understand how to use an '<iframe' youtube link in HTML to embed videos and am considering creating a database using PHPmyadmin that uses a form that the client can fill in with the iframe link whenever he needs to embed a new video.
I understand if that sounds like a convoluted way of doing this but if anyone knows a more intuitive way to solve this issue please let me know :)
I think it can be done using a database, may be MySQL, to keep it simple and a simple backend programming language, PHP would do.
You create an admin page just to collect the URLs from the admin. A nice little login page which stores admin username and password in a table. And you can use this module to assign roles to admin, add an admin or delete one.
Inside the module created above, create a page with a form to fetch and store URLs in the database. If you are going to categorize the videos, use suitable columns. Say you are going to categorize based on the genre and length, the table in your database should contain genre and length so that you can use them as filters later on.
Use cookies to create session for the admin. This is to avoid redirecting him to the login page after every single reload.
For all other user who is not admin, do not redirect to the admin page. Redirect them to a common page where they can search and enjoy the videos that the admin has added.
Again, like mentioned in many comments above, wordpress does it all. You have an option to use it too, it's free.

WordPress Login System (with the loop?)

I currently have a MySQL database from my old site that used to have a basic PHP log-in form and it would query a table containing the user information to log them in. Basic stuff. However I've recently moved to WordPress and it appears to be quite overwhelming at first, so I'm struggling to understand how to integrate my old log-in form with a WordPress site.
I have tried looking at this post:
Wordpress login system and I am still confused. I understand the 'loop' is responsible for displaying multiple 'Posts' on a single page. But to integrate my own PHP code or more specifically; a log-in page, would I make a logged-in 'Post' and a not-logged-in 'Post', and perhaps use a template to display one or the other for a single page via a 'Loop' that uses an if statement to check if the user is logged in?
Or is there some easier method that I'm completely missing?
Thanks!
EDIT: I've thought about creating two pages, both using a template to check if the user is logged in at the top, and display relevant content if they are, or redirect to the log-in page if they aren't. Would this work?
The other possible method I could think of is creating two Posts and displaying the relevant one on a single Page via The Loop. Would this be possible? Are there any security concerns?
EDIT2: I'm going to try the Members plugin and see if I can modify the WordPress MySQL tables to allow room for my previous data.
EDIT3: I need to sync my user logins to our external database as it contains flags to check whether my members are able to access our 'support' pages. I'm not sure how this would be viable while relying on the normal WordPress login system and tables.
Keep it simple stupid.
The point of WordPress is to make things easier. So if you want to go with WP, you should adopt the WP way of doing things.
As comments has suggested, import your current user table into WP. Should be simple enough to change the columns around to get a working import directly into the WP users table.
If there is extra information in your current user table, simple create new fields in the User Profile section of WP. There should be plugins for this (although I have not tried any), but it is quite simple to add these fields yourself, just google for it, there are many tutorials.
For a frontend page to be accessed by only logged in users, simple create a page template and check if user is logged in with is_user_logged_in().
For the access part (Support Pages), either create different user roles and check that the currently logged in user is of the correct role. Or you could also add a custom user capability and validate it on your support pages.
Based on the very general details you have given there is no 'easier method' you are missing. We can't help you form the requirements of your application, but we can help with code if you paste examples of the code you are using, what you are trying to achieve, and what is going wrong with it. Pick one thing, try it out, and if it doesn't work and you get stuck then post it here.

How to auto fill Text box in php (Similar to Facebook)

What I am trying to do is to make something similar to what I see all the time on almost any website. The button that says Share to facebook. The goal for me is to let my guests share the item they are viewing in my store (Ran on prestashop) on their blog I run (Running on Oxwall).
The goal is for the button to not only link to a blog post submission webpage but to already have the subject line filled out with the item they are sharing's name and the blog post to display the information about the item. I would like to try and do all this using PHP. I am not sure how to go about doing it but I am sure that I could pass the value. Please note that I can mod BOTH the blog site and the shop as I run both and want to connect them.
As an extra bonus I am also running a forum using phpbb3 if I could do the same thing but onto that as well I would greatly thank you. I am trying to interlink everything into one big network. I know its not an easy task but I am sure there is an easy way to pass data onto the other site so that this can be done.
Facebook a 2 tools to get items informations in the page, it parses the page looking for the most common tags and it uses OpenGraph.
You can also provide product informations in the head of your page (between head tags), then blog side, you retrieve only the contents and parse it as XML.
I advise you to cache this data to avoid useless connections between websites and awful overloads while parsing.
You can use your own specifications, Open Graph or another standard, but i advise to use a standard.

Getting a discussion forum /query support on my website

I want to have a forum like thing on my website.I dont want any complicated thing, just the user must be able to post questions and the administrator(that is me) can answer them..(It would be nice if it has tree like structure but even without that it is fine) ..All the users can read the questions on the forum anytime(obvious) ..I dont want to put phpbb3 or any such readymade tool..I just want to be it simple (something like this scroll to the bottom) ..How to get this thing done..If possible in php please tell that..Otherwise tell other options..Please help me out..
You could probably do something like this in WordPress. (Your local webserver would need to be running MySQL as well as PHP to achieve this.) At the simplest level you could set up a page and allow user comments on it.
A really simple way is just to have a basic form with text-input, textarea, and submit button. Then have the person input their name, question, and submit it. Make sure you validate the form with js and/or php. Then update a password protected page that only you can access with the name and question. Then using whatever cms you have for this page (or just static html if you have the patience) you can just update the front page with the new question and answer above the form.
The best way, though, is going to be some kind of "readymade" system that you tweak...

PHP, MySQL: Display only required parts of my website in sister website

Now I have my website built on PHP & Mysql. Consider this like a forum. Now when a user posts a reply in my website 1 (ex. www.website1.com), I want to be able to show the starting thread and it's related replies in a sister website of mine. I want to do this in a way that it does not show the rest of the page & other page contents (like logo etc.). I don't think iframe would be a solution because an iframe would embed the whole page and the users visiting my sister website (totally different domain i.e. www.website2.com) would be able to see all the page contents, like logo etc. I want to avoid that. I want to make them see only limited information from website 1 and only the info. that I intend.
I hope that makes sense. In a way, you could say that I am trying to replicate my 1 website, and show only a limited part of it. Users browsing 2nd website can post a reply in the 2nd website and it should automatically be posted & visible to the visitors of the website 1. Users of website 1 should not know that a user of website 2 has posted it. They would feel that some user from website 1 has posted it. Do I have to use 2 separate mysql DB or just 1? I think it would be problematic if I am trying to use different DB. I also feel I might have to face DB connectivity issues as I can connect to only 1 DB at a time.
It's basically like users of website1.com should feel that they are replying to users of website1.com & users of website2.com should feel that they are replying to users of website2.com. (I need it this way to bridge the gap between them). At the same time I want to make the front end of the websites different so that they don't feel that they are replying to some other users outside the domain. These websites would be under my control and I will have access to the source code at any time. If I need to change the source code, these changes are welcome.
Is this really possible?
Thank you in advance.
I'd recommend generating RSS (might be runtime) and using it on the sister website. If RSS is not suitable for your needs, you can create your own XML-based format (or any other :) )
Make two forums which use one database. Both websites would put new messages in the same database.
Make an API for website1, so that website2 can retrieve and post messages on the forum. Website2 would do a HTTP request to website1, which returns XML or JSON, so that website2 can request a list of posts that it can display.
Have both sites connect to the same database and display the content they pull in whatever way is appropriate for the particular site. Each site can only pull the fields relevant to that site.
If the idea is to have two websites with the same data but different presentations, then you would want to simply share a single database between them - assuming they are hosted in the same place and can both get at the database.
You can then just create different PHP pages that both access the same database in the same way but display the data differently.
The best way to do this would be to have a shared library of functions or classes that both sites use to manipulate the data. You would then build a different "presentation layer" on top of that for each site.

Categories