 |
Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc Comunitatea PHP Romania
|
| Subiectul anterior :: Subiectul următor |
| Autor |
Mesaj |
MadMan
Data înscrierii: 04/Mai/2008
Mesaje: 3
|
| Trimis: Dum Mai 04, 2008 9:15 pm Titlul subiectului: Eroare generare cod imagine |
|
|
Buna ziua, va rog sa ma ajutati intr-o problema: am un script php pentru licitatii si problema este ca in pagina de inregistrare user nou ar trebui sa se genereze un cod unic care trebuie introdus in camp...la fel ca la inregistrarea pe acest forum, insa in locul codului unic imi apare un X de culoare rosie (ca o poza care nu exista intr-un html) si nu stiu cum sa rezolv aceasta problema. Mentionez ca rulez pe Windows un Apache 2.2.6 si PHP 5.2.5.
Va multumesc anticipat! |
|
| Sus |
|
dechim
Data înscrierii: 10/Mai/2005
Mesaje: 595
Locație: Drobeta Turnu Severin
|
| Trimis: Dum Mai 04, 2008 9:19 pm Titlul subiectului: |
|
|
Din cat ai spus nu se poate spune unde este eroarea.
Vezi la View-Source ca sa te prinzi ce generezi poate chiar ai cod html de imagine. |
|
| Sus |
|
MadMan
Data înscrierii: 04/Mai/2008
Mesaje: 3
|
| Trimis: Dum Mai 04, 2008 9:42 pm Titlul subiectului: |
|
|
Deci in pagina signup.php printre altele imi apare:
if($config['security'])
{
$_POST['security_code'] = trim($_POST['security_code']);
if(strtoupper($_POST['security_code']) != strtoupper($_SESSION['seccode']))
{
$security_error = 'The word you entered is not correct';
$errors++;
... si mai este seccode.php cu urmatoarele linii:
<?php
require_once('includes/config.php');
require_once('includes/functions/func.global.php');
// Start session
session_start();
// Get 5 random characters
$captchastr = getrandnum(4);
// Create the image
$captcha = imagecreate(200,50);
// Set background color
$backcolor = imagecolorallocate($captcha, 224, 224, 224);
// Set Text color
$txtcolor = imagecolorallocate($captcha, 86, 86, 86);
$gd_support = gd_info();
// Run through the 5 characters and add them to the image
for($i=1;$i<=5;$i++)
{
$rotdirection = rand(1,2);
if ($rotdirection == 1)
{
$angle = rand(0,20);
}
if ($rotdirection == 2)
{
$angle = rand(345,360);
}
if($gd_support['FreeType Support'])
{
imagettftext($captcha,rand(16,22),$angle,($i*30),30,$txtcolor,"includes/fonts/zeroes_3.ttf",substr($captchastr,($i-1),1));
}
else
{
imagestring($captcha, 5, ($i*30), 20, substr($captchastr,($i-1),1), $txtcolor);
}
}
// Create 10 lines with the background color
for($i=1; $i<=10;$i++)
{
imageline ($captcha, rand(1,200), 0,rand(50,100),50, $backcolor);
}
// Create 3 lines with the text color
for($i=1; $i<=3;$i++)
{
imageline ($captcha, rand(1,200), 0,rand(50,100),50, $txtcolor);
}
// Set the string to session
$_SESSION['seccode'] = $captchastr;
//Send the png header
header('Content-type: image/png');
//Output the image as a PNG
imagepng($captcha);
//Delete the image from memory
imagedestroy($captcha);
?> |
|
| Sus |
|
badtiger
Data înscrierii: 03/Noi/2006
Mesaje: 233
|
| Trimis: Dum Mai 04, 2008 10:23 pm Titlul subiectului: |
|
|
| da click dreapta "view poza" si vezi ce-i cu calea catre ea |
|
| Sus |
|
PHPRomania Bot
Bot Member
Data înscrierii: 27/Dec/2007
Mesaje: 1
Locaţie: Server Google |
| Trimis: Mie Dec 26, 2007 7:01 pm Titlul subiectului: Ad |
|
|
|
|
|
| Sus |
|
| |
|