Pereiti prie turinio

php kontaktu forma


Rekomenduojami pranešimai

Sveiki štai naudoju šita kontaktu forma :

 

<?php

if (isset($_POST['Submit'])) {

$vardas = $_POST["vardas"];

$email = $_POST["email"];

$laiskas = $_POST["laiskas"];

$tema = $_POST["tema"];

 

$admin_mail = "[email protected]";

 

 

 

$suformuotas_laiskas = "

 

Vardas: $vardas

El. pastas: $email

 

$laiskas";

 

// Patikrina ar netuscias vardo laukelis:

$zinute = "Tuscias vardo laukelis";

if ($vardas != "")

{

// Patikrina ar netuscias emailo laukelis:

$zinute = "Tuscias el.pasto laukelis";

if ($email != "")

{

// Patikrina ar netuscias laisko laukelis:

$zinute = "Tuscias zinutes laukelis";

if ($laiskas != "")

{

// Patikrina ar netuscias laisko laukelis:

$zinute = "Tuscias zinutes laukelis";

if ($tema != "")

{

// Siuntimo funkcija:

mail ($admin_mail, $tema, $suformuotas_laiskas);

$zinute = "Laiskas issiustas.";

}

}

}

}

echo $zinute;

 

} else {

echo '

?>

 

 

 

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">

<tr>

<td><strong>Kontaktai</strong></td>

</tr>

</table>

 

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">

<tr>

<td><form name="form1" method="post" action="#">

<table width="100%" border="0" cellspacing="1" cellpadding="3">

<tr>

<td width="16%">Tema</td>

<td width="1%">:</td>

<td width="82%"><input name="tema" type="text" id="tema" size="50" style=" width: 250px;"></td>

</tr>

<tr>

<td>Turinys</td>

<td>:</td>

<td><textarea name="laiskas" style="height: 70px; width: 250px;" id="laiskas"></textarea></td>

</tr>

<tr>

<td>Vardas</td>

<td>:</td>

<td><input name="vardas" type="text" id="vardas" size="50" style=" width: 250px;"></td>

</tr>

<tr>

<td>El.Paštas</td>

<td>:</td>

<td><input name="email" type="text" id="email" size="50" style=" width: 250px;"></td>

</tr>

<tr>

<td> </td>

<td> </td>

<td><input type="submit" style="border:0px solid #000000; border-color: #000; color: #000;" name="Submit" value="Siusti"> <input type="reset" style="border:0px solid #000000; border-color: #000; color: #000;" name="Submit2" value="Ištrinti"></td>

</tr>

</table>

</form>

</td>

</tr>

</table>

<?php

';

}

?>

 

 

o kokia beda tai yra tas kad pas mane baltas fonas ir nemato zmones kur rasyt

ka galima būtų šitam kode padaryt kad matytusi tos vietos kur rašyt reikia ? ;)

Nuoroda į pranešimą
Dalintis kituose puslapiuose
Css failas yra? Jame gal input'ai aprašyti būt.

 

Arba keisk

<input name="tema" type="text" id="tema" size="50" style=" width: 250px;">

į

<input name="tema" type="text" id="tema" size="50" style=" width: 250px; border:1px solid black;">

Ačiu ir dar vienas klausymas apie wordpress tvs

insirašiau plugina Exec-PHP ir jis turi skaityt php kodus puslapiuose bet jis nevisada skaito tai viskas gerai tai ne kas gali but ?

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Exec-PHP niekad naudot neteko, bet, jei gerai suprantu, principą, tai rekomenduočiau tokio plugino nenaudot dėl apkrovos ir saugumo "dalykų". Jeigu gali prieit prie failų sistemos, tai geriau susikurk puslapiams atitinkamus templeitus ir juose įterpk php kodą.

 

O blogai skaityt gali dėl to, kad blogai parašytas kodas ;)

Nuoroda į pranešimą
Dalintis kituose puslapiuose
Exec-PHP niekad naudot neteko, bet, jei gerai suprantu, principą, tai rekomenduočiau tokio plugino nenaudot dėl apkrovos ir saugumo "dalykų". Jeigu gali prieit prie failų sistemos, tai geriau susikurk puslapiams atitinkamus templeitus ir juose įterpk php kodą.

 

O blogai skaityt gali dėl to, kad blogai parašytas kodas ;)

Exec-Php

En:

Security Information

 

The following lists show which users are allowed to write or execute PHP code in different cases. Allowing to write or execute PHP code can be adjusted by assigning the necessary capabilities to individual users or roles by using a role manager plugin.

Security Hole The following list shows which users have either or both of the "edit_others_posts" or "edit_others_pages" capability and are allowed to change others PHP code by having the "edit_others_php" capability but do not have the "exec_php" capability for themself. This is a security hole, because the listed users can write and execute PHP code in articles of other users although they are not supposed to execute PHP code at all.

 

No user matching the query.

Executing PHP Code in Text Widgets The following list shows which users have the "switch_themes" capability and therefore are allowed to write and execute PHP code in text widgets. In case you have deselected the option "Execute PHP code in text widgets" from above, this list will appear empty.

 

* admin

 

Executing PHP Code in Articles The following list shows which users have the "exec_php" capability and therefore are allowed to execute PHP code in articles.

 

* admin

-----------------------------------------------------------------------------------------------------

LT su google translate:

Saugumo informacija

 

Šie sąrašai, kurie rodo, vartotojams leidžiama rašyti arba vykdyti PHP kodas įvairiose atvejais. Leidžianti įrašyti arba vykdyti PHP kodas gali būti koreguojamas skiriant būtinus įgūdžius atskiriems vartotojams arba vaidmenis naudojant vaidmenį vadybininkas plugin.

Saugumo skylė Žemiau parodyta, kokie vartotojai turi vieną arba abu iš "edit_others_posts" arba "edit_others_pages" pajėgumus ir yra leidžiama pakeisti kiti PHP kodas turintys "edit_others_php" pajėgumą, bet neturi "exec_php" gebėjimas save. Tai yra saugumo skylė, nes išvardyti vartotojai gali rašyti ir vykdyti PHP kodas straipsnius kitiems vartotojams, nors jie neturi vykdyti PHP kodas visada.

 

Nėra vartotojų, atitinkančių užklausą.

Vykdančiosios PHP kodas Tekstas Widżety Žemiau parodyta, kokie vartotojai turi "switch_themes" pajėgumų ir todėl leidžiama rašyti ir vykdyti PHP kodas teksto raštai. Jei turite odznaczone parinktį "Execute PHP teksto raštai" iš aukščiau, šis sąrašas bus tuščias.

 

* Admin

 

Vykdančiosios PHP kodekso straipsniuose Toliau pateikiamas sąrašas rodo, kurį vartotojai turi "exec_php" pajėgumų ir todėl leisti vykdyti PHP straipsnius.

 

* Admin

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Dar viena beda su wordpress panaši..

foto :

http://img204.imageshack.us/img204/2963/57667296.jpg

 

nesimato laukeliu ir cia

kur admin parasyta ten turi bur laukelis bet nesimato ir kur žvaigždutes irgi nesimato gal galyt kasnors man pagelbet

kodas :

 

<?php

/*

Plugin Name: Sidebar Login

Plugin URI: http://wordpress.org/extend/plugins/sidebar-login/

Description: Adds a sidebar widget to let users login

Version: 2.2

Author: Mike Jolley

Author URI: http://blue-anvil.com

*/

 

load_plugin_textdomain('sblogin','wp-content/plugins/sidebar-login/');

 

function wp_sidebarlogin_menu() {

add_management_page(__('Sidebar Login','sblogin'), __('Sidebar Login','sblogin'), 6,'Sidebar Login', 'wp_sidebarlogin_admin');

}

 

if (!function_exists('wp_sidebarlogin_magic')) {

function wp_sidebarlogin_magic() {

function stripit($in) {

if (!is_array($in)) $out = stripslashes($in); else $out = $in;

return $out;

}

$_GET = array_map('stripit', $_GET);

$_POST = array_map('stripit', $_POST);

$_REQUEST = array_map('stripit', $_REQUEST);

return;

}

}

 

if (!function_exists(is_ssl)) :

function is_ssl() {

return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;

}

endif;

 

function wp_sidebarlogin_admin(){

// Update options

if ($_POST) {

wp_sidebarlogin_magic();

update_option('sidebarlogin_login_redirect', $_POST['sidebarlogin_login_redirect']);

update_option('sidebarlogin_logout_redirect', $_POST['sidebarlogin_logout_redirect']);

update_option('sidebarlogin_register_link', $_POST['sidebarlogin_register_link']);

update_option('sidebarlogin_forgotton_link', $_POST['sidebarlogin_forgotton_link']);

update_option('sidebarlogin_logged_in_links', $_POST['sidebarlogin_logged_in_links']);

echo '<div id="message"class="updated fade">';

_e('<p>Changes saved</p>',"sblogin");

echo '</div>';

}

// Get options

$sidebarlogin_login_redirect = get_option('sidebarlogin_login_redirect');

$sidebarlogin_logout_redirect = get_option('sidebarlogin_logout_redirect');

$sidebarlogin_register_link = get_option('sidebarlogin_register_link');

$sidebarlogin_forgotton_link = get_option('sidebarlogin_forgotton_link');

$sidebarlogin_logged_in_links = get_option('sidebarlogin_logged_in_links');

?>

<div class="wrap alternate">

<h2><?php _e('Sidebar Login',"sblogin"); ?></h2>

<br class="a_break" style="clear: both;"/>

<form action="?page=Sidebar Login" method="post">

<table class="niceblue form-table">

<tr>

<th scope="col"><?php _e('Login redirect URL',"sblogin"); ?>:</th>

<td><input type="text" name="sidebarlogin_login_redirect" value="<?php echo $sidebarlogin_login_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after login. Leave blank to use their current page.','sblogin'); ?></span></td>

</tr>

<tr>

<th scope="col"><?php _e('Logout redirect URL',"sblogin"); ?>:</th>

<td><input type="text" name="sidebarlogin_logout_redirect" value="<?php echo $sidebarlogin_logout_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after logout. Leave blank to use their current page.','sblogin'); ?></span></td>

</tr>

<tr>

<th scope="col"><?php _e('Show Register Link',"sblogin"); ?>:</th>

<td><select name="sidebarlogin_register_link">

<option <?php if ($sidebarlogin_register_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>

<option <?php if ($sidebarlogin_register_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>

</select> <span class="setting-description"><?php _e('User registrations must also be turned on for this to work (\'Anyone can register\' checkbox in settings).','sblogin'); ?></span></td>

</tr>

<tr>

<th scope="col"><?php _e('Show Lost Password Link',"sblogin"); ?>:</th>

<td><select name="sidebarlogin_forgotton_link">

<option <?php if ($sidebarlogin_forgotton_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>

<option <?php if ($sidebarlogin_forgotton_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>

</select></td>

</tr>

<tr>

<th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>

<td><textarea name="sidebarlogin_logged_in_links" rows="3" cols="80" /><?php echo $sidebarlogin_logged_in_links; ?></textarea><br/><span class="setting-description"><?php _e('One link per line. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users. Default: <br/><a href="http://localhost:8888/wordpress27/wp-admin/">Dashboard</a><br/><a href="http://localhost:8888/wordpress27/wp-admin/profile.php">Profile</a>','sblogin'); ?></span></td>

</tr>

</table>

<p class="submit"><input type="submit" value="<?php _e('Save Changes',"sblogin"); ?>" /></p>

</form>

</div>

<?php

}

 

/*

example of short call with text

 

sidebarlogin('before_title=<h5>&after_title='</h5>');

 

suggested by dev.xiligroup.com

*/

 

function sidebarlogin($myargs = '') {

if (is_array($myargs)) $args = &$myargs;

else parse_str($myargs, $args);

 

$defaults = array('before_widget'=>'','after_widget'=>'',

'before_title'=>'<h2>','after_title'=>'</h2>'

);

$args = array_merge($defaults, $args);

 

widget_wp_sidebarlogin($args);

}

 

function widget_wp_sidebarlogin($args) {

global $user_ID, $current_user;

 

/* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */

$defaults = array('thelogin'=>__('Prisijungti','sblogin'),

'thewelcome'=>__("Sveikas(-a)",'sblogin'),

'theusername'=>__('Vartotojas:','sblogin'),

'thepassword'=>__('Slaptažodis:','sblogin'),

'theremember'=>__('Prisiminti','sblogin'),

'theregister'=>__('Registruotis','sblogin'),

'thepasslostandfound'=>__('Password Lost and Found','sblogin'),

'thelostpass'=> __('Pamiršai slaptažodį?','sblogin'),

'thelogout'=> __('Atsijungti','sblogin'),

'thelogin'=> __('Prisijungti','sblogin')

);

 

$args = array_merge($defaults, $args);

extract($args);

 

get_currentuserinfo();

 

if ($user_ID != '') {

// User is logged in

echo $before_widget . $before_title .$thewelcome.' '.$current_user->display_name . $after_title;

echo '<ul class="pagenav">';

 

$user_info = get_userdata($user_ID);

$level = $user_info->user_level;

 

$links = get_option('sidebarlogin_logged_in_links');

$links = explode("\n", $links);

if (sizeof($links)>0)

foreach ($links as $l) {

$link = explode('|',$l);

if (strtolower(trim($link[1]))=='true' && $level!=10) continue;

echo '<li class="page_item">'.$link[0].'</li>';

}

 

$redir = get_option('sidebarlogin_logout_redirect');

if (empty($redir)) $redir = wp_sidebarlogin_current_url('nologout');

 

echo '<li class="page_item"><a href="'.wp_logout_url($redirect).'&redirect_to='.$redir.'">'.$thelogout.'</a></li></ul>';

 

} else {

// User is NOT logged in!!!

echo $before_widget . $before_title . $thelogin . $after_title;

// Show any errors

global $myerrors;

$wp_error = new WP_Error();

if ( !empty($myerrors) ) {

$wp_error = $myerrors;

}

if ( $wp_error->get_error_code() ) {

$errors = '';

$messages = '';

foreach ( $wp_error->get_error_codes() as $code ) {

$severity = $wp_error->get_error_data($code);

foreach ( $wp_error->get_error_messages($code) as $error ) {

if ( 'message' == $severity )

$messages .= ' ' . $error . "<br />\n";

else

$errors .= ' ' . $error . "<br />\n";

}

}

if ( !empty($errors) )

echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";

if ( !empty($messages) )

echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";

}

// login form

echo '<form action="'.wp_sidebarlogin_current_url().'" method="post">';

?>

<p><label for="user_login"><?php echo $theusername; ?><br/><input name="log" value="<?php echo attribute_escape(stripslashes($_POST['log'])); ?>" class="mid" id="user_login" type="text" /></label></p>

<p><label for="user_pass"><?php echo $thepassword; ?><br/><input name="pwd" class="mid" id="user_pass" type="password" /></label></p>

<p><label for="rememberme"><input name="rememberme" class="checkbox" id="rememberme" value="forever" type="checkbox" /> <?php echo $theremember; ?></label></p>

<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php echo $thelogin; ?> »" />

<input type="hidden" name="sidebarlogin_posted" value="1" />

<input type="hidden" name="testcookie" value="1" /></p>

</form>

<?php

// Output other links

$isul = false; /* ms for w3c - suggested by dev.xiligroup.com */

if (get_option('users_can_register') && get_option('sidebarlogin_register_link')=='yes') {

// MU FIX

global $wpmu_version;

if (empty($wpmu_version)) {

echo '<ul class="sidebarlogin_otherlinks">';

$isul= true;

?>

<li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register" rel="nofollow"><?php echo $theregister; ?></a></li>

<?php

} else {

echo '<ul class="sidebarlogin_otherlinks">';

$isul= true;

?>

<li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php" rel="nofollow"><?php echo $theregister; ?></a></li>

<?php

}

}

if (get_option('sidebarlogin_forgotton_link')=='yes') :

if ($isul== false) echo '<ul class="sidebarlogin_otherlinks">';

?>

<li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php echo $thepasslostfound; ?>" rel="nofollow"><?php echo $thelostpass; ?></a></li>

<?php

endif;

if ($isul) echo '</ul>';

}

// echo widget closing tag

echo $after_widget;

}

 

function widget_wp_sidebarlogin_init() {

if ( !function_exists('register_sidebar_widget') ) return;

// Register widget for use

register_sidebar_widget(array('Sidebar Login', 'widgets'), 'widget_wp_sidebarlogin');

}

 

function widget_wp_sidebarlogin_check() {

 

// Add options - they may not exist

add_option('sidebarlogin_login_redirect','','no');

add_option('sidebarlogin_logout_redirect','','no');

add_option('sidebarlogin_register_link','yes','no');

add_option('sidebarlogin_forgotton_link','yes','no');

add_option('sidebarlogin_logged_in_links', "<a href=\"".get_bloginfo('wpurl')."/wp-admin/\">".__('Dashboard')."</a>\n<a href=\"".get_bloginfo('wpurl')."/wp-admin/profile.php\">".__('Profile')."</a>",'no');

 

if ($_POST['sidebarlogin_posted']) {

// Includes

global $myerrors;

$myerrors = new WP_Error();

//Set a cookie now to see if they are supported by the browser.

setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);

if ( SITECOOKIEPATH != COOKIEPATH )

setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);

// Are we doing a sidebar login action?

if ($_POST['sidebarlogin_posted']) {

 

if ( is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )

$secure_cookie = false;

else

$secure_cookie = '';

 

$user = wp_signon('', $secure_cookie);

 

// Error Handling

if ( is_wp_error($user) ) {

 

$errors = $user;

 

// If cookies are disabled we can't log in even with a valid user+pass

if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )

$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'sblogin'));

 

if ( empty($_POST['log']) && empty($_POST['pwd']) ) {

$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.', 'sblogin'));

$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter your password.', 'sblogin'));

}

 

$myerrors = $errors;

 

} else {

nocache_headers();

$redir = get_option('sidebarlogin_login_redirect');

if (!empty($redir)) wp_redirect($redir);

else wp_redirect(wp_sidebarlogin_current_url('nologout'));

exit;

}

}

}

}

 

if ( !function_exists('wp_sidebarlogin_current_url') ) :

function wp_sidebarlogin_current_url($url = '') {

$pageURL = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';

 

if ($_SERVER["SERVER_PORT"] != "80") {

$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

} else {

$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

}

 

if ($url != "nologout") {

$pageURL .='#login';

}

//————–added by mick

if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );

//——————–

return $pageURL;

}

endif;

 

// Run code and init

add_action('init', 'widget_wp_sidebarlogin_check',0);

add_action('widgets_init', 'widget_wp_sidebarlogin_init');

add_action('admin_menu', 'wp_sidebarlogin_menu');

?>

 

 

ačiu lb lb būtų jai kasnors padėtumet ;) ;)

Nuoroda į pranešimą
Dalintis kituose puslapiuose

<input name="log" value="<?php echo attribute_escape(stripslashes($_POST['log'])); ?>" class="mid" id="user_login" type="text" />

<input name="pwd" class="mid" id="user_pass" type="password" />

 

Arba css faile pridėk klasei .mid arba id #user_pass ir #user_login stilių border:1px solid black; arba čia pat kode prirašyk pvz.

<input name="pwd" class="mid" id="user_pass" type="password" style="border:1px solid black;"/>

Nuoroda į pranešimą
Dalintis kituose puslapiuose
<input name="log" value="<?php echo attribute_escape(stripslashes($_POST['log'])); ?>" class="mid" id="user_login" type="text" />

<input name="pwd" class="mid" id="user_pass" type="password" />

 

Arba css faile pridėk klasei .mid arba id #user_pass ir #user_login stilių border:1px solid black; arba čia pat kode prirašyk pvz.

<input name="pwd" class="mid" id="user_pass" type="password" style="border:1px solid black;"/>

ačiu jai veiks ;)

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Na va kaip ir visos kitos bedos isisprende bet dbr nesuprantu kaskas yra prisijungime kad nerodo sonu foto :

kaireip parodytas prisijungimas desinei bet kokia panele

http://img12.imageshack.us/img12/4617/51442247.jpg

kaip matot desinei panelei sonai yra juosteles tos o pirmoi nera kaip ten viska ta sutvarkyt kodas :

 

<?php

/*

Plugin Name: Sidebar Login

Plugin URI: http://wordpress.org/extend/plugins/sidebar-login/

Description: Adds a sidebar widget to let users login

Version: 2.2

Author: Mike Jolley

Author URI: http://blue-anvil.com

*/

 

load_plugin_textdomain('sblogin','wp-content/plugins/sidebar-login/');

 

function wp_sidebarlogin_menu() {

add_management_page(__('Sidebar Login','sblogin'), __('Sidebar Login','sblogin'), 6,'Sidebar Login', 'wp_sidebarlogin_admin');

}

 

if (!function_exists('wp_sidebarlogin_magic')) {

function wp_sidebarlogin_magic() {

function stripit($in) {

if (!is_array($in)) $out = stripslashes($in); else $out = $in;

return $out;

}

$_GET = array_map('stripit', $_GET);

$_POST = array_map('stripit', $_POST);

$_REQUEST = array_map('stripit', $_REQUEST);

return;

}

}

 

if (!function_exists(is_ssl)) :

function is_ssl() {

return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;

}

endif;

 

function wp_sidebarlogin_admin(){

// Update options

if ($_POST) {

wp_sidebarlogin_magic();

update_option('sidebarlogin_login_redirect', $_POST['sidebarlogin_login_redirect']);

update_option('sidebarlogin_logout_redirect', $_POST['sidebarlogin_logout_redirect']);

update_option('sidebarlogin_register_link', $_POST['sidebarlogin_register_link']);

update_option('sidebarlogin_forgotton_link', $_POST['sidebarlogin_forgotton_link']);

update_option('sidebarlogin_logged_in_links', $_POST['sidebarlogin_logged_in_links']);

echo '<div id="message"class="updated fade">';

_e('<p>Changes saved</p>',"sblogin");

echo '</div>';

}

// Get options

$sidebarlogin_login_redirect = get_option('sidebarlogin_login_redirect');

$sidebarlogin_logout_redirect = get_option('sidebarlogin_logout_redirect');

$sidebarlogin_register_link = get_option('sidebarlogin_register_link');

$sidebarlogin_forgotton_link = get_option('sidebarlogin_forgotton_link');

$sidebarlogin_logged_in_links = get_option('sidebarlogin_logged_in_links');

?>

<div class="wrap alternate">

<h2><?php _e('Sidebar Login',"sblogin"); ?></h2>

<br class="a_break" style="clear: both;"/>

<form action="?page=Sidebar Login" method="post">

<table class="niceblue form-table">

<tr>

<th scope="col"><?php _e('Login redirect URL',"sblogin"); ?>:</th>

<td><input type="text" name="sidebarlogin_login_redirect" value="<?php echo $sidebarlogin_login_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after login. Leave blank to use their current page.','sblogin'); ?></span></td>

</tr>

<tr>

<th scope="col"><?php _e('Logout redirect URL',"sblogin"); ?>:</th>

<td><input type="text" name="sidebarlogin_logout_redirect" value="<?php echo $sidebarlogin_logout_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after logout. Leave blank to use their current page.','sblogin'); ?></span></td>

</tr>

<tr>

<th scope="col"><?php _e('Show Register Link',"sblogin"); ?>:</th>

<td><select name="sidebarlogin_register_link">

<option <?php if ($sidebarlogin_register_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>

<option <?php if ($sidebarlogin_register_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>

</select> <span class="setting-description"><?php _e('User registrations must also be turned on for this to work (\'Anyone can register\' checkbox in settings).','sblogin'); ?></span></td>

</tr>

<tr>

<th scope="col"><?php _e('Show Lost Password Link',"sblogin"); ?>:</th>

<td><select name="sidebarlogin_forgotton_link">

<option <?php if ($sidebarlogin_forgotton_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>

<option <?php if ($sidebarlogin_forgotton_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>

</select></td>

</tr>

<tr>

<th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>

<td><textarea name="sidebarlogin_logged_in_links" rows="3" cols="80" /><?php echo $sidebarlogin_logged_in_links; ?></textarea><br/><span class="setting-description"><?php _e('One link per line. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users. Default: <br/><a href="http://localhost:8888/wordpress27/wp-admin/">Dashboard</a><br/><a href="http://localhost:8888/wordpress27/wp-admin/profile.php">Profile</a>','sblogin'); ?></span></td>

</tr>

</table>

<p class="submit"><input type="submit" value="<?php _e('Save Changes',"sblogin"); ?>" /></p>

</form>

</div>

<?php

}

 

/*

example of short call with text

 

sidebarlogin('before_title=<h5>&after_title='</h5>');

 

suggested by dev.xiligroup.com

*/

 

function sidebarlogin($myargs = '') {

if (is_array($myargs)) $args = &$myargs;

else parse_str($myargs, $args);

 

$defaults = array('before_widget'=>'','after_widget'=>'',

'before_title'=>'<h2>','after_title'=>'</h2>'

);

$args = array_merge($defaults, $args);

 

widget_wp_sidebarlogin($args);

}

 

function widget_wp_sidebarlogin($args) {

global $user_ID, $current_user;

 

/* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */

$defaults = array('thelogin'=>__('Prisijungti','sblogin'),

'thewelcome'=>__("Sveikas(-a)",'sblogin'),

'theusername'=>__('Vartotojas:','sblogin'),

'thepassword'=>__('Slaptažodis:','sblogin'),

'theremember'=>__('Prisiminti','sblogin'),

'theregister'=>__('Registruotis','sblogin'),

'thepasslostandfound'=>__('Password Lost and Found','sblogin'),

'thelostpass'=> __('Pamiršai slaptažodį?','sblogin'),

'thelogout'=> __('Atsijungti','sblogin'),

'thelogin'=> __('Prisijungti','sblogin')

);

 

$args = array_merge($defaults, $args);

extract($args);

 

get_currentuserinfo();

 

if ($user_ID != '') {

// User is logged in

echo $before_widget . $before_title .$thewelcome.' '.$current_user->display_name . $after_title;

echo '<ul class="pagenav">';

 

$user_info = get_userdata($user_ID);

$level = $user_info->user_level;

 

$links = get_option('sidebarlogin_logged_in_links');

$links = explode("\n", $links);

if (sizeof($links)>0)

foreach ($links as $l) {

$link = explode('|',$l);

if (strtolower(trim($link[1]))=='true' && $level!=10) continue;

echo '<li class="page_item">'.$link[0].'</li>';

}

 

$redir = get_option('sidebarlogin_logout_redirect');

if (empty($redir)) $redir = wp_sidebarlogin_current_url('nologout');

 

echo '<li class="page_item"><a href="'.wp_logout_url($redirect).'&redirect_to='.$redir.'">'.$thelogout.'</a></li></ul>';

 

} else {

// User is NOT logged in!!!

echo $before_widget . $before_title . $thelogin . $after_title;

// Show any errors

global $myerrors;

$wp_error = new WP_Error();

if ( !empty($myerrors) ) {

$wp_error = $myerrors;

}

if ( $wp_error->get_error_code() ) {

$errors = '';

$messages = '';

foreach ( $wp_error->get_error_codes() as $code ) {

$severity = $wp_error->get_error_data($code);

foreach ( $wp_error->get_error_messages($code) as $error ) {

if ( 'message' == $severity )

$messages .= ' ' . $error . "<br />\n";

else

$errors .= ' ' . $error . "<br />\n";

}

}

if ( !empty($errors) )

echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";

if ( !empty($messages) )

echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";

}

// login form

echo '<form action="'.wp_sidebarlogin_current_url().'" method="post">';

?>

<center><p><label for="user_login"><?php echo $theusername; ?><br/><input name="log" value="<?php echo attribute_escape(stripslashes($_POST['log'])); ?>" class="mid" id="user_login" type="text" style="border:1px solid black;" /></label></p></center>

<br>

<center><p><label for="user_pass"><?php echo $thepassword; ?><br/><input name="pwd" class="mid" id="user_pass" type="password" style="border:1px solid black;"/></label></p></center>

<br>

<center><p><label for="rememberme"><input name="rememberme" class="checkbox" id="rememberme" value="forever" type="checkbox" /> <?php echo $theremember; ?></label></p></center>

<center><p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php echo $thelogin; ?> » " /></center>

<input type="hidden" name="sidebarlogin_posted" value="1" />

<input type="hidden" name="testcookie" value="1" /></p>

</form>

<?php

// Output other links

$isul = false; /* ms for w3c - suggested by dev.xiligroup.com */

if (get_option('users_can_register') && get_option('sidebarlogin_register_link')=='yes') {

// MU FIX

global $wpmu_version;

if (empty($wpmu_version)) {

echo '<ul class="sidebarlogin_otherlinks">';

$isul= true;

?>

<li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register" rel="nofollow"><?php echo $theregister; ?></a></li>

<?php

} else {

echo '<ul class="sidebarlogin_otherlinks">';

$isul= true;

?>

<li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php" rel="nofollow"><?php echo $theregister; ?></a></li>

<?php

}

}

if (get_option('sidebarlogin_forgotton_link')=='yes') :

if ($isul== false) echo '<ul class="sidebarlogin_otherlinks">';

?>

<li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php echo $thepasslostfound; ?>" rel="nofollow"><?php echo $thelostpass; ?></a></li>

<?php

endif;

if ($isul) echo '</ul>';

}

// echo widget closing tag

echo $after_widget;

}

 

function widget_wp_sidebarlogin_init() {

if ( !function_exists('register_sidebar_widget') ) return;

// Register widget for use

register_sidebar_widget(array('Sidebar Login', 'widgets'), 'widget_wp_sidebarlogin');

}

 

function widget_wp_sidebarlogin_check() {

 

// Add options - they may not exist

add_option('sidebarlogin_login_redirect','','no');

add_option('sidebarlogin_logout_redirect','','no');

add_option('sidebarlogin_register_link','yes','no');

add_option('sidebarlogin_forgotton_link','yes','no');

add_option('sidebarlogin_logged_in_links', "<a href=\"".get_bloginfo('wpurl')."/wp-admin/\">".__('Dashboard')."</a>\n<a href=\"".get_bloginfo('wpurl')."/wp-admin/profile.php\">".__('Profile')."</a>",'no');

 

if ($_POST['sidebarlogin_posted']) {

// Includes

global $myerrors;

$myerrors = new WP_Error();

//Set a cookie now to see if they are supported by the browser.

setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);

if ( SITECOOKIEPATH != COOKIEPATH )

setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);

// Are we doing a sidebar login action?

if ($_POST['sidebarlogin_posted']) {

 

if ( is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )

$secure_cookie = false;

else

$secure_cookie = '';

 

$user = wp_signon('', $secure_cookie);

 

// Error Handling

if ( is_wp_error($user) ) {

 

$errors = $user;

 

// If cookies are disabled we can't log in even with a valid user+pass

if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )

$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'sblogin'));

 

if ( empty($_POST['log']) && empty($_POST['pwd']) ) {

$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.', 'sblogin'));

$errors->add('empty_password', __('<strong>ERROR</strong>: Please enter your password.', 'sblogin'));

}

 

$myerrors = $errors;

 

} else {

nocache_headers();

$redir = get_option('sidebarlogin_login_redirect');

if (!empty($redir)) wp_redirect($redir);

else wp_redirect(wp_sidebarlogin_current_url('nologout'));

exit;

}

}

}

}

 

if ( !function_exists('wp_sidebarlogin_current_url') ) :

function wp_sidebarlogin_current_url($url = '') {

$pageURL = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';

 

if ($_SERVER["SERVER_PORT"] != "80") {

$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

} else {

$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

}

 

if ($url != "nologout") {

$pageURL .='#login';

}

//————–added by mick

if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );

//——————–

return $pageURL;

}

endif;

 

// Run code and init

add_action('init', 'widget_wp_sidebarlogin_check',0);

add_action('widgets_init', 'widget_wp_sidebarlogin_init');

add_action('admin_menu', 'wp_sidebarlogin_menu');

?>

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Prisijunkite prie diskusijos

Jūs galite rašyti dabar, o registruotis vėliau. Jeigu turite paskyrą, prisijunkite dabar, kad rašytumėte iš savo paskyros.

Svečias
Parašykite atsakymą...

×   Įdėta kaip raiškusis tekstas.   Atkurti formatavimą

  Only 75 emoji are allowed.

×   Nuorodos turinys įdėtas automatiškai.   Rodyti kaip įprastą nuorodą

×   Jūsų anksčiau įrašytas turinys buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.

Įkraunama...
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

  • Prisijunk prie bendruomenės dabar!

    Uždarbis.lt nariai domisi verslo, IT ir asmeninio tobulėjimo temomis, kartu sprendžia problemas, dalinasi žiniomis ir idėjomis, sutinka būsimus verslo partnerius ir dalyvauja gyvuose susitikimuose.

    Užsiregistruok dabar ir galėsi:

    ✔️ Dalyvauti diskusijose;

    ✔️ Kurti naujas temas;

    ✔️ Rašyti atsakymus;

    ✔️ Vertinti kitų žmonių pranešimus;

    ✔️ Susisiekti su bet kuriuo nariu asmeniškai;

    ✔️ Naudotis tamsia dizaino versija;

    ir dar daugiau.

    Registracija trunka ~30 sek. ir yra visiškai nemokama.

  • Naujausios temos

  • Karštos temos

×
×
  • Pasirinkite naujai kuriamo turinio tipą...