@-moz-document url-prefix("http://snipplr.com/") {
code {
font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace !important;
font-size:0.9em !important;
background-color:#E0E0E0 !important;
}
#meerkat-wrap, a.adhere, a.ad1, ins, #top-banner {
display:none !important; /*remove ads*/
}
}
@-moz-document url-prefix("http://snipplr.com/edit/"), url-prefix("http://snipplr.com/new/") {
#title, #tags, #url, #comment {
font-family:Arial, sans serif !important;
font-size:1em !important;
font-style:normal !important;
}
#source {
font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace !important;
font-size:0.9em !important;
height:26em !important;
}
#comment {
height:11em !important;
}
#sidecol {
display:none !important;
}
#maincol {
margin-right:0 !important;
padding-right:0 !important;
border-right:0 !important;
}
#maincol p {
padding-right:15px !important;
}
#comment, #source {
width:100% !important;
}
}
@-moz-document url-prefix("http://snipplr.com/view/"), url-prefix("http://snipplr.com/view.php?codeview") {
div.description pre, .comments pre {
color:#000000 !important;
background-color:#E0E0E0 !important;
margin:1.4em !important;
border:1px dashed #E0E0E0 !important;
font-size:0.9em !important;
}
#innersource pre, #viewsource textarea {
font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace !important;
font-size:13px !important;
}
#comment {
font-family:Arial, sans serif !important;
font-size:1em !important;
font-style:normal !important;
}
#viewsource .sourcenav {
text-align:right !important;
}
#viewsource .sourcenav .rgt {
float:none !important;
}
#viewsource .sourcenav ins { /*remove ads*/
visibility:hidden !important;
}
#sidecol h2:first-child, #sidecol ins { /*remove ads*/
/*display:none !important;*/
}
hr.dotted.marg + table, center ins { /*remove ads*/
display:none !important;
}
}
@-moz-document url-prefix("http://snipplr.com/") {
#sponsored-search { /*remove ads*/
display:none !important;
}
}
Tag Archive for user
User stylesheet for Snipplr
Create Username/Password for Samba – Ubuntu Shared Folder
sudo smbpasswd -a <username>
Drop Privileges
# Get the UID the application was started with # which must have been 'root' if you want this process # to have 'root' like abilities. privUID = os.geteuid() # Get the UID that the application should use for # most of its processing, 'nobody' is usually # a good choice. normalUID = pwd.getpwnam( 'nobody' )[2] def runAsNormal(): """Switch this process to normal privileges, we shouldn't be able to do anything naughty in this mode.""" os.seteuid( normalUID ) def runAsPrivileged(): """Switch to super user privileges, here we can do anything we want.""" os.seteuid( privUID ) # Once program has initialized, drop privileges runAsNormal() # ... some normal application code... # Do do something that requires super user privileges try: runAsPrivileged() # ... do the stuff we need to be super for finally: # Switch out of super mode and back to normal runAsNormal()
User Registration in CakePHP
<?php
/**
* Class used for user authentication on the league website
*
*/
class User extends AppModel
{
var $name = 'User';
var $validate = array(
'id' => array('rule' => 'blank',
'on' => 'create'),
'username' => array('rule' => 'alphanumeric',
'required' => true,
'message' => 'Please enter a username'),
'password' => array('rule' => array('confirmPassword', 'password'),
'message' => 'Passwords do not match'),
'password_confirm' => array('rule' => 'alphanumeric',
'required' => true)
);
function confirmPassword($data, $fieldName) {
$valid = false;
if ($data['password'] == Security::hash(Configure::read('Security.salt') . $this->data['User']['password_confirm'])) {
$valid = true;
}
return $valid;
}
}
?>
Gestionale per utente php con form di login, logout, upload e canc files
//admin.php page
<? session_start();
if($_SESSION['galleria']!="admin"){ ?>
<form method="post" action="function.php">
<input type="hidden" name="tipo" value="login">
User <input type="text" name="user"><br />
Password <input type="password" name="password">
<br />
<input type="submit" value="INVIA">
</form>
<? } else {?>
<form method="post" enctype="multipart/form-data" action="function.php">
<input type="hidden" name="tipo" value="upload">
<input type="file" name="documento">
<br />
<input type="submit" value="INVIA">
</form>
<? }
$cartella="photo";
$directory=opendir($cartella);
while($files=readdir($directory))
{
if ($files != "." and $files !="..")
print $files."<a href='function.php?tipo=canc&file=".$files."'>cancella</a><br>";
}
/*fine sessione file manager*/ ?>
<a href="function.php?tipo=logout">Logout</a>
//function.php page
<?
session_start(); /*va sempre in cima alla pagina per dirgli che abbiamo intenzione di utilizzare all'interno del documento delle variabili di sessione*/
$cartella="photo";
switch($_REQUEST['tipo']) {
case'login':
if(($_REQUEST['user']=="yourusername")&&($_REQUEST['password']=="yourpassword")){
/* creo una ariabile di sessione, che si chiamerà galleria:*/
$_SESSION['galleria']="admin";
}
/*se non c'è la variabile di sessione facciamo ritornare l'utente alla pagina di admin*/
header("location:admin.php");
break;
case'logout':
session_destroy();
header("location:admin.php"); /*this permits to return to previous page*/
break;
case'upload':
move_uploaded_file( $_FILES['documento']['tmp_name'],$cartella."/".$_FILES['documento']['name']);
chmod($cartella."/".$_FILES['documento']['name'],0666);
header("location:admin.php"); /*this permits to return to previous page*/
break;
case'canc':
unlink($cartella."/".$_REQUEST['file']);
header("location:admin.php"); /*this permits to return to previous page*/
break;
}
?>