jnerotrix Posted December 6, 2008 Share Posted December 6, 2008 Im building a survey site and i want it so for just a users session (I have a login system) but when that user clicks on a link it goes to the link but it dissapears (or appears to dissapear) to the user that has clicked the link is This possible Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 I'm sorry, I don't really understand? What link? How does it disappear? Do you have any code for us? Do you have any errors? Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 i dont know how to develop this code :sorry: its kinda confusing to explain Ok theres a page with a list of surveys and it would look like this: ---------------------- <a href="#">Survey 1 </a> <a href="#">Survey 2 </a> <a href="#">Survey 3 </a> <a href="#">Survey 4 </a> <a href="#">Survey 5 </a> -------------- I want it so if say the user click Survey 1 it would take them to that page but when they go back it wont display Survey 1 anymore because the user has already clicked it can this be done with a code or can i use mysql to display links or something Thanks, Jnerotrix Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 Does this make any more sense Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 It can be done, but there;s a lot of code for someone who seem to have a huge knowledge of php. I don't think anyone is going to write the code for you. Did you build your user login system yourself? If so we can probably start from there! Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 yea but i cheated i took bits and pieces of other people codes and just put them together the login system is fully functional -------------------- Files with my login system login.php main.php (default after login page) I changed it to index.php though process.php (logout) register.php userinfo.php ( is a very simple public profile ) useredit.php ( user can edit their email & Password) Directory: (admin) admin.php (main admin page) (1st registered user is admin u can also set other admins in admin panel *ban users *Delete Users that have been inactive for (Certain Number of Days) adminprocess.php (process all the admin.php forms) then for the Mysql Stuff Directory : Folder is "include" constants.php database.php form.php mailer.php session.php (you include this file on all the pages you want the user session) view_acrive.php (this shows active members and guests viewing site) Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 Ok, first make a new page where you're going to list all your surveys, make sure this is protected (can only be seen when logged in). For now you can list the surveys in html, we'll change that later Quote Link to comment Share on other sites More sharing options...
.josh Posted December 6, 2008 Share Posted December 6, 2008 Are you wanting the links to permanently be hidden for the user once he takes the survey, or just for that login session, as in, he can log out and log back in and it be available again? Or maybe it will be available again tomorrow or next week or something? Part of getting help is being specific with what you want. Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 well actually i have already done this with user sessions on the main index page Heres the index page code: If user is logged in it shows surveys else displays main login page (Permanantly Hidden) <? include("include/session.php"); ?> <html> <head> <style> .shakeimage{ position:relative } </style> <script language="JavaScript1.2"> /* Shake image script (onMouseover)- © Dynamic Drive (www.dynamicdrive.com) For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com */ //configure shake degree (where larger # equals greater shake) var rector=3 ///////DONE EDITTING/////////// var stopit=0 var a=1 function init(which){ stopit=0 shake=which shake.style.left=0 shake.style.top=0 } function rattleimage(){ if ((!document.all&&!document.getElementById)||stopit==1) return if (a==1){ shake.style.top=parseInt(shake.style.top)+rector } else if (a==2){ shake.style.left=parseInt(shake.style.left)+rector } else if (a==3){ shake.style.top=parseInt(shake.style.top)-rector } else{ shake.style.left=parseInt(shake.style.left)-rector } if (a<4) a++ else a=1 setTimeout("rattleimage()",50) } function stoprattle(which){ stopit=1 which.style.left=0 which.style.top=0 } </script> </head> <title> EpicBux Survey Site </title> <body> <center> <?php if($session->logged_in){ ?> <img src="./logo.gif"><br> <a href="./index.php"><img src="./images/btn-home.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./login.php"><img src="./images/btn-login.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./advertise.php"><img src="./images/btn-ad.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./register.php"><img src="./images/btn-signup.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a><br> <img src="./bgimage.gif"> <? } else { ?> <img src="./logo.gif"><br> <a href="./index.php"><img src="./images/btn-home.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./advertise.php"><img src="./images/btn-ad.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./process.php"><img src="./images/btn-logout.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a><br> <table height="440" width="873" border="1"> <table height="400" width="800" bgcolor="green" align="center"> <tr> <td> Welcome<?php echo "$session->username"; ?></td> </tr> <tr> <td> EpicBux is aGreat New Survey Site Where you can make money easily online by filling out some simple forms and givind friend refferals links </td> </tr> </table> <tr> <td><h1> Surveys Available </h1></td> </tr> <tr> <td> <a href="#"> Survey Dec-1 = $0.80 </a></td> </tr> <tr> <td> <a href="#"> Survey Dec-2 = $0.80 </a></td> </tr> </table> <? } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 At the moment your surveys show when the user is logged out (or at least that's how it looks) You need to sort that code out, if the user is logged in they just see a nav, if they're not logged in they see the same nav, and the surveys, as well as attempting to display a username. Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 Sorry i always write it backwards now its fixed <? include("include/session.php"); ?> <html> <head> <style> .shakeimage{ position:relative } </style> <script language="JavaScript1.2"> /* Shake image script (onMouseover)- © Dynamic Drive (www.dynamicdrive.com) For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com */ //configure shake degree (where larger # equals greater shake) var rector=3 ///////DONE EDITTING/////////// var stopit=0 var a=1 function init(which){ stopit=0 shake=which shake.style.left=0 shake.style.top=0 } function rattleimage(){ if ((!document.all&&!document.getElementById)||stopit==1) return if (a==1){ shake.style.top=parseInt(shake.style.top)+rector } else if (a==2){ shake.style.left=parseInt(shake.style.left)+rector } else if (a==3){ shake.style.top=parseInt(shake.style.top)-rector } else{ shake.style.left=parseInt(shake.style.left)-rector } if (a<4) a++ else a=1 setTimeout("rattleimage()",50) } function stoprattle(which){ stopit=1 which.style.left=0 which.style.top=0 } </script> </head> <title> EpicBux Survey Site </title> <body> <center> <?php if($session->logged_in){ ?> <img src="./logo.gif"><br> <a href="./index.php"><img src="./images/btn-home.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./advertise.php"><img src="./images/btn-ad.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./process.php"><img src="./images/btn-logout.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a><br> <table height="440" width="873" border="1"> <table height="400" width="800" bgcolor="green" align="center"> <tr> <td> Welcome<?php echo "$session->username"; ?></td> </tr> <tr> <td> EpicBux is aGreat New Survey Site Where you can make money easily online by filling out some simple forms and givind friend refferals links </td> </tr> </table> <tr> <td><h1> Surveys Available </h1></td> </tr> <tr> <td> <a href="#"> Survey Dec-1 = $0.80 </a></td> </tr> <tr> <td> <a href="#"> Survey Dec-2 = $0.80 </a></td> </tr> </table> <? } else { ?> <img src="./logo.gif"><br> <a href="./index.php"><img src="./images/btn-home.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./login.php"><img src="./images/btn-login.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./advertise.php"><img src="./images/btn-ad.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a> <a href="./register.php"><img src="./images/btn-signup.gif" border="0" class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()" onClick="top.focus()"></a><br> <img src="./bgimage.gif"> <? } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 Make sure you use full tags <?php not <? when opening Next you're going to need to make a new table in your database. Are you going to be adding surveys over time? Or will there be a set amount? The answer to this will be the difference between needing 1 or 2 tables. Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 i will add more surveys over time yes and i will fix the <? to <?php Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 OK, first table CREATE TABLE `test`.`surveys` ( `id` INT NOT NULL AUTO_INCREMENT , `title` VARCHAR( 32 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = MYISAM second table CREATE TABLE `test`.`completed_surveys` ( `member_id` INT NOT NULL , `survey_id` INT NOT NULL ) ENGINE = MYISAM Have a look at the tables once their made and see if they make sense to you!? Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 am i supposed to replace test Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 ok i have added the tables Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 sorry, yes you are Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 what do i do next i have added the tables Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 The easiest option I think will be to manually add your new surveys to the first table, It seems like more effort than necessary to make an area for you to add them!! So go into phpMyAdmin and go the surveys table Input a line, leave id blank and write in the title of your first survey (do this for all your surveys) Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 the surveys are going to be html links like this <a href="#">Survey 1</a> Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 Yes I know, what you need to do is add them to your table, leave id blank and write in the title field Survey 1, keep going for all your surveys Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 i cant get into my phpmy admin keeps saying Server too busy, try again later Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 Unfortunately we're going to have to wait until you can do that, unless you want to write a php script to do it? Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 I wrote one this should work right? <?php include("include/session.php"); ?> <?php if (isset($_POST['action'])) { mysql_connect("localhost", "USER", "PASS") or die(mysql_error()); mysql_select_db("sex1800_loginbux") or die(mysql_error()); mysql_query("INSERT INTO title (title) VALUES('$title') ") or die(mysql_error()); echo "Survey Added!"; } ?> <html> <head> </head> <title> Add a Survey </title> <center> <?php if($session->isAdmin()){ ?> <table border="1"> <tr> <td>Survey Title: <input type="text" name="title"></td> </tr> <tr> <td><input type="submit" value="Add Survey"></td> <input type='hidden' name='submitted' value='yes'> </tr> </form> </table> <?php } else { echo 'You Must Be An Administrator to add a Survey'; } ?> Quote Link to comment Share on other sites More sharing options...
jnerotrix Posted December 6, 2008 Author Share Posted December 6, 2008 i forgot to define title i fixed it: <?php include("include/session.php"); $self = $_SERVER['PHP_SELF']; ?> <?php if (isset($_POST['action'])) { $title = $_POST['title']; mysql_connect("localhost", "sex1800_admin", "----------") or die(mysql_error()); mysql_select_db("sex1800_loginbux") or die(mysql_error()); mysql_query("INSERT INTO title (title) VALUES('$title') ") or die(mysql_error()); echo "Survey Added!"; } ?> <html> <head> </head> <title> Add a Survey </title> <center> <?php if($session->isAdmin()){ ?> <table border="1"> <form action="$self" method="post"> <tr> <td>Survey Title: <input type="text" name="title"></td> </tr> <tr> <td><input type="submit" value="Add Survey"></td> <input type='hidden' name='submitted' value='yes'> </tr> </form> </table> <?php } else { echo 'You Must Be An Administrator to add a Survey'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.