Jump to content

TapeGun007

Members
  • Posts

    307
  • Joined

  • Last visited

Everything posted by TapeGun007

  1. I just need someone to steer me in the right direction. I've used minimal SQL to link a couple of tables together, but linking three is beyond my little bit of SQL knowledge. Here are the tables:
  2. Oh man, it just dawned on me... and now I feel very stupid. It's a sub domain, and there was one additional folder that I left out of the string, because it doesn't exist in the URL. Even the first example basically works now, sorry guys, and thank you.
  3. Ok, the echo $_SERVER['DOCUMENT_ROOT']; give me this: \\\\boswinfs01\\home\\users\\web\\b406\\ez.nancyholston I tried all these: <?php include ($_SERVER['DOCUMENT_ROOT'] . '\\components\\Header.php'); ?> <?php include ($_SERVER['DOCUMENT_ROOT'] . '\components\Header.php'); ?> <?php include ($_SERVER['DOCUMENT_ROOT'] . '/components/Header.php'); ?> I get this error: Warning: main(\\\\boswinfs01\\home\\users\\web\\b406\\ez.nancyholston\components\Header.php) [function.main]: failed to open stream: No such file or directory in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1 Warning: main() [function.include]: Failed opening '\\\\boswinfs01\\home\\users\\web\\b406\\ez.nancyholston\components\Header.php' for inclusion (include_path='.;c:\php\4\pear') in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1
  4. I've already tried both of those, I get this with BOTH: Warning: main(\components\Header.php) [function.main]: failed to open stream: No such file or directory in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1 Warning: main() [function.include]: Failed opening '\components\Header.php' for inclusion (include_path='.;c:\php\4\pear') in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1
  5. I cut and pasted your exact line, I get this error: Warning: main(\\boswinfs01\home\users\web\b406\ez.nancyholston\components\Header.php) [function.main]: failed to open stream: No such file or directory in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1 Warning: main() [function.include]: Failed opening '\\boswinfs01\home\users\web\b406\ez.nancyholston\components\Header.php' for inclusion (include_path='.;c:\php\4\pear') in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1 Members Menu: Again, the include file is here: \\boswinfs01\home\users\web\b406\ez.nancyholston\components\Header.php The file calling the include is here: \\boswinfs01\home\users\web\b406\ez.nancyholston\admin\menu.php
  6. I am using includes in the main directory. But when I call those includes in a sub folder ("admin" in this case), they simply do not work regardless of all the methods I've tried. Here is the path to root: \\boswinfs01\home\users\web\b406\ez.nancyholston I do this: <?php include "\\boswinfs01\home\users\web\b406\ez.nancyholston\components\Header.php" ?> I get this error: Warning: main(\boswinfs01\home\users\web\b406\ez.nancyholston\components\Header.php) [function.main]: failed to open stream: No such file or directory in \\boswinfs01\home\users\web\b406\ez.nancyholston\_fr\admin\menu_members.php on line 1 I've tried this as well include $_SERVER['DOCUMENT_ROOT']."/components\Header.php" But I get the same error. I've always programmed in ASP. I read that Windows servers base the path on the folder you are in, whereas Linux will base it on the root. Anyway, I'm sure there is a simple fix. Thanks
  7. I did as you suggested and it didn't work initially. So I took your google code, pasting it at the top, and it worked fine. Then I decided to clear out IE8 cache, put my code back in, and added the cookies back in. Everything works fine again! Thank you for your expertise, you saved me hours of time!!!!
  8. The headers are just HTML code (that's use on every page), nothing else. Just saving lines of code by including it. Then if I edit the include, it fixes ALL the pages. Ok, you win. The above code with nothing else worked fine. So... uh... I don't know it works fine locally. *shrug* Any suggestions on how to accomplish the same thing a different way?
  9. Again, it works fine on my laptop (with IIS, and PHP 5, and mySQL installed). My local system basically mirrors my web host, thus why I'm so befuddled! But... I am also new to php (an ASP convert), so... I have to bow to other people's knowledge for a bit. Here is the code: <?php If (isset($_GET["logout"])) { setcookie("AgentName","",time()-3600); setcookie("AgentLogin","",time()-3600); setcookie("AgentEmail","",time()-3600); setcookie("AgentVass","",time()-3600); header('Location:agent_login.php'); exit(); } ?> <?php include("components/inc_header.php"); ?> <?php include("components/inc_header2.php"); ?> <!-- Begin Main Content --> <?php if (isset($_POST["fUsername"])) { $UserName = $_POST["fUsername"]; $PassWord = $_POST["fPassword"]; $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db(my_db, $con); $result = mysql_query("SELECT * FROM Agents WHERE Agent_Email='$UserName'"); while($row = mysql_fetch_array($result)) { If ($row['Agent_Password']==$PassWord) { setcookie("AgentName",$row['Agent_Name'],time()+3600*24); setcookie("AgentLogin","Agent_5487_Meir",time()+3600*24); setcookie("AgentEmail",$UserName,time()+3600*24); setcookie("AgentVass",$PassWord,time()+3600*24); echo "Page seems to just die right here, no redirect!"; header('Location: agent_mainmenu.php'); exit; } Else { $Error = "Password and/or Username invalid"; } } mysql_close($con); } ?> <form action="agent_login.php" method="post"> <table cellspacing="0" cellpadding="4" border="0"> <tr valign="top"> <td class="adtext" rowspan="4"> </td> <td colspan="2"><h1>Agent Login:</h1></td> </tr> <tr> <td>Username:</td><td><input type="text" name="fUsername" value="<?php if (isset($_COOKIE['AgentEmail'])) echo $_COOKIE['AgentEmail'] ?>"></input></td> </tr> <tr> <td>Password:</td><td><input type="password" name="fPassword" value="<?php if (isset($_COOKIE['AgentVass'])) echo $_COOKIE['AgentVass'] ?>"></input></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit"></input><p><span class="error"><?php if (isset($Error)) echo $Error; ?></span></td> </tr> <tr><td colspan="2" align="center"><a href="agent_login.php?logout=true">Log Out</a></td></tr> </table> </form> <!-- End Main Content -->
  10. Heh, that doesn't have anything to do with it. That was just a test to see where my code was dying. Commenting that line out doesn't make the redirect work. The code simply does not redirect, and the page dies right there.
  11. I use this same code on my laptop, it works fine, but I upload it to my web host, and it doesn't work. while($row = mysql_fetch_array($result)) { If ($row['Agent_Password']==$PassWord) { echo "Test"; header('Location: agent_mainmenu.php'); exit; } Else { $Error = "Password and/or Username invalid"; } } Any Ideas? I see the word "test" appear, and the rest of the page doesn't load and it doesn't redirect.
  12. Yeah... interesting. Unfortunately, I'm under a heavy deadline and will have to peek at that later. I have this bookmarked. I appreciate your willingness to help me earlier! Many thanks to you.
  13. I found a sample code on w3schools.com <?php $con = mysql_connect("localhost","xxx",xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("movedb", $con); $result = mysql_query("SELECT * FROM agents"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Email</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Agent_Name'] . "</td>"; echo "<td>" . $row['Agent_Email'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> This did exactly what I needed it to do. *shrug*
  14. Ok, I modified the code slightly as well saying "connection successful" when connected to the db. I am getting the "Query Failed" when I run your code. I presume then, that this snippet of code is able to realize that there are records available, but for some reason the query fails. Now that I have the problem narrowed down, how do I fix this? There must be something very simple I am not getting here. I am used to writing code in ASP. For example: I could then write a table and insert the values read from the db into the table cells. This is really what I'm trying to do in php. I plan to eventually convert this other website from ASP to PHP. I just need to learn the differences. If I can simply access the database, and spit out the records, I believe I would be well on my way. I just can't seem to get over this little hump. Thanks.
  15. Ok.... wait a minute. There IS data in the table. Using the mySQL Query Browser, there are two agents. The table is: agents: Agent_ID Agent_Name Agent_Password Agent_Email There are two records in there currently. Granted your code above fixed the error, why does it not see there is data?
  16. Ah! I'll have to look at this because there should be data (or so I assumed). Is there a link somewhere that is like a reference guide to what the errors mean so I can troubleshoot easier? And...btw, thank you so much!
  17. I can't find the solution to a simple problem on Google. The error I get is: Line 15 is the While statement.
  18. Ah... isset is what I needed to know. Thanks, I fixed it and it works! Thanks. I knew it was something really stupid. All I needed was the if(isset($_POST['stuff'])
  19. Ok, I have a sneaky suspicion that I'm not searching for the right answer here, because it's got to be simple and I can't find it. Let's say I have a form called form.php: So, basically the form will call itself with form information from "stuff". Now, the PHP code I want before the form is: Of course, the IF statement gives me this error: I did my homework: I know WHY I get the error, it's because when the form first loads, that variable "stuff" doesn't contain anything. What I can't find is the answer. And I know it's some rather simple. *sigh*
  20. Uh... problem solved... I'm not sure why, but I would never have figured it out if I didn't have an ASP page that I tested on a few weeks ago. I have GoDaddy as my webhost (would I wouldn't recommend to anyone). While testing some email capability in ASP, I noticed I would not received emails if I used "[email protected]" for some reason. It just dawned on me, that I was using that to fill in my form. I tried another email address and it delivers fine.
  21. Ok, I just got a chance to go back and play with this, and no luck. What the problem is, is that if I change the mail() to mail($to,$subject,$headers); instead of mail($to,$subject,$message,$headers); It sends me an email just fine. I use the echo commands to see what is in $message, and it comes out just fine. But having that $message in there causes the email not to be sent at all. Can someone help explain what I am doing wrong here?
  22. Ok, I'm a complete php noob. I'm trying to convert some ASP 3 pages to php. So far so good. I have a form that people fill out and it emails me their information. It does not email me however (used to when everything was hard coded with no variables). I could use some help, after reading a bit on this forum, I already see how I can update this code a bit better. Trying to convert isn't exactly the easiest thing when you're used to a particular way of doing things. You can view this form at www.meirsystems.com/applynow.php Thank you for helping! Also, does the mail() function allow me to send in HTML format?
×
×
  • 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.