Warranty Messages : 389
|
Bonjour à tous ! Voilà je vient de finir la base de mon site web réaliser en PHP, MySQL, mais (il y a toujours un mais). J'ai réaliser mon site en local sous Xampp tout fonctionne impeccable, comme je vient de finir la base j'ai transféré mon site sur mon hébergeur pour le testé en situation réel, mais quand je veut me connecté sur mon panneau d'administration j'ai l'erreur suivant qui s'affiche Warning: Cannot modify header information - headers already sent by (output started at /home/ah38423/web/www/includes/functions.php:210) in /home/ah38423/web/www/admin/admin.php on line 20
Warning: Cannot modify header information - headers already sent by (output started at /home/ah38423/web/www/includes/functions.php:210) in /home/ah38423/web/www/admin/admin.php on line 21 Ligne 19 à 22 du fichier admin.php if ($error === false) { setcookie($tablePrefix.'loggedIn', $c['username'].'_'.md5(SECRET.sha1(md5($c['password']).get_date('n'))), time()+(60*60*24*30), '/'); header('Location: index.php'); } Donc je n'arrive pas à me connecté. Aurait vous une idée pour réglé ce problème ? Merci |
Warranty Messages : 389
|
Voici mon fichier admin.php complet. <?php define('ISADMIN', true); include('../config.php');
if (empty($install) && empty($upgrade) && !is_logged_in()) { $error = false; if (isset($_POST['submit'])) { $c = get_post_data(); if (empty($c['username']) || empty($c['password'])) $error = true; $user = get_single_item(array( 'table' => USERS, 'class' => 'user', 'where' => '`user_username` = "'.escape($c['username']).'" AND `user_password` = "'.md5($c['password']).'"' )); if (empty($user)) $error = true; if ($error === false) { setcookie($tablePrefix.'loggedIn', $c['username'].'_'.md5(SECRET.sha1(md5($c['password']).get_date('n'))), time()+(60*60*24*30), '/'); header('Location: index.php'); } } set_page_info('title', 'Connexion'); get_header(); ?> <h2>Connexion</h2> <?php if ($error === true) { ?> <p class="error">Cette combinaison nom d'utilisateur et mot de passe ne fonctionne pas.</p> <?php } ?> <form action="index.php" method="post"> <p><label for="username">Pseudo</label> <input type="text" name="username" id="username" /></p> <p><label for="password">Mot de passe</label> <input type="password" name="password" id="password" /></p> <p><input type="submit" name="submit" class="button" value="Connexion" /></p> </form> <?php get_footer(); }
//$referer = get_global($_SERVER, 'HTTP_REFERER'); //if (!empty($referer) && !preg_match('/^'.preg_quote(str_replace('www.', '', get_option('website')), '/').'/', $referer)) error('Vous ne pouvez pas accéder directement à cette page.');
if (!defined('ACTION') || (defined('ACTION') && ACTION != 'delete')) { session_start(); $_SESSION['token'] = md5(uniqid(rand(), true)); } elseif (defined('ACTION') && ACTION == 'delete') { session_start(); } ?> |
Warranty Messages : 389
|
Voici mon fichier functions.php <?php function add_trailing_slash($str = '') { if (empty($str) || preg_match('|/$|', $str)) return $str; else return $str.'/'; }
function bad_agent($agent = '') { return preg_match('/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer|DigExt|Jakarta|Missigua|psycheclone|LinkWalker|ZyBorg|Waterunicorn|ICS)/i', $agent); }
function bool2word($bool = true) { return ((bool)$bool === true) ? 'yes' : 'no'; }
function contains_spam($str = '') { return preg_match('/(content-type|bccccdocument.cookie|onclick|onload|javascript|alert|beastial|bestial|blowjob|clit|cock|cum|cunilingus|cunillingus|cunnilingus|cunt|ejaculate|fag|felatio|fellatio|fuck|fuk|fuks|gangbang|gangbanged|gangbangs|horny|hotsex|jism|jiz|kock|kondum|kum|kunilingus|orgasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx|viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|backgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i', $str); }
function currentuser() { if (!is_logged_in()) return false; static $user; if (empty($user)) { global $tablePrefix; $cookie = get_global($_COOKIE, $tablePrefix.'loggedIn'); $explode = explode('_', $cookie); $user = get_single_item(array( 'table' => USERS, 'class' => 'user', 'where' => '`user_username` = "'.$explode['0'].'"' )); } return $user; }
// function error($error = '', $files = true) { // set_page_info('title', 'Erreur!'); // if ($files === true) get_header(); // echo '<h2>Erreur!</h2>'."\n".'<p class="error">'.$error.' <a href="javascript:history.back();">Retour.</a></p>'."\n\n"; // if ($files === true) get_footer(); // }
function get_date($format = '', $date = '', $mysql = false) { global $dateFormats; return date((!empty($format)) ? $format : $dateFormats['standard'], (!empty($date)) ? (($mysql) ? strtotime($date) + (60 * 60 * (int)get_option('timeoffset')) : $date) : time()); }
function get_footer() { if (is_admin()) include(ABSPATH.'admin/footer.php'); else include_theme_file('footer.php'); exit; }
function get_gravatar($email = '', $size = 40) { if ($email == '') return; return 'http://www.gravatar.com/avatar.php?gravatar_id='.md5($email).'&default=identicon&size='.$size; }
function get_header() { global $pageInfo, $install; if (is_admin()) include(ABSPATH.'admin/header.php'); else include_theme_file('header.php'); }
function get_ids($object = false) { $ids = array(); if (!empty($object) && is_object($object)) { $ids = array(); foreach($object->items as $item) { if (method_exists($item, 'get_id')) $ids[] = $item->get_id(); } } return $ids; }
function get_page_info($key = '') { global $pageInfo; if (array_key_exists($key, $pageInfo)) return $pageInfo[$key]; else return false; }
function get_post_data($html = false) { $c = array(); if (!empty($_POST) && is_array($_POST)) foreach($_POST as $key => $value) $c[$key] = clean($value, $html); return $c; }
function get_rand() { $length = rand(7, 12); $rand = (int) ((rand() + rand() + rand()) / rand()) + rand() - (rand()/2); if ($rand < 0) get_rand(); $rand = md5($rand); if (rand(0, 1)) $rand = preg_replace('/[a-z]+/', '', $rand); if ($length > strlen($rand)) $length = strlen($rand); return substr($rand, 0, $length); }
function get_single_item($options = array(), $object = null) { if (!is_null($object)) { foreach($object->items as $item) { if (isset($item->$options['0']) && $item->$options['0'] == $options['1']) return $item; } } else { $items = new items(array_merge($options, array( 'limit' => 1, 'pagination' => false ))); if ($items->total === 1) return $items->items['0']; else return false; } }
function get_slug($str = '') { return (!empty($str)) ? trim(preg_replace('/[-]+/', '-', preg_replace('/[ ]+/', '-', trim(preg_replace('/[^a-z0-9-]/', ' ', strtolower($str)))))) : ''; }
function include_file($file = '', $vars = array()) { global $globals; if (empty($file)) return false; static $files = array(); $vars = array_merge($globals, (array)$vars); if (count($vars) > 0) eval('global $'.implode(', $', $vars).';'); if (!in_array($file, $files)) { include($file); $files[] = $file; } return true; }
function is_admin() { return (defined('ISADMIN') && ISADMIN === true); }
function is_logged_in() { global $tablePrefix; $cookie = get_global($_COOKIE, $tablePrefix.'loggedIn'); $explode = explode('_', $cookie); if (!empty($cookie) && !empty($explode) && count($explode) === 2) { $user = get_single_item(array( 'table' => USERS, 'class' => 'user', 'where' => '`user_username` = "'.escape($explode['0']).'"' )); return (!empty($user)) ? ($cookie === $user->get_username().'_'.md5(SECRET.sha1($user->get_password().get_date('n')))) : false; } else return false; }
function make_link($options = array()) { $link = '<a href="'.$options['href'].'"'; if (!empty($options['title'])) $link .= ' title="'.$options['title'].'"'; if (!empty($options['class'])) $link .= ' class="'.$options['class'].'"'; $link .= '>'.$options['text'].'</a>'; return $link; }
function remove_leading_slash($str = '') { return preg_replace('#^/#', '', $str); }
function set_page_info($key = '', $value = '') { global $pageInfo; return $pageInfo[$key] = $value; }
function valid_email($email) { if (strpos($email, '@') !== false && strpos($email, '.') !== false) return preg_match("/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i", $email); else return false; }
function valid_password($password = '') { return (!empty($password) && preg_match('/^[a-zA-Z0-9_-]{6,14}$/', $password)); }
function valid_slug($slug = '') { return (!empty($slug) && preg_match('/^[a-z0-9-]+$/', $slug)); }
function valid_url($url) { return preg_match('/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i', $url); }
function valid_username($username = '') { return (!empty($username) && preg_match('/^[a-zA-Z0-9_-]{4,18}$/', $username)); }
function nice_array($array,$var_dump=false){echo '<pre>';if($var_dump){var_dump($array);}else{print_r($array);}echo '</pre>';} ?>
|