Jump to content

[php] Help!


Im Jake

Recommended Posts

Look up on:

 

1. cookies

2. if(isSet(....) {

// content

} else {

3. header("blah.php");

}

4. if statements

 

 

 

It checks if the cookie has been set, if not it most likely uses header to redirect you.

I would write a script, but I think it'd be better for you to look up a few things and learn about it, and then come back for questions.

Link to comment
Share on other sites

Look up on:

 

1. cookies

2. if(isSet(....) {

// content

} else {

3. header("blah.php");

}

4. if statements

 

 

 

It checks if the cookie has been set, if not it most likely uses header to redirect you.

I would write a script, but I think it'd be better for you to look up a few things and learn about it, and then come back for questions.

I know almost nothing about php or html, could you write something up, i usually learn from viewing source codes...

 

EDIT: learned vb and java like that.

Link to comment
Share on other sites

whereyoustarted.php

 

<?php
if (isset($_COOKIE["valid_user"])) {
// show content
} else {
header("whereyouwannago.php");
}
?>

 

whereyouwannago.php

 

<?php
setcookie( /* set whatever */ );
header("whereyoustarted.php");
?>

 

From that point the content will be showed. Until the user deletes the cookie, and you can choose to destroy the cookie within a specific time frame, etc.., plenty of possiblities.

 

I don't have much time, and I'm not exactly sure what you want to do, but that's the most basic layout for this type of activity.

 

And I don't want your money, go learn though. This stuff is pretty simple.  ;)

Link to comment
Share on other sites

whereyoustarted.php

 

<?php
if (isset($_COOKIE["valid_user"])) {
// show content
} else {
header("whereyouwannago.php");
}
?>

 

whereyouwannago.php

 

<?php
setcookie( /* set whatever */ );
header("whereyoustarted.php");
?>

 

From that point the content will be showed. Until the user deletes the cookie, and you can choose to destroy the cookie within a specific time frame, etc.., plenty of possiblities.

 

I don't have much time, and I'm not exactly sure what you want to do, but that's the most basic layout for this type of activity.

 

And I don't want your money, go learn though. This stuff is pretty simple.  ;)

 

err...

 

<?php

if (isset($_COOKIE["valid_user"])) {

// show content

} else {

header("Termsofservice.php");

}

?>

<?php
setcookie( /* set whatever */ );
header("www.vbprogramming.org");
?>

wtf. is that right? gah this is so fking confusing. so i save this as ToS.php and thats it? is this coding right?

Link to comment
Share on other sites

This will be my last post, I'm going out for a bit.

 

Here is what you need to do

 

set values for the cookie

 

setcookie(name,value,expire,path,domain,secure)

 

<?php
$value = "cookie value";
// cookie that expires in 24 hours
setcookie("valid_user",$value, time()+3600*24);
?>

 

<?php
// Print cookie
echo $_COOKIE["valid_user"];
echo "<br />";
echo $HTTP_COOKIE_VARS["valid_user"];
echo "<br />";

print_r($_COOKIE);
?>

 

wrote this pretty quickly, so might include some type of syntax errors, but maybe another user will be able to help you.

 

Sorry I couldn't do more, if you're still having trouble when I get back I can try to help, otherwise, good luck.  ;)

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.