PC Nerd
Members-
Posts
1,122 -
Joined
-
Last visited
Never
Everything posted by PC Nerd
-
if its about the string stuff, soz i dont blame you instead of going "UPDATE players SET blah blah blah = $variable", use: "UPDATE players SET blah blah blah = ".$variable; good luck
-
can you mark this thread as SOLVED using the mod at the bottom of the page it helps
-
i dont know much about the _result, but look at actually getting the array mysql_fetch_array, and looping through that i think thats the more popular way of doing it, and i know whats how id do it, but i dont know for certain, i dont use _result. good luck
-
um, not sure is this helps, or if php has this sort if thing, but look for string indexing ( i know slicing exists ) you may have to write a function manually, but it should be possible. id go something like incrimenting a number, then corisponding that to the string indexing if you ned more help, ill try to come up with something, but i cant garentee itll wrk, i dont do much string slicing at all ( in fact, i only know the theaory behind i) good luck pm me if you need more help
-
ok, well instead of gooing: ";skdjfghlskdjfhg $VARIABLE fkdghsldfkjghslkjdfgh" use "aksjdfhalkjgh".$VARIABLE.",khdgksjdghkjagf"; also, do you have to include the database connection variable for the query, i use mysqli and that requires it??? if that doesnt work. where you have a calculation, actually store the result of the calculation in another variable and use that variable for the string. good luck
-
yes thatw completely correct ( assumeing that you used the % deliberately as wildcards) ????
-
***bump***
-
please???
-
if you know windows well, its exactly like a scheduled task. you tell it where the script is, and when and how often to run it and it does it. your server may or may not offer cron tobs aka cron tabs. youll have to look into it. either you submit a user friendly form, or you have to code it manually youreflt, in which i recommend googl for a quick tutorial. goodluck
-
anyone????
-
there are plenty of threads about crons, but the basics are: if you run windows, its exactly like a "scheduled task may hosts offer them, and its as simple as telling them where the script is, and how often to run it......... or you may have to code the cron your self, in which google would be the best place to get a quick tutorial........ you can simply set it to run every week, day, month, what ever you like, and even at specific times during the day....... so simply write your script, and "cron" it
-
ok, the output is in B_A-Base.php, yet another page. all of these files are included in the Login4.php file ill post the code below ( thats where $DB_Login comes in) <?php $username = $_POST['User_Name']; $password = $_POST['Password']; $valid = $_POST['Valid']; #echo "Username: {$username}<br>Password: {$password}<br>Valid: {$valid}<br><br>"; //echo out the values to see if they are being sent. $Error = ""; $Error1 = ""; $Error2 = ""; $Error3 = ""; $Error4 = ""; if($username != "" && $password != "" && $valid != "") { require('inc_files/Login_Pics.inc'); $img = "B_A-Login_".$_POST['IMG_Valid']; $Image_Validate = $IMAGES["$img"]; if($_POST['Valid'] == $Image_Validate) { require("inc_files/Database_link.inc"); $SQL_Login = "SELECT User_Name, `Password`, User_ID FROM General_Stats WHERE User_Name = '".$_POST['User_Name']."'"; $Login_Query = mysqli_query($DB_Server, $SQL_Login); if(!empty($Login_Query)) { $DB_Login = mysqli_fetch_array($Login_Query); if($DB_Login['User_Name'] == $_POST['User_Name'] && $DB_Login['Password'] == $_POST['Password']) { require("inc_files/B_A-Login.inc"); header("Location: B_A-Base.php"); } else { $Error = True; $Error4 = True; } } else { $Error = True; $Error3 = True; } } else { $Error = True; $Error2 = True; } } else { $Error = True; $Error1 = True; } ?> HTML FORMATING HERE <?php #echo "<form name = 'Login_Relocation' action = 'B_A-Base.php' method = 'POST'>\n"; #echo "<input type = 'button' name = 'relocation' value = 'Play Battle-Ages'>\n"; #echo "</form>"; #echo "<a href = 'B_A-Base.php' alt = 'Base'>Player Battle-Ages</a>\n"; if($Error1 == True) { die("ERROR 1 You have not filled in the log in fields. Click <a href = 'B_A-Home.php' alt = 'Home'>here</a> to return to the Home Page."); } if($Error2 == True) { die("ERROR 2 You did not type in the correct validation image. Click <a href = 'B_A-Home.php' alt = 'Home'>here</a> to return to the Home Page."); } if($Error3 == True) { die("ERROR 3 There was an error in the Database. You have not been logged in. Click <a href = 'B_A-Home.php' alt = 'Home'>here</a> to return to the Home Page.");#.mysqli_error($Login_Query)); } if($Error4 == True) { die("ERROR 4 There was an error in the Database. You have not been logged in. Click <a href = 'B_A-Home.php' alt = 'Home'>here</a> to return to the Home Page.");#.mysqli_error($DB_Login)); } ?> thats the login file, or Master file that all the other stuff is included in thankx for your help.......... PS i am getting the output from the cookies in the next page, where the login is redirected after its logged in, seting cookies etc. thankyou
-
ok, if your saying that the new variable would be called "varz" then ill have to think about it, or if your simply adding the two variables together, and rigging so it always == 1 please let me know
-
well try unset( at the end of the while) and also look at whether or not the query is actually returning anytihng....... good luck
-
ok, i have no idea in what your saying...l could you please expand and explain please
-
um, im setting 3 cookies but theyre all storing the current timestamp, and theres some other cookie that i used to use, but no longer do, its still there this is my code $User_Name = $_POST['User_Name']; $User_ID = $Login['User_ID']; $Login_ID = $Login['Login_ID']; #$Logged_In = "YES"; #$Active = "Yes"; setcookie("User_Name", $User_Name, strtotime('+ 30 minutes')); setcookie("Login_ID", $Login_ID, strtotime('+ 30 minutes')); setcookie("User_ID", $User_ID, strtotime('+ 30 minutes')); thats the contents of the create cookies inc this is the login file <?php $now = date("U"); #echo $now; $Login_SQL = "INSERT INTO Login_Records (User_ID, Logged_In) VALUES ('".$DB_Login['User_ID']."', '".$now."')"; $Login_Query = mysqli_query($DB_Server, $Login_SQL); # or die("Could not Login. Please try again later"); unset($Login_SQL, $Login_Query); $Login_SQL = "SELECT User_ID, Login_ID FROM Login_Records WHERE User_ID ='".$DB_Login['User_ID']."' AND Logged_In = '".$now."'"; $Login_Query = mysqli_query($DB_Server, $Login_SQL) or die("Could not login. Please try again later"); $Login = mysqli_fetch_array($Login_Query); ?> can anyone see whats happening this is the output when i echo the contents of the cookies ( through a foreach ) User_Name => 1176012801 Logged_In => 1176012801 Login_ID => 1176012801 User_ID => 1176012801 thankx
-
ok, look intot the time functions eg $now = time(); if($then > strtotime("5 minutes ago")) {delete} becauase the time is like an integer, its simply saying if its older than 5 minutes ago, then delete
-
um, from memory, look at the strip_char() function, althpough thats prolly nt its name. thers a function that finds special characters ie "<>?,./;':"[]\{}| etc and the whitecpase, the replaces then with their something or rather name ie which is the whitespace from memory goo dluck i hope thats what you were looking for
-
um, theres anothe thread on page 2, 3, or 4 on this, look into it but the essence is $now = strtotime("now"); $then = strtotime("5 minutes ago"); if ($pag4e['time'] >= $then) { echo now."<br>"; DO STUFF echo "Record was older than".$then; } goo dluck
-
not sure but the delete should be a drop wuery shouldnt it??? not sure though good luck
-
to actually do the email stuff if($then => $now) { $set _mail_param = "EMAIL BODY"; # set email params etc here mail($params_in_here); #id write to a database that the email was sent $now; } # then id check if the email was sent 30 days abo, then id suspend account or something if( $mail_time =< $then) { #youd do other stuff to get then and now do stuff to database to the account_status field or something } pm me if your confused good luck
-
to insert a new row, its: INSERT INTO Table_Name (field names here) VALUES (values corrisponding order to field nams) thats only from memory, but i think its right good luck
-
yeah. please expand on your queswtion, is it code that your looking for ( WE WILL NOT CODE IT FOR YOU ), or tutorials, or just examples, or is it opensource installers like forums ( phpbb or SMF) what is you want? thankx
-
[SOLVED] Automatically make text into a link
PC Nerd replied to christo16's topic in PHP Coding Help
ok this is an example of how id do it function link_string($val) { $link_format1 = "<a href = '"; $link_format2 = "' alt = '"; $link_format3 = "'>"; $link_format4 = "</a>\n"; $new_link = $link_format1.$val.link_format2.$val.$link_format3.$val.$link_format4; return $val ### not sure about the return, but its either that or return($val) try it and see } foreach($_POST as $key => $val){ $new_val = link_string($val); $_POST[$key] = $new_val; } that code turns avery value in the array into a link... simply change the foreach stuff to select individual elements hope it helps -
um, not sure but try $var = 1 OR 0 ## whatever if ($var == 0) OR if($var == 1) good luck