PHP

PHP Login Script / form

Today I have coded a php login script for you guys to have a look at. It is in its most basic form only using variables stored in the script as verification of the users identity but you could adapt it easily for use with a database.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/*
Simple PHP login script
–> By Andrew Pryde
–> http://www.pryde-design.co.uk
*/
 
// EDIT [...]

PHP

XSS Hole in PHP_SELF

It was brought to my attention recently by a reader of the blog that there was a vulnerability in one of my posts (The email sending script). I dismissed it becuase PHP_SELF is a server variable but then he confirmed with a proof of concept.
I was not aware of this and generally my code [...]

PHP

Last Five Wordpress posts on site index

As you can see there is a new layout for http://pryde-design.co.uk it includes the latest 5 blog posts as well and I am going to share how I did that with you as it took me ages to work out!
At the top of your page include / require the wordpress ‘header file’ (change the path [...]

PHP

PHP Mailing system

I have decided to write a tutorial on creating a mailing system In PHP. I do this because I have recently had to build one for a client and I found it quite interesting as I had not used the mail function in ages.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?
// Enter your email
$to = "andrew@pryde-design.co.uk";
 
// Contact form
$form = ‘<form name="Email Form" [...]

PHP

PHP updater

If you are releasing an application and need it to be able to update its self you can use fopen to open a remote file. for example:

1
2
3
4
5
6
7
8
9
10
11
12
<?php
if($fp = fopen("http://server/file-to-update-from", "r")) {
$content = ”;
while($line = fread($fp, 1024)) {
$content .= $line;
}
fclose($fp);
$fh = open("localfile-to-update", "w"); # you can use "a" for append if needed
fwrite($fh, $content);=
fclose($fh);
}
?>

As you can see [...]

PHP