motorway Posted October 15, 2008 Report Share Posted October 15, 2008 Ужасная проблема с гостевыми книгами. Там, где требуется ввести кодовое слово или число, отображается значок того, что картинка не загрузилась. Причем это происходит иногда, и в разных браузерах по-разному, но в основном глюк в IE7, Safari, Opera, иногда в IE8. С чем это связано? Вероятно, с генерацией картинки на PHP, то есть у нее нет адреса (в свойствах просто виден адрес скрипта). Либо с глюкавым поведением броузеров. Что тут можно предпринять? Также вероятный вариант - это происходит из-за того, что страница с гостевой вставлена в iframe - когда заходишь просто без него, работает лучше. Link to comment Share on other sites More sharing options...
Darhazer Posted October 16, 2008 Report Share Posted October 16, 2008 Наверника скрипт, которой делаеть картинку, не работаеть хорошо... покажите его, может быт изправим Link to comment Share on other sites More sharing options...
motorway Posted October 16, 2008 Author Report Share Posted October 16, 2008 Может быть, но ведь ошибка появляется иногда, и притом в одном и том же броузере у некоторых людей работает, у кого-то - нет. Вот файл print_sec_img.php: <?phpsession_name('GBOOK');session_start();define('IN_SCRIPT',true);if (empty($_SESSION['secnum']) || strlen($_SESSION['secnum']) != 5 || preg_match('/\D/',$_SESSION['secnum'])) {die('Invalid or missing security number');}require('settings.php');require('secimg.inc.php');$sc=new PJ_SecurityImage($settings['filter_sum']);$sc->printImage($_SESSION['secnum']);exit();?> Вот secimg.inc: <?phpclass PJ_SecurityImage { function PJ_SecurityImage($key) { $this->code = ''; $this->key = $key; } // End PJ_SecurityImage function encrypt($plain_text) { $this->code = trim(crypt($plain_text,$this->key)); } // End encrypt function checkCode($mystring,$checksum) { $this->encrypt($mystring); if ($this->code == $checksum) return true; else return false; } // End checkCode function printImage($random_number) { header("Content-type: image/jpeg"); $im = @imagecreate(100, 20) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); $text_color = imagecolorallocate($im, 0, 0, 0); for ($i=0;$i<strlen($random_number);$i++) { $display = substr($random_number,$i,1); $x = ($i*20) + rand(3,6); $y = rand(3,6); imagestring($im, 5, $x, $y, $display, $text_color); } for ($i=1;$i<100;$i++) { $cor_x = rand(1,100); $cor_y = rand(1,20); imagesetpixel($im,$cor_x,$cor_y,$text_color); } imagejpeg($im); imagedestroy($im); } // End printImage function get() { return $this->code; } // End get} // End class PJ_SecurityImage?> И settings.php: <?php/* >>> SETUP YOUR GUESTBOOK <<< *//* Detailed information found in the readme file *//* File version: 1.6 $ Timestamp: 14th Feb 2008 18:37 *//* Password for admin area */$settings['apass']='admin';/* Website title */$settings['website_title']="My lovely website";/* Website URL */$settings['website_url']='http://www.domain.com/';/* Guestbook title */$settings['gbook_title']="My lovely website - guestbook";/* Name of the file where guestbook entries will be stored */$settings['logfile']='entries.txt';/* Use "Your website" field? 1 = YES, 0 = NO */$settings['use_url']=0;/* Open URLs in a new window? 1 = YES, 0 = NO */$settings['url_blank']=0;/* Allow private posts (readable only by admin)? 1 = YES, 0 = NO */$settings['use_private']=1;/* Hide e-mail addresses? 1 = YES, 0 = NO */$settings['hide_emails']=1;/* Allow smileys? 1 = YES, 0 = NO */$settings['smileys']=1;/* Send you an e-mail when a new entry is added? 1 = YES, 0 = NO */$settings['notify']=0;/* Your e-mail. Only required if $settings['notify'] is set to 1 */$settings['admin_email']='you@yourdomain.com';/* URL of the gbook.php file. Only required if $settings['notify'] is set to 1 */$settings['gbook_url']='http://www.domain.com/guestbook/gbook.php';/* Filter bad words? 1 = YES, 0 = NO */$settings['filter']=1;/* Filter language. Please refer to readme for info on how to add more bad words to the list! */$settings['filter_lang']='en';/* Prevent automated submissions (recommended YES)? 0 = NO, 1 = YES, GRAPHICAL, 2 = YES, TEXT */$settings['autosubmit']=1;/* Checksum - just type some digits or chars. Used to help prevent SPAM */$settings['filter_sum']='k39dw28rh3';/* Use JunkMark SPAM filter (recommended YES)? 1 = YES, 0 = NO */$settings['junkmark_use']=1;/* JunkMark score limit after which messages are marked as SPAM */$settings['junkmark_limit']=60;/* Ban IP address if JunkMark score is 100 (100% SPAM)? 1 = YES, 0 = NO */$settings['junkmark_ban100']=1;/* Ignore proxy servers from JunkMark check? 1 = YES, 0 = NO */$settings['ignore_proxies']=0;/* Show "NO GUESTBOOK SPAM" banner? 1 = YES, 0 = NO */$settings['show_nospam']=1;/* Prevent multiple submissions in the same session? 1 = YES, 0 = NO */$settings['one_per_session']=1;/* Maximum chars word length */$settings['max_word']=75;/* Language file */$settings['language']='language.inc.php';/* Allow IPv6 format? 1 = YES, 0 = NO */$settings['allow_IPv6']=0;/* DO NOT EDIT BELOW */if (!defined('IN_SCRIPT')) {die('Invalid attempt!');}ini_set('display_errors', 0);ini_set('log_errors', 1);?> Link to comment Share on other sites More sharing options...
motorway Posted October 16, 2008 Author Report Share Posted October 16, 2008 Похоже, это происходит из-за того, что IE блокирует нек-рые куки. Но что с этим можно сделать? Просто написать, чтобы включили их? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now