Monday 29 June, 2009 12:07 am | Usefull PHP | admin
|
The base usage in my mind when I write this tutorial to convert text into image with php is to write email into images dinamically to avoid spammers collecting such addresses from the internet.
To run such a script you must have GD library installed. We’ll take parametres via GET and merge into image:
<?php
if(!isset($_GET['text']))
{
die("No text provided");
}
header ("Content-type: image/png");
$textToConvert = $_GET['text'];
$font = 4;
$width = ImageFontWidth($font) * strlen($textToConvert);
$height = ImageFontHeight($font);
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0, 0,0);imagestring ($im, $font, 0, 0, $textToConvert, $text_color);
imagepng ($im);
?>
Save this as textToImage.php and then when you want to create the image and read text do it like :
<img src="textToImage.php?text=emailAddress@emailProvider.com">
Tags: php convert text into image, php email to image, php merge text into image, php write text to an image, php write to image, Write text and convert into image
Sunday 28 June, 2009 12:34 am | Usefull PHP | admin
|
To get browser name just use next thing :
<?php
print $_SERVER['HTTP_USER_AGENT'];
?>
And for all the features of browser user :
<?php
print_r(get_browser(null, true));
?>
Tags: php browser name, php detect visitor browser, php get browser, php get browser capabilities, php get user browser, php get user browser name, php get_browser, php get_browser() function
Monday 22 June, 2009 11:51 pm | Uncategorized | admin
|
Ventrilo is a voice over IP program that allows multiple people to communicate with each other over an internet connection. You have a choice of audio codecs like Speex and GSM, Ventrilo is based on the client-server model, the client will reside on your computer and the server will relay all of the data from the other clients to your computer. Ventrilo server hosting is fairly affordable, starting at $2.91 per month for 10 users.
Ventrilo is a great utility for development teams who like to keep in touch without having to deal with IM programs.
Tags: Ventrilo Server Hosting
Friday 19 June, 2009 5:35 am | It Stuff | admin
|
Sounds exactly what you want ? Are you damn curious about how to bypass captcha with php? Me too, and, I’ve found a very interesting set of functions which does that for you. Go to http://pastebin.com/f1560d747
You’ll see it’s requesting an api key you may get right here http://www.captchakiller.com/
Good Luck!
I have not tested it yet, you may let me know how is it by commenting!
Tags: bypass captcha, bypass captcha code, php bypass captcha, php bypass captcha code
Wednesday 17 June, 2009 2:21 am | Usefull PHP | admin
|
In my point of view, a very usefull and common thing we need when we build for example a membership site it’s country list array. I will do it within next function then will show how to use it :
Click here to get the function
And here’s how to use it for example to generate a select (drop down) with options to list countries:
<?php
$countryList = countryArray();
print "<select name=\"countryList\">";
foreach($countryList as $simbol => $country) {
print "<option value=\"$simbol\">$country</option>\n";
}
print "</select>";
?>
Simply usefull!
Tags: countries array, country array, php countries, php countries array, php country array, php country drop down, php country list, php country list array
Tuesday 16 June, 2009 12:14 am | Usefull PHP | admin
|
Beeing surprised that I didn’t write here about this “cute” php function called list(). I like it a lot, it’s like the extract() function in some way if you remember.
The list() php function will assign variables in one shot to strings from arrays.
<?php
$countingArray = array(1,2,3);
list("one", "two", "three") = $countingArray;
print "I am counting $one, errr I think it comes $two, and lastly $three";
?>
Tags: assign variables, list, php convert string into variable, php list, php list function
Monday 15 June, 2009 11:28 pm | It Stuff | admin
|
A web server is a device that allows you to present your website over the internet. Only a few companies afford to pay a huge amount to encompass an entire web server, named as dedicated web hosting. The other small and medium sized organizations can not afford such big sums. The option of shared or cheap web hosting is always open for such small scale companies.
Understanding shared hosting one can reveal that more than one websites can be hosted on a single server on which web space on the hard disc is divided among all the websites hosted on that server. It means that a number of websites use the same server to save their data. There is some necessary information that everyone must collect before choosing a shared or cheap web hosting. Like, is the shared web hosting worthwhile? What is the maximum number of websites that can use a hard drive? Are the server activities affected by increasing the number of hosted websites?
There is no limit of hosted websites on a single server, theoretically. As the web servers cost very high, everyone would like to host as many site as they can. This is actually beneficial for the web hosting providing company to host a large number of sites on a single server; however, for the website owner’s point of view it is not a good practice to host the website on a server that contains a lot of websites. Some of the experienced webmasters believe that it less depend on the number of websites, there is a possibility that only a single large website may occupy all the CPU and RAM space. So, there is a need to know which websites are hosted on that shared web server on which you are going to host your website.
Tags: cheap web hosting, shared web hosting, web hosting
Monday 15 June, 2009 12:14 am | Complete Scripts | admin
|
A very usefull and common subject : php pagination. You need this when you have a lot of entries in the database and don’t want to show them in a single page, here comes the results pagination in php. This works pretty simple, not that complex : firstly we calculate the total ammount of entries, then the numbers of page needed to show everthing, and, of course, how many results per page. Finaly, we’ll print out the entries and links for next, previous and page numbers.
//include database connection (check previous posts to get this one)
include('dbConnection.php');
//get the number of total rows
$query = "SELECT * FROM TableName";
$result = mysql_query($query);
// Number of records found
$num_record = mysql_num_rows($result);
// Number of results per page
$display = 5;
if(isset($_GET['page']) {
$currentPage = $_GET['page'];
}else{
$currentPage = 1;
}
//last page
$lastPage = ceil($num_record/$display);
//limit in the query thing
$limitQ = 'LIMIT ' .($currentPage - 1) * $display .',' .$display;
//normal query and print results
$query = "SELECT * FROM TableName $limitQ";
$result = mysql_query($query);
//here you do your loop like
while($row=@mysql_fetch_object($result)) {
print "$row->FieldName";
}
//pagination navigation (links)
//previous
if ($currentPage == 1) {
print "Prev ";
} else {
print "<a href=pagename.php?page=1>First page</a> ";
$previousPage = $currentPage-1;
print "<a href=pagename.php?page=$previousPage>Previous</a>";
}
print " { Page $currentPage of $lastPage } ";
//for next pages links
if ($currentPage== $lastPage) {
print "Next last";
} else {
$nextPage = $currentPage+1;
print " <a href=pagename.php?page=$nextPage>NEXT</a> ";
print " <a href=pagename.php?page=$lastPage>LAST</a> ";
}
?>
Now you can use this pagination to split your mysql results into multiple webpages!
Tags: paginate, pagination, php links, php navigation, php paginate, php paginate entries, php paginate results, php pagination, php results pagination, results pagination, set a number of results per page, split mysql results into page
Sunday 14 June, 2009 1:48 am | It Stuff | admin
|
Hi,
This is a request for people reading my feed or who already subscribed.
Please use the feedburner feed so I will be able to see how many guy’s are following.
FEEDBURNER URL :
http://feeds2.feedburner.com/crivionweb/kRHa
Tags: feedburner feed
Sunday 14 June, 2009 12:23 am | Complete Scripts | admin
|
Final step and the most easiest part is now users logging out. Just build a page called logout.php and put a link to it everywhere you want to give the option to users to logout & here’s the function:
<?php
function logoutUser() {
session_unset();
session_destroy();
header("Location: homePage.php");
exit();
}
logoutUser();
?>
Extraordinary,
Now you know how to build a complete membershipt script/site with php including registering module, logiging in & check this thing, and of course users logout module.
Tags: logout function, php logout, php user logout function, users logout
« Previous entries