Jump to content

ILYAS415

Members
  • Posts

    292
  • Joined

  • Last visited

Everything posted by ILYAS415

  1. ILYAS415

    help

    hehe lol post your full code
  2. Heres a modified version of your script to check if that id exists... if($a == 'delete') { $id = $_POST['id']; if (is_numeric($id) == false){ //PROVIDES SOME SECURITY print "Invalid Id"; }else{ $check= mysql_query("SELECT * FROM adminrecord WHERE `id`='$id'"); $check_num= mysql_num_rows($check); if ($check_num == "0"){ print "Record could not be found"; }else{ mysql_query("DELETE FROM `adminrecord` WHERE `id`='$id'") or die (mysql_error()); print "Record Deleted! <a href='chartview.php'>Return to Admin Chart</a>"; }}}
  3. try... if($a == 'delete') { $id = $_POST['id']; mysql_query("DELETE FROM `adminrecord` WHERE `id`='$id'") or die (mysql_error()); print "Record Deleted! <a href='chartview.php'>Return to Admin Chart</a>"; } 1second your code in insecure asweel vunerable to sql injection
  4. Hey thanks! Okay its telling me htat no database is selected so ill fix that. Thanks again.
  5. Okay when i run my script i get a serious error. The page tells me that... Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/username/public_html/game/index.php on line 23 Heres my query at line 22 and my function at line 23... $user= mysql_query("SELECT * FROM `users` WHERE `username`='$username' AND `password`='$password'"); $usernum= mysql_num_rows($user); The query works for me on the database when i run it but not on this script. For a test of this script go to... THIS URL I would appreciate it alot if anyone can help. Note: Ive checked my database and all the columns and tables im looking for are valid and exist.
  6. Hey everyone im curious about a certain php function.... The function is called... __halt_compiler(); Okay i looked it up on http://ca.php.net/halt_compiler but i couldnt understand a word being said (im onli 15 ) Anyway im wondering, does it compress all the php files you have and then create a .zip file or something in that directory? Thanks,
  7. Hmm just realised that code only works in Mozilla... hmmmm. 1sec im just playing around with some codes
  8. Nope still not working :S comes out as.... Ilyas415 - /me message here instead of ilyas415 message here
  9. Or you could be more specific and use... <html> <head> <title>Price calculator</title> </head> <body> <?php $length = $_POST["length"]; $height = $_POST["height"]; $price = $_POST["price"]; $total = $_POST["total"]; ?> <p><img src="Phil/images/b_spiderman.gif" height="100"></p> <form method="post" action="<?php echo $PHP_SELF;?>"> <p>Length: <input type="text" name="length" id="length"> <br> Height: <input type="text" name="height" id="height"> </p> <p> <input type="submit" value="submit" name="submit"> </p> </form> <?php if(strip_tags($_POST['length']) && strip_tags($_POST['height']) && strip_tags($_POST['submit'])){ //NOTE THAT $_POST['length'] OR $_POST['height'] IS FROM THE INPUT FIELDS NAME //if u use cooldudes and ur using more than one form on a page //you'll run into problems // set the PRICE to the square footage cost of the inserts $price = 0.25; $total = $length * $height * $price; echo "Your inserts are an estimated cost of $ $total"; } ?> </body>
  10. Another way to do it is simply by doing something like this... Forum/website name > $forum > $category > Text here or maybe even if your viewing a thread... $threadname All you'll need to do is assign the variables before that text. e.g. by using $_GET probably?
  11. Nope not working... :S heres my code im using... if (strpos($msg, "/me") === "0"){ $msg= str_replace("/me", "", $msg); $out="$chattext ".ucfirst($fetch->username)." <font color=white>$msg</font><br>"; }else{ $out = $chattext . $n . " - " . $msg . "<br>"; $out = str_replace("\'", "'", $out); $out = str_replace("\\\"", "\"", $out); } $out= chat($out); Thanks again
  12. hmmm i would try.... include "../top.php"; //means go up a level and find top.php include "../bottom.php"; If that doesnt work tell us the error wihch your getting
  13. Barand your code didnt appear to work for me. phpSensai im not sure how exactly to use the function your gave me. Can you please give me a snippet based on the example i gave? hmm im considering bbcodes as my last option.
  14. Hmm im not entirely sure what your trying to do (the replies confused me) sooo here it goes.... Okay im thinking that your trying to make a select box from which the user can select different ways to view results... heres my way.... <select name=orderby> <option value="-">Select one...</option> <option value="date" onclick="window.location='?orderby=date';">Date</option> <option value="price" onclick="window.location='?orderby=price';">Price</option> <option value="id" onclick="window.location='?orderby=id';">ID</option> </select> <? if (isset($_GET['orderby']){ $orderby= $_GET['orderby']; }else{ $orderby="date"; } //CHECKING TO SEE IF THE PERSON HAS CHOSEN TO ORDER BY A CERTAIN FIELD $sql= mysql_query("SELECT * FROM table ORDER BY $orderby DESC"); //SQL QUERY CAN BE MODIFIED EVEN MORE //WHATEVER ELSE YOU WANT ?> Hope that helps. I tested on my own server it works.
  15. Okay i'm making a chat room thing and i would like to know how check if the user has entered a certain word into his her string. Basically im trying to make a /me commad (the typical action command). I have already tried using this.... strpos("/me", $string, 1); however that means that the user can enter in.... wow the /me command is wicked and if will be seen as an action command because it got /me inside it. I only want the script to look for /me if it is in the beggining of a sentance.
  16. Well basically i had someone beta test my site and he came up with this and told me its a user enumeration... http://www.ragingmortals.com/~ragingmo/
  17. How can i prevent user enumeration on my site? I have no idea how to and when i googled it I couldnt understand the results i was given. Any help will be appreciated. Thanks.
  18. Jonnie i dont think thats right. Basically im trying to send the score variable to the php script. Also i am already posting vars to php script... getURL("flashtophp1.php", this, "POST"); thanks,
  19. Just out of curiosity, is there a MAJOR difference between the functions... mysql_fetch_array($sql); and mysql_fetch_object($sql); Id like to know because i use the mysql_fetch_object and i can see a majority of people use the array one. p.s. i no that mysql_fetch_object uses "$var->tablecolumn" and mysql_array uses "$var[0]".
  20. Yeh I'd say Nethnet's answer is the best. I used to use tutorials all the time. Then i started my own RPG text-based game. The game took me about 6months to complete believe it or not. If your looking to specialise in text based game programming you might want to look up... • ajax - a javascript tool which basically runs stuff right on the page without needing a reload • find some game scripts. Id be happy to give you some of mine to look at. • note down ideas from other games and see how you could possibly code them
  21. Okay ive been playing around with a flash game which i created. The game is integrated into an arcade for a text-based game. Okay basically im trying to get the end scores for the game and send them to a php script. The php script is then meant to process the score and see if the player is worthy enough to be credited money in the actual text-based game. Heres the code which is meant to send information to the php script: _root.finalscore=_root.score; var receiver_lv:LoadVars = new LoadVars(); receiver_lv.onLoad = function(ok){ if(ok){ message.text = receiver_lv.message; score = _root.score; getURL("flashtophp1.php", this, "POST"); }else{ message.text = "There was an error!!"; } } receiver_lv.load("flashtophp1.php"); Okay and heres the php script which then processes it: <? $username= $_SESSION['username']; $score= $_POST['score']; //OKAY THE PROBLEM IS THAT THE SCRIPT READS THE POST VAR AS EMPTY if ($score < "100"){ $msg="You need 100 to win a prize! your score was $score $username"; }else{ $money= $score*5; $msg="You earned £$money ".ucfirst($username).""; mysql_query("UPDATE users SET money=money+'$money' WHERE username='$username'"); } echo "&message=$msg $score"; ?> Well the problem is that the $_POST['score'] var is empty.
  22. Okay Hi. I have a problem with a chat script. Basically when someone enters a string and somewhere in the string the use a # character, then there actualy name there using doesn't appear only the message they were typing in appears. Example:- normally when someone types something in it comes out like this... When they use a hash it comes out like this:- The hash does not appear in the string though. Heres the coding for the script im using... <?php /* author: chris at linuxuser.at licence: GPLv2 */ require_once "includes/db_connect.php"; include_once "includes/functions.php"; include_once "includes/smile.php"; logincheck(); $username= $_SESSION['username']; $fetch= mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'")); $fn = "chat.txt"; $maxlines = 18; $nick_length = 10; /* Set this to a minimum wait time between posts (in sec) */ $waittime_sec = 0; /* spam keywords */ $spam[] = "nigger"; $spam[] = "cum"; $spam[] = "dick"; $spam[] = "EAT coon"; $spam[] = "bitch"; $spam[] = "fuck"; $spam[] = "whore"; $spam[] = "sex"; $spam[] = "slut"; $spam[] = "cock"; $spam[] = "bastard"; $spam[] = "motherfucker"; $spam[] = "hoe"; $spam[] = "tits"; $spam[] = "boobs"; $spam[] = "breasts"; $spam[] = "penis"; $spam[] = "arse"; /* IP's to block */ $blockip[] = "72.60.167.89"; /* spam, if message IS exactly that string */ $espam[] = "ajax"; /* Get Message & Nick from the Request and Escape them */ $msg = $_REQUEST["m"]; $msg = htmlspecialchars(stripslashes($msg)); $msg = str_replace("#", "", $msg); $msg = stripslashes($msg); $n = $_REQUEST["n"]; $n = htmlspecialchars(stripslashes($n)); $n= str_replace("#", "", $n); $n= stripslashes($n); if (strlen($n) >= $nick_length) { $n = substr($n, 0, $nick_length); } else { for ($i=strlen($n); $i<$nick_length; $i++) $n .= " "; } if ($waittime_sec > 0) { $lastvisit = $_COOKIE["lachatlv"]; setcookie("lachatlv", time()); if ($lastvisit != "") { $diff = time() - $lastvisit; if ($diff < 5) { die(); } } } if ($msg != "") { if (strlen($msg) <= "2") { die(); } if (strlen($msg) >= "3") { /* Smilies are ok */ if (strtoupper($msg) == $msg) { die(); } } if (strlen($msg) > 150) { die(); } if (strlen($msg) > 15) { if (substr_count($msg, substr($msg, 6, ) > 1) { die(); } } foreach ($blockip as $a) { if ($_SERVER["REMOTE_ADDR"] == $a) { die(); } } $mystring = strtoupper($msg); foreach ($spam as $a) { if (strpos($mystring, strtoupper($a)) === false) { /* Everything Ok Here */ } else { die(); } } foreach ($espam as $a) { if (strtoupper($msg) == strtoupper($a)) { die(); } } $handle = fopen ($fn, 'r'); $chattext = fread($handle, filesize($fn)); fclose($handle); $arr1 = explode("\n", $chattext); if (count($arr1) > $maxlines) { /* Pruning */ $arr1 = array_reverse($arr1); for ($i=0; $i<$maxlines; $i++) { $arr2[$i] = $arr1[$i]; } $arr2 = array_reverse($arr2); } else { $arr2 = $arr1; } $chattext = implode("\n", $arr2); if (substr_count($chattext, $msg) > 2) { die(); } $msg="<font color=orange>".ucfirst($msg)."</font>"; if ($fetch->userlevel == "0"){ $n="<font color=lightblue>".ucfirst($n)."</font>"; }elseif ($fetch->userlevel == "0.5"){ $n="<font color=#f8ff6a>".ucfirst($n)."</font>"; }elseif ($fetch->userlevel == "1"){ $n="<font color=#71f8ff>".ucfirst($n)."</font>"; }elseif ($fetch->userlevel == "2"){ $n="<font color=#ff6464>".ucfirst($n)."</font>"; }elseif ($fetch->userlevel == "3"){ $n="<font color=#7cff5b>".ucfirst($n)."</font>"; } $out = $chattext . $n . " - " . $msg . "<br>"; $out = str_replace("\'", "'", $out); $out = str_replace("\\\"", "\"", $out); $out= chat($out); $handle = fopen ($fn, 'w'); fwrite ($handle, $out); fclose($handle); $timenow= time() + (60 * 5); mysql_query("UPDATE users SET chatonline='$timenow' WHERE username='$username'"); } ?> Thanks, im in a rush because i have to go work now. Thanks, i tried to keep it as simple as possible.
  23. Okay ive fixed the problem i finally found a piece of coding on the internet which let me scroll down continiously but now im a bit stuck. Basically on firefox when i visit the page the div textbox almost appears to continiously shake or refresh which it doesn't do on ie5. Any ideas?
  24. Hey hi people. I need help with a DIV textarea html code. Basically what the code does is creates a scroll so the visitors can scroll down a chat kind of thing. Im trying to make the scoll start at the bottom and continue to scroll to the bottom of the DIV textarea. Heres my code:- <div align="center" id="chatwindow" style="overflow:auto; height:300px; width:99%; text-align:left;"> </div> I can't seem to find any codes for the textarea to scroll it down but the closestone ive gotten to is... function scrollToBottom(el) { el.scrollTop=el.scrollHeight; } scrolltoBottom(chatwindow); I really need someone to tell me how i could do this Thanks.
  25. Thanks Red arrow that sounds like a solution thanks. The rest were too complicated or would've been too hard/long.
×
×
  • 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.