Jump to content

brad_langdon

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by brad_langdon

  1. I don't know what a cron job is...
  2. Thanks for the reply. But ah...whats a cron job? lol sorry.
  3. Hi. I have payment "due dates" for my clients hosting in a mysql database. I am wanting to set it up so that when a clients hosting is due in a week / month etc and on the actual day itself an email will be sent to myself and to the client reminding them about payment with the amount etc. Can anyone point me in the best direction for this? Was preferring to build it from scratch but a free program would also do. Thanks everyone who helps
  4. I have had issues using seesion vars with headers before by not being consistent and I would rather use this method. Does anyone know how to fix this header problem?
  5. Firstly the code with the issue is as follows... header( "Location:../index.php?validate=failed" ."&name=$name"."&phone=$phone" ."&email=$email" ."&enquiry=$enquiry" ); It works fine unless the last variable ( $enquiry ) has more than one line of text. If the user only types one line of text into the enquiry field it works fine but as soon as they have a line break by pressing enter I get the following error... Warning: Header may not contain more than a single header, new line detected. in /home/brad_langdon/vander.co.nz/HeatPump/inserts/sendmail.php on line 52 Please Note: I am using POST to get the form data to the processing page. I am just using GET to get the data back to the form page if it does not validate so that the user does not have to re enter everything. Also the problem is not having more than one variable in the header as I have checked this. Thanks to anyone in advance who can help
  6. Thanks, I thought that Session variables didn't work with headers. Also, how do you fill the form with variables? Do you just enter the value of the field as a variable?
  7. Hi, When a user submits my form it then goes to "sendmail.php" where it is then checked to see if any of the required fields were left empty etc. So far so good. If a required field has been left blank then I use a header to redirect the user back to the form page while defining a variable as true so that a message will pop p telling them to fill in all required fields etc. My question is this...when I redirect to the form page all of the fields are blank again...how do I redirect while keeping the text that the user has typed out in the form so that they don't have to start from scratch again? Any help would be very appreciated...I have searched for a solution but have had no luck so far.
  8. Thanks guys group by worked a charm
  9. Hi, I have a data base full of products. One of the fields in the database is labeled "category". I want to list each category. The problem is that I have many products in the same category so I need to list each category only once. This is what I have at present... $result = mysql_query("SELECT * FROM products") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo $row['category']; } Obviously this lists the duplicates as well. I read a tutorial on the 'DISTINCT' function. I tried it with no success. The tutorials I read did not explain how to use it in a query such as I have above. If anyone can explain to me how to use it properly or maybe an alternative that would be much appreciated. I hope I have posted this in the right section :-\ Thanks in advance guys.
  10. Thanks. Does anyone out there have any idea why this is not working though??? :-\
  11. Update to last post... PFMaBiSmAd, the last piece of code yo asked me to write came up with this output... "Notice: Undefined index: client in /var/www/vhosts/vander.co.nz/httpdocs/login/loggedin.php on line 76" The code on line 76 is if ($_SESSION['login'] == "TRUE") { echo ("Welcome"); }
  12. That made no difference... and for the output was "NULL"
  13. The output is...string(6) "knight" knight is the user name so that part worked...not sure what string(6) is though?
  14. It redirects you to the end page. the end page is called loggedin.php. There are two pages of concern. The process page and the end page which is called loggedin.php
  15. I removed them...still not working properly. Have I typed the variable in the wrong syntax or something?
  16. I don't know what those two tags are for as this is modified downloaded code. Should I take them off? I have now changed the <? to <?php still no luck though.
  17. Now that I checked the first variable isn't working either...I changed the variable name in the process page so that it didn't match but it still prints as true on the results page. Thank you so much for the help by the way... PROCESS PAGE <?php session_start(); ob_start(); $host="****"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="login"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['client'] = $myusername; $_SESSION['login'] = "TRUE"; session_write_close(); header("location:http://www.vander.co.nz/login/loggedin.php"); } else { $_SESSION['login'] == "TRUE"; session_write_close(); header("Location: http://www.vander.co.nz/index.php"); } ob_end_flush(); ?> END PAGE <?php session_start(); ?> <!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" xml:lang="en" lang="en"> <head> <link href="http://www.vander.co.nz/Images/Favicon.ico" rel="shortcut icon" /> <link href="http://www.vander.co.nz/css/main.css" rel="stylesheet" type="text/css" /> <link href="http://www.vander.co.nz/css/scroll.css" rel="stylesheet" type="text/css" /> <link href='http://www.vander.co.nz/css/contact.css' type='text/css' rel='stylesheet' media='screen' /> <link href="http://www.vander.co.nz/css/prettyPhoto.css" rel="stylesheet" type="text/css" media="screen" charset="utf-8" /> <script src="http://www.vander.co.nz/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script src="http://www.vander.co.nz/js/jquery.pngFix.js" type="text/javascript" ></script> <script src="http://www.vander.co.nz/js/jquery.scrollable-1.0.2.js" type="text/javascript" ></script> <script src="http://www.vander.co.nz/SpryAssets/SpryEffects.js" type="text/javascript"></script> <script src='http://www.vander.co.nz/js/jquery.simplemodal.js' type='text/javascript'></script> <script src="http://www.vander.co.nz/js/contact.js" type='text/javascript'></script> <meta http-equiv="Content-Type" ncontent="text/html; charset=utf-8" /> <title>Vander - Branding & Design</title> <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_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];} } function MM_effectAppearFade(targetElement, duration, from, to, toggle) { Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle}); } 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];}} } //--> </script> </head> <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-8299099-1"); pageTracker._trackPageview(); } catch(err) {}</script> <body id="Home" onload="MM_preloadImages('Images/Portfolio/PrevOver.png','Images/Portfolio/NextOver.png')"> <?php include("../header.php"); ?> <div id="content"> <? if ($_SESSION['login'] == "TRUE") { echo ("Welcome"); } $result = $_SESSION['client']; echo $result; ?> <div style="width:100%; height:56px; float:left;"></div> </div> <?php include("../footer.php"); ?> </body> </html>
  18. Yes I have started a session on both pages. Thanks I have changed the first variable call to == instead of =. Still no luck with the second variable call...so confused ???
  19. Thanks for the reply. I changed it to SESSION instead of session but still no luck. $myusername has been set as it is the input from the form on a previous page. I added ini_set ("display_errors", "1"); error_reporting(E_ALL); to the output page but nothing came up. PS I am not a pro with php...
  20. I have a process page that logs the user in...no problems there. I have two session variables but only one is passing onto the next page. // PROCESS PAGE if($count==1){ $_session['client'] = $myusername; // myusername is already defined from a form $_session['login'] = 'TRUE'; // this variable passes through fine session_write_close(); header("location:http://www.vander.co.nz/login/loggedin.php"); } // NEXT PAGE <? if ($_session['login'] = 'TRUE') { echo ("Welcome"); } $result = $_session['client']; // supposed to echo the clients name stored in "$myusername" echo $result; ?> The end result does echo the "Welcome" but not the client name. I have included a start session at the top of both pages and also ended the session before the header on the process page. Really stuck and have researched with no success.
×
×
  • 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.