Jump to content

aussiefly

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by aussiefly

  1. thanks mate that worked brilliantly....cant beleive i forgot the set cheers
  2. yup you guys are totally correct...dont know whay i was trying to insert those details rather than update Anyway, even with update it throws an sql syntax error...this seems to happen when im trying to insert multiple values in my query...anyone know where im going wrong ???
  3. Hey everyone! I've got a query that im running to stick multiple values into a table ina mysql database. $schedule_insert ="INSERT INTO `days` (monday, tuesday, wednesday, thursday, friday, saturday, sunday) VALUES ('$monday','$tuesday','$wednesday','$thursday','$friday','$saturday','$sunday') WHERE userid = $_SESSION[id]"; $schedule_update = mysql_query($schedule_insert); Now is that the best way to do it and will it work fine??? I've been using the query without the `WHERE` conditional and it works...im just wondering if ive got the WHERE conditional in the right spot. Any ideas
  4. awesome! That did the trick perfectly! Thanks for the help aussie
  5. hi guys, i'm putting together a little referrer script for my site and I was just wondering if there is some simply way to 'grab' the variables listed in a URL. So for instance if a client was sending people to www.somerandomURL.com?refer=101 is there a way that when a new member then registers i can grab that account no out of the URL and store it in a variable for later use??
  6. Thanks everyone...i managed to get there with your help. cheers aussie
  7. hey guys, for some reason im getting a funny return from this query: $query = mysql_query("SELECT `balance` FROM `members` WHERE userid = '415'"); echo $query; now it just keeps echoing Resource #6. So I thought it was obviously a problem with my query...but when i go and run the query in phpmyadmin it brings up the result no problems. Its freaking driving me nuts...ive been screwing with it for 2 hrs now. Anyone know why ???
  8. I managed to work around the problem and solved the cockup in my awfull code lol Thanks everyone
  9. ok this is my first go at php pagination and its working.....sort of Here is the guts of my pagination and query code (ive still got things to change like the count rather than just selecting all rows etc). // check to see if page number is set and if not set it. if(isset($_GET[’pagenum’])) { $pagenum = $_GET[’pagenum’]; } else { $pagenum = 1; } //Here we count the number of results //Edit $data to be your query $data = mysql_query("SELECT * FROM `transactions` where `user_id` = $_SESSION[userid]") or die(mysql_error()); $rows_count = mysql_num_rows($data); //This is the number of results displayed per page $page_rows = 6; //This tells us the page number of our last page $last = ceil($rows_count/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //This sets the range to display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; // query transactions database for user history $trans_query = "SELECT * FROM `transactions` where `user_id` = $_SESSION[userid] $max"; $trans_result = mysql_query($trans_query); php?> <h1> User Account History </h1><table cellpadding="10" border="1" rules="rows" frame="void"> <tr> <td>Trans #</td><td>Date</td><td>Liberty #</td><td>Amount</td><td>Type</td><td>Status</td></tr> <?php while ($row = mysql_fetch_assoc($trans_result)) { php?> <tr> <td><?php echo $row['trans_id']; php?></td> <td><?php echo $row['date']; php?></td> <td><?php echo $row['liberty_acc']; php?></td> <td><?php echo $row['amount']; php?></td> <td><?php echo $row['type']; php?></td> <td><?php echo $row['status']; php?></td> </tr> <?php } // end loop php?> </table> <?PHP // This shows the user what page they are on, and the total number of pages echo " --Page $pagenum of $last-- <p>"; // First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page. if ($pagenum == 1) { } else { echo " <a href='history1.php?pagenum=1'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='history1.php?pagenum=$previous'> <-Previous</a> "; } //just a spacer echo " ---- "; //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='history1.php?pagenum=$next'>Next -></a> "; echo " "; echo " <a href='history1.php?pagenum=$last'>Last ->></a> "; } php?> The problem is that it seems to display the results fine...but when i go to click next page etc...nothing happens and it just sits there. The problem is clearly somewhere in the updating of the $max variable which is actually the limit....it doesnt seem to be updating from what i can see...and i just cant see what to fix. Any ideas p.s im really going to have to donate to the site after all the time you guys have been putting into helping me learn some scripting. Cheers
  10. ahhh thats it...now i'm getting it!!! Thanks guys...this place is an awesome resource...btw i looked up print_r in the php manual and me using it was why it was printing out all the extra data cheers again aussie
  11. actually the clearer questions is....is there a way to display the assoc array without it listing the database field or row tags? so that it would just print out the actual field data ???
  12. Ok that seems to work really well without having to specify the databse fields It's displaying: Array ( [trans_id] => 22 [user_id] => 415 [amount] => 125.00 [acc] => 2456743 [type] => withdrawal [date] => Sun, 24 Feb 2008 21:32:43 -0600 [status] => pending ) Any idea how I can format that to look good and without the [] => symbols etc? Thanks again aussie
  13. hey guys, I'm still coming to grips with some fo the php basics and although I have queries down and am able to grab details from the database...i need some help on grabbing multiple data. So say I have a transaction table with data in it...lets say 7 different fields etc and I want to select whole rows when it relates to my userid and then display it how would i go about it? $normal_query = "SELECT * FROM `transactions` where `user_id` = '415'"; $result = mysql_fetch_array($normal_query); php?> <?php echo $result; php?> So pretty much I want to see al the transactions from a specific user etc and then display them on a page...Now I was sticking it into an array but how then do i display it all without having to name each field from the table??? Any ideas for a complete newb ???
  14. Thanks everyone. I managed to get around it and get the script to work. I apologise for all my newbyness
  15. yup i've tried all of those solutions and im still getting a syntax error when i click the submit. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(email, password, phone) VALUES (randomemail@email.com,'c5dedfe8df822a7d3d9103' at line 1 any ideas why i suck at SQL
  16. Hi everyone! I am getting a mysql syntax error when I stick this query in my script. $insert ="UPDATE `members` SET (email, password, phone) VALUES ('$_POST[email]','.md5($_POST[password]).','.$_POST[phone]') WHERE `members`.`email` = $_SESSION[email]"; Its probably a bit of a sloppy query...i'm updating some user settings via a form. any idea what i'm missing??? Ity's the first time I've tried to update multiple fields etc.
  17. ok i fixed it...appears it was a stupid error on my part....where you place the session start seems to make a difference. thanks for all the advice everyone
  18. yup when they are logged in on the members section and click a regular link to settings.php which is in the same dir...the session variables appear to be empty. It truly is quite weird....i even have the session start on the new page and everthing in place...but they just appear to not have any values entered
  19. Hi everyone! This is probably a simple fix but because im a newb and still learning its beyond me a bit. I'm currently working on a script that involves members logging in and members areas etc. So i'm clearly using sessions to store user variables and data etc. Now from my main users homepage there is a link to go to a script to change their details like email address etc....lets call it settings.php So they are on members.php and then click a standard href html link to go to settings.php to update their user details. Problem is that when I try to access the session variables on the settings.php page....they are blank...ive tried echoing them out and seeing what comes up and they are empty objects etc...i dont get any errors but they are empty. So i did a bit of reading and found that the settings.php is considered to be a seperate application and therefore the session would be a new unique session and not be able to read the variables from the prior script...members.php So my question is...how do i forward my users to settings.php and get them to update their details with/without those session variables persisting. Is there a way to forward them to that page when they click a link so that it doesnt create a new session? I did try to use a HEADER redirect to send them there upon clicking the button but got the headers already sent error. I suspect there is an easy way to do this and its probably got to do with me using a straight html link to send them to settings.php so any ideas???
  20. ok this is the actual page source code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="styles.css" rel="stylesheet" type="text/css"> <style> .searchBox { border : 1px solid #000000; background-color : #FFFFFF; color : #000000; font-size : 13px; font-family : Verdana, Arial, Helvetica, sans-serif; font-weight: bold; } .searchButton { border : 1px solid #000000; font-size : 13px; font-family : Verdana, Arial, Helvetica, sans-serif; font-weight: bold; } </style> <style> .catTable { background-color: #FFFFFF; } .catHeadText { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: none; font-weight: bold; } .subCatText { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: none; } a.catHeadText { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: none; font-weight: bold; } a.subCatText { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: none; } a.catHeadText:VISITED { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: none; font-weight: bold; } a.subCatText:VISITED { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: none; } a.catHeadText:HOVER { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: underline; } a.subCatText:HOVER { font-size : 11; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; text-decoration: underline; } </style> </head> <body topmargin="0" bgcolor="#dddddd" background="images/back.jpg"> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#ffffff"> <tr> <td bordercolor="#FFFFFF"><table width="780" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><img src="images/index1_r2_c1.jpg" width="780" height="149"></td> </tr> <tr> <td align="center"><a href="index.php"><img src="images/index1_r1_c1.jpg" border="0"></a><a href="signup.php"><img src="images/index1_r1_c2.jpg" border="0"></a><a href="login.php"><img src="images/index1_r1_c3.jpg" border="0"></a><a href="faq.php"><img src="images/index1_r1_c4.jpg" border="0"></a><a href="tell_friend.php"><img src="images/index1_r1_c5.jpg" border="0"></a><a href="mailto:konrad@thetrafficempire.com"><img src="images/index1_r1_c6.jpg" border="0"></a><img src="images/index1_r1_c7.jpg" ></td> </tr> <tr> <td><table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><SCRIPT language=javascript1.2 type=text/javascript> function isEmail(str) { var supported = 0; if (window.RegExp) { var tempStr = "a"; var tempReg = new RegExp(tempStr); if (tempReg.test(tempStr)) supported = 1; } if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)"); var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"); return (!r1.test(str) && r2.test(str)); } function KeepCount() { var NewCount = 0; var i = 1; window.alert(document.NewUser.sel1[1]); for(i=1;i<5;i++){//get the current count if (document.NewUser.sel1[i].checked) {NewCount++;} } if (NewCount == 3){//3 have been checked so far... disabled the others var i = 1; for(i=1;i<5;i++){//let's disable all the others that have not been checked if (!document.NewUser.sel1[i].checked){document.NewUser.sel[i].disabled = true;} } window.alert('You have selected 3 options, this is the form maximum.'); } if(NewCount < 3){//less than 3 have been checked so far... undisable any that are disabled var i = 1; for(i=1;i<5;i++){//let's disable all the others that have not been checked document.NewUser.sel1[i].disabled = false; } } } function EvaluateField() { var userName = document.NewUser.name.value; var userEmail = document.NewUser.email.value; var userEmail2 = document.NewUser.email1.value; var SiteName = document.NewUser.site.value; var SiteURL = document.NewUser.url.value; var SiteLanguage = document.NewUser.language.selectedIndex; if(SiteLanguage==0 ){ alert('You need to set your primary site language.'); document.NewUser.language.focus(); return false; } if(userName == "") { alert("The field \"Your name\" must be filled."); document.NewUser.name.focus(); return false; } if(userEmail == "") { alert("The field \"Your E-mail address\" must be filled."); document.NewUser.email.focus(); return false; } else { if(isEmail(userEmail) == false) { alert(userEmail + " can not be used as an email address."); document.NewUser.email.focus(); return false; } } if(userEmail != userEmail2) { alert("The fields \"Your E-mail address\" and \"Confirm your E-mail address\" must be identically."); document.NewUser.email.focus(); return false; } if(SiteName == "") { alert("The field \"Your site name\" must be filled."); document.NewUser.site.focus(); return false; } if(SiteURL == "") { alert("The field \"Your site URL\" must be filled."); document.NewUser.url.focus(); return false; } if(SiteURL == "http://") { alert("The field \"Your site URL\" must be filled."); document.NewUser.url.focus(); return false; } alert('We will now open your site to check that your URL is correct. Please follow the information on top of the next screen.') return true; } </SCRIPT> <!-- Begin of table--><center><BR> <table border="0" cellpadding="5" cellspacing="5" width="700"> <tr> <td> <p align="center"><B> After filling out the boxes, read and accept the terms & conditions.</b><BR> </p> <FORM name=NewUser action="" method=post> <table width="" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="200" align="left">Your Name:</td> <td align="left" width="200"> <input type="text" name="name" size="30"> </td> </tr> <tr> <td width="200" align="left">Your E-mail address:</td> <td align="left" width="200"> <input type="text" name="email" size="30"> </td> </tr> <tr> <td width="200" align="left">Confirm E-mail address:</td> <td align="left" width="200"> <input type="text" name="email1" size="30"> </td> </tr> <tr> <td width="200" align="left">Share Your E-mail:</td> <td align="left" width="200"> <SELECT name="share"><OPTION value=0 selected>No, Keep my email private</OPTION><OPTION value=1>Yes, show it to my up & down line</OPTION></SELECT> </td> </tr> <tr> <td width="200" align="left">Your Website Name:</td> <td align="left" width="200"> <input type="text" name="site" size="30"> </td> </tr> <tr> <td width="200" align="left">Your Website URL:</td> <td align="left" width="200"> <input type="text" name="url" value="http://" size="30"> </td> </tr> <tr> <td width="200" align="left" class="text" valign="top">Show Your Site In:</td> <td align="left" class="text" width="200"> <INPUT TYPE=CHECKBOX VALUE="1" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Arts & Humanities<BR> <INPUT TYPE=CHECKBOX VALUE="2" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Auto, Boating & Aviation<BR> <INPUT TYPE=CHECKBOX VALUE="3" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Computing & Technology<BR> <INPUT TYPE=CHECKBOX VALUE="4" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Health & Fitness<BR> <INPUT TYPE=CHECKBOX VALUE="5" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Internet & Online<BR> <INPUT TYPE=CHECKBOX VALUE="6" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Leisure & Entertainment<BR> <INPUT TYPE=CHECKBOX VALUE="7" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Lifestyle<BR> <INPUT TYPE=CHECKBOX VALUE="8" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Reference, Media & News<BR> <INPUT TYPE=CHECKBOX VALUE="9" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Personal<BR> <INPUT TYPE=CHECKBOX VALUE="10" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Services<BR> <INPUT TYPE=CHECKBOX VALUE="11" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Shopping<BR> <INPUT TYPE=CHECKBOX VALUE="12" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Society & Culture<BR> <INPUT TYPE=CHECKBOX VALUE="13" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Travel<BR> <INPUT TYPE=CHECKBOX VALUE="14" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Work & Money<BR> <INPUT TYPE=CHECKBOX VALUE="16" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Advertising<BR> <INPUT TYPE=CHECKBOX VALUE="17" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Affiliate Programs<BR> <INPUT TYPE=CHECKBOX VALUE="18" name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> Auctions<BR> </td> </tr> <tr> <td width="200" align="left" class="text" valign="top">You Are Interested In:</td> <td align="left" class="text" width="200"> <BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="1 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Arts & Humanities<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="2 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Auto, Boating & Aviation<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="3 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Computing & Technology<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="4 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Health & Fitness<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="5 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Internet & Online<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="6 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Leisure & Entertainment<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="7 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Lifestyle<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="8 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Reference, Media & News<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="9 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Personal<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="10 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Services<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="11 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Shopping<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="12 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Society & Culture<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="13 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Travel<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="14 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Work & Money<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="16 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Advertising<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="17 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Affiliate Programs<BR> <INPUT onClick="KeepCount();" TYPE=CHECKBOX VALUE="18 " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> Auctions<BR> </td> <tr><br> <td width="200" align="left">Your Websites Language is:</td> <td align="left" width="200"> <select name="sel6[6]"> <OPTION value="6">English</OPTION> <OPTION value="7">Other</OPTION> </SELECT> </td> </tr> <tr> <td align="left" width="450" colspan=2> <br><BR> <!--begin Terms--> <b>Terms & Conditions </b><ul> <li> Your site(s) does not contain any message boxes <li> Your site(s) does not contain inappropriate contents <li> Your site(s) does not break out of frames <li> Your site(s) does not use site rotation <li> Your site(s) does not use URL or domain forwarding <li> Your account will be deleted if not used for 90 days <li> Your account will be deleted if we can not send youemails <li> Your account can be disable if it causes system any problems <li> You are not allowed to have more than one (1) account <li> Your site(s) does not contain any popup windows <!--end Terms--> </ul> <BR></td> </tr> </table> <center> <INPUT onclick="return EvaluateField();" type=submit name="add" value="Accept Terms & Conditions"> </center> <!-- End of table--> </form> </td></tr></table></center> </td> </tr> </table></td> </tr> </table> </table> </body> </html>
  21. yup that really does look like a great solution to grey the checkboxes out. I've plugged the code in but unfortunately it still doesnt seem to work. Its almost like the onclick is not being called when they select a checkbox. I can literally select all the boxes without getting an alert window. Any idea why? here is the signup page in its entirety after inserting your suggestions <? unset($login,$pwrd,$id); session_start(); session_register("login","pwrd","id"); require('config_inc.php'); require('error_inc.php'); //require('error_inc.php'); //require('config_inc.php'); $ref=intval($ref); if($REQUEST_METHOD=="POST"){ if(isset($add)){ //print "Name:$name"; ?> <HTML><HEAD><TITLE></TITLE></HEAD><FRAMESET Rows='30,*' BORDER='0'><FRAME MARGINHEIGHT='0' MARGINWIDTH='0' SRC='addframe.php?name=<?=$name;?>&email=<?print $email;?>&share=<?print $share;?>&site=<?print $site;?>&language=<?print $language;?>&ref=<?print $ref;?>&sel[1]=<?print $sel[1];?>&sel[2]=<?print $sel[2];?>&sel[3]=<?print $sel[3];?>&sel1[1]=<?print $sel1[1];?>&sel1[2]=<?print $sel1[2];?>&sel1[3]=<?print $sel1[3];?>&pass=<?print $pass;?>&url=<?print $url;?>' SCROLLING='No' NORESIZE NAME='top' BORDER='0'><FRAME MARGINHEIGHT='0' MARGINWIDTH='0' SRC='<?print $url;?>' SCROLLING='AUTO' NORESIZE NAME='main' BORDER='0'></FRAMESET><noframes></noframes></HTML> <? exit; } } $query = "select * from ".$t_language." order by language"; $result = MYSQL_QUERY($query); $query1 = "select * from ".$t_cat." order by id"; $result1 = MYSQL_QUERY($query1); require('header_inc.php'); ?> <SCRIPT language=javascript1.2 type=text/javascript> function isEmail(str) { var supported = 0; if (window.RegExp) { var tempStr = "a"; var tempReg = new RegExp(tempStr); if (tempReg.test(tempStr)) supported = 1; } if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)"); var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"); return (!r1.test(str) && r2.test(str)); } function KeepCount() { var NewCount = 0; var i = 1; for(i=1;i<5;i++){//get the current count if (document.NewUser.sel1[i].checked) {NewCount++;} } if (NewCount == 3){//3 have been checked so far... disabled the others var i = 1; for(i=1;i<5;i++){//let's disable all the others that have not been checked if (!document.NewUser.sel1[i].checked){document.NewUser.sel[i].disabled = true;} } window.alert('You have selected 3 options, this is the form maximum.'); } if(NewCount < 3){//less than 3 have been checked so far... undisable any that are disabled var i = 1; for(i=1;i<5;i++){//let's disable all the others that have not been checked document.NewUser.sel1[i].disabled = false; } } } function EvaluateField() { var userName = document.NewUser.name.value; var userEmail = document.NewUser.email.value; var userEmail2 = document.NewUser.email1.value; var SiteName = document.NewUser.site.value; var SiteURL = document.NewUser.url.value; var SiteLanguage = document.NewUser.language.selectedIndex; if(SiteLanguage==0 ){ alert('You need to set your primary site language.'); document.NewUser.language.focus(); return false; } if(userName == "") { alert("The field \"Your name\" must be filled."); document.NewUser.name.focus(); return false; } if(userEmail == "") { alert("The field \"Your E-mail address\" must be filled."); document.NewUser.email.focus(); return false; } else { if(isEmail(userEmail) == false) { alert(userEmail + " can not be used as an email address."); document.NewUser.email.focus(); return false; } } if(userEmail != userEmail2) { alert("The fields \"Your E-mail address\" and \"Confirm your E-mail address\" must be identically."); document.NewUser.email.focus(); return false; } if(SiteName == "") { alert("The field \"Your site name\" must be filled."); document.NewUser.site.focus(); return false; } if(SiteURL == "") { alert("The field \"Your site URL\" must be filled."); document.NewUser.url.focus(); return false; } if(SiteURL == "http://") { alert("The field \"Your site URL\" must be filled."); document.NewUser.url.focus(); return false; } alert('We will now open your site to check that your URL is correct. Please follow the information on top of the next screen.') return true; } </SCRIPT> <!-- Begin of table--><center><BR> <table border="0" cellpadding="5" cellspacing="5" width="700"> <tr> <td> <p align="center"><B> After filling out the boxes, read and accept the terms & conditions.</b><BR> </p> <FORM name=NewUser action="" method=post> <table width="" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="200" align="left">Your Name:</td> <td align="left" width="200"> <input type="text" name="name" size="30"> </td> </tr> <tr> <td width="200" align="left">Your E-mail address:</td> <td align="left" width="200"> <input type="text" name="email" size="30"> </td> </tr> <tr> <td width="200" align="left">Confirm E-mail address:</td> <td align="left" width="200"> <input type="text" name="email1" size="30"> </td> </tr> <tr> <td width="200" align="left">Share Your E-mail:</td> <td align="left" width="200"> <SELECT name="share"><OPTION value=0 selected>No, Keep my email private</OPTION><OPTION value=1>Yes, show it to my up & down line</OPTION></SELECT> </td> </tr> <tr> <td width="200" align="left">Your Website Name:</td> <td align="left" width="200"> <input type="text" name="site" size="30"> </td> </tr> <tr> <td width="200" align="left">Your Website URL:</td> <td align="left" width="200"> <input type="text" name="url" value="http://" size="30"> </td> </tr> <tr> <td width="200" align="left" class="text" valign="top">Show Your Site In:</td> <td align="left" class="text" width="200"> <? $i=0; while($row = mysql_fetch_array($result1)){ $ch["id"][$i]=$row["id"]; $ch["title"][$i]=$row["title"]; $i++; }?> <? $siz=$i; for($i=0;$i<$siz;$i++){ ?> <INPUT TYPE=CHECKBOX VALUE="<? print $ch["id"][$i]; ?> " name="'sel[1]' , , 'sel[2]' , , 'sel[3]'"> <? print $ch["title"][$i]; ?><BR> <? } ?> </td> </tr> <tr> <td width="200" align="left" class="text" valign="top">You Are Interested In:</td> <td align="left" class="text" width="200"> <BR> <? $siz=$i; for($i=0;$i<$siz;$i++){ ?> <INPUT TYPE=CHECKBOX VALUE="<? print $ch["id"][$i]; ?> onClick="KeepCount();" " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> <? print $ch["title"][$i]; ?><BR> <? } ?> </td> <tr><br> <td width="200" align="left">Your Websites Language is:</td> <td align="left" width="200"> <select name="sel6[6]"> <? while($row = mysql_fetch_array($result)){ ?> <OPTION value="<?print $row["id"];?>"><?print $row["language"];?></OPTION> <? } @mysql_free_result($result); ?> </SELECT> </td> </tr> <tr> <td align="left" width="450" colspan=2> <br><BR> <!--begin Terms--> <b>Terms & Conditions </b><ul> <li> Your site(s) does not contain any message boxes <li> Your site(s) does not contain inappropriate contents <li> Your site(s) does not break out of frames <li> Your site(s) does not use site rotation <li> Your site(s) does not use URL or domain forwarding <li> Your account will be deleted if not used for 90 days <li> Your account will be deleted if we can not send youemails <li> Your account can be disable if it causes system any problems <li> You are not allowed to have more than one (1) account <li> Your site(s) does not contain any popup windows <!--end Terms--> </ul> <BR></td> </tr> </table> <center> <INPUT onclick="return EvaluateField();" type=submit name="add" value="Accept Terms & Conditions"> </center> <!-- End of table--> </form> </td></tr></table></center> <? require('footer_inc.php'); ?> I suspect its gotto do with teh INPUT calling onclick evaluate function right down the bottom. any ideas
  22. hey guys! just working on a multiple checkbox solution which also restricts the number of boxes selected and im having dramas getting the php/mysql to work. It just doesnt seem to restrict you clicking the options or popup the warning window...any ideas for a complete newb?? ok the php/form part <? $siz=$i; for($i=0;$i<$siz;$i++){ ?> <INPUT TYPE=CHECKBOX VALUE="<? print $ch["id"][$i]; ?> onClick="return KeepCount()" " name="'sel1[1]' , , 'sel1[2]' , , 'sel1[3]' "> <? print $ch["title"][$i]; ?><BR> <? } ?> And now the section of javascript it should be calling: function KeepCount() { var NewCount = 0 if (document.NewUser.sel1[1].checked) {NewCount = NewCount + 1} if (document.NewUser.sel1[2].checked) {NewCount = NewCount + 1} if (document.NewUser.sel1[3]checked) {NewCount = NewCount + 1} if (NewCount == 4) { alert('Form Accepts 3 Selections Maximum') document.NewUser; return false; } } Any ideas why its not working??? do i have the onclick in the wrong place??
  23. yup that worked! I changed the time length of the cookie when it was set with the remember me option to be less than that of the logout argument and it worked perfectly! So after all that fiddling we finally got there! Thanks again everyone for all your fantastic help. cheers aussie
  24. ok that didnt work or make any difference...BUT...I think i'm getting to the heart of the problem. On my login form I have a checkbox with the remember me option...and it has the following code related to it: if(!empty($_POST['stay_in'])) { $joined =''.$_POST['username'].'[]'.md5($_POST['password']).''; setcookie('login_cookie', $joined, 2147483647, '/', '.www.mysite.info'); } //end if This has to be the reason why the cookie isnt being reset due to the time limit...what do ya think ????
×
×
  • 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.