Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
I've been teaching myself PHP and have seen people using the syntax, "? :". I assume it is an alternative for a condition statement but I have been searching Google and can't find an explanation. Example: $port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : ''; Please explain.
-
Try to integrate your forums into your design. I just think it looks tacky when you have a bunch of pages that look the same then when you click on "forums" a whole other style shows. Besides phpBB is very easy to customize.
-
Yes, you can explode the string with the delimiter being a space (" "). Then loop to 20 storing these words into another string then display the new string in the description.
-
Try echoing out some of your vars to see if there is actually values, or correct values, in them. Also, if you surround your code with the <?php ... ?> then in the code tags it will be easier to read.
-
In your second function echo out $webcleaned and see if anything is there. You should also initialize $webcleaned at the beginning of your function. function chk_webs($urlcheck) { $webcleaned = ""; // BAD URL submission blocking. $urlcheck = ereg_replace("@"," ",$urlcheck); echo $urlcheck; echo "this function is working"; $webcleaned = $urlcheck; echo '$webcleaned: ' . $webcleaned; return $webcleaned; }
-
Sounds like you need to learn CSS, but I'm not exactly sure what you're asking... Please elaborate.
-
Like I said in your other thread, post some code...
-
Could you post the code please?
-
Yes, you should have a primary key for the cities (id), and a column for the city name in the city table. Your tables should look something like this: Players Table id name city_id 1 tim 7 2 jim 3 3 bob 10 City Table id name 1 Philadelphia 2 Chicago 3 New York So now when you look up players you can reference their city_id and find it on the City Table. Yes. It depends how you want to do this but I recommend just passing a variable with the $_GET[''] method. For example, you could pass the city_id through via the URL with $_GET. Wherever you call this page use: $cityID = 1; Click here for the next page... That way when you get to the "page_name.php" you can retain the variable $cityID by simply doing: echo 'City ID: ' . $_GET['cityID']; That will display, "City ID: 1". I probably went off on a tangent, hope this answers your questions though.
-
Did you mean different players according to what city they're in? Because seems to me you can only be in 1 city at a time... If this is the case then you should get the ID of both players and check to see if they're in the same city... $results = mysql_query("SELECT city_id FROM player_table WHERE player_id = ".$player1.""); $data = mysql_fetch_array($results) $player1_city_id = $data['city_id']; $results = mysql_query("SELECT city_id FROM player_table WHERE player_id = ".$player2.""); $data = mysql_fetch_array($results) $player2_city_id = $data['city_id']; if($player1_city_id == $player2_city_id) { echo 'fight!'; } else { echo 'throw error'; } ?> This probably isn't the best way to do it but you get the idea. Hope this helps!
-
$status=$_GET["status"]; if ($status=="loggedout") { unset($_SESSION["User_Id"]); unset($_SESSION["User_Name"]); unset($_SESSION["Pwd"]); unset($_SESSION["Account_Type"]); unset($_SESSION["loggedIn"]); header("login.php"); } ?> $_SESSION["user_name"]=$_POST["login"]; $_SESSION["pwd"]=$_POST["pwd"]; $connected=$_POST["connected"]; if ($connected=="True") { //When user has pressed the connection button mysql_select_db($database_N_DB, $NOSA_DB); $query_User_accounts = "SELECT * FROM user WHERE user_name LIKE '".$_SESSION["user_name"]."' AND P_word='".$_SESSION["pwd"]."'"; $User_accounts = mysql_query($query_User_accounts, $N_DB) or die(mysql_error()); $row_User_accounts = mysql_fetch_assoc($User_accounts); $totalRows_User_accounts = mysql_num_rows($User_accounts); if ($totalRows_User_accounts==0) { // Testing if login is correct $message=" - Incorect Login/Password - "; echo $message; } else { $_SESSION["loggedIn"]=1; echo "Connected"; } // If End for Correct Login mysql_free_result($User_accounts); } //If end for connected button pressed if (!$_SESSION["loggedIn"]) { //if not logged in ?> <br /> td img {display: block;}<br /> </pre> <table width="98%" border="0" cellspacing="0"> User Name: Password: </table> <br>} else {<br>echo "<a href="'login.php?status=loggedout'" rel="">Log Out[/url]"; } ?&g Sorry, I don't have a good answer for this but a tip you should use "[.code]code here...[./code]" (without the period). Also for some reason the code tags don't pick up "<?php" (with the capital 'P') so I changed them to lower case.
-
First of all, I saw this ---^ in your script. Obviously you didn't write the script yourself. So I suggested you to go the the author or wherever this script originated from and ask them for help. Looks to me you didn't even attempt to code your own game. Second, typical help in these forums are for odds and ends not to write a whole game. The Freelance section is probably more suitable for this kind of request. Third, everyone else is right, the attitude you brought here is going to get you no where. The reason everyone is on these forums is to help or get help, so just relax and count to 10.
-
should be: [code] And this: [code]{ echo''; }; ?>
-
Why don't you post for help where you seem to have gotten the code from? http://www.bbgamezone.com/
-
Yes it resets the ini file back to the default values. The function ini_set(); is only for the session you run your script. Read more here: http://us3.php.net/manual/en/function.ini-set.php
-
Not sure if this is a bug or you may have not got to this yet but here's what I did: I logged in on the demo name and clicked on "Add Miles" and put these values in these fields. Miles Done: asdf Reason For Travel: cause i wanted to Destination: mars Date Miles Done: asdf Clicked on "Add Miles" and it brought me to a page that said, "Miles Added Successfully Go Back" but nothing was added. I'm guessing if you don't have an incorrect type in the, 'Miles Done:' field or an incorrect date in the, 'Date Miles Done:' textfield than it just doesn't add this to the DB. Probably check these fields with some javascript.
-
Hmm good I idea. Unfortunately I'm not a SQL guru and at the moment do not have time to investigate this problem. I kind of just want to get it done. When I have time I will definitely look into this and, if I come up with something, I will post it here for all to see.
-
I briefly read some tutorials on "preg_match_all()" and don't remember anything more than making an array of matches but I could have easily overlooked it. Anyway this is the code that makes up for it to store the string after each replacement... if($i>0) { $theData = $theData2;} $pieces = explode("@", $value); $theData = str_replace($value, $pieces[0], $theData); $theData2 = $theData; Well this needs to be done by today so I just decided to run my original version. This is only a one time deal. But if I need something like this in the future I will definitely implement your suggestions and revised code. My script has been running for about 20 minutes and only has 100,000 records complete... :-\
-
Thanks for the revised code. I will implement and test it but doesn't this line of code only get you only the last replaced email. $theData = str_replace($value, $pieces[0], $theData); For example, if I had, "blah blah blah tim@yahoo.com blah blah blah george@aol.com" $theData would have the string, "blah blah blah tim@yahoo.com blah blah blah george" and tim@yahoo.com would still remain.
-
The goal is to find all email addresses and eliminate the @ sign and everything after it. Code: $connection = mysql_connect($host, $user_name, $password) or die ("Unable to connect!"); mysql_select_db($db) or die ("Unable to select database!"); ini_set('max_execution_time', '15000'); $inc = 1000; $j=0; $start = 0; $finish = $inc; echo "Starting email replacement... "; while($j { queryCall($start, $finish); $start += $inc; $finish += $inc; $j++; echo $start . " - " . $finish . " "; } function queryCall($start, $finish) { $pattern = "/\b[^@\s]+@\S+?\.[a-z]+\.?[a-z]+\b/i"; $t=0; $results = mysql_query("SELECT Body_, MessageID_ FROM messages_ LIMIT " . $start . " , " . $finish . ""); while ($data = mysql_fetch_array($results)) { preg_match_all($pattern, $data['Body_'], $matches); $theData = ""; $theID = 0; $i=0; $theData = $data['Body_']; $theID = $data['MessageID_']; $t++; foreach($matches[0] as $value) { if($i>0) { $theData = $theData2;} $pieces = explode("@", $value); $theData = str_replace($value, $pieces[0], $theData); $theData2 = $theData; $i++; } $theData = mysql_real_escape_string($theData); mysql_query("UPDATE messages_ SET Body_ = '" . $theData . "' WHERE MessageID_ = " . $theID . ""); } } ?> Example: Contact was made -----Original Message----- From: Tim M [mailto:timm017@yahoo.com] Sent: Wednesday, August 25, 2004 10:31 AM To: Pearson Owners Discussion List Subject: test test --- --- You are currently subscribed to pearson as: tim@yahoo.com. To unsubscribe send a blank email to leave-pearson-196315R
-
Oh ok. Yes I know what you're talking about. I have actually indexed and done some other things to optimize my query. The fact is that I'm scanning and updating 338,000 records, that are each a couple paragraphs long. Thanks.
-
I'm sorry Mchl, what do you mean by tweaking query? Could you give an example?
-
Thanks for you responses but I found a solution to my problem. I used: ini_set('max_execution_time', '1500'); This approach changes the execution time only for the session, then restores the default time when the execution is complete.
-
I have a script that scans through over 338,000 records of text. I get a fatal error: Fatal error: Maximum execution time of 900 seconds exceeded in... Is there any way to override this connection time?
-
PHP's all ready installed but has been disabled. Is there a command or configuration to enable PHP through SSH on a linux server?