This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function PrintJSON( $jsonData ) | |
{ | |
header( 'Content-Type: application/json; charset=utf8' ); | |
echo $jsonData; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function AddMessage2Log( $sText, $sModule = "" ) | |
{ | |
if ( defined( "LOG_FILENAME" ) && strlen( LOG_FILENAME ) > 0 ) { | |
if ( strlen( $sText ) > 0 ) { | |
ignore_user_abort( true ); | |
if ( $fp = @fopen( LOG_FILENAME, "ab+" ) ) { | |
if ( flock( $fp, LOCK_EX ) ) { | |
@fwrite( $fp, date( "Y-m-d H:i:s" ) . " - " . $sModule . " - " . $sText . "\n" ); | |
if ( function_exists( "debug_backtrace" ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// set the header context stream for virtualhost lookup | |
$context = stream_context_create( array( 'http' => array( 'header' => 'Host: www.someurl.uz' ) ) ); | |
// use a localhost url or alternatively 127.0.0.1 ip | |
$url = 'http://localhost/api/filter.org.php?login=test_user&password=mypassword&otherparam=itsvalue'; | |
// fetch the data through webserver using the Host http header we set | |
$data = json_decode( file_get_contents( $url, 0, $context ) ); | |
// verify you have your data | |
var_dump( $data ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="<?=$APPLICATION->GetCurPage()?>" method="POST" name="form1"> | |
<?php echo CalendarDate("birthdate", "25.11.1975", "form1", "15", "class=\"my_input\""); ?> | |
<?php echo CalendarDate("deathdate", ConvertTimeStamp(), "form1", "15", "class=\"my_input\""); ?> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require( $_SERVER[ 'DOCUMENT_ROOT' ] . '/bitrix/modules/main/include/prolog_before.php' ); // header | |
// other stuff here... | |
require( $_SERVER[ 'DOCUMENT_ROOT' ] . '/bitrix/modules/main/include/epilog_after.php' ); // footer | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* Callback to use in array_filter function, which filters only active users. | |
* @param $userID int id of the user | |
* @return bool true if user is active, otherwise false | |
*/ | |
function IsActive( $userID ) | |
{ | |
$rsUser = CUser::GetByID( $userID ); | |
$user = $rsUser->Fetch(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( extension_loaded( "soap" ) ) { | |
echo 'Soap loaded'; | |
} | |
else { | |
echo 'Soap NOT loaded'; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create password for user admin in /etc/httpd/mypasswd file | |
htpasswd -c /etc/httpd/mypasswd admin | |
# create .htaccess file in directory that you want restrict access | |
# write these rules | |
AuthType Basic | |
AuthName "Restricted Area" | |
AuthBasicProvider file | |
AuthUserFile /etc/httpd/mypasswd | |
Require valid-user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<definitions name="Organization" | |
targetNamespace="urn:Organization" | |
xmlns:tns="urn:Organization" | |
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns="http://schemas.xmlsoap.org/wsdl/"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ImgUtils { | |
/** | |
* Creates and returns image resource if type is supported. | |
* Currently supported types (JPEG, GIF, PNG) | |
* @param string $file URL to the file | |
* @return bool|resource image resource if image type supported, otherwise false | |
*/ | |
private static function OpenImage( $file ) | |
{ |
OlderNewer