Want to build a website?
Feel free to contact us at any time.


View Latest news here.

Favicon Creator

Want to save yourself the time of figuring out how big a favicon should be in photoshop? Just go here: http://www.favicon.cc/ This is, by far, the easiest way to create a favicon for your website.

What the hell is a Favicon?
A Favicon is a “Favorites Icon”. To the left of the url in the address bar you will see an image that says that looks like a lightbulb. That’s the favicon for this website. When someone adds this website to their Favorites or Bookmarks, they will have that little image desplayed next to the website link. Simple huh?

Don’t Feel like creating a Favicon?

Well I could do it for you for about 6 million dollars, or you could go to http://www.favicon.cc/ and click on the tag cloud. There are tons of open use favicons for you to pick from.

 

Here is a rar file full of programming cheat sheets in PDF formats. It covers HTML, CSS, JavaScript, MySQL, Website SEO, jQuery, Durpal, Wordpress and more. Cheat sheets are a great way to remember a large amount of information. Entry to mid level programmers should always have cheat sheets handy around there computer while programming. While the sheets are visually available you will become more and more familiar with formats, functions, and santax.

Here is a list of whats inside

Quote:
1.) liquidicity HTML Help Sheet
2.) Addison-Wesley’s JavaScript Reference Card
3.) The most common DOM methods at a glance
4.) Smarty Cheat Sheet for Template Designers
5.) Expression Engine Quick Reference Chart
6.) CSS Cheat sheet (w3c recommended) LVL 1
7.) CSS Cheat sheet (w3c recommended) LVL 2
8.) DRUPAL 5 PHP TEMPLATE THEME DEVELOPER’S CHEAT SHEET
9.) MySQL Injection Cheat Sheet
10.) CSS Shorthand Cheat Sheet by Example leigeber.com
11.) CSS CHEAT SHEET - At a glance
12.) Drupal 6.x Core Hooks Cheat Sheet, valid as of January 20th, 2008
13.) XHTML Cheat Sheet v. 1.03
14.) Cake PHP Cheat Sheet
15.) CSS2.1 Quick Reference Card
16.) jQuery 1.2 Cheat Sheet v1.0
17.) Javascript Quick Reference Card
18.) Prototype JavaScript Library 1.5.0
19.) Cascading Style Sheets (CSS 2)
20.) RGB Color Codes Sheet
21.) Full CheatSheet for Javascript-Framework mootools rev 1.2
22.) Mysql Cheatsheet
23.) Filtering & Escaping
24.) html character entities
25.) PHP 4 Cheat Sheet
26.) PHP PCRE Cheat Sheet
27.) The Web Developer’s SEO Cheat Sheet
28.) jQuery API 1.2 Sheet
29.) JQuery Visual Map
30.) Anthonydamasco.com Web Term Cheat Sheet
31.) Wordpress 2.0 Plugin API
32.) Wordpress Theme Cheatsheet
33.) Drupal cheat Sheet
Quote:
Password: anthonydamasco.com
Quote:

download link available here:
http://www.anthonydamasco.net/downlo…heatsheets.rar

Navicat 8 for Mysql Review

This software has saved a ton of time for me. I recently obtained a copy of this great software and started using it today. Prior to using Navicat, I used MySQL Front and Nerocode MySQL client. Those are good clients, but they don’t have all the capabilities of Navicat 8.

Whats so damn special?

Well for starters, the software runs extremely smooth. It also does a great job organizing all my different database connections. But that’s just the tip of the iceberg. I am able to import and export straight from an excel spread sheet. This makes it extremely easy for my clients to do data entry or keep local records of there database without having to mess with a 3rd party converter. Navicat 8 also does a great job at backing up databases. I backed up a database with 40 tables and over 50 thousand rows in under 2 minutes. I was very pleased with it.

Alright Alright, how do I get this shiney MySQL goodness?

Well, as with most good things, you gotta buy it. Of course there are other ways of obtaining this software but I do not endorse that method at all…

Stay legal and buy it here :-p
http://www.navicat.com/store.html

 

So what we are trying to do is stop people from seeing pages unless they are logged in. We also don’t want any people going directly to the url to see the page either.

The first thing that we need to do is to create a session and a session variable.

Assuming you have a html form with a “username” and a “password” field, it would post a page that has this script

//##################################
// Author: Anthony Damasco
//
// Purpose: The login form posts the username and password to this script. We check if the password is correct and then display the main page, else we sent the user to
// “incorrect_password.php”
//
// Directions: Post a form with 2 text fields to this script. Name them “username” and “password”. then just change the include files in the if else below .
//##################################

// Connect to the database
//…………………………………
include “../includes/database_connect.php”;

// if both Fields are filled out proceed with check
if(isset($_POST['username']) && isset($_POST['password']))
{
// escape the variables
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

// If the username and password exsist in the database then you get in, else, you get to see the wrong password page
$sql = “SELECT * FROM Users WHERE `username`=’$username’ AND `password`=’$password’”;
$result = mysql_query($sql);

if(mysql_num_rows($result) == 1)
{

session_start();
// create the session variables
$user = mysql_fetch_assoc($result);
foreach($user as $key => $value)
{
$_SESSION[$key] = $value;
}

//The username and password were correct, show em the goods
include “main.php”;
}
else
{

// they got the password wrong
include ‘incorrect_password.php’;
}

mysql_close();
}
else
{
// they got the password wrong
include ‘incorrect_password.php’;
}

Now that the session variables are set, every page that will have protection, this user will be able to see. But no one else will. This is how we protect the pages.

Make a page called “password_check.php” and use the code below.

<?php
//##################################
// Author: Anthony Damasco
// Purpose: To protect files with a password
// Directions: Include this file at the top of the php pages. Do not start a new session, it is being created here.
//##################################

// check to see if there is a session, if not, create one. Woot
$ifsession = session_id();

if ( isset($ifsession)) {
session_start();
}

// If “password” is not stored in the session then show them nothing, and exit the script completely. this will also exit HTML and stop the page from displaying as long as the file extension is “.php”
if (!isset($_SESSION['password']))
{
include ‘not_logged_in.php’;
exit();

// else continue script
} else {
// Continue Script
}

?>

Now, on all the pages that need protection you just put an ” include “password_check.php”; ” at the top of the page, now you won’t have to start a session at the top of the protected pages because the session is already being created in this script.

Happy Coding!

 

This is how you store numbers in a MySQL database, then generate an average number based on all the collected data. I will assume you have some basic knowledge php and already know how to setup a database and connect to it. Make sure that when you create your table, to set the field that will store the numbers as INT.

First thing you need to do is create a form to collect the data. We will use this block of code as our example.

<form action="insert.php" method="get">
how would you rate this goat?
<input name="goat" type="radio" value="1">
<input name="goat" type="radio" value="2">
<input name="goat" type="radio" value="3">
<input name="goat" type="radio" value="4">
<input name="goat" type="radio" value="5">
</form>

Then you just dump the data into the mysql database

<?php

// grab the number from the form
$number = $_POST["goat"];

// connect to the mysql database
include "connect_to_db.php";

// insert the number into the database
$sqx123412331 = "INSERT INTO averages VALUES (NULL, '$number ')";
mysql_query($sqx123412331) or die ( mysql_error() );

//thank user for data :)
echo "thanks!";

?>

Once all that stuff is done your website now has the capability of storing numbers, next you will generate and the averages.

<?php

// connect to the mysql database
include "connect_to_db.php";

// use mysql to grab the number
$sql = "SELECT AVG(number) FROM averages “;
$result = mysql_query($sql);
while($r=mysql_fetch_array($result))
{
$rate=$r["AVG(number)"];
}

// Round the number
$The_Averaged_Number = round($rate);

//unset the vars so that they can re-used
unset($sql);
unset($result);
unset($r);
unset($rate);

?>

you can simply echo the variable from here anywhere you need it displayed. Hope that this has been helpful, Post questions in the comments if you have any.

Display Random Text in PHP

Rotating image and text are very popular in web development. In php, this can be done very easily.

What is a rotating element?
A rotating element is an image or block of text that is different every time you refresh the browser.  An example can be seen on my portfolio website, anthonydamasco.com , At the top right of my page you see 2 lines of text, if you refresh the page, you’ll notice that the text will change. Simple as that.

The Code

//Author: Anthony Damasco
//Purpose: Display random content
//First you create an array of HTML, you can use tags here too!
$random_text = array(”text 1″,
” Text 2″,
” Text 3″,
“Text 4″ );


//random function
srand(time());
$sizeof = count($random_text);
$random = (rand()%$sizeof);

// display random text
print("$random_text[$random]“);
?>

Where you see “text 1″, you just fill in whatever html code that you want, remember to place a backslash before every quote (example \”)

Save this code in it’s own file called “bait.php”, Then on any page you like you can call it by pasting the following code in any .php file.

<?php include ‘bait.php’; ?>

And that’s all there is too it.
Happy coding!