Jump to content

HaLo2FrEeEk

Members
  • Posts

    724
  • Joined

  • Last visited

    Never

Everything posted by HaLo2FrEeEk

  1. Also you shouldn't rely on just names as identifiers in input and select objects. use name="" and id="" at the same time, and make sure they're both the same. Also, why is your select size=5 if there's only 4 options? And finally, use quotes. Different browsers handle code differently, using proper code standards helps eliminate cross-browser issues.
  2. When you're writing a new line to the file, add this to the end "\n" without the quotes, to the end. Here are a few examples, depending on how you're writing the url: $newline = $someurl."\n"; or $newline = "http://example.com/".$somepage."\n"; or $newline = "http://example.com/somepage.html\n"; Either way, append "\n" (again, without the quotes) to the end of each new line you add.
  3. First let me apologize if this is in the wrong forum, it has to do with both Javascript and ASP, but there is no ASP forum. Also, prepare yourself for a long read. I've been going through the source code for a site that I go on frequently. It's the homepage for Bungie Studios, creators of Halo. It's a very well-developed page, very professional, and as I'm going through it I'm noticing a lot of javascript functions __doPostBack(). These seem to control the ajax-like dynamic loading that the site does. Most of the functions are formatted like this: javascript:__doPostBack('ctl00$mainContent$findStatsLinkButton','') From what I understand, doPostBack is supposed to be something like this: __doPostBack(eventTarget, eventArgument) So using the example from above, "ctl00$mainContent$findStatsLinkButton" is the eventTarget, the object that will be recieving the returned data, and eventArgument is blank, meaning no arguments are passed. I want to make sure I'm understanding this right, there is a single form on the page: <form name="aspnetForm" method="post" action="/Online/Default.aspx" id="aspnetForm"> And this javascript: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> And these hidden inputs: input type="hidden" name="ctl00_masterScriptManager_HiddenField" id="ctl00_masterScriptManager_HiddenField" value="" /> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" /> <input type="hidden" name="__BNETSTATE" id="__BNETSTATE" value="[realllllly long unrelated (I think) text]" /> <input type="hidden" name="__VIEWSTATE" id=" __VIEWSTATE" value="" /> [...] <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="[another really long text, different on each pageload)" /> Which means that when a doPostBack link is clicked, it sets the hidden input "__EVENTTARGET" to the eventTarget value sent to the function, sets the hidden input "__EVENTARGUMENT" to the eventArguement passed (if any,) then submits the form. Since the form's action is "Online/Default.aspx" that means that the information is posted to that page, right? So basically it's posting all the input's values to Online/Default.aspx, then returning the result to eventTarget. Is there a reason the eventTarget value is formatted like it is? Here's an example of a portion of the page that can be updated: <div id="ctl00_ctl00_mainContent_haloStatRotator_bodyCountAllAjaxPanelPanel"> <div id="ctl00_mainContent_haloStatRotator_bodyCountAllAjaxPanel" jq="0"> <img id="ctl00_mainContent_haloStatRotator_allImage" src="/images/halo3stats/h3_characters/gif_large/brute_ultra.gif" style="border-width:0px;" /> <div class="infoblock"> <h4>Select Character:</h4> <select name="ctl00$mainContent$haloStatRotator$allDropDown" onchange="javascript:setTimeout('__doPostBack(\'ctl00$mainContent$haloStatRotator$allDropDown\',\'\')', 0)" id="ctl00_mainContent_haloStatRotator_allDropDown"> <option value="-1">-- Infantry --</option> <option selected="selected" value="0">Brute Infantry</option> <option value="1">Grunt Infantry</option> <option value="2">Jackal Infantry</option> <option value="4">Drone Infantry</option> <option value="6">Flood Carrier Form</option> <option value="7">Flood Combat Form</option> <option value="8">Sentinel Infantry</option> <option value="10">Engineer</option> <option value="-2">-- Leader --</option> <option value="11">Brute Leader</option> <option value="12">Drone Leader</option> <option value="-3">-- Hero --</option> <option value="14">Brute Hero</option> <option value="-4">-- Specialist --</option> <option value="17">Brute Specialist</option> <option value="18">Grunt Specialist</option> <option value="19">Jackal Specialist</option> <option value="20">Hunter Specialist</option> <option value="21">Flood Pure Form</option> <option value="-5">-- LightVehicle --</option> <option value="23">Shade</option> <option value="24">Ghost</option> <option value="25">Chopper</option> <option value="26">Recharge Station</option> <option value="-6">-- HeavyVehicle --</option> <option value="29">Wraith</option> <option value="30">Phantom</option> <option value="-7">-- GiantVehicle --</option> <option value="31">Scarab</option> <option value="-8">-- StandardVehicle --</option> <option value="34">Prowler</option> <option value="35">Banshee</option> </select> <ul class="kiatoday"> <li>KIA Today:</li> <li class="value">4,434,907</li> </ul> <ul class="kiaalltime"> <li>KIA All Time:</li> <li class="value">2,192,870,370</li> </ul> <p>Recruits compete for their postings as well as their gear.</p> </div> </div> </div> The image, "KIA Today", "KIA All Time", and "Recruits compete for their postings as well as their gear." are updated. How does the script know to update the div just by passing the id of the select tag to __doPostBack? The reason I'm asking this all is because there's stats on this page that you can only get by actually clicking the doPostBack links, but I need to get it for a contest I'm running, I need to poll some of that information to keep track of the contest's progress. I need to know if there's any way to post information to this page using php and get the result on my own server. That's the only way I'm gonna be able to get at the information I need for my server. Am I understanding the process of how this all works? And is there a way I can get at the information on my own server. Thank you for your time, anyone who takes the time to read this all, I appreciate it immensely, and to anyone that helps.
  4. Are you gonna completely ignore the code that I posted? It'll help you quite a bit.
  5. I took the liberty of cleaning up your php for you. I didn't clean up the errors with the HTML, you'll have to do that, but there are a LOT of them. Tags that are closed but never opened or opened and never closed, all sorts of things. But anyway, here is your php: <?php session_start(); if(!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> <html> <head> <title>Mafia Syndicate BETA .::. Families</title> <link REL="stylesheet" TYPE="text/css" HREF="main.css"> <script language=javascript src=Menus.js></script> </head> <body background="wallpaper.jpg"> <center> <table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat"> <TR> <TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"><?php include("leftmenu.php");?></TD> <td width="100%" valign="top"><br> <?php $fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1")); ////CREATE CREW///// if($_POST['createfamily'] && $_POST['familyname']) { $familyname == $_POST['familyname']; if($rankpoints <= 140109) { echo "You must be Underboss before you can make a crew!"; } else { if($crewlevel==0) { $finalcash = $cash - 500000000000 ; if($finalcash <0) { echo "You do not have enough cash!"; } elseif($finalcash >=0) { $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1")); if($num_true >= 5) { echo "There are already 5 Crew Slots!"; } else { $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'")); if($num_true >= 1) { echo "There is already a Family with that name!"; } else { function change($msg) { $post = $msg; $post = str_replace("'", "`", $post); return $post; } $new=change($crewname); mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')"); mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'"); mysql_query("UPDATE users SET cash='$finalcash', family='$new' WHERE username='$username'"); mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')"); echo "You have created the Family <b>$new!</b>"; } } } } } } if($_POST['cancelapply']) { mysql_query("DELETE FROM famreq WHERE username='$username'"); echo "You have cancelled your application!"; } /////END OF CREATE CREW!!!///// if(famlevel->2); if($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])) { $sql2="SELECT * from famreq WHERE username='$username'"; $result2=mysql_query($sql2); $num_true=mysql_num_rows($result2); if($num_true >= 1) { echo "You have already pending Family request!"; } elseif($num_true <=1) { $crewnamejoin = $_POST['inviteusername']; $crewnamejoin = strip_tags($inviteusername); $sql="SELECT * FROM users WHERE username='$username'"; $result=mysql_query($sql); if($_POST['acceptinvite']) { $sql="SELECT * from famreq WHERE family='$famid'"; $result=mysql_query($sql); mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES ('', '$invitedusername', '$username', '$status', '$f' )"); echo "You have requested $invitedusername to join your family!"; } } if($_POST['leave'] && $famlevel >=2 && $famlevel <7){ if($famlevel <= 0) { echo "You are not in a Family!"; } else { if($famlevel >= 4) { echo "You can not leave your family!"; if($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10) { $newcrewname = $_POST['newfamname']; $newcrewname = strip_tags($newfamname); $crewid = $_POST['famid']; $crewid = strip_tags($famid); $sql="SELECT * from family WHERE id='$famid'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)) { // Start looping table row $oname = $rows['name']; } $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'")); if($num_true >= 1) { echo "There is already a family with that name!"; } else { function change($msg) { $post = $msg; $post = str_replace("'", "`", $post); return $post; } $newfamname=change($newfamame); mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'"); mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'"); mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'"); mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'"); mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'"); mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'"); mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'"); echo "You changed the family $oname to $newfamname!"; } } if($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15) { $crewnamedrop = $_POST['famnamedrop']; $crewnamedrop = strip_tags($famnamedrop); mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'"); mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'"); mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'"); mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'"); mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'"); mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'"); echo "You have droped <b>$crewnamedrop</b>!"; } if($_POST['acceptbg']) { mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'"); echo "You are now a bodyguard"; } if($_POST['acceptbg2']) { mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'"); echo "You are now a bodyguard!"; } if($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500) { if($fetch->slot ==75) { $next=125; $upgradecost=10000000000; } elseif($fetch->slot ==125) { $next=200; $upgradecost=150000000000; } elseif($fetch->slot ==200) { $next=300; $upgradecost=20000000000; } elseif($fetch->slot ==300) { $next=500; $upgradecost=30000000000; } $newcash = $cash - $upgradecost; if($newcash <0) { echo "You do not have enough cash to upgrade!"; } else { mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'"); mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'"); echo "Your Family size is now <b>$next</b>!"; } } ?> <table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%> <tr> <td align="center" colspan="5" class="header">Crews</td> </tr> <?php include "includes/db_connect.php"; $sql="SELECT * FROM family ORDER by id ASC"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)) { // Start looping table row $name=$rows['owner']; $famname=$rows['id']; $famname2=$rows['name']; $sql2="SELECT * from users WHERE family='$famname2'"; $result2=mysql_query($sql2); $num=mysql_num_rows($result2); ?> <tr> <td width="70%"><a href="viewcrewprofile.php?viewcrew=<?php echo $famname ?>"><?php echo $rows['name']; ?></a></td> <td width="20%"><a href="viewprofile.php?viewuser=<?php echo $name ?>"><?php echo $rows['owner']; ?></a></td> <td width="10%"><?php echo "$num"; ?></td> </tr> <?php } ?> <tr> <td colspan="5" align="right"> <?php $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1")); echo "$num_true"; ?> /5 Families </td> </tr> </table> <br><br> <td> <?php $sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'"; $result2=mysql_query($sql2); $num_true=mysql_num_rows($result2); echo "$num_true"; ?> </td> <td align="center"><input type="submit" name="acceptreq" value="Accept"></td> <tr> <td class="header" colspan="2" align="center">Create Crew </td> </tr> <tr> <td><p><font color="blue"><b>Making a family will Cost $500,000,000,000. You must be ranked Underboss + to make a Family.</b></font></p></td> </tr> <tr> <td width="92%" bgcolor="#3c3025" border="0"><center>Crew Name:<br><input type="text" style="border:1px solid black;" name="familyname"><br><br><input type="submit" value="Create Family" name="createfamily"></center></td> </tr> <?php $num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'")); if($num_true == 1) { ?> <tr> <td class="header" colspan="2" align="center">Pending Application</td> </tr> <?php include "includes/db_connect.php"; $sql="SELECT * FROM famreq WHERE username='$username'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)) { // Start looping table row ?> <tr> <td colspan="2" align="center">You have requested <b><?php echo $username; ?></b><br><br><input type="submit" value="Cancel Application" name="cancelapply"></td> </tr> <?php } } ?> </table></form> <?php } ?> <br> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <?php $num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''")); if($num_true >= 1){ ?> <tr> </tr> <?php $sql="SELECT * FROM BG WHERE bg='$username' AND crew=''"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)) { // Start looping table row ?> <tr> </tr> <?php } } ?> </table> <br> <?php if($famlevel >= 0) { ?> <form method="post" action=""> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <?php $num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'")); if($num_true >= 1) { ?> <tr> <td class="header" colspan="2" align="center">Bodyguard Invitation</td> </tr> <?php $sql="SELECT * FROM BG WHERE bg='$username'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)) { // Start looping table row ?> <tr> <td colspan="2" align="center">You have been invited to be a bodyguard!<br><input type="submit" value="Accept" name="acceptbg"></td> </tr> <?php } } ?> </table> <br> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Leave Crew</td> </tr> <tr> <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font><br><br><input type="submit" value="Leave Crew" name="leave"></td> </tr> <?php if($crewlevel >=7 && $fetch->slot <200) { ?> <tr> <td class="header" colspan="2" align="center">Upgrade Crew Size</td> </tr> <tr> <td align="center"> <?php if($fetch->slot ==50) { $next=75; $upgradecost=100000000; } if($fetch->slot ==75) { $next=125; $upgradecost=1250000000; } elseif($fetch->slot ==125) { $next=200; $upgradecost=1500000000; } elseif($fetch->slot ==200) { $next=300; $upgradecost=3000000000; } elseif($fetch->slot ==300) { $next=500; $upgradecost=5000000000; } ?> Your Families current size is <b><?php echo $fetch->slot ; ?></b>, it will cost $<?php echo number_format($upgradecost); ?> to upgrade it to <?php echo $next ;?>.<br> <input type="submit" name="upgrade" value="Upgrade"> </td> </tr> <?php } ?> </table> <?php } ?> </form> <?php if($userlevel >= 5) { ?> <form method="post" action=""> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Change Family Name</td> </tr> <tr> <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td> </tr> <tr> <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br> <input type="submit" value="Change" name="change"> </td> </tr> </table> </form> <br><br> <?php } if($userlevel >= 15) { ?> <form method="post" action=""> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Drop Family</td> </tr> <tr> <td width="90%" align="center"><br><center><select name="famnamedrop"> <?php include "includes/db_connect.php"; $sql="SELECT * FROM family ORDER by id"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)) { // Start looping table row ?> <option><?php echo $rows['name']; ?></option> <?php } ?> </select> <br><br> <input type="submit" value="Drop Family" name="dropfamily"></center> </td> </tr> </table> </form> <?php } ?> <br><br></td> <TD width="150" valign="top"> <?php include("rightmenu.php");?> </TD> </TR> </table> <?php } } ?> </center> </body> </html> And your problem seems to be 1 missing }, right at the end, the last <?php ?> tag, there was only 1 } there originally, so I put another. Try it out. Also, there's no need to include the same file more than once in a script, just include it once at the very beginning of the file. db_connect as an example, you include it I think 3 times, it only needs to be included once. And you also only include it inside multiple if statements, which is bad because it makes you HAVE to include it more than once. ALSO, it seems that you're running queries before you've even included db_connect at all, so you'll probably get errors there, too.
  6. Seriously, what thorpe said, properly formatting your code helps a TON in finding errors. I mean, seriously, with all those nested if statements, why would you NOT format it? Makes it a lot easier to go back later and update things, too. Just realize that if you ever work for a company doing this sorta thing, they will make you adhere to their standards of coding and formatting, best to learn how now and have to change later than have to learn how later. I find that indenting everything inside an if/for/foreach/while statement, up to and including the final }, with 2 spaces, it helps a lot, like this: if(something) { //indented 2 spaces; if(something else) { //indented an additional 2 spaces; } else { //still indented; } } else { //outside of the other if statement, go back to just 2 spaces; } //and end the if with a 2-space-indented bracket See how nicely organized that is? Of course, that's just my way, everyone has their own, some people use tabs, I find it takes up too much horizontal space.
  7. So basically if there's duplicate IP's you only want to print one of each? You could do that like this: while($REQUEST = mysql_fetch_assoc($QueryReturn)) { $ip[] = $_REQUEST['shout_ip']; } $ips = array_unique($ip); foreach($ips as $ip) { echo $ip; } It's a little more code, but basically what you're doing is creating a new array with just the ips in it, then you run it through array_unique() to remove duplicate entries, then you loop through it and print each value. EDIT: There is another way, I think. Just change your query to this: $QueryReturn = mysql_query ( 'SELECT DISTINCT `shout_id`, `shout_ip`, `shout_ban`, `shout_ban_datetime` FROM `shout` WHERE `shout_ban` = "1" ORDER BY `shout_id` GROUP BY `shout_ip` DESC ' ); I'm not 100% sure, but I think that will only pull 1 of each unique value from the database.
  8. My bad, I actually figured it out shortly after posting this. Basically I just made an array of useragent strings from common search engines and crawlers, then did something like this: $query = (in_array($useragent, $disallow)) ? "" : "[query for +1 click]"; mysql_query($query); It works, and I can add new useragents to the array any time I want, which helps make it versatile.
  9. I have a click counter on my site that...well, counts the number of clicks a link gets on the frontpage. It's a good system, but it's got a few flaws, an example being that it counts "clicks" from search engines and crawlers. Since the most common of these is Google, I'd like to start by ignoring clicks from Googlebot. I still want to redirect the bot like normal, I just don't want to count it's access of the click counter URL. How could I go about doing that? I'm having a hard time figuring out what Useragent or IP range Google uses.
  10. I kinda figured it out. Sorta: $url_replace = array("\"", """, "'", ",", ":", ";", ". ", "! ", "? ", "*", "/ ","/", "(", ")", "+", "-"); $urltitle = strtolower($info['news_title']); $urltitle = str_replace($url_replace, "", $urltitle." "); $urltitle = str_replace("...", " ", $urltitle); $urltitle = str_replace(" ", "-", trim($urltitle)); Basically I make the string lowercase, replace all the characters in the array $url_replace, replace the "..." character group with a space, then replace spaces with a trim()'ed version of $urltitle. It seems to work, there are no duplicate dashes, and from what I can tell no missing spaces either.
  11. Ok, I worked a bit on the code. There are no word replacements yet, but I replaced all punctuation characters using an array of those characters. Here is my current code: $url_replace = array("\"", """, "'", ",", ":", ";", ". ", "! ", "? ", ".", "!", "?", "*", "/"); $urltitle = strtolower($info['news_title']); $urltitle = str_replace($url_replace, "", $urltitle." "); $urltitle = trim(str_replace(" ", "-", $urltitle), "-"); This will replace strings like "New Forum: Game Cutscenes" with "new-forum-game-cutscenes", so that's all good, but it has trouble with things like elipses, where it replaces all the periods with nothing, making something like "JTV changes suck...just sayin" look like this "jtv-changes-suckjust-sayin". As you can see that's a problem. Can anyone think of a way to fix it? And if not, then I also tried this: $urltitle = preg_replace("#[\W_]#", "", $urltitle); For matching non-alpha-numeric characters and underscores...unfortunately it also matches spaces. I can't think of a way to make it not match spaces but still match the rest of the characters. Oh and titles like this "Halo 3 ODST / Halo Reach Media" replaces to this "halo-3-odst--halo-reach-media" with the double dash, I need that fixed, too.
  12. There has to be a better way. There are so many characters to replace, I don't want to manually type them all. There's periods, colons, semicolons, commas, exclamation points, question marks, asterisks, quotes, apostrophes, and a ton of others. Not to mention things like ellipses (...) that I'm finding difficult to replace. There has to be some function to simplify it.
  13. I'm looking for a simple way to simplify a string of text (used as a title) to be used in a mod_rewrite url. Here's the code I'm using: $url_remove = array("-and-", "-of-", "-a-", "-the-", "-to-", "-for-", ".", ":-"); $urltitle = strtolower($info['news_title']); $urltitle = str_replace(" ", "-", " ".$urltitle." "); $urltitle = str_replace($url_remove, "", " ".$urltitle." "); And here's an example title: New Forum: Gaming Cutscenes I need it to replace it with this: new-forum-gaming-cutscenes instead it replaces it to this: -new-forumgame-cutscenes- Obviously something is going amiss somewhere. How can I go about removing words that search engines don't find relavant (like and, or, for, etc...) and then replace spaces with dashes (-)? Thanks in advance!
  14. That's exactly what cags just said. No, he said "Technically speaking you don't have to include the topic id in the URL providing you ensure the end part of the URL is unique for each topic." I said "wouldn't I have to include the topic ID in the URL?" He said I didn't have to, I said I thought I did. I can't think of a way to make 2 similar or same names different, it wouldn't hurt anything to have the topic id included, so I'll just do that. Makes no difference. Good, I'll just use php then.
  15. For topics wouldn't I have to include the topic ID in the URL? The names can be fooled by having two topics with close enough names to each other, by having the topic ID in there it eliminates all possibility of it going to the wrong topic. For the forums I could just do the same thing: http://infectionistcom/view/forum1/infectionist_machinima_news.html And while we're on that subject is it better to use .html or .php as a file extension? I mean, I know it's all fake anyway, but I'm partial to using php, dunno why. Will it make a difference to search engines?
  16. Ok wait, I just realized, the htaccess wouldn't have to be dynamically generated, I would just have to make the url something like this: http://infectionist.com/forum/view/topic1784/slow-motion-bullets.html That way the information it would get is from the view/topic1784, and the "filename" could be anything. I would control that from the php for the forum, not the htaccess, the only part that would really matter is the view/topic##, right?
  17. I tried goodle and it's failed me, or maybe I failed it, who knows. I was wondering if there was any way to dynamically generate an .htaccess file. The reason I want to know is so that I can use it to rewrite links for my forum to include the name of the topic in the url, for example: http://infectionist.com/forum/viewtopic/slow-motion-bullets.html instead of: http://infectionist.com/forum/viewtopic.php?t=1784 I know it's gotta be possible, and I know I could just do a simple rewrite to make the urls like this: http://infectionist.com/forum/view/topic1784.html But I want google to be able to crawl the url's better and cache the content more efficiently. Effectively I want to improve my site's SEO, and this will help. Can someone help me out?
  18. Uhm...idk how you work out that 1 bungie MINUTE is 10 minutes...last I heard 1 bungie minutes is, you know...1 MINUTE! And the Bungie Render to Video feature is only available to players who have Bungie Pro, which costs like, 800 MS points. Some people don't want/need Pro, they only want to record a few clips here and there. That's what my service is for. And also, I started the idea for my service before Bungie introduced or even announced Render to Video, so yeah, there's that too. And yes, darkfreaks, like daniel said, only the frontend is done. When it's completed submit.php will not do anything unless a POST array is passed to it with the proper values. If the proper values are not submitted, it will not get saved. I needed an output for debugging, so testers could post that returned array and I could see if there were any issues. It worked perfectly for what I needed and helped me fix a lot of problems. Course I haven't worked on this for some time, and don't know when I will again, I have to be in the mood to work on it, really.
  19. Is there a way to do it without flash/java?
  20. I have jQuery, but it doesn't remotely relate to the question I was asking. As far as I know jQuery doesn't have any ability to perform push delivery via AJAX. How does IRC do it? Like website-embedded IRC clients? I've been going to this site called justin.tv for a month or so now and they've got a chat box that's IRC-based and has instant updates. I'm pretty sure it doesn't use flash, but I might be mistaken. I might just have to resign myself to the fact that I'll have to update it every 5 or 10 seconds. I suppose that's ok. I mean, you're not getting much data, so I think I can handle that.
  21. No...I'm asking: Sorry, thought that was pretty clear. Push delivery basically keeps a connection alive to the database and when new data is put into the database, it's automatically pushed to the client's browser, instead of the broswer pulling it from the database.
  22. Bleh flash, I don't know flash. Ok, I'll get started on the AJAX then. One quick question, is there an easy method of push delivery with AJAX, so that I don't have to check for updates every 5 seconds, but rather when a new post is made it's automatically sent to all browsers? I've been looking online but I can't find how to do it.
  23. I'm helping a friend build a chat script (as part of a larger project) and I'm looking for a nicer way of deleting individual posts from the chat. Currently I have it check against current userdata to see if the logged-in user is an admin or chat mod. If he is then it prints a little red x next to each chat post, to delete that post. The little red x is a link that sends you to chat.php?action=deletepost&postid=#, where # is the chat_id identifier in the database. It works, but it's ugly, because from then on the URL will read chat.php?action=deletepost&postid=#, which might cause issues when the person refreshes. I was trying for some sort of dynamic form printed before the loop that prints all the chat responses, something like this: echo "<form name=\"deletepostform\" method=\"POST\" action=\"chattest.php\">"; echo "<input type=\"hidden\" name=\"action\" id=\"action\" value=\"deletepost\">"; echo "<input type=\"hidden\" name=\"postid\" id=\"postid\" value=\"\">"; echo "</form>\n\n"; Then in the loop that prints the chat posts I could print a link like this: <a href=\"".$_SERVER['PHP_SELF']."\" onclick=\"javascript:document.deletepostform.postid.value='".$row['chat_id']."';document.deletepostform.submit();\" title=\"delete post\"> which SHOULD set the value of the form's postid field to the current post id, then submit that form...unfortunately this doesn't work everytime. In fact it never works on the first click, I have to click it multiple times to get it to work. I'd like to stay away from printing a new form for each chat item, since I'd need unique names for each one and I don't like that. Basically I need a way to submit POST data without using a form. Is this possible? I know that I can use REQUEST or GET but I don't like that since like I said, the url will be messed up after that. I want the URL to always stay at chat.php. Eventually I will be changing this all to AJAX, which will simplify things a LOT, but right now I just need it working how it is. Can anyone help me out?
  24. Hey, I moved all the files from a certain folder on my main domain, to a new subdomain. Unfortunately since the site's been in operation for 3 years now there are plenty of links around the web that point to the old location. I wanted to set up an .htaccess file that would take all requests for files in the folder and send them to the subdomain, where all the files will be moved to. I had it working with a subfolder test, but when I tried to change it a little I couldn't get it to work how I needed it. Basically the old folder was called /movies, and the new subdomain is media.infectionist.com. If, for example, there is a link to the file testvid.wmv that points to the /movies folder, I want it to automatically redirect to media.infectionist.com/testvid.wmv. I also have a subfolder in the movies folder that I want to go to a different subdomain than the other files are going to, I want this subfolder, /cutscenes, to go to cutscenes.infectionist.com instead. Here is the .htaccess I have so far: RewriteEngine on RewriteRule cutscenes/(.*)\.(wmv|mp4|mov|png|jpg) http://cutscenes.infectionist.com/$1\.$2 RewriteRule (.*)\.(wmv|mp4|mov|png|jpg|scr|exe) http://media.infectionist.com/$1\.$2 So any request that tries to get a file inside the /cutscenes folder should be directed to cutscenes.infectionist.com, and any other request should go to media.infectionist.com, right? Well, it's not working. Since I've already deleted the files from the /cutscenes folder, they're just giving a 404 error. When I try to call a file from the regular /movies folder, it just plays it from that folder and doesn't redirect to the media subdomain. Why is this happening? I thought I had it in the right order, but it shouldn't matter because either way I have it it still doesn't work. Can someone PLEASE help me figure this out! I really want to clean up my movies folder. In fact it'd be perfect if I could just delete the movies folder alltogether and have this .htaccess reside in the root of my main domain. Thank you all in advance. Edit: if I remove the RewriteRule (.*)\.(wmv|mp4|mov|png|jpg|scr|exe) http://media.infectionist.com/$1\.$2 line from the .htaccess then the cutscene redirect works...but not the other movies. If I remove the RewriteRule cutscenes/(.*)\.(wmv|mp4|mov|png|jpg) http://cutscenes.infectionist.com/$1\.$2 line then the media redirect works, but not cutscenes. Is there a way to get them to work together?!? The only thing I can think of is to have this .htaccess redirect all requests to media, then have another htaccess in the media subdomain that redirects cutscene requests to the cutscene subdomain, but that seems like it would be overkill. Is that what I have to do?
  25. highlight and unhighlight functions never return a value, they perform a...FUNCTION? Wow. rmw_jslib.js is only used on the forum, therefore isn't even in the source code for the capture.php page, therefore plays absolutely no part here. array() loop is vulnerable!?! What the hell, where do I have an array() loop?
×
×
  • 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.