Blogs
How to open a socket and send headers in php
I didn't play much with sockets and headers in php, but this is a good place to start.
I got this code from an article about php security:
"Of course, you can write your own client instead of manually entering requests with telnet. The following example shows how to perform the same request using PHP:
- liviu's blog
- Login or register to post comments
- Read more
How to make a page available only for certain ip's
How to make a page available only for certain ip's
How to block a php page for everyone except for certain ip's
How to only let certain ip's access a page and redirect the others somewhere else in php
You can do that like this
<?php if (($_SERVER['REMOTE_ADDR']<>'79.114.167.66')&&($_SERVER['REMOTE_ADDR']<>'78.97.250.137')) die ('the site is in maintenance');
?>
- liviu's blog
- Login or register to post comments
- Read more
Writing a blog guidelines
Writing a blog guidelines
Here are some things i picked up over the time about how to write in a blog.
- It's good to write one, or two posts daily. Google loves content. The more the better
- It's a good thing to write short stories and short sentences. Otherwise you risk getting your visitors tired/bored
- It's good to use bold on the keywords in posts. (<b>keyword</b> or <strong>keyword</strong>) This helps your users and the Google bot understand what your post/page is about.
- liviu's blog
- Login or register to post comments
- Read more
Why aren't my line breaks from the form showing when I display data from the database
Why aren't my line breaks from the form showing when I display data from the database?
I ran into this a year ago, when i was building my first community site in php from the ground up. I formatted the data to look ok in the form, but when i fetched the data from the database and echoed it on the page, all the line breaks were gone. It looked horribly. In phpmyadmin it looked good thou.
- liviu's blog
- Login or register to post comments
- Read more
How to google search like you were in another country
How to google search like you were in another country?
How to search google like you were in the USA?
There is a parameter you can use: gl (I think it stands for Global Location)
Here is how it works:
http://www.google.com/search?q=bank&gl=us
http://www.google.com/search?q=bank&gl=uk
- liviu's blog
- Login or register to post comments
- Read more
How to see what new pages google indexed in the last x days, weeks, months from a site
There is a parameter you can use in a google search, which lets you see what new pages from a site google indexed in the last x days.
The search looks like this:
http://www.google.com/search?q=site:website-design-blog.com&as_qdr=d5
This will search what new pages from the site website-design-blog.com have been indexed in the last 5 days.
- liviu's blog
- Login or register to post comments
- Read more
Where i got the favicon from
I got the favicon (the one in the address bar) from flickr. It says design makes me happy. In case anyone, except me, was wandering (why would i wander?I'm the one that put it there; what?). It's under a Creative Commons license so no harm done.
- liviu's blog
- Login or register to post comments
How to create captcha in php
How to create captcha in php?
How to protect a form with image verification?
I found on the web a great tutorial about how to implement captcha in forms. I saw it's used all around the web.
- liviu's blog
- Login or register to post comments
How to clean a variable against xss and sql injections attack
How to clean a variable against xss and sql injections attack?
This should be quite efective:
$var=mysql_real_escape_string(trim(htmlspecialchars(strip_tags($_GET['var']))));
- liviu's blog
- Login or register to post comments
How to submit a form without a submit button
I got this question at a job interview. How to submit a form without a submit button? Well, to do it you have to use something like this.form.submit trigered by an event.
Example:
<select onchange="this.form.submit()">
- liviu's blog
- Login or register to post comments