function getProduct($id) { $connection = getDbConnection(); $sql = <<<EOT SELECT p.`id`, p.`name`, p.description, p.price, p.image FROM products AS p WHERE p.id = {$id} EOT; $result = mysqli_query($connection, $sql); return $result->fetch_row(); }
function searchForKeyword($keyword) { $db = getDbConnection(); $stmt = $db->prepare("SELECT name as beer FROM `beers` WHERE name LIKE ? ORDER BY name LIMIT 5;"); $keyword = '%' . $keyword . '%'; $stmt->bindParam(1, $keyword, PDO::PARAM_STR, 100); $isQueryOk = $stmt->execute(); $results = array(); if ($isQueryOk) { $results = $stmt->fetchAll(PDO::FETCH_COLUMN); } else { trigger_error('Error executing statement.', E_USER_ERROR); } $db = null; return $results; }
/** * Echoes some stuff */ function doIt() { if ($this->foo_name == 'Bar') { $res = globalDoIt(); echo $res; } //в простых случаях {} можно опускать if ($this->foo_name == 'Test') { return; } //логически сгруппированный блок кода $db = getDbConnection(); $it = $db->exec('select * from a'); foreach ($it as $record) { echo $record->get('id'); } $i++; }
function searchForKeyword($keyword) { $db = getDbConnection(); //$stmt = $db->prepare("SELECT DISTINCT tag_name FROM `tags` WHERE tag_name LIKE ? ORDER BY tag_name"); //$stmt = $db->prepare("SELECT DISTINCT word FROM `dictionary` WHERE word LIKE ? ORDER BY word"); $stmt = $db->prepare("SELECT DISTINCT tag_name FROM `tags` WHERE tag_name LIKE ? ORDER BY tag_name"); $stmt2 = $db->prepare("SELECT DISTINCT word FROM `dictionary` WHERE word LIKE ? ORDER BY word"); $keyword = $keyword . '%'; $stmt->bindParam(1, $keyword, PDO::PARAM_STR, 100); $stmt2->bindParam(1, $keyword, PDO::PARAM_STR, 100); $isQueryOk = $stmt->execute(); $isQueryOk2 = $stmt2->execute(); $results = array(); if ($isQueryOk && $isQueryOk2) { $results = $stmt->fetchAll(PDO::FETCH_COLUMN) + $stmt2->fetchAll(PDO::FETCH_COLUMN); } else { trigger_error('Error executing statement.', E_USER_ERROR); } $db = null; return $results; }
protected function query($sql, $action) { $con = getDbConnection(); $stmt = $con->prepare($sql) or die($con->error); $result; $ex; try { $result = $action($stmt, $con); if ($stmt->error !== null && $stmt->error !== "") { throw new Exception($stmt->error); } } catch (Exception $e) { $ex = $e; } $stmt->close(); $con->close(); // try,finally if (isset($ex)) { throw $ex; } return $result; }
private function getFormItems($mod_strings, $app_list_strings, $sugarConfigDefaults, $drivers, $checked, $db, $errors, $supportedLanguages, $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) { // ------------------------------ // DB Type and DB configuration // ----------------------------------> // database selection $out_dbtypesel = "\n <div class=\"floatbox\" id=\"fb5\">\n <h2>{$mod_strings['LBL_DBCONF_TITLE']}</h2>\n\n <div class=\"form_section\">\n <h3>{$mod_strings['LBL_SYSOPTS_DB']}</h3>"; foreach ($drivers as $type => $driver) { $oci = $type == "oci8" ? "" : 'none'; // hack for special oracle message $out_dbtypesel .= <<<EOQ <input type="radio" class="checkbox" name="setup_db_type" id="setup_db_type" value="{$type}" {$checked[$type]} onclick="onDBTypeClick(this);//document.getElementById('ociMsg').style.display='{$oci}'"/>{$mod_strings[$driver->label]}<br> EOQ; } $out_dbtypesel .= <<<EOQ </div> <div name="ociMsg" id="ociMsg" style="display:none"></div> <!-- </div> --> EOQ; $out2 = $out_dbtypesel; $out2 .= <<<EOQ2 <!-- <div class="floatbox"> --> <div class="form_section starhook"> <!-- <div class="required">{$mod_strings['LBL_REQUIRED']}</div> --> <h3>{$mod_strings['LBL_DBCONF_TITLE_NAME']}</h3> EOQ2; $config_params = $db->installConfig(); $form = ''; foreach ($config_params as $group => $gdata) { $form .= "<div class='install_block'>"; if ($mod_strings[$group . '_LABEL']) { $form .= "<label>{$mod_strings[$group . '_LABEL']}" . "<i> i <div class=\"tooltip\">{$mod_strings[$group]}</div></i></label>\n"; } foreach ($gdata as $name => $value) { if (!empty($value)) { if (!empty($value['required'])) { $form .= "<span class=\"required\">*</span>"; } else { } if (!empty($_SESSION[$name])) { $sessval = $_SESSION[$name]; } else { $sessval = ''; } if (!empty($value["type"])) { $type = $value["type"]; } else { $type = ''; } $form .= <<<FORM FORM; //if the type is password, set a hidden field to capture the value. This is so that we can properly encode special characters, which is a limitation with password fields if ($type == 'password') { $form .= "</div><div class=\"install_block\"><label>{$mod_strings['LBL_DBCONF_TITLE_PSWD_INFO_LABEL']}</label><span> </span><input type='{$type}' name='{$name}_entry' id='{$name}_entry' value='" . urldecode($sessval) . "'><input type='hidden' name='{$name}' id='{$name}' value='" . urldecode($sessval) . "'></div><div class=\"install_block\">"; } else { $form .= "<input type='{$type}' name='{$name}' id='{$name}' value='{$sessval}'>"; } $form .= <<<FORM FORM; } else { $form .= "<input name=\"{$name}\" id=\"{$name}\" value=\"\" type=\"hidden\">\n"; } } $form .= "</div>"; } $out2 .= $form; // ---------- user data set (dbConfig_a.php) //if we are installing in custom mode, include the following html if ($db->supports("create_user")) { // create / set db user dropdown $auto_select = ''; $provide_select = ''; $create_select = ''; $same_select = ''; if (isset($_SESSION['dbUSRData'])) { // if($_SESSION['dbUSRData']=='auto') {$auto_select ='selected';} if ($_SESSION['dbUSRData'] == 'provide') { $provide_select = 'selected'; } if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') { if ($_SESSION['dbUSRData'] == 'create') { $create_select = 'selected'; } } if ($_SESSION['dbUSRData'] == 'same') { $same_select = 'selected'; } } else { $same_select = 'selected'; } $dbUSRDD = "<select name='dbUSRData' id='dbUSRData' onchange='toggleDBUser();'>"; $dbUSRDD .= "<option value='provide' {$provide_select}>" . $mod_strings['LBL_DBCONFIG_PROVIDE_DD'] . "</option>"; $dbUSRDD .= "<option value='create' {$create_select}>" . $mod_strings['LBL_DBCONFIG_CREATE_DD'] . "</option>"; $dbUSRDD .= "<option value='same' {$same_select}>" . $mod_strings['LBL_DBCONFIG_SAME_DD'] . "</option>"; $dbUSRDD .= "</select><br> "; $setup_db_sugarsales_password = urldecode($_SESSION['setup_db_sugarsales_password']); $setup_db_sugarsales_user = urldecode($_SESSION['setup_db_sugarsales_user']); $setup_db_sugarsales_password_retype = urldecode($_SESSION['setup_db_sugarsales_password_retype']); $out2 .= <<<EOQ2 <br> <div class='install_block'> <!-- <div class="ibmsg">{$mod_strings['LBL_DBCONFIG_SECURITY']}</div> --> </div> <div class='install_block'> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}<i> i <div class="tooltip">{$mod_strings['LBL_DBCONFIG_SECURITY']}</div></i></label> {$dbUSRDD} </div> <div class="clear"></div> <span id='connection_user_div' style="display:none"> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']} <span class="required">*</span></label> <input type="text" name="setup_db_sugarsales_user" maxlength="16" value="{$_SESSION['setup_db_sugarsales_user']}" /> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_DB_PASSWORD']}</label> <input type="password" name="setup_db_sugarsales_password_entry" value="{$setup_db_sugarsales_password}" /> <input type="hidden" name="setup_db_sugarsales_password" value="{$setup_db_sugarsales_password}" /> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_DB_PASSWORD2']}</label> <input type="password" name="setup_db_sugarsales_password_retype_entry" value="{$setup_db_sugarsales_password_retype}" /> <input type="hidden" name="setup_db_sugarsales_password_retype" value="{$setup_db_sugarsales_password_retype}" /> </div> </span> </div> EOQ2; } $out = $out2; // ------ siteConfig_a.php $out .= <<<EOQ </div> </div> <div class="floatbox" id="fb6"> <h2>{$mod_strings['LBL_SITECFG_TITLE']}</h2> <div class="form_section"> <p>{$errors}</p> <div class="required">{$mod_strings['LBL_REQUIRED']}</div> <h3>{$mod_strings['LBL_SITECFG_TITLE2']}<div class="tooltip-toggle"><em> i </em><div class="tooltip">{$mod_strings['LBL_SITECFG_PASSWORD_MSG']}</div></div></h3> EOQ; //hide this in typical mode if (!empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') { $out .= <<<EOQ <div class='install_block'> {$mod_strings['LBL_SITECFG_URL_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_SITECFG_URL']}</b></label> <input type="text" name="setup_site_url" value="{$_SESSION['setup_site_url']}" size="40" /> <br>{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_SYSTEM_NAME']}</b></label> <input type="text" name="setup_system_name" value="{$_SESSION['setup_system_name']}" size="40" /><br> </div> EOQ; $db = getDbConnection(); if ($db->supports("collation")) { $collationOptions = $db->getCollationList(); } if (!empty($collationOptions)) { if (isset($_SESSION['setup_db_options']['collation'])) { $default = $_SESSION['setup_db_options']['collation']; } else { $default = $db->getDefaultCollation(); } $options = get_select_options_with_id(array_combine($collationOptions, $collationOptions), $default); $out .= <<<EOQ <div class='install_block'> <br>{$mod_strings['LBL_SITECFG_COLLATION_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_COLLATION']}</b></label> <select name="setup_db_collation" id="setup_db_collation">{$options}</select><br> </div> EOQ; } } $help_url = get_help_button_url(); if (!isset($_SESSION['email1'])) { $_SESSION['email1'] = null; } if (!isset($_SESSION['setup_site_admin_user_name'])) { $_SESSION['setup_site_admin_user_name'] = null; } $out .= <<<EOQ <div class='install_block'> <!-- <p class="ibmsg">{$mod_strings['LBL_SITECFG_PASSWORD_MSG']}</p> --> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_ADMIN_Name']} <span class="required">*</span></label> <input type="text" name="setup_site_admin_user_name" value="{$_SESSION['setup_site_admin_user_name']}" size="20" maxlength="60" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_ADMIN_PASS']} <span class="required">*</span></label> <input type="password" name="setup_site_admin_password" value="{$_SESSION['setup_site_admin_password']}" size="20" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_ADMIN_PASS_2']} <span class="required">*</span></label> <input type="password" name="setup_site_admin_password_retype" value="{$_SESSION['setup_site_admin_password_retype']}" size="20" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_URL']} <span class="required">*</span></label> <input type="text" name="setup_site_url" value="{$_SESSION['setup_site_url']}" size="40" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_EMAIL_ADDRESS']} <span class="required">*</span></label> <input type="email" name="email1" value="{$_SESSION['email1']}" size="40" /> </div> <div class="clear"></div> <div class="clear"></div> <!-- <a href="javascript:;" onclick="\$('.security-block').toggle();">More..</a><br/><br/> --> EOQ; $out .= <<<EOQ </div> EOQ; $out .= <<<EOQ EOQ; // ------------------ // Choose Demo Data // -------------------------> //demo data select $demoDD = "<select name='demoData' id='demoData' class='select'><option value='no' >" . $mod_strings['LBL_NO'] . "</option><option value='yes'>" . $mod_strings['LBL_YES'] . "</option>"; $demoDD .= "</select>"; $out .= <<<EOQ3 </div> </div> <div class="floatbox full" id="fb0"> <h2>{$mod_strings['LBL_MORE_OPTIONS_TITLE']}</h2> </div> <div class="floatbox full" id="fb1"> <div class="install_block"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_DBCONF_DEMO_DATA_TITLE']}</h3> <div class="form_section" style="display: none;"> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_DBCONF_DEMO_DATA']}</label> {$demoDD} </div> </div> </div> </div> EOQ3; // ------------------ // Choose Scenarios // -------------------------> $scenarioSelection = "<p class='ibmsg'>{$mod_strings['LBL_WIZARD_SCENARIO_EMPTY']}</p>"; if (isset($_SESSION['installation_scenarios']) && !empty($_SESSION['installation_scenarios'])) { $scenarioSelection = ""; foreach ($_SESSION['installation_scenarios'] as $scenario) { $key = $scenario['key']; $description = $scenario['description']; $scenarioModuleList = implode($scenario['modulesScenarioDisplayName'], ','); $title = $scenario['title']; $scenarioSelection .= "<input type='checkbox' name='scenarios[]' value='{$key}' checked><b>{$title}</b>. {$description} ({$scenarioModuleList}).<br>"; } } $out .= <<<EOQ <!-- Scenario Selection --> <div class="floatbox full" id="fb3"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_WIZARD_SCENARIO_TITLE']}</h3> <div class="form_section" style="display: none;"> <p class="ibmsg">{$mod_strings['LBL_WIZARD_SCENARIO_DESC']}</p> <div class="formrow">{$scenarioSelection}</div> <div class="clear"></div> </div> </div> EOQ; //--End of scenarios //--------------- // SMTP Settings //--------------------> // smtp // TODO-t: test it for all types $MAIL_SSL_OPTIONS_GMAIL = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '2'); //$MAIL_SSL_OPTIONS_YAHOO = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '1'); $MAIL_SSL_OPTIONS_EXCHG = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], 'none'); $MAIL_SSL_OPTIONS_OTHER = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], 'none'); // set default notify_allow_default_outbound checkbox value $notify_allow_default_outbound_checked = empty($_SESSION['notify_allow_default_outbound']) ? '' : ' checked="checked" '; // set default smtp toggle buttons selected value if (empty($_SESSION['smtp_tab_selected'])) { $_SESSION['smtp_tab_selected'] = 'smtp_tab_other'; } $out .= <<<EOQ <div class="floatbox full" id="fb2"> <!-- smtp settings --> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_MAIL_SMTP_SETTINGS']}</h3> <div style="display: none;"> <br> <!-- <p>{$mod_strings['LBL_WIZARD_SMTP_DESC']}</p> --> <!-- smtp types toggler buttons --> <p style="display: inline;">{$mod_strings['LBL_CHOOSE_EMAIL_PROVIDER']} </p><div class="tooltip-toggle"> <em>i</em> <div class="tooltip">{$mod_strings['LBL_WIZARD_SMTP_DESC']}</div></div> <div class="clear"></div> <div> <input type="button" class="smtp_tab_toggler" id="smtp_tab_gmail_toggler" for="smtp_tab_gmail" value="{$mod_strings['LBL_SMTPTYPE_GMAIL']}" /> <input type="button" class="smtp_tab_toggler" id="smtp_tab_yahoo_toggler" for="smtp_tab_yahoo" value="{$mod_strings['LBL_SMTPTYPE_YAHOO']}" /> <input type="button" class="smtp_tab_toggler" id="smtp_tab_exchange_toggler" for="smtp_tab_exchange" value="{$mod_strings['LBL_SMTPTYPE_EXCHANGE']}" /> <input type="button" class="smtp_tab_toggler selected" id="smtp_tab_other_toggler" for="smtp_tab_other" value="{$mod_strings['LBL_SMTPTYPE_OTHER']}" /> <input type="hidden" name="smtp_tab_selected" value="{$_SESSION['smtp_tab_selected']}"> </div> <!-- smtp / gmail tab --> <div class="form_section smtp_tab" id="smtp_tab_gmail"> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPSERVER']}</label> <input type="text" name="smtp_tab_gmail[mail_smtpserver]" size="25" maxlength="64" value="smtp.gmail.com"> </div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPPORT']}</label> <input type="text" name="smtp_tab_gmail[mail_smtpport]" size="5" maxlength="5" value="587"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> <input type="checkbox" name="smtp_tab_gmail[mail_smtpauth_req]" id="smtp_tab_gmail__mail_smtpauth_req" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_1');"> </div> <div class="formrow"> <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> <select name="smtp_tab_gmail[mail_smtpssl]"> {$MAIL_SSL_OPTIONS_GMAIL} </select> </div> <div class="clear"></div> <div class="toggleArea" id="toggleArea_1"> <div class="formrow"> <label>{$mod_strings['LBL_GMAIL_SMTPUSER']}</label> <input type="text" name="smtp_tab_gmail[mail_smtpuser]" id="smtp_tab_gmail__mail_smtpuser" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_GMAIL_SMTPPASS']}</label> <input type="password" name="smtp_tab_gmail[mail_smtppass]" id="smtp_tab_gmail__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input name="smtp_tab_gmail[notify_allow_default_outbound]" id="smtp_tab_gmail__notify_allow_default_outbound" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> </div> <div class="clear"></div> </div> <!-- smtp / yahoo! mail tab --> <div class="form_section smtp_tab" id="smtp_tab_yahoo"> <input type="hidden" name="smtp_tab_yahoo[mail_smtpserver]" size="25" maxlength="64" value="smtp.mail.yahoo.com"> <input type="text" name="smtp_tab_yahoo[mail_smtpport]" size="5" maxlength="5" value="465"> <input type="hidden" name="smtp_tab_yahoo[mail_smtpssl]" value="1"> <div class="formrow"> <label>{$mod_strings['LBL_YAHOOMAIL_SMTPUSER']}</label> <input type="text" name="smtp_tab_yahoo[mail_smtpuser]" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_YAHOOMAIL_SMTPPASS']}</label> <input type="password" name="smtp_tab_yahoo[mail_smtppass]" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input name="smtp_tab_yahoo[notify_allow_default_outbound]" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> <div class="clear"></div> </div> <!-- smtp / ms-exchange tab --> <div class="form_section smtp_tab" id="smtp_tab_exchange"> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPSERVER']}</label> <input type="text" name="smtp_tab_exchange[mail_smtpserver]" size="25" maxlength="64" value=""> </div> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPPORT']}</label> <input type="text" name="smtp_tab_exchange[mail_smtpport]" size="5" maxlength="5" value="25"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> <input type="checkbox" name="smtp_tab_exchange[mail_smtpauth_req]" id="smtp_tab_exchange__mail_smtpauth_req" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_2');"> </div> <div class="formrow"> <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> <select name="smtp_tab_exchange[mail_smtpssl]" tabindex="501"> {$MAIL_SSL_OPTIONS_EXCHG} </select> </div> <div class="clear"></div> <div class="toggleArea" id="toggleArea_2"> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPUSER']}</label> <input type="text" name="smtp_tab_exchange[mail_smtpuser]" id="smtp_tab_exchange__mail_smtpuser" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPPASS']}</label> <input type="password" name="smtp_tab_exchange[mail_smtppass]" id="smtp_tab_exchange__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input name="smtp_tab_exchange[notify_allow_default_outbound]" id="smtp_tab_exchange__notify_allow_default_outbound" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> </div> <div class="clear"></div> </div> <!-- smtp / other tab--> <div class="form_section smtp_tab" id="smtp_tab_other"> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPSERVER']}</label> <input type="text" name="smtp_tab_other[mail_smtpserver]" size="25" maxlength="64" value=""> </div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPPORT']}</label> <input type="text" name="smtp_tab_other[mail_smtpport]" size="5" maxlength="5" value="25"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> <input type="hidden" name="smtp_tab_other[mail_smtpauth_req]" value="0"> <input type="checkbox" id="mail_smtpauth_req_chk" name="smtp_tab_other[mail_smtpauth_req]" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_3');"> </div> <div class="formrow"> <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> <select name="smtp_tab_other[mail_smtpssl]" tabindex="501"> {$MAIL_SSL_OPTIONS_OTHER} </select> </div> <div class="clear"></div> <div class="toggleArea" id="toggleArea_3"> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPUSER']}</label> <input type="text" name="smtp_tab_other[mail_smtpuser]" id="smtp_tab_other__mail_smtpuser" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPPASS']}</label> <input type="password" name="smtp_tab_other[mail_smtppass]" id="smtp_tab_other__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input type="hidden" name="smtp_tab_other[notify_allow_default_outbound]" value="0"> <input id="notify_allow_default_outbound_chk" name="smtp_tab_other[notify_allow_default_outbound]" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> </div> <div class="clear"></div> <!-- </div> --> <!-- smtp default values & tabs toggler js & tooltip help --> <script> var toggleSMTPAuthFields = { toggleArea_1 : { user: '******', pass: '******', allow: 'smtp_tab_gmail__notify_allow_default_outbound' }, toggleArea_2 : { user: '******', pass: '******', allow: 'smtp_tab_exchange__notify_allow_default_outbound' }, toggleArea_3 : { user: '******', pass: '******', allow: 'notify_allow_default_outbound_chk' } }; var toggleSMTPAuthSettings = function(chkbox, elemID) { if(\$(chkbox).prop('checked')) { \$('#' + elemID).show(); } else { \$('#' + toggleSMTPAuthFields[elemID].user).val(''); \$('#' + toggleSMTPAuthFields[elemID].pass).val(''); \$('#' + toggleSMTPAuthFields[elemID].allow).prop('checked', false); \$('#' + elemID).hide(); } }; \$(function(){ \$('.smtp_tab_toggler').click(function(){ \$('.smtp_tab_toggler.selected').removeClass('selected'); \$(this).addClass('selected'); \$('.smtp_tab').hide(); \$('#'+\$(this).attr('for')).show(); \$('input[name="smtp_tab_selected"]').val(\$(this).attr('for')); }); // save last selected tab and set as default when form (re)load \$('#{$_SESSION['smtp_tab_selected']}_toggler').click(); \$('select[name="smtp_tab_gmail[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); \$('select[name="smtp_tab_yahoo[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); \$('select[name="smtp_tab_exchange[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); \$('select[name="smtp_tab_other[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); toggleSMTPAuthSettings(document.getElementById('smtp_tab_gmail__mail_smtpauth_req'), 'toggleArea_1'); toggleSMTPAuthSettings(document.getElementById('smtp_tab_exchange__mail_smtpauth_req'), 'toggleArea_2'); toggleSMTPAuthSettings(document.getElementById('mail_smtpauth_req_chk'), 'toggleArea_3'); }); </script> </div> <!-- toggle hidden box end --> EOQ; // db setup (dbConfig_a.php) $out2 = <<<EOQ2 <input type='hidden' name='setup_db_drop_tables' id='setup_db_drop_tables' value=''> </div> EOQ2; // ---------- // Branding // -------------> // company logo $currentLogoLink = SugarThemeRegistry::current()->getImageURL('company_logo.png'); // show logo if we have $hiddenLogo = ''; if (!file_exists($currentLogoLink)) { $hiddenLogo = 'display:none;'; } // TODO--low: check the tooltip text at the logo image! $out .= <<<EOQ <!-- Branding --> </div> </div> <div class="floatbox full" id="fb3"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_WIZARD_SYSTEM_TITLE']}</h3> <div class="form_section" style="display: none;"> <p class="ibmsg">{$mod_strings['LBL_WIZARD_SYSTEM_DESC']}</p> <p class="ibmsg">{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']}</p> <div class="formrow"> <label>{$mod_strings['SYSTEM_NAME_WIZARD']} <i>i<div class="tooltip">{$mod_strings['SYSTEM_NAME_HELP']}</div></i></label> <input type="text" name="setup_system_name" size="25" maxlength="64" value="{$_SESSION['setup_system_name']}"> </div> <div class="clear"></div> <div class="formrow"> <!-- file upload --> <label>{$mod_strings['NEW_LOGO']} <i>i<div class="tooltip">{$mod_strings['NEW_LOGO_HELP']}</div></i></label> <input type="file" name="company_logo" id="company_logo"> </div> <div class="clear"></div> <div class="formrow"> <label> </label> <input type="button" name="company_logo_upload_btn" value="{$mod_strings['COMPANY_LOGO_UPLOAD_BTN']}" onclick="onUploadImageClick(this);"> </div> <div class="clear"></div> <div class="formrow" id="current_logo_row"> <label>{$mod_strings['CURRENT_LOGO']} <i>i<div class="tooltip">{$mod_strings['CURRENT_LOGO_HELP']}</div></i> </label> <img height="100" src="{$currentLogoLink}" alt="Company Logo" style="max-height: 100px; max-width: 230px; float:left; {$hiddenLogo}" /> </div> <div class="clear"></div> </div> EOQ; // System location defaults // TODO--low: 1000s sep, Decimal Symb, Name Format $defaultDateFormatSelect = self::getSelect('default_date_format', $sugarConfigDefaults['date_formats'], empty($_SESSION['default_date_format']) ? $sugarConfigDefaults['default_date_format'] : $_SESSION['default_date_format']); $defaultTimeFormatSelect = self::getSelect('default_time_format', $sugarConfigDefaults['time_formats'], empty($_SESSION['default_time_format']) ? 'h:ia' : $_SESSION['default_time_format']); $timezoneSelect = self::getSelect('timezone', array_merge(array(TimeDate::guessTimezone() => TimeDate::guessTimezone()), TimeDate::getTimezoneList()), TimeDate::guessTimezone()); //$defaultLanguageSelect = get_select_options_with_id($supportedLanguages, $current_language); $defaultLanguageSelect = self::getSelect('default_language', $supportedLanguages, $current_language); // example name formats (its are in the original language file so may this functionality was there in the original sugarcrm installer also) $nonDBLocalization = new NonDBLocalization(); $sugarConfigDefaults['name_formats'] = $nonDBLocalization->getUsableLocaleNameOptions($sugarConfigDefaults['name_formats']); $defaultLocalNameFormatSelect = self::getSelect('default_locale_name_format', $sugarConfigDefaults['name_formats'], empty($_SESSION['default_locale_name_format']) ? $sugarConfigDefaults['default_locale_name_format'] : $_SESSION['default_locale_name_format']); $out .= <<<EOQ </div> <!-- System Local Settings --> <!-- TODO--low: add the time-zone settings here!! --> <div class="floatbox full" id="fb4"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_LOCALE_TITLE']}</h3> <div class="form_section" style="display: none;"> <p class="ibmsg">{$mod_strings['LBL_WIZARD_LOCALE_DESC']}</p> <div class="formrow"> <label>{$mod_strings['LBL_DATE_FORMAT']}</label> {$defaultDateFormatSelect} </div> <div class="formrow"> <label>{$mod_strings['LBL_TIME_FORMAT']}</label> {$defaultTimeFormatSelect} </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_TIMEZONE']}</label> {$timezoneSelect} </div> <div class="clear"></div> <div class="formrow" style="display: none;"> <label>{$mod_strings['LBL_LANGUAGE']}</label> {$defaultLanguageSelect} </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_CURRENCY']}</label> <input type="text" name="default_currency_name" value="{$sugarConfigDefaults['default_currency_name']}"> </div> <div class="formrow"> <label>{$mod_strings['LBL_CURRENCY_SYMBOL']}</label> <input type="text" name="default_currency_symbol" size="4" value="{$sugarConfigDefaults['default_currency_symbol']}"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_CURRENCY_ISO4217']}</label> <input type="text" name="default_currency_iso4217" size="4" value="{$sugarConfigDefaults['default_currency_iso4217']}"> </div> <!-- <div class="formrow"> <label>{$mod_strings['LBL_NUMBER_GROUPING_SEP']}</label> <input type="text" name="default_number_grouping_seperator" size="3" maxlength="1" value="{$sugarConfigDefaults['default_number_grouping_seperator']}"> </div> <div class="formrow"> <label>{$mod_strings['LBL_DECIMAL_SEP']}</label> <input type="text" name="default_decimal_seperator" size="3" maxlength="1" value="{$sugarConfigDefaults['default_decimal_seperator']}"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_NAME_FORMAT']}</label> {$defaultLocalNameFormatSelect} </div> --> <div class="clear"></div> </div> </div> EOQ; $out .= "<div class=\"floatbox full\">"; $out .= " <h3 onclick=\"\$(this).next().toggle();\" class=\"toggler\">» {$mod_strings['LBL_SITECFG_SECURITY_TITLE']}</h3>"; $out .= <<<EOQ <div class="security-block" style="display:none;"> <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell"> <tr><td colspan="2" id="help"><!-- <a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a> --></td></tr> <tr> <th width="500"> </th> <th width="200" style="text-align: right;"> </th> </tr> <tr> <td colspan="2"> {$errors} <div class="required">{$mod_strings['LBL_REQUIRED']}</div> <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr"> <tr><th colspan="3" align="left">{$mod_strings['LBL_SITECFG_SITE_SECURITY']}</td></tr> EOQ; $checked = ''; //if(!empty($_SESSION['setup_site_sugarbeet_anonymous_stats'])) $checked = 'checked=""'; $out .= "\n <tr style='display:none'><td></td>\n <td><input type='checkbox' class='checkbox' name='setup_site_sugarbeet_anonymous_stats' value='yes' {$checked} /></td>\n <td><b>{$mod_strings['LBL_SITECFG_ANONSTATS']}</b><br><i>{$mod_strings['LBL_SITECFG_ANONSTATS_DIRECTIONS']}</i></td></tr>\n\n"; $checked = ''; //if(!empty($_SESSION['setup_site_sugarbeet_automatic_checks'])) $checked = 'checked=""'; $out .= <<<EOQ <tr style='display:none'><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_sugarbeet_automatic_checks" value="yes" /></td> <td><b>{$mod_strings['LBL_SITECFG_SUGAR_UP']}</b><br><i>{$mod_strings['LBL_SITECFG_SUGAR_UP_DIRECTIONS']}</i><br> </td></tr> <tbody id="setup_site_session_section_pre"> <tr><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_custom_session_path" value="yes" onclick="javascript:\$('#setup_site_session_section').toggle();" {$customSession} /></td> <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_SESSION']}</b><br> <em>{$mod_strings['LBL_SITECFG_CUSTOM_SESSION_DIRECTIONS']}</em><br> </td> </tr> </tbody> <tbody id="setup_site_session_section" {$customSessionHidden}> <tr><td></td> <td style="text-align : right;"></td> <td align="left"> \t <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_SESSION_PATH']} <span class="required">*</span></div> \t <input type="text" name="setup_site_session_path" size='40' value="{$_SESSION['setup_site_session_path']}" /></td> \t </div> </td> </tr> </tbody> <tbody id="setup_site_log_dir_pre"> <tr><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_custom_log_dir" value="yes" onclick="javascript:\$('#setup_site_log_dir').toggle();" {$customLog} /></td> <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_LOG']}</b><br> <em>{$mod_strings['LBL_SITECFG_CUSTOM_LOG_DIRECTIONS']}</em><br> </td> </tr> </tbody> <tbody id="setup_site_log_dir" {$customLogHidden}> <tr><td></td> <td style="text-align : right;" ></td> <td align="left"> <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_LOG_DIR']} <span class="required">*</span></div> <input type="text" name="setup_site_log_dir" size='30' value="{$_SESSION['setup_site_log_dir']}" /> </div> </tr> </tbody> <tbody id="setup_site_guid_section_pre"> <tr><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_specify_guid" value="yes" onclick="javascript:\$('#setup_site_guid_section').toggle();" {$customId} /></td> <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_ID']}</b><br> <em>{$mod_strings['LBL_SITECFG_CUSTOM_ID_DIRECTIONS']}</em><br> </td> </tr> </tbody> <tbody id="setup_site_guid_section" {$customIdHidden}> <tr><td></td> <td style="text-align : right;"></td> <td align="left"> \t <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_APP_ID']} <span class="required">*</span></div> \t <input type="text" name="setup_site_guid" size='30' value="{$_SESSION['setup_site_guid']}" /> \t </div> </td> </tr> </tbody> </table> </td> </tr> </table> </div> EOQ; $out .= "</div>"; return $out; }
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { ?> <div id="contenu"> <h2>Modification d'une image</h2> <?php require_once '../include/function.php'; $id = $_GET['id']; $contenuarticle = getDbConnection()->query("select id, titre, date,commentaire,photo from contenu where id =" . $id); $contenu = $contenuarticle->fetch(); ?> <form action="../actions/modifierimage.php" method="post" enctype="multipart/form-data"> <p><input type="hidden" name="id" value="<?php echo $contenu['id']; ?> " /></p> <fieldset> <legend><i>Les champs signalés par * sont obligatoires</i></legend> * <span>Titre : </span> <input type="text" name="titre" id="titre" value="<?php echo $contenu['titre']; ?> "/></br> * <span>Lien vers la page : </span> <select name="commentaire" id="commentaire" size="11">
function processMessage($message) { // Variable $conn = getDbConnection(); //connection to DB $message_id = $message['message_id']; $chat_id = $message['chat']['id']; /* * Control the empty fields in incoming message */ if (isset($message['from']['first_name'])) { $first_name_id = $message['from']['first_name']; } else { $first_name_id = ''; } if (isset($message['from']['last_name'])) { $last_name_id = $message['from']['last_name']; } else { $last_name_id = ''; } if (isset($message['from']['username'])) { $username_id = $message['from']['username']; } else { $username_id = ''; } if (isset($message['text'])) { /* * The very function of process messag */ $text = $message['text']; if (strpos($text, "/start") === 0) { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_BENVENUTO, 'reply_markup' => array('keyboard' => array(array('Help', 'Social Media', 'Forum', 'Credit')), 'one_time_keyboard' => false, 'resize_keyboard' => true))); /* * Log the user in DB. If the user is already activated only you change their status in active also. */ dbLogUserStart($chat_id, $first_name_id, $last_name_id, $username_id); /* * Possibility to send logo/image when the user enter for first time (optinal) * Function: SendPicture($chat_id, INFO_PHOTO ); */ /* * Menù Help */ } else { if ($text === "Help") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_HELP, 'reply_markup' => array('keyboard' => array(array('Info', 'Comandi', 'Contatti', 'Exit')), 'one_time_keyboard' => false, 'resize_keyboard' => true))); } else { if ($text === "Info" || $text === "Informazioni" || $text === "/informazioni") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_INFO, "disable_web_page_preview" => true)); } else { if ($text === "Comandi") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_COMANDI, "disable_web_page_preview" => true)); } else { if ($text === "Contatti") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_CONTATTI, "disable_web_page_preview" => true)); } else { if ($text === "Exit") { /* * Return to menù home page */ apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'Sei tornato al menu\' in Home.', 'reply_markup' => array('keyboard' => array(array('Help', 'Social Media', 'Forum', 'Credit')), 'one_time_keyboard' => false, 'force_reply_keyboard' => true, 'resize_keyboard' => true))); } else { if ($text === "Social Media") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_SOCIAL, "disable_web_page_preview" => true)); } else { if ($text === "Forum") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_FORUM, "disable_web_page_preview" => true)); } else { if ($text === "Credit") { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_CREDIT, "disable_web_page_preview" => true)); } else { if ($text === "/stop") { /* * Here inserted disabling user from the DB (not cleared but only put off) */ apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_EXIT)); dbLogUserStop($chat_id); } else { if (strpos($text, "Stop") === 0) { /* * For ecception * Here inserted disabling user from the DB (not cleared but only put off) */ apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_EXIT)); dbLogUserStop($chat_id); } else { /* * Function that stores all messages that users send through extra bot */ apiRequest("sendMessage", array('chat_id' => $chat_id, "reply_to_message_id" => $message_id, "text" => MESSAGE_NULL)); dbLogTextOn($chat_id, $first_name_id, $message_id, $text); } } } } } } } } } } } } else { apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => MESSAGE_SCUSE)); } }
echo "Le fichier dépasse la limite autorisée par le serveur (fichier php.ini) !"; break; case 2: // UPLOAD_ERR_FORM_SIZE echo "Le fichier dépasse la limite autorisée dans le formulaire HTML !"; break; case 3: // UPLOAD_ERR_PARTIAL echo "L'envoi du fichier a été interrompu pendant le transfert !"; break; case 4: // UPLOAD_ERR_NO_FILE echo "Le fichier que vous avez envoyé a une taille nulle !"; break; } } else { move_uploaded_file($_FILES['photo']['tmp_name'], "../include/design/photos/" . $_FILES['photo']['name']); getDbConnection()->query('INSERT INTO contenu (titre,date,commentaire,photo) VALUES (' . "'" . $_POST["titre"] . "'," . "now()" . ",'" . $_POST["commentaire"] . "','" . $_FILES['photo']['name'] . "')"); header("Location: ../admin/admin.php?id=images"); } } else { echo "Problème à la connexion <br />"; } } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
<?php session_start(); require_once '../include/function.php'; if (isset($_POST['user']) && isset($_POST['mdp'])) { if (getDbConnection()) { $pw = md5($_POST["mdp"]); if (getDbConnection()->query('SELECT login,pass_md5 from membre where login= "******"user"] . '" and pass_md5 = "' . $pw . '"')->rowcount()) { $_SESSION['clegen'] = md5(rand()); $_SESSION['util'] = crypt($_POST["user"], '$5$'); $_SESSION['id'] = $_SESSION['util'] . $_SESSION['clegen']; header('Location: ../admincompudream.php '); } else { $_SESSION['id'] = "erreur"; header('Location: ../admincompudream.php'); } } else { $_SESSION['id'] = "connexion"; header('Location: ../admincompudream.php'); } } else { header('Location: ../compudream.php'); }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/templates/preheader.php"; if (isset($_POST['id'])) { $link = getDbConnection(); $dbid = $link->query("SELECT user FROM comments WHERE id = " . $_POST['id'])->fetch_array()['user']; if (isset($userid) && $userid == $dbid) { $link->query("DELETE FROM comments WHERE id = " . $_POST['id']); } else { echo $dbid . "/" . $userid; } $link->close(); }
<div class="clear"></div> </div> </div> </header> <div class="main"> <!--==============================Content=================================--> <div class="content"><div class="ic">More Website Templates @ TemplateMonster.com - December 16, 2013!</div> <div class="container_12"> <div class="grid_4 "> <a href="#" class="donate">ωρολογιο προγραμμα</a> <h4>ολες οι ταξεις</h4> <ul class="list"> <?php require_once 'helpers/dbConnectioni.php'; $conn = getDbConnection(); $sql = "SELECT class,lessonprogram_file FROM lessonprogram"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while ($row = $result->fetch_assoc()) { echo $row['class'] . " " . $row['lessonprogram_file']; echo '</br>'; } } else { echo "0 results"; } $conn->close(); ?> </ul>
case 'dbname': $default = empty($settings[$name]) ? '' : $settings[$name]; break; } $value = $default; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $value = empty($_POST[$name]) ? $default : $_POST[$name]; } $settings[$name] = $value; } } $_SESSION['settings'] = $settings; // if a POST, try to connect to the database using the parameters $error = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $instance = getDbConnection($error); if ($instance && empty($error)) { $_SESSION['settings'] = $settings; $wizard->redirectToPage('+1'); exit; } } ob_start(); if (!empty($error)) { echo '<div class="x2-note errorMsg">' . $error . "</div>\n"; } ?> <fieldset> <legend><?php echo LEGEND_CONNECTION; ?>
<?php if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { $compteur = getDbConnection()->query("select * from contact"); // Récupération et affichage des données $ligne = $compteur->fetch(); print "<table border='1'><p align='left'><a href='../compudream.php' title='Modifier a partir du site'>Retour a la page d'accueil</a></p><tr><th>Libelle</th><th>Adresse</th><th>Téléphone</th><th>E-mail</th><th>Facebook</th><th>Modifier</th></tr>"; $requetearticle = getDbConnection()->query("SELECT con_id, libelle, adresse1, adresse2, cp, ville, tel,email,facebook FROM contact ORDER BY con_id"); $ligne = $requetearticle->fetch(); // Récupération et affichage des données while ($ligne) { print '<td>' . stripslashes($ligne['libelle']) . '</td><td>' . stripslashes($ligne['adresse1']) . ' ' . stripslashes($ligne['adresse2']) . ' ' . stripslashes($ligne['cp']) . ' ' . stripslashes($ligne['ville']) . '</td><td>' . stripslashes($ligne['tel']) . '</td><td>' . stripslashes($ligne['email']) . '</td><td>' . stripslashes($ligne['facebook']) . '</td><td><a href="../forms/modifiercontact.php?id=' . $ligne['con_id'] . '">Modifier</a></td></tr>'; $ligne = $requetearticle->fetch(); } print "</table>"; } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
EOQ; //hide this in typical mode if (!empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') { $out .= <<<EOQ <div class='install_block'> {$mod_strings['LBL_SITECFG_URL_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_SITECFG_URL']}</b></label> <input type="text" name="setup_site_url" id="button_next2" value="{$_SESSION['setup_site_url']}" size="40" /> <br>{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_SYSTEM_NAME']}</b></label> <input type="text" name="setup_system_name" value="{$_SESSION['setup_system_name']}" size="40" /><br> </div> EOQ; $db = getDbConnection(); if ($db->supports("collation")) { $collationOptions = $db->getCollationList(); } if (!empty($collationOptions)) { if (isset($_SESSION['setup_db_options']['collation'])) { $default = $_SESSION['setup_db_options']['collation']; } else { $default = $db->getDefaultCollation(); } $options = get_select_options_with_id(array_combine($collationOptions, $collationOptions), $default); $out .= <<<EOQ <div class='install_block'> <br>{$mod_strings['LBL_SITECFG_COLLATION_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_COLLATION']}</b></label>
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { require_once '../include/function.php'; $titre = $_GET['titre']; $contenu = $_GET['contenu']; $page = $_GET['page']; $temps = time(); $requete = getDbConnection()->query("INSERT INTO article (titre,contenu,temps,page) VALUES('" . $titre . "','" . $contenu . "','" . $temps . "','" . $page . "')"); header("Location: ../admin/admin.php?id=articles"); } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { $id = $_GET['id']; $requete = getDbConnection()->query("DELETE FROM contenu WHERE id=" . $id); header("Location: ../admin/admin.php?id=images"); } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { ?> <div id="contenu"> <h2>Modification de l'horaire</h2> <?php require_once '../include/function.php'; $contenuarticle = getDbConnection()->query("select titre,lundi,mardi,mercredi,jeudi,vendredi,samedi,dimanche from horaire"); $contenu = $contenuarticle->fetch(); ?> <form action="../actions/modifierhoraire.php" method="get"> <fieldset> <legend><i>Les champs signalés par * sont obligatoires</i></legend> * <span>Titre : </span> <input type="text" name="titre" id="titre" value="<?php echo $contenu['titre']; ?> "/></br> * <span>Lundi : </span> <input type="text" name="lundi" id="lundi" value="<?php echo $contenu['lundi']; ?> "/></br> * <span>Mardi : </span> <input type="text" name="mardi" id="mardi" value="<?php
require 'config/db.php'; require 'model/user.php'; require 'model/message.php'; $app = new Slim\App(); $app->get('/', function ($request, $response, $args) { $response->write("Welcome to Slim!"); return $response; }); $app->get('/hello[/{name}]', function ($request, $response, $args) { $response->write("Hello, " . $args['name']); return $response; })->setArgument('name', 'World!'); $app->get('/user/{id}', function ($request, $response, $args) { $newResponse = $response->withHeader('Content-type', 'application/json'); $newResponse->write(json_encode(getUser(getDbConnection(), $args['id']))); return $newResponse; }); $app->get('/messages', function ($request, $response, $args) { $newResponse = $response->withHeader('Content-type', 'application/json'); $queryParams = $request->getQueryParams(); if (isset($queryParams['lat']) || isset($queryParams['lng'])) { $lat = $queryParams['lat']; $lng = $queryParams['lng']; $messages = messagesWithLatLng(getDbConnection(), $lat, $lng); } else { $messages = messages(getDbConnection()); } $newResponse->write(json_encode($messages)); return $newResponse; }); $app->run();
<DIV id="main"> <?php $contenuarticle = getDbConnection()->query("select id, titre,contenu,page from article WHERE page = 'Maintenance - Professionnels' ORDER BY temps DESC"); $contenu = $contenuarticle->fetch(); if ($contenuarticle) { //Connexion à la bdd while ($contenu) { $_SESSION['bienconnecte'] == 1 ? $linkedit = '<a href="forms/modifierarticle.php?id=' . $contenu['id'] . '">Modifier</a> <a href="actions/supprimerarticle.php?id=' . $contenu['id'] . '">Supprimer</a> <a href="actions/majarticle.php?id=' . $contenu['id'] . '">Mettre en avant</a>' : ($linkedit = NULL); print "<div id='milieu'><p><h1>" . $contenu["titre"] . "</h1>" . "</br>" . $contenu["contenu"] . "</br>" . "</br>" . $linkedit . "</p></div>"; $contenu = $contenuarticle->fetch(); } } else { //No bdd Test $_SESSION['bienconnecte'] == 1 ? $linkedit = '<a href="#">Modifier (test)</a> <a href="#">Supprimer (test)</a>' : ($linkedit = NULL); print "<h1>" . "Un titre" . "</h1>" . "</br>" . "Un Contenu" . "</br>" . "</br>" . $linkedit; } ?> </DIV> <div id="bas"> </div>
$(this).mouseenter(function() { $(this).find("ul").stop(true, true).fadeIn(); }); $(this).mouseleave(function() { $(this).find("ul").stop(true, true).fadeOut(); }); } }); })(jQuery); </script> <div id="banner"> <ul class="bjqs"> <?php $photoliste = getDbConnection()->query("select id, titre,date,commentaire,photo from contenu ORDER BY date DESC"); if ($photoliste) { //Connexion à la bdd $photoaffiche = $photoliste->fetch(); while ($photoaffiche) { print "<li><a href=?id=" . $photoaffiche["commentaire"] . "><img src='./include/design/photos/" . $photoaffiche["photo"] . "'width='700' height='300' /></li></a>"; $photoaffiche = $photoliste->fetch(); } } else { } ?> </ul> </div> <script> $(document).ready(function() { $('#banner').bjqs({
<DIV id="main"> <?php $contenuarticle = getDbConnection()->query("select id, titre,contenu,page from article WHERE page = 'Cyber-espace' ORDER BY temps DESC"); $contenu = $contenuarticle->fetch(); if ($contenuarticle) { //Connexion à la bdd while ($contenu) { $_SESSION['bienconnecte'] == 1 ? $linkedit = '<a href="forms/modifierarticle.php?id=' . $contenu['id'] . '">Modifier</a> <a href="actions/supprimerarticle.php?id=' . $contenu['id'] . '">Supprimer</a> <a href="actions/majarticle.php?id=' . $contenu['id'] . '">Mettre en avant</a>' : ($linkedit = NULL); print "<div id='milieu'><p><h1>" . $contenu["titre"] . "</h1>" . "</br>" . $contenu["contenu"] . "</br>" . "</br>" . $linkedit . "</p></div>"; $contenu = $contenuarticle->fetch(); } } else { //No bdd Test $_SESSION['bienconnecte'] == 1 ? $linkedit = '<a href="#">Modifier (test)</a> <a href="#">Supprimer (test)</a>' : ($linkedit = NULL); print "<h1>" . "Un titre" . "</h1>" . "</br>" . "Un Contenu" . "</br>" . "</br>" . $linkedit; } ?> </DIV> <div id="bas"> </div>
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { require_once '../include/function.php'; $id = $_GET['id']; $temps = time(); $requete = getDbConnection()->query("UPDATE article SET temps ='" . $temps . "' WHERE id=" . $id); header("Location: ../admin/admin.php?id=articles"); } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { $titre = addslashes($_GET['titre']); $lundi = addslashes($_GET['lundi']); $mardi = addslashes($_GET['mardi']); $mercredi = addslashes($_GET['mercredi']); $jeudi = addslashes($_GET['jeudi']); $vendredi = addslashes($_GET['vendredi']); $samedi = addslashes($_GET['samedi']); $dimanche = addslashes($_GET['dimanche']); $requete = getDbConnection()->query("UPDATE horaire SET titre ='" . $titre . "', lundi = '" . $lundi . "', mardi = '" . $mardi . "', mercredi = '" . $mercredi . "', jeudi = '" . $jeudi . "', vendredi = '" . $vendredi . "', samedi = '" . $samedi . "', dimanche = '" . $dimanche . "'"); header("Location: ../admin/admin.php?id=horaires"); } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
/** * Tworzy polaczenie z baza danych MySQL i zwraca 'resource', przydatny jako drugi argument * w funkcji mysql_query. */ function utworzPolaczenieMysql() { return getDbConnection(); }
/** * Add a contact to the DB * * Will return TRUE if the contact was saved * * @param string $name * @param string $email * @param string $phone Phone is optional * @return boolean */ function addContact($name, $email, $phone = null) { $dbh = getDbConnection(); }
/** * Returns true if there exists a valid visit from the specified IP not older then 30 minutes. */ function visitedRecently($ip) { $dbConnection = getDbConnection(); // Retrieves entries with the same IP, not older than 30 minutes ago. $counterName = addslashes($this->counterName); $result = mysql_query("SELECT * FROM {$this->settings->mysqlValidVisitTableName} WHERE ip = '$ip' AND counterName = '$counterName' AND visitTime > NOW() - INTERVAL 30 MINUTE", $dbConnection); if (mysql_num_rows($result) > 0) { $visitedRecently = true; } else { $visitedRecently = false; } return $visitedRecently; }
<?php require_once '../include/function.php'; session_start(); if (isset($_SESSION['id'])) { if (isset($_SESSION['util']) && isset($_SESSION['clegen'])) { if ($_SESSION['id'] == $_SESSION['util'] . $_SESSION['clegen']) { $_SESSION['bienconnecte'] = 1; if ($_SESSION['bienconnecte'] == 1) { $id = $_GET['id']; $requete = getDbConnection()->query("DELETE FROM article WHERE id=" . $id); header("Location: ../admin/admin.php?id=articles"); } } } else { print "Votre IP a été enregistré, tentative de Hack détecté."; } } else { print "Impossible d'acédez a la page directement!!"; }
/** * creates the new database */ function handleDbCreateDatabase() { global $mod_strings; global $setup_db_database_name; global $setup_db_host_name; global $setup_db_host_instance; global $setup_db_port_num; global $setup_db_admin_user_name; global $setup_db_admin_password; global $sugar_config; echo "{$mod_strings['LBL_PERFORM_CREATE_DB_1']} {$setup_db_database_name} {$mod_strings['LBL_PERFORM_CREATE_DB_2']} {$setup_db_host_name}..."; $db = getDbConnection(); if ($db->dbExists($setup_db_database_name)) { $db->dropDatabase($setup_db_database_name); } $db->createDatabase($setup_db_database_name); echo $mod_strings['LBL_PERFORM_DONE']; }
// $command = "ADD"; //$_POST['command']; // $ht_file = ""; //$_POST['ht_file']; // } $username = "******"; //$_POST['username']; $password = "******"; //$_POST['password']; $command = "ADD"; //$_POST['command']; $ht_file = ""; //$_POST['ht_file']; if ($debug == 1) { echo "DATA is {$command}, {$username}, {$password}, {$ht_file}\n"; } // Get the connection to the database. $dbh = getDbConnection(); switch ($command) { /* CHECK if the user exists */ case 'CHECK': echo userExists($username) ? "FOUND" : "NOT_FOUND"; break; /* ADD a new user */ /* ADD a new user */ case 'ADD': addUser($username, $password); echo "ADDED"; break; /* DELETE a user */ /* DELETE a user */ case 'DELETE': deleteUser($username);