View Full Version : A Beginner to Coding?
.Joe.
June 25th, 2008, 00:01
Does anyone the most efficient site/place to learn how to code website templates, forum skins, etc. stuff like that?
Any help will be appreciated.
DarkBlood
June 25th, 2008, 00:10
References are the best start to learning it on your own (In My Opinion):
http://www.mysql.org (Use their search to look up a specific thing, IE: search for CREATE TABLE.)
http://www.php.net/manual/en/indexes.php (Function Index)
http://www.w3schools.com/ (For other stuff like HTML, CSS and JS.)
=====================
http://en.wikipedia.org/wiki/ASP.NET - ASP.NET Article
http://www.postgresql.org/ - PostgreSQL Website
http://en.wikipedia.org/wiki/Oracle_Database - Oracle DB
http://en.wikipedia.org/wiki/TxtSQL - Txt SQL (Might be needed for MyUPB (http://www.myupb.com/news/).)
=====================
Your question is vauge, because there aren't just PHP Message Board softwares (IE: Snitz Forum), and not all forum softwares use MySQL.
You also may have been talking about creating stuff for a remote host (like invisionfree), if that's the case, none of this should help; and you're better off going to the invisionfree support forums.
.Joe.
June 25th, 2008, 04:23
Thank you Iyeru,
Sorry if my question was vague, I'm looking to learn how to code templates (web designs), but right now like only simple HTML and CSS, and creating tables, etc.
Any places I can learn how to do that?
JonnyH
June 25th, 2008, 05:03
Depends what your designing for. Check the script website for documentation.
.Joe.
June 25th, 2008, 06:21
Thank you Iyeru,
Sorry if my question was vague, I'm looking to learn how to code templates (web designs), but right now like only simple HTML and CSS, and creating tables, etc.
Any places I can learn how to do that?
This is what I want to learn to do.
JonnyH
June 25th, 2008, 06:23
Tizag is a very well built site. I used it to learn PHP and Javascript:
http://www.tizag.com/htmlT/
DarkBlood
June 25th, 2008, 07:06
This is what I want to learn to do.
Like jonny said, it depends on the forum.
For example, if you have IPB 1.3 or earlier, you may need to know some PHP to change certain parts of the templates. (2.0 caches, soooo... if you have that you need to turn of cache'ing and have IPB get template data direct from the files, to change stuff you can't change via the ACP templating system. Don't know if it can do that though, phpBB3 has a setting to do that.)
.Joe.
June 25th, 2008, 07:18
What programming languages will I need to know to code my website designs?
JonnyH
June 25th, 2008, 07:28
HTML for your basic website templates, which I linked above.
Like Iyeru said, if want to do some advanced forum templates it's good to have some good knowledge of PHP and Javascript.
JohnN
June 25th, 2008, 07:31
if your using a script with a templating engine, none. You'll need to get familier with the scripts syntax, but the documentation on its site should cover this. It's good to know javascript - I suggest using mootools http://mootools.net/ so you can avoid having to do heaps of complex coding.
Getting proficient in css is a must. I've always gone to sites like cssbeauty.com and just read the articles - you pick stuff up through osmosis.
DarkBlood
June 25th, 2008, 07:35
if your using a script with a templating engine, none.
But both phpBB3 and IPB 2 have templating engines, and you still may need to know that stuff.
hamster
June 25th, 2008, 07:59
What I did, was to rip templates or grab free ones, then take them apart and test them here and there to see which code does what :P
Experiential learning ftw :P
Dynash
June 25th, 2008, 15:35
Also learning how the Smarty template engine works is good too. I know WoltLab BB3 uses the smarty template engine, almost all scripts these days do, but you still need to learn the var's for all different scripts, like {@RELATIVE_WBB_DIR} in WoltLab is the path to the icon folder, whereas another script could have {@PATH_TO_ICON} etc.
edit: also, I agree with Tizag, also using http://www.learnphpfree.com is good too.
JohnN
June 25th, 2008, 15:48
But both phpBB3 and IPB 2 have templating engines, and you still may need to know that stuff.
You'll need to get familier with the scripts syntax
filler
.Joe.
June 26th, 2008, 01:17
What language will I need to know if I wanted to design/create my own script? Something like a control panel, or a billing system?
Richard
June 26th, 2008, 03:24
What language will I need to know if I wanted to design/create my own script? Something like a control panel, or a billing system?
PHP.
But dont be suprised if it takes you 6-9 months of learning before you are able to even consider starting a project as big as a billing system :P
.Joe.
June 26th, 2008, 03:33
Oh, no don't worry. I expect even longer. Well I just started learning PHP, and I just made a log-in form, just a simple PHP log-in form. So it has no sessions or cookies. I honestly just started learning PHP today, the code I created is:
<html>
<head />
<body>
<form action="index.php"method=POST>
Username: <input type=text name=user><br />
Password: <input type=password name=pass><br />
<input type=submit value="OK!"><p>
</form>
<?php
$user=$_POST('user');
$pass=$_POST('pass');
if (($user==".Joe. && ($pass=="MyPass")) echo "Access Granted"
else echo "Access Denied!";
?>
</body>
</html>
Do you think I'm on the right track on progressing through and learning PHP? :)
I'm getting a pretty good understanding on variables, 'if' and 'else' statements, and echo's, etc. I already had a good understand of HTML.
Can anyone explain 'GET' and 'POST' statements a bit more to me?
JohnN
June 26th, 2008, 04:41
$_GET is an array of all data passed through the URL. eg:
mydomain.com?var1=hello&var2=world
if in the page you put print_r (print everything in an array) you would get this:
array(
[var1] => hello
[var2] => world
)
the array all this data is held in is $_GET
for $_POST it works the same way, except the variables are passed when a user submits a form.
<form name='form' action='post.php' method='post'>
<input type='text' name='Name'>
</form>
when submitted to post.php you could access the data put into the "Name" input like so: $_POST['Name']
neat eh?
Remember, when dealing with user input you MUST clean it first:
so:
$username = addslashes(striptags($_POST['username']));
for example.
You talked earlier about creating a control panel. You'll need to be doing incredibly advanced stuff for that.
DarkBlood
June 26th, 2008, 11:52
You talked earlier about creating a control panel. You'll need to be doing incredibly advanced stuff for that.
As well as DHTML if you want menus to animate (IE: flyout and stuff)
.Joe.
June 26th, 2008, 15:10
Okay, I'm trying to make a more serious log-in/authentication script but I'm going to have to use mySQL. I don't have alot of knowledge in this. I've made my database in mySQL, called Login, now I have to make a table also called login...now I made a table with 3 fields but I can't seem to figure out how to make the 1st field's 'type' an ID type? Anyone know what I'm talking about? And for the 2nd, and 3rd fields I want to make them user and pass types.
Dynash
June 26th, 2008, 15:16
CREATE TABLE IF NOT EXISTS `storage` (
`username` int(30) NOT NULL default '',
`password` int(30) NOT NULL default '',
`ID` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
I can't remember it correctly right now but I think that's it.
JohnN
June 26th, 2008, 15:41
joe, get phpmyadmin - it's fantastic. it'll help you tremendously.
Dynash
June 26th, 2008, 16:02
There are other low requirement alternatives, phpMiniAdmin (Link (http://www.sourceforge.net/projects/phpminiadmin)) - DMS (Link (http://deceptive-logic.com/resources/?resource=database_ms)) - FlashMyAdmin (Link (http://www.flashmyadmin.org/english/flashmyadmin.org.php)) - mySQLDump (Link (http://www.mysqldumper.de/en/))
there is another, but I forgot what it is.
.Joe.
June 26th, 2008, 16:49
I am using phpmyadmin, but I'm having troubles...
http://www.imgtags.com/uploads/SQLtable.jpg
Here's where I am, I don't know how to edit like you did. When I go through "type" scrolldown box there's nothing called "ID"?
I want my tables to look like this:
http://www.imgtags.com/uploads/sqltable2.jpg
Dynash
June 26th, 2008, 16:57
the first image is editing values directly in the table, try registering an account, and the ID should automatically add on, going 1,2,3,4, etc, without re-using the old #, even if the accounts been deleted.
http://www.google.com/search?client=opera&rls=en&q=php/mysql+login+script&sourceid=opera&ie=utf-8&oe=utf-8
there's some good tuts through there.
JohnN
June 26th, 2008, 17:01
allright:)
make sure you have a blank table, no rows, cols or anything.
then:
1250
now make it look like this:
1251
ok great! you've made your table structure.
Now go to insert. leave id blank, type in a username and a password and you're done!
.Joe.
June 26th, 2008, 21:50
Thanks Dynash and JohnN, I think that's it, Well mine quite doesn't look like the one it has there...it doesn't show the username or password like the one I wanted it to like does. I don't know if I did something wrong...or its a different version...I don't know.
Also, when I tried to put the script on my index.php page, I get an error looking like this:
Parse error: syntax error, unexpected T_STRING in /home/digitial/public_html/index.php on line 22
This is line 22, is there something wrong?:
$get=mysql_query("SELECT count(id) FROM login WHERE user='$user' and pass='$pass");
Also, I'm not really good at FTP...so is it bad to use the file manager on the cPanel? If not, where do I go to upload an image on the main index page?
Thanks.
DarkBlood
June 27th, 2008, 00:31
$get=mysql_query("SELECT count(id) FROM `login` WHERE user=`{$user}` and pass=`{$pass}`");
Is the correct way I believe. What's with id though? It's not a mySQL loop var--oh wait, nevermind.
iBrightDev
June 27th, 2008, 00:35
here is a simple login script that i hope helps you advance your knowledge. i have commented it a lot, so, i hope it helps you understand what was done.
first, you will need to create a database with a table named "login", no quotes. That table will need a couple values entered in. there is only 2 columns really needed. "user" and "pass"
make sure the password value is entered in the database as an md5 encrypted password. you can use this site (http://www.iwebtool.com/md5) for a converter.
now, create a script to allow you to connect to your database.
<?php
$DATABASEname = "DATABASE"; // Database name
$DATABASEuser = "USER"; // User with rights to the database
$USERpassword = "PASSWORD"; // Users password
$MYSQLhost = "HOST"; // Mysql host, typically localhost
// Make the connection.
mysql_connect($MYSQLhost, $DATABASEuser, $USERpassword) OR die ('Could cont connect to MySQL: '.mysql_error());
mysql_select_db($DATABASEname) OR die ('Could not select the database: '.mysql_error() );
?>
ok, time for the fun stuff, create an index page for the login form. create a new file named "index.php"
<?php # index.php
/************************************************************ *******************
* iBright Login is a product of::
* © Method Computer Technologies ® All Rights Reserved 2006 - 2008
*
* Author: Justin St. Germain
*
* Method Computer Technologies
* 00+1+(480)233-5006
*
************************************************************ *******************/
include ('connect.php'); // Connect to the database.
// Send NOTHING to the Web browser prior to the session_start() line!
// Check if the form has been submitted
if (isset($_POST['submitted'])) {
$errors = array(); // Initialize error array.
//Check for a username
if (empty($_POST['username'])) { // if the username wasnt entered
$errors[] = 'You need to enter a username.';
} else { // find the user name
$n = mysql_real_escape_string($_POST['username']);
}
//Check for a password
if (empty($_POST['password'])) { // If the password was not entered
$errors[] = 'You need to enter a password.';
} else { // run the password that was entered through md5 encryption check
$p = mysql_real_escape_string(md5($_POST['password']));
}
if (empty($errors)) { //If everything's OK.
/* Retrieve the user and pass
for username and password combination */
$query = "SELECT user, pass FROM login WHERE user='$n' AND pass='$p'";
$result = @mysql_query ($query); // Run the query
$row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable.
if ($row) { // A record was pulled from the database.
// Set the session data & redirect.
session_name ('uID');
session_start();
$_SESSION['user'] = $row[0];
$_SESSION['pass'] = $row[1];
$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
// Redirect the user to the admin.php (SUCCESSFUL LOGIN) page.
// Start defining the URL.
$url = $strAdminURL;
// Check for a trailing slash
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1); // Chop off the slash.
}
// Add the page.
$url .= '/admin.php';
header("Location: $url");
exit(); // Quit the script.
} else { // No record matched the query.
$errors[] = 'The username and password you entered do not match those on file.'; // Public Message.
}
} // End of if (empty($errors)) IF
mysql_close(); // Closes the database connection.
} else { // Form has not been submitted.
$errors = NULL;
}
//Begin the page login area now.
$page_title = 'Login';
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<title><?=$pT?></title>
</head>
<body>
Welcome to the admin panel. Please login to start editing the site to your specifications.
<br><br>
<?
if (!empty($errors)) { // Print any error messages.
echo '<strong>Error!</strong><br/>
The following error(s) occured:<br/>';
foreach ($errors as $msg) { // Print each error.
echo " - $msg<br/>\n";
}
echo '<br/>Please try again.';
}
// Error message if someone trys to bypass the login.
if (isset($_GET['error'])) {
echo 'Error!<br/>
The following error(s) occured:<br/>';
echo ' - Please enter a username and password to access the admin panel.';
}
// Create the form.
?>
<b>Login</b>
<form action="index.php" method="post">
<p>Username:<br>
<input class="textArea" type="text" name="username" size="20" maxlength="40" /><br/>
Password:<br>
<input class="textArea" type="password" name="password" size="20" maxlength="20" /></p>
<p><input type="submit" name="submit" value="Login" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>
</body>
</html>
now, you need create a file that will check to see if someone has tried to bypass your login or not, and if they do try to, it will kick them back to the login page and display an error. name this file "process.php"
<?php # process.php
# User is checked here after login.
session_name ('uID');
session_start(); // Start the session
// If no session value is present, redirect the user
if (!isset($_SESSION['agent']) OR ($_SESSION['agent'] != md5($_SERVER['HTTP_USER_AGENT'])) ) {
// Start defining the URL
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
// Check for a trailing slash
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1); // Chop off the slash.
}
$url .= '/index.php?error=1'; // Add the page.
header("Location: $url");
exit(); // Quit the script.
}
?>
now that the bypass checking is done, we need to create a page to go to if you have successfully logged in. name this page "admin.php"
<?php
require_once ('process.php'); // Make sure that the login was not bypassed.
// If the user logged in successfully, display the following message.
echo "Welcome to the admin panel. You have built a successful login script.<br/>\n";
echo "Every login scripts needs a way to log out, so, <a href=\"logout.php\">click here</a> to end the session.\n";
?>
now we need to be able to log out. create "logout.php"
<?php
session_name ('uID'); // define the session to logout of.
session_start(); // declare that we are using sessions
unset($_SESSION['user'], $_SESSION['pass'], $_SESSION['agent']); // unset our sessions
session_destroy(); // now destory them and remove them from the users browser
// Start defining the URL
$url = 'http://' . $_SERVER['HTTP_HOST'];
// Check for a trailing slash
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1); // Chop off the slash.
}
$url .= '/index.php'; // Add the page.
header("Location: $url"); // forward you to a page of your choice
exit(); // exit
?>
there you have it. i hope that helps you.
iBrightDev
June 27th, 2008, 00:38
This is line 22, is there something wrong?:
$get=mysql_query("SELECT count(id) FROM login WHERE user='$user' and pass='$pass");
just put...
$get=mysql_query("SELECT * FROM login WHERE user='$user' and pass='$pass");
Tree
June 27th, 2008, 00:48
This is line 22, is there something wrong?:
You missed then ending single quote on $pass. It's fixed in the below code.
$get=mysql_query("SELECT COUNT(id) FROM login WHERE user='$user' and pass='$pass'");
.Joe.
June 27th, 2008, 01:11
I actually found that out a little while ago, but even when I fixed it, it still gave me the same error, I was using mysitename.com/index.php but I had to use mysitename.com/index.html
Why is it when I use the HTML extension it works, but not when I use the PHP one?
iBrightDev
June 27th, 2008, 09:06
You missed then ending single quote on $pass. It's fixed in the below code.
$get=mysql_query("SELECT COUNT(id) FROM login WHERE user='$user' and pass='$pass'");
haha, totally passed that over. ;)
I actually found that out a little while ago, but even when I fixed it, it still gave me the same error, I was using mysitename.com/index.php but I had to use mysitename.com/index.html
Why is it when I use the HTML extension it works, but not when I use the PHP one?
explain a little more. not making much sense. :S
.Joe.
July 4th, 2008, 01:25
I mean, I guess I can't save PHP languages in an HTML file.
BrandonTheG
July 4th, 2008, 07:42
Correct, unless you send the the .html through the PHP paser.
Dynash
July 4th, 2008, 08:01
Using .htaccess :P
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
Also using tpl files, in the smarty template engine.
DarkBlood
July 4th, 2008, 10:03
Using .htaccess :P
Some hosts don't allow that file (Exa: T35.com) and FTP will spit out the following message:
Forbidden Filename: .htaccess
Using the workaround to get a PHP file to write an .htaccess produces an empty .htaccess file.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.