Jump to content

rhysmeister

Members
  • Posts

    51
  • Joined

  • Last visited

Posts posted by rhysmeister

  1. ok...in that case...you don't want to use an XML parser. if the page doesn't validate as strict XHTML (which MOST pages don't) you won't be able to retrieve it. Instead, get it with regular expressions:

     

    Very good point. I went for DOM because it would't matter if the title tags were on different lines. I might try to stip out any newline characters.

     

    Thanks, I will give your approach a go this evening.

  2. Can anyone see what I'm doing wrong with the code? No matter what I do I can't seem to get my txtUsername and txtPassword variables posted by the page. I've returned to using php after a few years and this has me stumped at the moment.

     

     

    <?php
    require_once('Connections/localhost.php'); 
    $FF_valUsername = $_POST['txtUsername'];
    // *** Start the session
    session_start();
    // *** Validate request to log in to this site.
    $FF_LoginAction = $PHP_SELF;
    if (isset($FF_valUsername))
    {
      $FF_valUsername=$_POST["txtUsername"];
      $FF_fldUserAuthorization="mem_role";
      $FF_redirectLoginSuccess="index.php";
      $FF_redirectLoginFailed="index.php";
      $FF_rsUser_Source="SELECT mem_email, mem_password ";
      if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
      $FF_rsUser_Source .= " FROM member WHERE mem_email='" . $FF_valUsername . "' AND mem_password='" . $_POST["txtPassword"] . "'";
      mysql_select_db($database_localhost, $localhost);
      $FF_rsUser=mysql_query($FF_rsUser_Source, $localhost) or die(mysql_error());
      $row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
      if(mysql_num_rows($FF_rsUser) > 0) {
        // username and password match - this is a valid user
        $MM_Username=$FF_valUsername;
        session_register("MM_Username");
        if ($FF_fldUserAuthorization != "") {
          $MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
        } else {
          $MM_UserAuthorization="";
        }
        session_register("MM_UserAuthorization");
        if (isset($accessdenied) && false) {
          $FF_redirectLoginSuccess = $accessdenied;
        }
        mysql_free_result($FF_rsUser);
        session_register("FF_login_failed");
    $FF_login_failed = false;
        header ("Location: $FF_redirectLoginSuccess");
        exit;
      }
      mysql_free_result($FF_rsUser);
      session_register("FF_login_failed");
      $FF_login_failed = true;
      header ("Location: $FF_redirectLoginFailed");
      exit;
    }
    ?>
    <?php
    require_once("classes/Connection.php");
    $MyConnection = new Connection();
    ?>
    <!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">
    <!-- DW6 -->
    <head>
    <!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>www.sqlcoders.co.uk</title>
    <link rel="stylesheet" href="3col_rightNav.css" type="text/css" />
    <script type="text/javascript" src="javascript/global_javascript.js"></script>
    <style type="text/css">
    <!--
    .style1 {font-size: 150%}
    -->
    </style>
    </head>
    <body>
    <div id="masthead">
      <h1 class="style1" id="siteName">www.sqlcoders.co.uk - The Complete SQL Resource </h1>
      <div id="globalNav"><a href="#" title="www.sqlcoders.co.uk">Home</a>|<a href="article.php" title="Browse our index of articles." target="iframe">Articles</a>| <a href="scripts.html" title="Browse our script archive." target="iframe">Scripts</a> | <a href="reference.html" title="Use our SQL reference to learn how to use specific functions." target="iframe">Reference</a> | <a href="faq.html" title="FAQ's for those common questions." target="iframe">FAQ's</a> | <a href="#" title="Post in our forums to help you resolve a query or problem.">Forums</a> |  <a href="product.html" title="Read product and book reviews here." target="iframe">Product & Book Reviews</a>| <a href="join.html" title="Join www.sqlcoders.co.uk for full member benefits!" target="iframe">Join Us</a> | <a href="contact.html" title="Contact us here!" target="iframe">Contact</a>| <a href="online.php" title="See who's online" target="iframe">Who's Online?</a></div>
      <?php
      		$result = mysql_query("SELECT mem_name, mem_created FROM member ORDER BY mem_created DESC LIMIT 1");
    	while($row = mysql_fetch_row($result))
    	{
    		$name = $row[0];
    		$registered = $row[1];
    	} 
    	echo $FF_rsUser_Source;
      ?>
      <h2 id="pageName">SQL Articles, Scripts, FAQ's & Forums<span class="latestmember"><?php echo $name." on ".$registered; ?></span><span class="latestmember">Latest member: </span></h2><div class="latestmember"></div>
      <div id="breadCrumb"></div>
    </div>
    <div id="headlines">
    <h2>SQL Server News</h2>
      <script language="javascript" src="http://www.rss-info.com/rss2.php?integration=js&windowopen=1&rss=http%3A%2F%2Fmsdn.microsoft.com%2Fsql%2Frss.xml&number=3&width=230&ifbgcol=FFFFFF&bordercol=FFFFFF&textbgcol=FFFFFF&rssbgcol=FFFFFF&showrsstitle=0&showtext=1"> </script>
    <h2>MySQL News</h2> 
    <script language="javascript" src="http://www.rss-info.com/rss2.php?integration=js&windowopen=1&rss=http%3A%2F%2Fwww.mysql.com%2Fmysql.rss&number=3&width=230&ifbgcol=FFFFFF&bordercol=FFFFFF&textbgcol=FFFFFF&rssbgcol=FFFFFF&showrsstitle=0&showtext=1"> </script>
    <h2>Oracle News</h2>
    <script language="javascript" src="http://www.rss-info.com/rss2.php?integration=js&windowopen=1&rss=http%3A%2F%2Fwww.oracle.com%2Frss%2Frss_ocom_dbnews.xml&number=3&width=230&ifbgcol=FFFFFF&bordercol=FFFFFF&textbgcol=FFFFFF&rssbgcol=FFFFFF&showrsstitle=0&showtext=1"> </script>
    <h2>PostgreSQL News</h2>  
    <script language="javascript" src="http://www.rss-info.com/rss2.php?integration=js&windowopen=1&rss=http%3A%2F%2Fwww.postgresql.org%2Fnews.rss&number=3&width=230&ifbgcol=FFFFFF&bordercol=FFFFFF&textbgcol=FFFFFF&rssbgcol=FFFFFF&showrsstitle=0&showtext=1"> </script>  
      <div id="advert"> <img src="" alt="" width="107" height="66" /></div>
    </div>
    <!-- end masthead -->
    <div id="content">
    <iframe src="iframe.html" name="iframe" width="100%" height="10000px" scrolling="Auto" frameborder="0"></iframe>
    </div>
    <!-- end content -->
    <div id="navBar">
      <div id="search">
      <?php
      				if(!isset($txtUsername))
    			{
    				echo "Not set!!!!!!";
      				}
    			if ($FF_login_failed = true)
    			{
    				echo  $FF_valUsername." = ".$txtPassword;
       ?>
        <form action="index.php" METHOD="post" enctype="" name="frmLogin" target="" id="frmLogin">
          <label>Login</label>
      <table border="0" cellpadding="0" cellspacing="0" height="100%">
      	<tr>
    			<td>
          				<p style="font-size: 80%; float: left">
            				Username
    			</td>
    			<td>
            				<input name="txtUsername" type="text" id="txtUsername" onfocus="changeColour(this)" onblur="revertColour(this)" size="10" style="float: right" />
          				</p>
    			</td>
    	</tr>
    			<td>
          				<p style="font-size: 80%; float: left">
            			Password
    			</td>
    			<td>
            			<input name="txtPassword" type="password" id="txtPassword" onfocus="changeColour(this)" onblur="revertColour(this)" size="10" style="float: right" />
    			</td>
    	</tr>
    	<tr>
    		<td>
    		<?
    				echo "<p style=\"font-size: 80; font-color=\"red\">Login Failed</p>";
    			}
    		else if ($FF_login_failed = false && isset($txtUsername))
    		{
    			echo "Welcome user!";
    		}
    		?>
    		</td>
    		<td>
            <input name="btnLogin" type="submit" class="btn" id="btnLogin" onmouseover="changeColour(this)" onmouseout="revertColour(this)" value="Login" style="float: right" />
    		</td>
    	</tr>
      </table>
          </p>
        </form>
      </div>
      <div id="sectionLinks">
        <h3>Latest Articles </h3>
        <ul>
    <?php
    	$result = mysql_query("SELECT art_id, art_title FROM article WHERE art_timestamp < NOW() ORDER BY art_timestamp DESC LIMIT 5");
    	while($row = mysql_fetch_row($result))
    	{
    			echo "<li><a href=\"article.php?article=".$row[0]."\" target=\"iframe\">".$row[1]."</a></li>";
    	}
    ?>
        </ul>
      </div>
      <div class="relatedLinks">
        <h3>Latest Comments </h3>
        <ul>
    <?php
    	$result = mysql_query("SELECT cmt_id, cmt_art_id,cmt_mem_id, LEFT(cmt_comment, 50), art_title, mem_name
    							FROM comment, article, member
    							WHERE cmt_art_id = art_id
    							AND cmt_mem_id = mem_id
    							ORDER BY cmt_timestamp DESC
    							LIMIT 10");
    	while($row = mysql_fetch_row($result))
    	{
    		echo "<li><a href=\"article.php?article=".$row[1]."#comment=".$row[0]."\" target=\"iframe\">".$row[5]." On ".$row[4]."</a></li>";
    		echo $row[3];
    	}
    ?>
        </ul>
      </div>
      <div class="relatedLinks">
        <h3>Latest Scripts </h3>
        <ul>
    <?php
    	$result = mysql_query("SELECT spt_id, spt_filename, LEFT(spt_comment, 50), mem_name
    							FROM script, member
    							WHERE spt_submitted_mem_id = mem_id
    							ORDER BY spt_timestamp DESC
    							LIMIT 5");
    	while($row = mysql_fetch_row($result))
    	{
    		echo "<li><a href=\"script.php?script=".$row[0]."\" target=\"iframe\">".$row[1]." submitted by ".$row[3]."</a></li>"; 
    		echo $row[2];
    	}
    ?>
        </ul>
      </div>
    </div>
    <!--end navBar div -->
    <div id="siteInfo"> <img src="" width="44" height="22" /> <a href="#">About Us</a> | <a href="#">Site Map</a> | <a href="#">Privacy Policy</a> | <a href="#">Contact Us</a> | ©2007 www.sqlcoders.co.uk </div>
    <br />
    </body>
    </html>
    

  3. Ok sorted this, a bit embarrassed to admit this...... but all the problem was was my links some pages where acsservicesomething.php when they should have been acsservicessomething.php, oh the joy of programming!! Guess I was too tired. Never saw this mentioned though in all the stuff I found on the error. Just thought I\'d wrap it up. Thanks to all who offered advice.

  4. Still can\'t get around this problem, I\'ve tried many weird and wonderful methods to try and get around this problem but to no avail. The strange thing is this is adapted from another script which works perfectly, only the field names of text boxes and mysql fields have changed really. Here is my code for the page...

     

    <html>
    
    <?php
    
    if($submit)  // update services details
    
     {
    
      include("includes/databaseconnection.inc"); // include file for reference to db connection
    
      $sql = "UPDATE services SET domainname=\'$domainname\', hostserver=\'$hostserver\',
    
              package=\'$package\', hostprice=\'$hostprice\', hostrenewal=\'$hostrenewal\',
    
              registrationprice=\'$registrationprice\', registrationrenewal=\'$registrationrenewal\',
    
              ftpusername=\'$ftpusername\', ftppassword=\'$ftppassword\', ftpdomain=\'$ftpdomain\',
    
              sitechangesareas=\'$sitechangesareas\', sitechangesrenewal=\'$sitechangesrenewal\',
    
              securesitesolutionsusername=\'$securesitesolutionsusername\',
    
              securesitesolutionspassword=\'$securesitesolutionspassword\',
    
              securesitesolutionsprice=\'$securesitesolutionsprice\',
    
              securesitesolutionsrenewal=\'$securesitesolutionsrenewal\',
    
              emailforwardingaddress=\'$emailforwardingaddress\',
    
              emailforwardingprice=\'$emailforwardingprice\',
    
              emailforwardingrenewal=\'$emailforwardingrenewal\',
    
              popid=\'$popid\', additionalpopprice=\'$additionalpopprice\',
    
              additionalpoprenewal=\'$additionalpoprenewal\',
    
              webforwardaddress=\'$webforwardaddress\',
    
              webforwardprice=\'$webforwardprice\', webforwardrenewal=\'$webforwardrenewal\',
    
              searchenginepackageprice=\'$searchenginepackageprice\',
    
              searchenginepackagerenewal=\'$searchenginepackagerenewal\',
    
              webmaintenancepackage=\'$webmaintenancepackage\',
    
              webmaintenancerenewal=\'$webmaintenancerenewal\',
    
              teleitmaintenanceprice=\'$teleitmaintenanceprice\',
    
              teleitmaintenancerenewal=\'$teleitmaintenancerenewal\',
    
              customerdomainrenewals=\'$customerdomainrenewals\' WHERE domainname=\'$domainname\'"; // sql to update contact details
    
      $result = mysql_query($sql) or die(mysql_error()); // execute query
    
      ?>
    
      <head>
    
      <title>Service details for <?php echo $domainname ?> have been ammended.</title>
    
      </head>
    
      <body bgcolor="#ffffff">
    
      <table border="0">
    
      <tr><td><img src="acs.gif"></td><td><h3>Service details for <?php echo $domainname ?> have been ammended.</h3></td></tr>
    
      </table>
    
      </body>
    
      </html>
    
      <?php
    
      die(); // exits the current script, or else clause is processed, is an alias for exit()
    
     }  // end of first if clause
    
    if($edit)  // edit service details
    
     {
    
      ?>
    
      <head>
    
      <title>Edit service details for <?php echo $domainname ?>.</title>
    
      </head>
    
      <body bgcolor="#ffffff">
    
      <table border="0">
    
      <tr><td><img src="acs.gif"></td><td><h3>Edit details for <?php echo $domainname ?></h3></td></tr>
    
      </table>
    
      <?php
    
      include("includes/databaseconnection.inc"); // include file for reference to db connection
    
      $sql = "SELECT * FROM services WHERE domainname = \'$domainname\'";
    
      $result = mysql_query($sql) or die(mysql_error());
    
      $myrow = mysql_fetch_array($result);
    
      ?>
    
      <form method="post" action="editcontactdetails.php">
    
      <table border="0">
    
      <tr><td>Domain name: </td><td><input type="text" name="domainname" readonly value=\'<?php echo $myrow["domainname"]?>\'></td></tr>
    
      <tr><td>Host Server: </td><td><input type="text" name="hostserver" value=\'<?php echo $myrow["hostserver"]?>\'></td></tr>
    
      <tr><td>Package: </td><td><input type="text" name="package" value=\'<?php echo $myrow["package"]?>\'></td></tr>
    
      <tr><td>Host Price: </td><td><input type="text" name="hostprice value=\'<?php echo $myrow["hostprice"]?>\'></td></tr>
    
      <tr><td>Host Renewal: </td><td><input type="text" name="hostrenewal" value=\'<?php echo $myrow["hostrenewal"]?>\'></td></tr>
    
      <tr><td>Registration Price: </td><td><input type="text" name="registrationprice" value=\'<?php echo $myrow["registrationprice"]?>\'></td></tr>
    
      <tr><td>Registration Renewal: </td><td><input type="text" name="registrationrenewal" value=\'<?php echo $myrow["registrationrenewal"]?>\'></td></tr>
    
      <tr><td>FTP Username: </td><td><input type="text" name="ftpusername" value=\'<?php echo $myrow["ftpusername"]?>\'></td></tr>
    
      <tr><td>FTP Password: </td><td><input type="text" name="ftppassword" value=\'<?php echo $myrow["ftppassword"]?>\'></td></tr>
    
      <tr><td>FTP Domain: </td><td><input type="text" name="ftpdomain" value=\'<?php echo $myrow["registrationprice"]?>\'></td></tr>
    
      <tr><td>Site Changes Areas: </td><td><input type="text" name="sitechangesareas" value=\'<?php echo $myrow["sitechangesareas"]?>\'></td></tr>
    
      <tr><td>Site Changes Price: </td><td><input type="text" name="sitechangesprice" value=\'<?php echo $myrow["sitechangesprice"]?>\'></td></tr>
    
      <tr><td>Site Changes Renewal: </td><td><input type="text" name="sitechangesrenewal" value=\'<?php echo $myrow["sitechangesrenewal"]?>\'></td></tr>
    
      <tr><td>Secure Site Solutions Username: </td><td><input type="text" name="securesitesolutionsusername" value=\'<?php echo $myrow["securesitesolutionsusername"]?>\'></td></tr>
    
      <tr><td>Secure Site Solutions Password: </td><td><input type="text" name="securesitesolutionspassword" value=\'<?php echo $myrow["securesitesolutionspassword"]?>\'></td></tr>
    
      <tr><td>Secure Site Solutions Price: </td><td><input type="text" name="securesitesolutionsprice" value=\'<?php echo $myrow["securesitesolutionsprice"]?>\'></td></tr>
    
      <tr><td>Secure Site Solutions Renewal: </td><td><input type="text" name="securesitesolutionsrenewal" value=\'<?php echo $myrow["securesitesolutionsrenewal"]?>\'></td></tr>
    
      <tr><td>Email Forwarding Address: </td><td><input type="text" name="emailforwardingaddress" value=\'<?php echo $myrow["emailforwardingaddress"]?>\'></td></tr>
    
      <tr><td>Email Forwarding Price: </td><td><input type="text" name="emailforwardingprice" value=\'<?php echo $myrow["emailforwardingprice"]?>\'></td></tr>
    
      <tr><td>Email Forwarding Renewal: </td><td><input type="text" name="emailforwardingrenewal" value=\'<?php echo $myrow["emailforwardingrenewal"]?>\'></td></tr>
    
      <tr><td>POP ID: </td><td><input type="text" name="popid" value=\'<?php echo $myrow["popid"]?>\'></td></tr>
    
      <tr><td>Additional POP Price: </td><td><input type="text" name="additionalpopprice" value=\'<?php echo $myrow["additionalpopprice"]?>\'></td></tr>
    
      <tr><td>Additional POP Renewal: </td><td><input type="text" name="additionalpoprenewal" value=\'<?php echo $myrow["additionalpoprenewal"]?>\'></td></tr>
    
      <tr><td>Web Forward Address: </td><td><input type="text" name="webforwardaddress" value=\'<?php echo $myrow["webforwardaddress"]?>\'></td></tr>
    
      <tr><td>Web Forward Price: </td><td><input type="text" name="webforwardprice" value=\'<?php echo $myrow["webforwardprice"]?>\'></td></tr>
    
      <tr><td>Web Forward Renewal: </td><td><input type="text" name="webforwardrenewal" value=\'<?php echo $myrow["webforwardadrenewal"]?>\'></td></tr>
    
      <tr><td>Search Engine Package Price: </td><td><input type="text" name="searchenginepackageprice" value=\'<?php echo $myrow["searchenginepackageprice"]?>\'></td></tr>
    
      <tr><td>Search Engine Package Renewal: </td><td><input type="text" name="searchenginepackagerenewal" value=\'<?php echo $myrow["searchenginepackagerenewal"]?>\'></td></tr>
    
      <tr><td>Web Maintenance Package: </td><td><input type="text" name="webmaintenancepackage" value=\'<?php echo $myrow["webmaintenancepackage"]?>\'></td></tr>
    
      <tr><td>Web Maintenance Renewal: </td><td><input type="text" name="webmaintenancerenewal" value=\'<?php echo $myrow["webmaintenancerenewal"]?>\'></td></tr>
    
      <tr><td>TeleIT Maintenance Price: </td><td><input type="text" name="teleitmaintenanceprice" value=\'<?php echo $myrow["teleitmaintenanceprice"]?>\'></td></tr>
    
      <tr><td>TeleIT Maintenance Renewal: </td><td><input type="text" name="teleitmaintenancerenewal" value=\'<?php echo $myrow["teleitmaintenancerenewal"]?>\'></td></tr>
    
      <tr><td>Customer Domain Renewals: </td><td><input type="text" name="customerdomainrenewals" value=\'<?php echo $myrow["customerdomainrenewals"]?>\'></td></tr>
    
      <tr><td></td><td><input type="submit" name="submit" value="Submit"></td></tr>
    
      </table>
    
      </form>
    
      </body>
    
      </html>
    
      <?php
    
     } // end of second if clause
    
    else // select service details to edit by domain name
    
     {
    
      include("includes/databaseconnection.inc"); // include file for reference to db connection
    
      $sql = "SELECT domainname FROM services";
    
      $result = mysql_query($sql) or die(mysql_error());
    
      ?>
    
      <head>
    
      <title>Select services to edit by domain name.</title>
    
      </head>
    
      <body bgcolor="#ffffff">
    
      <table border="0">
    
      <tr><td><img src="acs.gif"></td><td><h3>Select service details to edit by domain name</h3></td></tr>
    
      </table>
    
      <form method="post" action="editservicedetails.php">
    
      <select name="domainname"> <!-- option specifies domain name to be used in the above query -->
    
      <?php
    
      while($myrow = mysql_fetch_array($result))
    
        {
    
         echo "<option>";
    
         echo $myrow["domainname"]; // the domain names are entered via this loop
    
         echo "</option>";
    
        }
    
      mysql_free_result($result);
    
      ?>
    
      </select>
    
      <input type="submit" name="edit" value="Submit">
    
      </form>
    
      </body>
    
      </html>
    
      <?php
    
     } // end of else clause
    
      ?>

     

    The error seems to occur on or before the

    if($edit)

    clause. Any help with this would be very much appreciated. (Apologies for the large code posting.)

  5. Take the plunge and install Linux on one of them. You can get a leading distribution of Linux for just a few £\'s on site such as www.ebay.com. My version of Linux (Mandrake 9.2) comes with a great installer which will get you up and running with Apache, PHP, MySQL (the list goes on!) very quickly. After all why run a webserver on software that costs far too much when superior software (in most respects) is available at minimal cost. As for computers check the rubbish bins (dumpsters in your dialect I believe!) outside large office buildings. I\'ve pulled many bits out, I\'ve managed to get combined into 2 PC\'s and an old laptop!

  6. I am trying to grab a field in a database where a date field is between the current date and within 60 / 45 / 30 / 15 days time(selected by a drop down box). Here is my sql

     

    SELECT domainname FROM domainname WHERE expirydate BETWEEN CURDATE() and CURDATE()+$selecteddays

     

    I have typed the same sql into the MySQL console and it accepts it without error, but returns no results, but I know there are entries the query should pick out that are present in the table. Any ideas people? Many thanks!

  7. When I submit some info on a php page of mine I get an \"Internal Server Error\". I get the following message in my apache log file...

     

    [Wed Oct 29 18:44:40 2003] [error] [client 127.0.0.1] Premature end of script headers: c:/php/php.exe

     

    I\'ve search google for this but can\'t seem to come up with anything. Any ideas?

  8. I have setup several web servers in a similar way. I think the problem (as previosly mentioned) lies with your router. If you can access the webserver locally then it must be this. Port 80 needs to be allowed in through the firewall and the port must be forwarded to your local machine. Are you using a Netgear router? There are known problems with some models. I recommend http://www.alliedtelesyn.com

×
×
  • 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.