Jump to content

Creating a session


3raser

Recommended Posts

That's not something you could do with a session. All the person would need to do is drop the session id and get a new session and they could vote again.

 

To do what you state would require that you remember the last time they voted using a database of some kind (mysql, flat-file...)

Link to comment
https://forums.phpfreaks.com/topic/181458-creating-a-session/#findComment-957226
Share on other sites

That's not something you could do with a session. All the person would need to do is drop the session id and get a new session and they could vote again.

 

To do what you state would require that you remember the last time they voted using a database of some kind (mysql, flat-file...)

 

I can do that, but my question is, how? I have more then one voting things. http://www.webmasters.webatu.com - How do I store IP's in just one row?...

Link to comment
https://forums.phpfreaks.com/topic/181458-creating-a-session/#findComment-957229
Share on other sites

That's not something you could do with a session. All the person would need to do is drop the session id and get a new session and they could vote again.

 

To do what you state would require that you remember the last time they voted using a database of some kind (mysql, flat-file...)

 

I can do that, but my question is, how? I have more then one voting things. http://www.webmasters.webatu.com - How do I store IP's in just one row?...

 

You wouldn't use 1 row. For each poll store an id identifying which poll was voted on, another id identifying the user and a timestamp to see when they last voted.

Link to comment
https://forums.phpfreaks.com/topic/181458-creating-a-session/#findComment-957234
Share on other sites

I SERIOUSLY don't understand what you mean...any examples you could give me?

 

Here is my vote.php page:

 

<?php

require("style.css");

$dbhost = 
$dbuser =
$dbpassword = 
$db = 
$ip = $_SERVER['REMOTE_ADDR'];
$pname = $_GET[project];

//connecting to the database
$connect = mysql_connect("$dbhost","$dbuser","$dbpassword") or die("Connection failed!");
mysql_select_db("$db") or die("Database fail!");

$query = mysql_query("SELECT * FROM info WHERE pname='$pname'");

$numrows = mysql_num_rows($query);

if ($numrows!=1)
   die("<content>Project does not exist!</content>");

$points = mysql_query("UPDATE info SET numbers  = numbers + 1 WHERE pname='$pname'");
echo "Voted for $pname! <br /><br />";

?>

Forum BBCode: <br /><br /><textarea rows="10" cols="32">[url=http://"http://www.webmasters.webatu.com/vote.php?project=<?php echo $pname; ?>"][img=http://www.webmasters.webatu.com/testing.php?pname=<?php echo $pname; ?>][/url]</textarea>

Link to comment
https://forums.phpfreaks.com/topic/181458-creating-a-session/#findComment-957235
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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