Jump to content

timmah22

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

timmah22's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is any html being submitted before the session_start();? is the <?php at the top of the page? [!--quoteo(post=388183:date=Jun 26 2006, 02:39 PM:name=simonsays)--][div class=\'quotetop\']QUOTE(simonsays @ Jun 26 2006, 02:39 PM) [snapback]388183[/snapback][/div][div class=\'quotemain\'][!--quotec--] OK, I just started to rewrite my project using Smarty and I am new to this engine. I have come across a following problem: Here is a php file [code] <? require_once('Smarty.class.php'); $smarty = new Smarty(); $smarty->assign('self', $_SERVER['PHP_SELF']); $smarty -> assign('uid', $_SESSION['uid']); $smarty -> assign('pwd', $_SESSION['pwd']); if (isset($_POST['proceed']) && $_POST['proceed']=='yes') {$smarty -> assign('proceed', $_POST['proceed']);} $i=2001; while($i>=1920) { $years[]=$i; $i--; } $smarty->assign('years', $years); session_start(); $random = substr(md5(time()),0,6); $_SESSION['random']=$random; echo "Session is ". $_SESSION['random']; $smarty->display('reg.tpl'); ?> [/code] it does some minor routine, but the thing that interests me the most is the spot where it creates session. Echo that I use for control displays session contents perfectly. That session ($_SESSION['random']) is used later in the image.php script: [code]<?php $text = $_SESSION['random']; header("Content-type: image/png"); $im = @imagecreate(65, 27) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 153, 0); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 5, 5, 5,  $text, $text_color); imagepng($im); imagedestroy($im); ?> [/code] and there is a spot in .tpl file responsible for displaying it (<img src='image.php'>) The problem is that the image is blank (no string in it) and when I click 'submit' the registration validation script also gives error that session is empty. What's wrong? Thanks in advance! [/quote]
  2. or you could do it the right way so you dont have to update your both php code and html everytime you add an email address. add a value to your option <select name="clinic" id="clinic"> <option value="timmah@timmah.com">Benkelman</option> <option value="timmah2@timmah.com">Wray</option> </select>
  3. did you create the image resource? $img = @imagecreate(100, 50) [!--quoteo(post=388215:date=Jun 26 2006, 04:11 PM:name=Benj RooZ)--][div class=\'quotetop\']QUOTE(Benj RooZ @ Jun 26 2006, 04:11 PM) [snapback]388215[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi, I'm trying to generate a random image using this code: [code]<?php $dirname = "/home/www/benjrox.net/subsites/myspace/images/bg/resized/"; if ($handle = opendir($dirname)) {     while (false !== ($dir = readdir($handle))) {         if ($dir != "." && $dir != "..") {             $bgcount++;               }     }     closedir($handle); } else {     die("Could not get a directory list"); } $randimg = rand(1,$bgcount); $img = "/home/www/benjrox.net/subsites/myspace/images/bg/resized/bg". $randimg .".jpg"; header("Content-type: image/jpeg"); imagejpeg($img,null,100); imagedestroy($img); ?>[/code] Except I keep getting this: The images exist, it just doesn't work [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /] Thanks, Benj [/quote]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.