|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I've got a site (password protected, sorry) where I have this in the
top of my template: session_start(); $iSessionId = session_id(); $iSessionName = session_name(); Then I have a bunch of links like this in the site: echo "<a href=\"/departments/\">Departments</a>"; The first time, and only the first time you load the page, that link is transformed in the HTML output to be this: <a href="/departments/? PHPSESSID=4aec641b497131493b1c4bf489def723">Depart ments</a> But if I reload the page, or go to any other page, I will get this: <a href="/departments/">Departments</a> which is what I want. Obviously I could do something where if it detects the PHPSESSID in the URL, it forces the page to reload, but I was thinking that there would be another way to do this without adding another page load into the mix. Is there? -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada College www.wnc.edu 775-445-3326 P.S. Please note that my e-mail and website address have changed from wncc.edu to wnc.edu. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Kevin Murphy wrote:
> I've got a site (password protected, sorry) where I have this in the top > of my template: > > session_start(); > $iSessionId = session_id(); > $iSessionName = session_name(); > > Then I have a bunch of links like this in the site: > > echo "<a href=\"/departments/\">Departments</a>"; > > The first time, and only the first time you load the page, that link is > transformed in the HTML output to be this: > > <a > href="/departments/?PHPSESSID=4aec641b497131493b1c4bf489def723">Depar tments</a> > > > But if I reload the page, or go to any other page, I will get this: > > <a href="/departments/">Departments</a> > > which is what I want. Obviously I could do something where if it detects > the PHPSESSID in the URL, it forces the page to reload, but I was > thinking that there would be another way to do this without adding > another page load into the mix. Is there? These are caused by the php.ini setting session.use_trans_sid being on. This setting allows sessions to work when are disabled. http://php.net/ref.session#ini.session.use-trans-sid I'm not sure why you have such a problem with it. Why is it important that the URL does not contain the session ID? Anyway, the way to "fix" it is to disable that php.ini setting. -Stut -- http://stut.net/ |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
dear friends
,i have problem with dynamic image displaying here the snippets thumb.php <?php header("Content-type: image/jpg"); $file = "data/original/filename.jpg"; readfile($file); ?> img.php <img src="thumb.php?filename.jpg" /> problem is i always get broken images, someone know how to fix this ? thx in advance anuwidy |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Hello, Anugrah.
On 9/18/07, Anugrah Widya <anuwidy@gmail.com> wrote: > i have problem with dynamic image displaying > > here the snippets > > thumb.php > <?php > header("Content-type: image/jpg"); > $file = "data/original/filename.jpg"; > readfile($file); > ?> > > img.php > <img src="thumb.php?filename.jpg" /> From your above examples, two questions come to mind: 1.) Is thumb.php in a folder above `data`? If not, adjust your path accordingly. 2.) When using the query ?filename.jpg are you going to call that as an $argv[1] variable? If you want to use it as a $_GET, $_POST, or $_REQUEST, it will need a variable name with an assigned value. For example: <img src="thumb.php?img=filename.jpg"> L>thumb.php <? $path = "../data/original/"; // In case it's a same-level directory as the PWD $img = $_GET['img']; header("Content-type: image/jpg"); readfile($path.$img); ?> -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished.... |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Daniel Brown wrote:
> Hello, Anugrah. > > On 9/18/07, Anugrah Widya <anuwidy@gmail.com> wrote: >> i have problem with dynamic image displaying >> >> here the snippets >> >> thumb.php >> <?php >> header("Content-type: image/jpg"); >> $file = "data/original/filename.jpg"; >> readfile($file); >> ?> >> >> img.php >> <img src="thumb.php?filename.jpg" /> > > From your above examples, two questions come to mind: > 1.) Is thumb.php in a folder above `data`? If not, adjust > your path accordingly. > 2.) When using the query ?filename.jpg are you going to call > that as an $argv[1] variable? If you want to use it as a $_GET, > $_POST, or $_REQUEST, it will need a variable name with an assigned > value. For example: > <img src="thumb.php?img=filename.jpg"> > L>thumb.php > <? > $path = "../data/original/"; // In case it's a same-level > directory as the PWD > $img = $_GET['img']; > header("Content-type: image/jpg"); > readfile($path.$img); > ?> > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 > > Give a man a fish, he'll eat for a day. Then you'll find out he was > allergic and is hospitalized. See? No good deed goes unpunished.... thank you Mr. Brown for your reply, yep thumb.php and img.php are in the same level correction for img.php <img src="thumb.php?url=filename.jpg" /> i don't know what wrong with it, when i save the image data to another files, the image didn;t corrupted, but when displayed dynamically it's corrupted.., and the path are ok ![]() did i miss something on this, and i didn;t aware of it ? |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Anugrah Widya wrote:
> dear friends ,> > i have problem with dynamic image displaying > > here the snippets > > thumb.php > <?php > header("Content-type: image/jpg"); > $file = "data/original/filename.jpg"; > readfile($file); > ?> > > img.php > <img src="thumb.php?filename.jpg" /> > > problem is i always get broken images, someone know how to fix this ? Rather than viewing img.php, go directly to thumb.php?filename.jpg in your browser. Change the content-type to text/plain and see what you get in the browser. You may also want to remove the ?> at the end of thumb.php - it's not needed and may be adding whitespace to the image you are returning. -Stut -- http://stut.net/ |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> >> thumb.php > >> <?php > >> header("Content-type: image/jpg"); > >> $file = "data/original/filename.jpg"; > >> readfile($file); > >> ?> Change header("Content-type: image/jpg"); to header("Content-type: image/jpeg"); Apparently IE doesn't like image/jpg [1]. [1] http://pear.php.net/bugs/bug.php?id=4586 Edward |
|
![]() |
| Outils de la discussion | |
|
|