Jump to content

me1000

Members
  • Posts

    183
  • Joined

  • Last visited

    Never

Everything posted by me1000

  1. here is my finished code, is there any way to clean it up some? thanks for your help! $filename = "pages2.xml"; $file= fopen( $filename, "w"); $opentag="<pages>\n"; fwrite($file, $opentag); fclose($file); while ($row = mysql_fetch_array($sql_result)) { $page_id = $row["ID"]; $page_title = $row["PAGE_TITLE"]; $page_link = 'index.php?page_id='.$page_id; $_xml= "<page> <name>".$page_title."</name> <url>".$page_link."</url> </page>"; $file= fopen( $filename, "a"); fwrite($file, $_xml); fclose($file); } $file= fopen( $filename, "a"); $closetag="</pages>"; fwrite($file, $closetag); fclose($file);
  2. Thank You, Problem is im not sure where to stick it all within the loop... this is what I did, $filename = "pages2.xml"; $file= fopen( $filename, "w"); fwrite($file, "<pages>"); while ($row = mysql_fetch_array($sql_result)) { $page_id = $row["ID"]; $page_title = $row["PAGE_TITLE"]; $page_link = 'index.php?page_id='.$page_id; $_xml= "<name>".$page_title."</name>\n <url>".$page_link."</url>\n"; } fwrite($file, "</pages>"); fwrite($file, $_xml); fclose($file); it comes out like this, <pages></pages><name>LAST page IN the DATABASE table</name> <url>index.php?page_id=62</url> so it only shows the last row of the database table, and the <page> tags are in the wrong spot! Im thinking it may have something to do with the "w" in the fopen command, Thank You,
  3. Hello, So Im loading an XML file within a page. I made it dynamic by coding it in PHP and adding a .htaccess so that it executes at a PHP file, well it executed just file, but it didnt work in the page that it was called upon by! so I just grabbed the code from the source (the xml created with the PHP) and saved it as a XML file. well that is fine for now, but not perfect. I already have the script that makes the XML file, but I want to be able to run it, and when i do it save the output of the PHP to the server as an xml file. here is the PHP code im using now, <?php //connect variables $dbhost = "localhost"; // database host $dbname = "databasename"; // database name $dbuser = "username"; // database username $dbpass = "password"; // database password $sTableName = "tablename"; // Your table name // The database connection mysql_connect("$dbhost", "$dbuser", "$dbpass"); mysql_select_db("$dbname"); // LET THE CODE BEGIN $sql = "SELECT ID, PAGE_TITLE ". //PAGE_TYPE "FROM $sTableName ORDER BY PAGE_TYPE ASC"; $sql_result = mysql_query($sql); echo "<pages> "; while ($row = mysql_fetch_array($sql_result)) { $page_id = $row["ID"]; $page_title = $row["PAGE_TITLE"]; //$page_type = $row["PAGE_TYPE"]; //$page_link = '<a href="index.php?page_id='.$page_id.'">'.$page_title.'</a>'; $page_link = 'index.php?page_id='.$page_id; echo "<page> "; echo "<name>".$page_title."</name> "; echo "<url>".$page_link."</url> "; echo "</page> "; } echo "</pages>"; ?> so when I goto a page, it runs the script and saves it as a xml file, and I dont have to think twice about it, but what would be really nice is to setup a cron job for it, but ill worry about the cron job later... Thank You,
  4. That was it... Thank you, I knew it was something trivial like that. Thanks Again
  5. Howdy, Working on developing a simple login script but Im getting an error... after about a half an hour of debugging this very simple script I have narrowed it down the the query here is the code... Maybe fresh eyes can find it. // 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"); // username and password sent from form $myusername=$_POST['myusername2']; $mypassword=$_POST['mypassword2']; // encrypt password $encrypted_mypassword=md5($mypassword); $sql= "INSERT INTO $tbl_name (username, password) VALUES ('$myusername','$encrypted_mypassword'"; $result=mysql_query($sql); $response = ($result) ? "Record Added" : "Error adding record!"; echo $response ; Thank You, Me1000
  6. me1000

    Syntax Help

    Thanks for your help, but like I said Im pretty much a noob when it comes to CSS, i dont know how to fix the text... ???
  7. me1000

    Syntax Help

    That makes it so that the text rollover is the same color as the default rollover. it needs to be white!
  8. me1000

    Syntax Help

    ok thanks, That all works great, but Im having trouble with the opacity, this is what im using right now, tr.subnav td a:hover { color: #FFF; background-color : #CCC; filter:alpha(opacity=1); /* IF IE because IE sucks, and everyone hates it! and I hate M$*/ -moz-opacity: .1; /* if older mozilla or not not CSS3 */ opacity: .1; /* if Newer browser */ it works great for the background trouble is it makes the text translucent as well. so you can't even read it, because the text is White, and the background color is white too, and the same transparent settings are being applied to the text and the background, the text needs to be white in order to stand out from the background, does anyone know of a way to apply a transparency to just the background and not both the text and background? Thanks for the help,
  9. me1000

    Syntax Help

    My style sheet is the same as before, but I want to be able to add one DIV tag to the whole group of cells, instead of adding them one by one, that way i can apply different styles to them. since some are links and some are not!
  10. me1000

    Syntax Help

    I figured it out... not exactly what i want though, to get the desired effect, I removed the Div tags, and added the class inside the <a> tag <a class="subnav" href="http://www.google.com/">LINK 1</a> now what I really would like to do, is set the dif tags outside all the links in the table <tr><div class="subnav" > <td><a href="index.php"><b>Home</b></a></td> <td><a href="index.php?page_id=2"><b>CONTACT US</b></a></td> <td><a href="index.php?page_id=49"><b>GUESTBOOK</b></a></td> <td><a href="index.php?page_id=3"><b>LINK TO US</b></a></td> <td><a href="index.php?page_id=5"><b>NEWS/UPDATES</b></a></td> </div> </tr> Then I can set it so that if its not a link do something, if it is a link do what i have it set to... ill keep playing, cuz i know there is a way, but feel free to tell me how I will be checking back here as I get frustrated lol
  11. me1000

    Syntax Help

    Im pretty much a noob when it comes to CSS, but anyway, can someone show me how to write this in the correct syntax? Thanks, .sub_nav { color: #FFFFFF; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 14; font-weight: bold; } a.sub_nav:link { color: #FFFFFF; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; } a.sub_nav:visited{ color: #FFFFFF; } a.sub_nav:hover { color: #FF0000; background-color : white; opacity: 0.25; } a.sub_nav:active { color: #237cc4; } and the page uses this to show it... <a href="http://www.link1.com/"><div class="sub_nav">link 1</div></a> Thanks edit: oh BTW is this right, a.sub_nav:hover { color: #FF0000; background-color : white; opacity: 0.25; } I want the background to be translucent, but not the text!
  12. ok, well thanks for pointing that out, im interested in how it is dangerous! the problem was the register_globals
  13. im almost positive it is, I had to tell my host to turn it on when i moved, I dont think they changed it... However, I may know why it isnt on... ill check with my host!
  14. cmd should be defined in the redirect, but its the "before" that isnt being defined, at all, the "else" is just there to tell me that one of the 2 conditions was not met. this is the URL after the redirect, http://www.site.com/3rd_ani_template/V2/template.php?cmd=search&words=Search+some+words&mode=normal&submit=Search redarrow || is or, both statements need to be true for it to redirect, and why i do an or, it my browser goes into an redirect loop! The code i used for you yesideez is as follows, echo "cmd=".$cmd."<br />before=".$before."<br />words=".$words."<br />submit=".$submit."<br />"; for the URL and I got this back, cmd= before= words= submit= That doesnt make any since!
  15. nope, that didnt work. its outputting the same thing as before... assuming I got the code write, here is what i have now, $before = trim($_GET['before']); if ($cmd =="search" && (strlen($before) == 0) ) { header( 'Location: http://www.site.com/3rd_ani_template/V2/template.php?type=html&page=search&before=yes&cmd=search&words='.$words.'&mode='.$mode.'&submit='.$submit ) ; }else{ echo "still not working"; }
  16. so i had this working a few hours ago, and to my knowledge i havnt changed anything! so why doesnt it work??? :'( if ($cmd =="search" && $before == "" ) { header( 'Location: http://www.site.com/3rd_ani_template/V2/template.php?type=html&page=search&before=yes&cmd=search&words='.$words.'&mode='.$mode.'&submit='.$submit ) ; }else{ echo "it doesnt work"; } the url when i goto that page is so the if statement should see that "cmd = search" and that "before" is not defined, so it will redirect it to the same URL but defining the "before" variable in the URL. therefore showing the search page, where it would not be shown before! Thanks,
  17. ok well i dont think what i originally wanted to do is possible, however here is my work around, if ($cmd="search" AND $before == "") { header( 'Location: http://www.site.com/3rd_ani_template/V2/template.php?type=html&page=search&before=yes&cmd=search&words='.$words.'&mode='.$mode.'&submit='.$submit ) ; }else{ } however, I have no idea how to add mutable conditions to an if statement, without writing an if statement inside of another! can someone tell me how?? lol nevermind for the record it is if lala && lala then you are singing! lol it works now...
  18. ok I have my search code, but I want to imbed it inside of one index page, My problem is that when i search for something it takes it back to the index page, and not the search results, however the URL after the search is but since it isnt including the search.php page inside the index page it only gives me my default index page the URL after you hit search should be the ?type=html&page=search must be there to show the search form, in my code i dont know where to change it so the URL reflects the change, here is my code, for the whole search // Create the search function: function searchForm() { // Re-usable form // variable setup for the form. $searchwords = (isset($_GET['words']) ? htmlspecialchars(stripslashes($_REQUEST['words'])) : ''); $normal = (($_GET['mode'] == 'normal') ? ' selected="selected"' : '' ); $boolean = (($_GET['mode'] == 'boolean') ? ' selected="selected"' : '' ); echo '<form method="get" action="http://www.site.com/3rd_ani_template/V2/template.php?type=html&page=search">'; echo '<input type="hidden" name="cmd" value="search" />'; echo 'Search for: <input type="text" style="color: #FFFFFF; border: 2px ridge #000000; background-color: #A5A5A5" name="words" value="'.$searchwords.'" /> '; echo 'Mode: '; echo '<select style="color: #FFFFFF; border: 2px ridge #000000; background-color: #A5A5A5" name="mode">'; echo '<option value="normal"'.$normal.'>Normal</option>'; echo '<option value="boolean"'.$boolean.'>Boolean</option>'; echo '</select> '; echo '<input type="submit" style="color: #000; border: 1px ridge #000000; background-color: #A5A5A5" value="Search" />'; echo '</form>'; } // Create the navigation switch $cmd = (isset($_GET['cmd']) ? $_GET['cmd'] : ''); switch($cmd) { default: echo '<h2>Search site!</h2>'; searchForm(); break; case "search": searchForm(); echo '<h3>Search Results:</h3><br />'; $searchstring = mysql_escape_string($_GET['words']); switch($_GET['mode']) { case "normal": $sql = "SELECT ID, PAGE_TITLE, KEYWORDS, MATCH(KEYWORDS) AGAINST ('$searchstring') AS score FROM site_PAGES WHERE MATCH(KEYWORDS) AGAINST ('$searchstring') ORDER BY score DESC"; break; case "boolean": $sql = "SELECT ID, PAGE_TITLE, KEYWORDS, MATCH(KEYWORDS) AGAINST ('$searchstring' IN BOOLEAN MODE) AS score FROM site_PAGES WHERE MATCH(KEYWORDS) AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY score DESC"; break; } // echo $sql; $result = mysql_query($sql) or die (mysql_error()); while($row = mysql_fetch_object($result)) { echo '<font size="2" face="Arial"><strong>Title: <a href="http://www.site.com/index.php?page_id='.$row->ID.'">'.$row->PAGE_TITLE.'</a></strong><br />'; echo 'Score: '. number_format($row->score, 1); echo '<br>Keywords:</font> <font size="1">'.stripslashes(htmlspecialchars($row->KEYWORDS))."</font>"; echo '<hr size="1" />'; } break; } Any ideas?? Thanks
  19. Hello, Im currently running IPB 2.2.1 I would like to integrate it with the rest of my site, in the sense that it will be placed in my template, to show a page in my current template, it just echo's a DB query, Im hoping a simple "?page=forum&..." will work, I know almost everything in IPB uses the url as index.php?... so if I can add everything after that "?" to after the "&" in the above, is this possible at all? if so will it be easy? im willing to work on it if it isnt, but i will need help! Thank you,
  20. [quote author=genericnumber1 link=topic=121295.msg498350#msg498350 date=1168116631] [code=php:0] if (preg_match('/^Microsoft Internet Explorer/', $client_data['browser'])){ [/code] or the slightly faster alternative, though it doesn't force "Microsoft Internet Explorer" to be at the front of the string... [code=php:0] if (strstr($client_data['browser'], 'Microsoft Internet Explorer')){ [/code] there might be alternative solutions as well [/quote] Thank you! it works fine now! :)
  21. I have a browser detection script, and i want the user to be prompted if they are using IE (any version) so here is what i have so far.. [code]if ( $client_data['browser'] == "Microsoft Internet Explorer". *)[/code] the * is a wildcard character in everything else i have ever used. thats just the opening, i have the rest of it but there was no need to post it. so basically if anything at all follows the Microsoft Internet Explorer then it needs execute the if command. Thanks,
  22. Thank You I really appreciate it!
  23. The database doesn't hold any HTML in it at all, so basicly all i need is just to add spaces to my current code, so that it HAS spaces lol... Thanks!
×
×
  • 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.