Mar 08
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/*Login Class*/
class  login{
	/*SUMIT FORM*/
	function formlogin($db,$action,$clientlogin,$username,$password){
		//VERITY DATA//
		return $this->parselogin($db,$action,$clientlogin,$username,$password);
	}
 
	/*VERIFY FOR NO MISSIN DATA*/
	function parselogin($db,$action,$clientlogin,$username,$password){
		//VARS//
		$credentials['action'] 			= $action;
		$credentials['clientlogin'] 	= $clientlogin;
		$credentials['username']		= $username;
		$credentials['password']		= $password;
 
		//CHECK FOR LOGIN ACTION//
		if ($credentials['action'] == 'login') {
			//COUNT ERRORS//
			$errorcount = 0;
			//PARSE DATA//
			foreach ($credentials as $key => $value){
    			if (empty($credentials[$key])){
        			$RETURN 	= "<h5><font color='red'>Missing Credentials</font></h5>";
        			$errorcount++;
    			}
    		}
    		//IF ALL DATA WAS FOUND TRY CREDENTIALS//
    		if ($errorcount == 0) {
    			return $this->logincredentials($db,$credentials['clientlogin'],$credentials['username'],$credentials['password']);
    		}
		}elseif ($credentials['action'] == 'logout'){
			//BLOW SESSION OUT//
			@session_start();
			@session_destroy();
			//REDIRECT//
			$RETURN  = "<script language=\"javascript\">";
			$RETURN .= "location.replace(\"index.php?task=login\")";
			$RETURN .=	"</script>";	
		} else {
			$RETURN 	= "<h5>Login Screen</h5>";
		}
		return $RETURN;
	}
	/*AUTHENTICATE LOGIN*/
	function logincredentials($db,$clientlogin,$username,$password){
		//CONNECT TO DB//
		$db->dbconnect();
 
		//SELECT CLIENTS DATABASE//
		$db->dbselect('main');
 
		//QUERY DATA AND VERIFY//
		$loginqry = mysql_query	("	SELECT `main_client`,`username`,`passwd`,`client`,`company`,`name`
									FROM main_credentials AS myCredentials
									JOIN main_client AS myClient ON myCredentials.main_client  = myClient.client
									JOIN main_company AS myCompany ON myClient.main_company = myClient.main_company
									WHERE myCredentials.username = '{$username}' 
									AND	 myCredentials.passwd = md5('{$password}')
									AND  myClient.clientlogin = '{$clientlogin}'	");
 
		$logincount = mysql_num_rows($loginqry);
		if($logincount	==	1){	
			$RETURN = "<h5><font color='blue'>Valid Credentials</font></h5>";
			//START SESSION HANDLER//
			@session_start();	
			@session_register("loginusername");
			@session_register("loginpassword");
 
			//ADD SESSION CLIENT//
			$_SESSION['clientlogin'] 	= $clientlogin;
			$_SESSION['username'] 		= $username;
			$_SESSION['password'] 		= $password;			
 
			//REDIRECT//
			$RETURN  = "<script language=\"javascript\">";
			$RETURN .= "location.replace(\"index.php?task=client\")";
			$RETURN .=	"</script>";		
		}else{	
			//SET FALSE RETURN//
			$RETURN = "<h5><font color='red'>Invalid Credentials</font></h5>";
			//DESTROY SESSION//
			@session_destroy();
		}
		//RETURN//
		return $RETURN;
	}
}
 
?>
Sep 15
 
#LOAD LIBS
from ftplib import FTP
import sys
import oss
ftp_ip       = ‘xx.xx.xxx.xx’
sftp_user    = ‘UserName’
sftp_pass     = ‘Password’

#Windows Path
clientl_sftp_path   = “C:\Users\LocalPATH\”

# Linux in Server
r_sftp_path   = “/mnt/Remote/Path/”

#CONNECT TO MEDIOS RESTRICTED FTP
try:ftp = FTP(ftp_ip)
ftp.login(ftp_user,ftp_pass)
#LIST FILES OT PUSH OR DIE TRYING :p
for root, dirs, files in os.walk(l_ftp_path):
for name in files:
#SET VAR
f = open(os.path.join(root,name),”rb”)
#DO UPLOAD
ftp.storbinary(’STOR ‘+name, f)
f.close()
#REMOVE FILE FROM LOCAL#
print “Removing: “+ os.path.join(root,name)#
# ERASE LOCAL FILES #
os.remove(os.path.join(root,name))
ftp.quit()
except ftp.Error:
print “Error Connecting”
sys.exit(1)

Sphere: Related Content

Mar 25

Lately I’ve been working on a new web repository, to ease my job I’m using joomla 1.0 as my frame work. at this point the site has partially functional ,however, there still much left to do.

The final goal of this site will be to work as social network repository for sites, such as digg, fark and facebook.

Peace.

Sphere: Related Content

Feb 28

Funny article about 9 signs that tell you to avoid that clueless web designer. My favorite: (sorry Microsoft diehard’s) “He’s a Frontpage expert”.

read more | digg story

Feb 27

Apple has just sent out invitations to press and developers to an event hosting the introduction of the iPhone SDK.

read more | digg story

Aug 25
Sphere: Related Content

May 17

function check_phone($phone)
{
if(!preg_match(”/[^0-9\ ]+$/”,$phone))
{
return TRUE;
}
else
{
return FALSE;
}
}
?>

May 14

function valid_email($email)

{
//check an email address is possibly valid
if(!eregi(”^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $email))

{
return true;
}

else

{
return false;
}
}