A full PHP + MySQL portfolio website with Google OAuth admin backend, portfolio gallery, and shop with print-on-demand support.
pottery/
├── config/
│ └── config.php # DB + OAuth credentials
├── includes/
│ ├── bootstrap.php # Loaded by all pages
│ ├── Database.php # PDO database helper
│ ├── Auth.php # Google OAuth
│ └── ImageUpload.php # Image upload + thumbnail
├── templates/
│ ├── nav.php # Public nav
│ └── footer.php # Public footer
├── public/
│ ├── index.php # Homepage
│ ├── portfolio.php # Portfolio gallery + lightbox
│ ├── shop.php # Shop (pots + merch)
│ ├── about.php # About page
│ ├── css/style.css # Main stylesheet
│ ├── js/main.js # Nav + misc JS
│ ├── js/portfolio.js # Lightbox
│ └── uploads/ # (created automatically)
├── admin/
│ ├── login.php # Google login
│ ├── logout.php
│ ├── dashboard.php
│ ├── auth/callback.php # Google OAuth callback
│ ├── pottery/ # Portfolio CRUD
│ ├── shop/ # Shop CRUD
│ ├── social/ # Social posts + links
│ ├── settings/ # Site content settings
│ ├── css/admin.css
│ ├── js/admin.js
│ └── partials/ # Sidebar, topbar
└── schema.sql # Database schema
mysql -u root -p < schema.sql
Edit config/config.php:
define('DB_HOST', 'localhost');
define('DB_NAME', 'pottery_portfolio');
define('DB_USER', 'your_db_user');
define('DB_PASS', 'your_db_password');
define('SITE_URL', 'https://yourdomain.com');
define('GOOGLE_CLIENT_ID', 'YOUR_GOOGLE_CLIENT_ID');
define('GOOGLE_CLIENT_SECRET', 'YOUR_GOOGLE_CLIENT_SECRET');
define('ALLOWED_ADMIN_EMAILS', 'your@gmail.com');
- Go to https://github.com/settings/developers
- Click OAuth Apps → New OAuth App
- Application name:
My Pottery Admin(anything) - Homepage URL:
https://yourdomain.com - Authorization callback URL:
https://yourdomain.com/admin/auth/callback.php
- Application name:
- Click Register application
- Copy Client ID and generate a Client Secret
- Paste both into
config.php:
define('GITHUB_CLIENT_ID', 'your_client_id');
define('GITHUB_CLIENT_SECRET', 'your_client_secret');
define('ALLOWED_GITHUB_USERS', 'your-github-username');
Apache — Point document root to the project root, or set up a VirtualHost:
<VirtualHost *:80>
DocumentRoot /var/www/pottery
ServerName yourdomain.com
<Directory /var/www/pottery>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Nginx:
server {
listen 80;
server_name yourdomain.com;
root /var/www/pottery;
index index.php;
location / { try_files $uri $uri/ /index.php?$args; }
location ~ \.php$ { fastcgi_pass unix:/run/php/php8.2-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }
location ~* \.(jpg|jpeg|png|gif|webp|ico|css|js)$ { expires 30d; }
}
mkdir -p public/uploads/pottery public/uploads/products
chmod -R 755 public/uploads
chown -R www-data:www-data public/uploads # Linux
- PHP 8.0+
- Extensions: PDO, PDO_MySQL, GD (for thumbnails), cURL (for OAuth)
Visit: https://yourdomain.com/admin/login.php
Sign in with your Google account. Only emails listed in ALLOWED_ADMIN_EMAILS can access the admin.
| Section | What you can do |
|---|---|
| Portfolio | Add/edit/delete pottery pieces with photos, technique, dimensions, year. Mark as featured. |
| Shop → Pots | Add individual pots for sale with price, availability, enquiry email. |
| Shop → Merch | Add print-on-demand products with provider, product URL (Printful, Printify, Redbubble). |
| Social Posts | Add posts by URL + thumbnail to show on homepage. |
| Social Links | Manage Instagram, TikTok, Pinterest, YouTube links. |
| Settings | Edit site name, tagline, bio, hero text, about text. |
- Create your products at printful.com
- Copy the product URL or your storefront URL
- In Admin → Add Product → Type: Merch → Provider: Printful → Paste URL
Same process — use your Printify store URL or individual product links.
Add your Redbubble shop/product URLs. Customers click "Buy Now" and go to Redbubble.
Since Instagram/TikTok restrict direct API access, the recommended workflow is:
- Thumbnail method: Upload your post image somewhere (Cloudinary, your own server, etc.), paste the image URL + post URL in Admin → Social Posts.
- Embed method: Paste the embed
<iframe>code directly (works for TikTok, YouTube).
The homepage shows posts marked as "featured".
- Colours: Edit
:rootvariables inpublic/css/style.css - Fonts: Change the Google Fonts import at the top of any page
- Adding pages: Create a new
.phpfile in the root, includebootstrap.phpand the nav/footer templates - Categories: Manage shop categories directly in the database (
shop_categoriestable)
- Google OAuth only allows your specific email(s) in
ALLOWED_ADMIN_EMAILS - Uploaded files are stored outside web-accessible directories (configure your server)
- All user input is escaped with
htmlspecialcharsor parameterised queries - Enable HTTPS and uncomment the redirect in
.htaccess