Jump to content

help with sessions and variables


martin9t9

Recommended Posts

hey guys im writing some code for my website... it goes like this

 

Page 1

<?php
/* this page is sent to page 2 */
$postid = 105;

?>

 

Page 2


<?php

session_start(); 
/* this page redirects to page 3 */
$_SESSION[$postid]='rating';

?>

 

Page 3


<?php

if($_SESSION['$rows['id'] == $rows['id']) echo 'yes'; else echo 'no';

?>

 

 

this code is on www.martin9t9.com/announcement once youve signed up join the pakenham network then go to the homepage and click on of the ticks, i wanna make it so you can only press that button once.

the part im unsure of is the $_SESSION[$postid] = 'true'; part i dont understand why i can use the variable there.

Link to comment
Share on other sites

I can't use that because I want more than one session depending on the variable. What I'm doing is making a website where you can make posts then you can rate them but I only want them to beable to be rated once by that person so I was gonna make a session to make that so.

Link to comment
Share on other sites

if they have to logon to vote/rate then you can use their username in a session variable to track which ones they've voted on. this of course will be reset if they logout and then logon again. better to just store their votes in a database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.