Jump to content

tomm098

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tomm098's Achievements

Member

Member (2/5)

0

Reputation

  1. <?php require_once ('Controllers/Registration.php');?> <?php require_once('../Connections/test.php'); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_MovieHeader = "-1"; if (isset($_GET['Title'])) { $colname_MovieHeader = $_GET['Title']; } mysql_select_db($database_test, $test); $query_MovieHeader = sprintf("SELECT * FROM Movie WHERE Tags LIKE %s ORDER BY Title ASC", GetSQLValueString("%" . $colname_MovieHeader . "%", "text")); $MovieHeader = mysql_query($query_MovieHeader, $test) or die(mysql_error()); $row_MovieHeader = mysql_fetch_assoc($MovieHeader); $totalRows_MovieHeader = mysql_num_rows($MovieHeader); $colname_MusicBody = "-1"; if (isset($_GET['Title'])) { $colname_MusicBody = $_GET['Title']; } mysql_select_db($database_test, $test); $query_MusicBody = sprintf("SELECT * FROM Music WHERE Movie = %s ORDER BY `Time` ASC", GetSQLValueString($colname_MusicBody, "text")); $MusicBody = mysql_query($query_MusicBody, $test) or die(mysql_error()); $row_MusicBody = mysql_fetch_assoc($MusicBody); $totalRows_MusicBody = mysql_num_rows($MusicBody); $colname_SearchComposer = "-1"; if (isset($_GET['Composer'])) { $colname_SearchComposer = $_GET['Composer']; } mysql_select_db($database_test, $test); $query_SearchComposer = sprintf("SELECT Composer FROM Movie WHERE Composer LIKE %s ORDER BY Composer ASC", GetSQLValueString("%" . $colname_SearchComposer . "%", "text")); $SearchComposer = mysql_query($query_SearchComposer, $test) or die(mysql_error()); $row_SearchComposer = mysql_fetch_assoc($SearchComposer); $totalRows_SearchComposer = mysql_num_rows($SearchComposer); mysql_select_db($database_test, $test); $query_User = "SELECT * FROM Users"; $User = mysql_query($query_User, $test) or die(mysql_error()); $row_User = mysql_fetch_assoc($User); $totalRows_User = mysql_num_rows($User); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/mainpages.dwt.php" codeOutsideHTMLIsLocked="false" --> <head><link rel="alternate" type="application/rss+xml" title="latest scribed." href="feed://www.what-song.com/RSSfeeds/latest.rss" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>what-song | Registration</title> <!--<SCRIPT LANGUAGE="JavaScript" SRC="js/Registration.js"></script>--> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="../thrColElsHdr.css" rel="stylesheet" type="text/css" /> <!--[if IE]> <style type="text/css"> /* place css fixes for all versions of IE in this conditional comment */ .thrColElsHdr #sidebar1, .thrColElsHdr #sidebar2 { padding-top: 30px; } .thrColElsHdr #mainContent { zoom: 1; padding-top: 15px; } /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ </style> <![endif]--> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <!-- InstanceParam name="OptionalRegion1" type="boolean" value="true" --> <link href="../movielink.css" rel="stylesheet" type="text/css" /></head> <body class="thrColElsHdr" onload="MM_preloadImages('../images/feediconrollover.gif','../images/facebook_button_11rollover.gif','../images/Twitter_buttonrollover.gif','../images/delicious-iconrollover.jpg')"> <div id="container"> <div id="header"> <table width="1016" height="81" border="0" cellpadding="5" cellspacing="10"> <tr> <td width="500" height="61"><a href="../index.php"><img src="../images/Buttons.Headers/images/logoheader_03.gif" alt="whatsong... find songs you heard in movies." name="whatsong" width="500" height="51" border="0" id="whatsong" /></a></td> <td width="55"> </td> <td width="202" class="loginlinks"><span class="style21"><?php if($_SESSION['Username'] || $_COOKIE['Username']) { //user is logged in echo ($_COOKIE['Username'])."<br /".("<a href=\"/logreg/Logout.php\">logout.</a>"); } else { //user is not logged in echo "<a href=\"/logreg/Login.php\">login. </a>"."<br />"."<a href=\"/logreg/Registration.php\">register.</a>"; } ?></span> </td> <td width="169"><a href="../RSSfeeds/latest.rss" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('RSS','','../images/feediconrollover.gif',1)"><img src="../images/feedicon.gif" alt="feed." name="RSS" width="38" height="38" border="0" id="RSS" /></a><a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('delicious','','../images/delicious-iconrollover.jpg',1)"><img src="../images/delicious-icon.jpg" alt="delicious." name="delicious" width="40" height="40" border="0" id="delicious" /></a><a href="http://twitter.com/what_song" target="_blank" onmouseover="MM_swapImage('Twitter','','../images/Twitter_buttonrollover.gif',1)" onmouseout="MM_swapImgRestore()"><img src="../images/Twitter_button.gif" alt="twiiter." name="Twitter" width="40" height="40" border="0" id="Twitter" /></a><a href="http://www.facebook.com/pages/What-Song/251368075323?ref=ts" target="_blank" onmouseover="MM_swapImage('Facebook','','../images/facebook_button_11rollover.gif',1)" onmouseout="MM_swapImgRestore()"><img src="../images/facebook_button_11.gif" alt="facebook." name="Facebook" width="40" height="40" border="0" id="Facebook" /></a></td> </tr> </table> <div id="navmenu"> <ul> <li><strong><a href="../index.php">home.</a></strong></li> <li><strong><a href="../browse.php?Title=">browse.</a></strong></li> <li><a href="../requests.php"><strong>requests.</strong></a></li> <li><a href="../questions.php"><strong>questions.</strong></a></li> <li><strong><a href="../top10.php">top 10.</a></strong></li> <li><strong><a href="../count.php">count.</a></strong></li> </ul> </div> </div> <div id="sidebar1"> <p align="center"><img src="../images/Buttons.Headers/images/images/Untitled-11_02.gif" alt="latest." width="146" height="60" /></p> <table width="186" height="220" border="0" align="center" cellpadding="4"> <tr> <td><a href="http://www.what-song.com/movie/title.php?Title=Whip%20It"><img src="../images/Posters/whip-it-poster.jpg" alt="Whip It" width="80" height="120" border="0" /></a></td> <td><a href="http://www.what-song.com/movie/title.php?Title=Fantastic%20Mr.%20Fox"><img src="../images/Posters/fantastic_mr_fox_poster2.jpg" alt="Fantastic Mr. Fox" width="80" height="120" border="0" /></a></td> </tr> <tr> <td><a href="http://www.what-song.com/movie/title.php?Title=Where%20the%20Wild%20Things%20Are"><img src="../images/Posters/where-the-wild-things-are-poster.jpg" alt="Where the Wild Things Are" width="80" height="120" border="0" /></a></td> <td><a href="http://www.what-song.com/movie/title.php?Title=Up In the Air"><img src="../images/Posters/upintheair.jpg" alt="Up in the Air" width="80" height="120" border="0" /></a></td> </tr> <tr> <td><a href="http://www.what-song.com/movie/title.php?Title=Sorority%20Row"><img src="../images/Posters/sorority-row-poster.jpg" alt="Sorority Row" width="80" height="120" border="0" /></a></td> <td><a href="http://www.what-song.com/movie/title.php?Title=Zombieland"><img src="../images/Posters/Zombieland.gif" alt="zombieland." width="81" height="120" border="0" /></a></td> </tr> <tr> <td width="81"><a href="http://www.what-song.com/movie/title.php?Title=Jennifer%27s%20Body"><img src="../images/Home Images/jennifersbody.jpg" alt="Jennifer's Body" width="80" height="120" border="0" /></a></td> <td width="83"><a href="http://www.what-song.com/movie/title.php?Title=500 Days of Summer"><img src="../images/Home Images/500daysofsummer_l200904301554.jpg" alt="500 Days of Summer" width="81" height="120" border="0" /></a></td> </tr> <tr> <td><a href="http://what-song.com/movie/title.php?Title=Inglourious%20Basterds"><img src="../images/Home Page/Original/InglouriousBasterds.jpg" alt="Inglourious Basterds" width="82" height="120" border="0" /></a></td> <td><a href="http://what-song.com/movie/title.php?Title=Adventureland"><img src="../images/Home Images/adventureland.jpg" alt="Adventureland" width="81" height="120" border="0" /></a></td> </tr> <tr> <td><a href="../movie/title.php?Title=I Love You, Man"><img src="../images/15th July 2009/i love you man.jpg" alt="I Love You, Man" width="80" height="120" border="0" /></a></td> <td><a href="../movie/title.php?Title=Hangover, The"><img src="../images/15th July 2009/hangover.jpg" alt="The Hangover" width="80" height="121" border="0" /></a></td> </tr> </table> <p class="movielink"> </p> <p align="center" class="style6"> </p> <p align="left" class="style22 style21"> </p> </div> <div id="sidebar2"> <p align="center"><img src="../images/images/words/search.gif" width="143" height="55" alt="search." /></p> <table width="200" border="0" align="center"> <tr> <td height="64" align="center" valign="top"><form id="form1" name="form1" method="get" action="../movie/resultsmovie.php"> <input name="textfield" type="text" id="textfield" /> <input type="submit" name="button" id="button" value="Search Movie" /> </form> <form id="form2" name="form2" method="get" action="../movie/resultscomposer.php"> <p> <input name="Composer" type="text" id="Composer" /> <input type="submit" name="Button2" id="Button2" value="Search Composer" /> </p> </form> <form id="form3" name="form2" method="get" action="../movie/resultsartist.php"> <p> <input name="Artist" type="text" id="Artist" /> <input type="submit" name="Button" id="Button" value="Search Artist" /> </p> </form> <form id="form4" name="form2" method="get" action="../movie/resultssong.php"> <p> <input name="Song" type="text" id="Song" /> <input type="submit" name="Button3" id="Button3" value="Search Song" /> </p> </form> <p></p> <p></p></td> </tr> </table> <!-- InstanceBeginEditable name="SoundtrackRegion" --> <p> </p> <p> </p> <!-- InstanceEndEditable --></div> <div id="mainContent"><!-- InstanceBeginEditable name="EditRegion10" --> <p>Registration <span class="answer">(only adds users in firefox, we are fixing this issue now)</span></p> <form id="frm" name="frm" method="post"> <table cellspacing="0" cellpadding="0" width="100%" class="Form" border="0" > <tr height="30" class="row"> <td class="answer">User Name:</td> <td><input type="text" id="txt_UserName" name="txt_UserName" value="<?php echo $txt_UserName?>" maxlength="20" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Password:</td> <td><input type="password" id="txt_Password" name="txt_Password" value="" maxlength="20" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Confirm Password:</td> <td><input type="password" id="txt_ConfirmPassword" name="txt_ConfirmPassword" value="" maxlength="20" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Email:</td> <td><input type="text" id="txt_Email" name="txt_Email" value="<?php echo $txt_Email ?>" maxlength="50" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Sex:</td> <td><select id="txt_Sex" name="txt_Sex" /><option value="Male">Male</option><option value="Female" <?php if($txt_Sex == 'Female') echo 'selected' ?> >Female</option></td> </tr> <tr height="30" class="row"> <td class="answer">Birth Year:</td> <td><input type="text" id="txt_BirthYear" name="txt_BirthYear" value="<?php echo $txt_BirthYear ?>" maxlength="4" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Country:</td> <td><input type="text" id="txt_Country" name="txt_Country" value="<?php echo $txt_Country ?>" maxlength="50" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Favorite Artist:</td> <td><input type="text" id="txt_FavoriteArtist" name="txt_FavoriteArtist" value="<?php echo $txt_FavoriteArtist ?>" maxlength="50" size="30"/></td> </tr> <tr height="30" class="row"> <td class="answer">Favorite Movie:</td> <td><input type="text" id="txt_FavoriteMovie" name="txt_FavoriteMovie" value="<?php echo $txt_FavoriteMovie ?>" maxlength="50" size="30"/></td> </tr> <tr align="center" class="answer"> <td colspan="100%"><?php echo recaptcha_get_html($publickey, $error);?></td> </tr> <tr class="answer"> <td colspan="100%"> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr height="30"> <td align="center"> <input type="button" id="btn_Cancel" name="btn_Cancel" onClick="javascript:document.location.href = 'Home.php';" value="Cancel"/> </td> <td align="center"> <input type="Submit" id="btn_Register" name="btn_Register" onClick="javascript:return ValidateForm();" value="Save"/> </td> </tr> </table> </td> </tr> </table> </form> <tr> <div class="BoxFooter"><span class="Error"><?php echo $Error ?></span></div> </p> <p> </p> <!-- InstanceEndEditable --> <p align="center" class="style13"> </p> <p class="style11"> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/whatsong09.json?callback=twitterCallback2&count=6"></script></p> <blockquote> <p class="style6"> </p> <p class="style6"> </p> <p class="style6"> </p> <p class="style6"> </p> </blockquote> <p> </p> <h2> </h2> <!-- end #mainContent --></div> <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" /> <div id="footer"> <table width="916" border="0" align="center" bgcolor="#336699" class="bottombanner"> <tr> <td width="307"> </td> <td width="40"> </td> <td width="83"><a href="../donate.php">Donate</a></td> <td width="93"><a href="../links.php">Links</a></td> <td width="133"><a href="../privacypolicy.php">Privacy Policy</a></td> <td width="111"><a href="../contact.php">Contact Us</a></td> <td width="119"><a href="../about.php">About Us</a></td> </tr> </table> <span class="style6"> 'what-song' is proudly hosted by <a href="http://www.BlueHost.Com/track/whatsong">bluehost</a> unlimited pages, traffic and space for $6.95/month<br /> </span> <div align="right"> <!-- end #footer --> </div> </div> <!-- end #container --></div> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=4533940; var sc_invisible=1; var sc_partition=34; var sc_click_stat=1; var sc_security="fc9673b4"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script> <noscript><div class="statcounter"></div></noscript> <!-- End of StatCounter Code --> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-8107331-1"); pageTracker._trackPageview(); } catch(err) {}</script> </body> <!-- InstanceEnd --></html> <?php mysql_free_result($MovieHeader); mysql_free_result($MusicBody); mysql_free_result($SearchComposer); mysql_free_result($User); ?>
  2. Hey all. I have a problem with my registration page. It doesn't work in safari for some reason, but works fine in firefox? I've been searching through the code for days looking for something, but I can't find it. Is it something simple? This is the link to the page http://www.what-song.com/logreg/Registration.php The information is not submitted into my database when using safari, but is inserted when using firefox??? Any help would be appreciated.
  3. I dont think i have a script. but this is what was returned Array ( [__utma] => 213566930.929732667496323600.1250559715.1273507737.1273513206.669 [__utmb] => 213566930.12.10.1273513206 [__utmc] => 213566930 [__utmz] => 213566930.1272378641.588.9.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=the boat that rocked song [userId] => 59 [username] => tomm098 [_csuid] => 4a36424d10dbcd31 [phpSESSID] => gcjcbqlbjlo8vmfjnueeqlgf17 [user] => MM_Username )
  4. Hmm I get the same error. Is there a way to make that link a variable. then simply write the variable into the PHP?
  5. This is my entire code, but im fairly sure its the link that is the problem because it works fine until i replace the first echo. I'm trying to replace the "($_COOKIE['Username']) after //user is logged in. with the first <a href link <p><a href="userstats.php?User=<?php echo ($_COOKIE ['Username']) ?>"><?php echo ($_COOKIE['Username']) ?></a></p> <p> <?php if($_SESSION['Username'] || $_COOKIE['Username']) { //user is logged in echo ($_COOKIE['Username'])."<br /"."<a href=\"Logout.php\">Logout</a>"; } else { //user is not logged in echo "<a href=\"/logreg/Login.php\">Login</a>"."<br />"."<a href=\"/logreg/Registration.php\">Register</a>"; } ?>
  6. Yer. sorry. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home2/whatsong/public_html/test.php on line 246
  7. Hey all I have a problem with echoing a PHP dynamic link. This is the link i need to echo. It works fine as a HTML link but as soon as i put it in the PHP echo code it stuffs up. I think it needs a different syntax or something. <a href="userstats.php?User=<?php echo ($_COOKIE ['Username']) ?>"><?php echo ($_COOKIE['Username']) ?></a> I must PHP echo it like so: <?php echo "THE LINK ABOVE" any help would be greatly appreciated.. thanks
  8. Is this what you mean if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; }
  9. Hey everyone. I'm having a slight problem with a Question Answer forum which is stored in a mySQL database. I have two seperate tables, one for Questions, one for Answers. Each Question has a unique ID. When someone answers a question it is assigned that Questions ID. All that is fine.. But I cannot get the answers to appear below the corresponding Questions. The insert record works fine and they have the same ID's but will the answers will not display because they are from different tables I think. The answers have a recordset filter with a form variable. I think if i can set a form variable to the Question ID's they will show up. But im not sure how to do that? Here is the form <form id="form6" name="form6" method="POST" action="<?php echo $editFormAction; ?>"> <p><span class="question"><?php echo $row_QA['Question']; ?></span><br /> <span class="answer"><?php echo $row_Answer['Answer']; ?></span> </p> <p> <input name="Answer" type="text" id="Answer" value="add your own answer" /> <input name="QuestionID" type="text" id="QuestionID" value="<?php echo $row_QA['ID']; ?>"/> <input name="User" type="hidden" id="User" value="tomm098" /> <input type="hidden" name="MM_insert" value="form6" /> <input type="submit" name="Submit" id="Submit" value="Submit" /> </p> </form> Here is the insert record PHP <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form6")) { $insertSQL = sprintf("INSERT INTO Answers (QuestionID, Answer, `User`) VALUES (%s, %s, %s)", GetSQLValueString($_POST['QuestionID'], "int"), GetSQLValueString($_POST['Answer'], "text"), GetSQLValueString($_POST['User'], "text")); mysql_select_db($database_test, $test); $Result1 = mysql_query($insertSQL, $test) or die(mysql_error()); } ?> and here is the recordset for the Answers filter $colname_Answers = "-1"; if (isset($_POST['QuestionID'])) { $colname_Answers = $_POST['QuestionID']; } mysql_select_db($database_test, $test); $query_Answers = sprintf("SELECT Answer, `User` FROM Answers WHERE QuestionID = %s", GetSQLValueString($colname_Answers, "int")); $Answers = mysql_query($query_Answers, $test) or die(mysql_error()); $row_Answers = mysql_fetch_assoc($Answers); $totalRows_Answers = mysql_num_rows($Answers); ?> Hopefully I have been clear enough. Thanks a lot
  10. Ok. I have no idea about SESSION or COOKIES. would it better if i validated the login with a SESSION but set a COOKIE at the same time?
  11. Just wondering how I go about setting cookies from a user login. I need a username and password cookie to be set when a user logs in, and at the same time validate the username and password is correct. Can anyone tell me how to write the code? I'm not even sure what below is right.. Thanks a lot.. setcookie('Username', $_POST['Username'], time()+60*60*24*365); setcookie('Password', $_POST['Password'], time()+60*60*24*365);
  12. Hey all. I currently have SESSION implemented in my site and would like it to set cookies when someone logs in. Does anyone know what to write in my validation PHP. Here is the code. <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['Username'])) { $loginUsername=$_POST['Username']; $password=$_POST['Password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "loginsuccesful.php"; $MM_redirectLoginFailed = "loginfailed.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_test, $test); $LoginRS__query=sprintf("SELECT Username, Password FROM Users WHERE Username=%s AND Password=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $test) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?>
  13. Do you know how I would go about doing that? I'm not sure where to even start using cookies?
  14. Hey, I have this $_SESSION code, across all my pages, however I was wondering how to make it so the browser remembers the user, and they do not have to login everytime they come back to my website. Just like how you are always logged into this site. Here is my PHP code: <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "../index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?>
  15. Hey, sorry about that. This is the code that updates the form. There are 7 fields there but you can ignore the other 4 of them. $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form5")) { $updateSQL = sprintf("UPDATE Music SET Title=%s, Artist=%s, Movie=%s, `Time`=%s, `Scene Description`=%s, `User`=%s WHERE ID=%s", GetSQLValueString($_POST['Title'], "text"), GetSQLValueString($_POST['Artist2'], "text"), GetSQLValueString($_POST['Movie'], "text"), GetSQLValueString($_POST['Time'], "text"), GetSQLValueString($_POST['Scene'], "text"), GetSQLValueString($_POST['User'], "text"), GetSQLValueString($_POST['ID'], "int")); mysql_select_db($database_test, $test); $Result1 = mysql_query($updateSQL, $test) or die(mysql_error()); }
×
×
  • 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.