This is a module I have worked on a while back. I have recently had the time to finish it and it is now released and hosted on drupal.org, which is very exciting.
You can view the module project page here, to see a demo page, please visit here
The module was made with one thing specifically in mind, giving the users more information when they encounter a 403 on a website. Since drupal uses various role based node access privileges, I thought a module that provides custom information based on the roles allowed or disallowed on any specific node will be more helpful.
The module works with the content access module to give the visitors information on what roles are allowed to access the nodes and maybe the admins can also give more information on how to obtain these roles. Anyways, please enjoy the module, if you have questions and comments, please let me know
Have you ever written a piece of code that works, but the amount of redundancy and inefficiency drove you nuts? Always had the itch to go back and pretty it up? Well, that’s exactly what I did. I recently wrote a script for a people directory, it contained 3 parts
An database storing the information of the people (i.e. name, states, country, etc etc.)
the html input file (see example below)
The data processor using PHP
input file (input.html)
The idea is that you will be able to select a last name or a state and find the corresponding results. For example, finding someone in the state of Virginia, finding someone with last name start with W, or a combination of both.
This was the first attempt for selecting the matching last name:
HERE
HERE
By using arrays, here are the code for selecting the matching last name and state and generate the SQL query
A while back one of my project was to create a joomla based content management website. Afterwards I was asked to make a backup mechanism that would back up all of the content on the website. There were plenty of third party plugins available on joomla’s extension directory but I found them either too complicated for normal users to operate or costed money. Another option was to use PhpMyAdmin to backup the entire joomla database, however that was too
complicated for the user in this situation as well. Therefore I decided to write a custom php script made just to handle the content backup.
Some file you need download: (PHP ZIP library: PHP zip library, contains: Zip.php and PEAR.php)
1st: I had to find where the content was stored, luckily for joomla based CMS all contents are stored in the database under the table “jos_content” or whatever the pre-fix: “xx_content” in the joomla database you created.
2nd: I had to create the basic MySQL connection script: here are the following:
openning the database:
//********************************************************************************
//opendb
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
//********************************************************************************
configure the database information: Simple enter the MySQL database information
Here are the basic scripts for openning and closing a mySQL database connection in php, for more information on them, visit w3schools to learn more
Now comes the meat of the script:
//************************************************
//include the php library for zip file compression
//************************************************
include ('Zip.php');
//*************************************************************************************
//Querying the database table containing the contents of the website, notice we used a
//concat function to combine the introtext and fulltext together
//*************************************************************************************
$query = "SELECT id, title, concat(introtext, concat('\n', `fulltext`)) content FROM jos_content";
$result = mysql_query($query);
//*****************************************************************
//Displaying the SQL querying result in html using a form text area
//*****************************************************************
echo "";
echo "
$number files created under /help/backup
";
//providing download link
echo "Click here to download the backup package";
As some of you can tell, this script is still in very immature stage, future updates could include SQL injection prevention measures, validation of the backup directory and also deletion of the html files once they have been packaged. Anyways I hope this have been useful.
It’s very exciting isn’t it, in the second program, We are attempting to create a customized simple internet browser. My program consist of the following controls:
1 WebBrowser (the web content area)
Name: BrowseWindow
3 buttons (HomeButton, BackButton, Button_1)
Some thoughts: The browser is very simple, address does not address content of the web. Maximize, content area does not, future considerations.
Code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BrowseWindow.Navigate(TextBox1.Text)
End Sub
Private Sub BackButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackButton.Click
BrowseWindow.GoBack()
End Sub
Private Sub HomeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HomeButton.Click
BrowseWindow.GoHome()
End Sub
End Class