Jump to content

fxuser

Members
  • Posts

    93
  • Joined

  • Last visited

    Never

Everything posted by fxuser

  1. on my table there might be some to columns NULL so i just want to update the from from un_curr to new_un ... which causes problems... i can stick around with my 2 queries.. i dont wanna bother you much ... just want the merged query to do the same job as the 2 that i have on my first post. thanks.
  2. What happens? it sents from and to WHERE `to`='$un_curr' which is not what i want.. i want it to from='$new_un' WHERE to='$un_curr' and to='$new_un' WHERE from='$un_curr' would this work? $query1 = mysql_query("UPDATE act SET `from`='$new_un', `to`='$new_un' WHERE `to`='$un_curr',`from`='$un_curr'"); so basically the first `from`='$new_un' goes with -> WHERE `to`='$un_curr' and `to`='$new_un' goes with -> WHERE `from`='$un_curr'
  3. Thanks for the reply but the query doesnt seem to work.. so i have to add these backtics in all my queries?will check the link , thanks.
  4. hello, so i want to merge these 2 queries: $query1 = mysql_query("UPDATE act SET from='$new_un' WHERE to='$un_curr'"); $query2 = mysql_query("UPDATE act SET to='$new_un' WHERE from='$un_curr'"); how can i do it? edit : if im in a wrong section please move it.
  5. yeah i know that , i thought it was due to the folder(tmp) but i was wrong... it seems to work now.. weird. thanks.
  6. So i uploaded my files to my host and i realised that the cookies werent saved while on my pc its working fine.. i also checked if the tmp folder exists on my host and i couldnt find it.. i tried to create it and it seems i dont have permission to do so... do i have to create this file in order to make cookies work? Thanks.
  7. whats the error your getting? try SELECT * FROM mrsw_adventurer_log ORDER BY user DESC
  8. I really didnt want to... but im still searching for a solution. thanks.
  9. still havent found any answer regarding this issue. bump
  10. in your database is password column named Password or password? try changing $row["Password"] to $row["password"]
  11. what if you dont use the elseif and just use else{ //do stuff }
  12. try changing $resultfin = mysql_query($result); to $resultfin = mysql_query($result) or die(mysql_error()); so u can get a msg about the error on your query
  13. this is how the file that loads the included file is: <?php define("MAIN", "True"); include_once 'config.php'; $status = "0"; $id = sanitizeString($_GET['id']); //e.x ?id=user1 we get user1 this is how my included file starts: <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; check_un($_GET['id']); $_GET['p'] = preg_replace('#[^0-9]#i', '', $_GET['p']);
  14. i tried defining a var in the file that i include the included file and checking if the defined var exists in the included file but that does not work.. also i tried phpchamps code above .. i putted it to a php file that i include and call it on the top of the included file where also ajax tells me that i cant load the file when on ajax success
  15. Thanks for the reply phpchamps,ill try it , wouldnt a htaccess with Deny from all do the job aswell? EDIT : it doesnt allow me to direct check it with your code .. which is the same as mine with the define("main","true"); but when i go to ajax and press the button i get this: You cannot view this file directly! and doesnt allow me to load the file i want when it success
  16. In my javascript code i use ajax so i load a php file .. then on the success i have a function where i load a file there.. the thing is how can i secure it from direct access from the browser? if i type the link of the file in the browser i can access it even tho it needs other files to run so it will return me errors.. how can i disable that? Thanks. EDIT: i have tried to put if(!defined("MAIN")){ die('<tt>You cannot view this file directly!</tt>'); } on the file i want to protect but then when i call the ajax on the success the file doesnt load on the page that i call it and shows the above die();
  17. Hello, This is my javascript code: $(document).ready(function(){ $('#upd').submit(function() { $.post('php.php', $('#upd').serialize(), function(data) { $('#error').html(data).show(); if ($('#thinupd').val() > 3){ $('#act').fadeOut('slow').load('includes/my_activity.include.php').fadeIn('slow'); } }); return false; }); }); so i have 2 questions... how can i secure the pages php.php and my included file above so when i go directly to disable the users to run the code by going to the url of the file? also i do a check so if the thinupd input has more than 3 characters it will fadeout , load the included file and fadein .. which does not work.. it does work if i dont put an if statement... For the page secure i figured this out which doesnt not seem to work pretty well: if(!defined("MAIN")){ die('<tt>You cannot view this file directly!</tt>'); } if i put the above code to an included file i cant see it directly but if i try this code on the above included file i will get the "You cannot view this file directly!" inside the div i am fadingout and in ... Thanks.
  18. i would suggest you leave the html above alone and put below the php code something like <html> stuff </html <?php stuff ?> also if u want it to do the insert if the button is pressed u should do this: if (isset($_POST['submit'])){ //do php stuff }
  19. you are right... change : echo "<a href='play.php?id=".id."'>Play ".$title."</a><br>"; to echo "<a href='play.php?id=".$id."'>Play ".$title."</a><br>";
  20. So the thing is: -Get the cat id -query with sql to check if the category exists , if it does then echo all the results , if not go to errorpage -when you click on the game you want to play then check if the id of the game exist , if it does then show the flash game , if not go to errorpage so this is what i came up with: The file that you will get all the results of each category game (select.php) $dbhost = 'localhost'; $dbname = 'root'; $dbuser = 'root'; $dbpass = 'games'; $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); if (isset($_GET['cat'])){ $cat = $_GET['cat']; $get_games = mysql_query("SELECT * FROM games WHERE category = '$cat'"); $get_games_rows = mysql_num_rows($get_games); if ($get_games_rows>=1){ while ($fetch = mysql_fetch_assoc($get_games)){ $id = $fetch['id']; $title = $fetch['title']; echo "<a href='play.php?id=".id."'>Play ".$title."</a><br>"; } } else echo "Category does not exist"; } else echo "Category is not set"; this one to show the game on play.php $dbhost = 'localhost'; $dbname = 'root'; $dbuser = 'root'; $dbpass = 'games'; $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); if (isset($_GET['id'])){ $game_id = $_GET['id']; $query = mysql_query("SELECT * FROM games WHERE id = '$game_id'"); $rows = mysql_num_rows($query); if ($rows>=1){ while($fetch = mysql_fetch_assoc($query)){ $swfname = $fetch['swfname']; } //show the flash game with that name } else{ echo "game does not exist"; } } else echo "Game is not set."; Correct me for any fault.
  21. thanks both , seems i have got it to work. If anything comes up regarding this problem ill reply back soon.
  22. Hello , i am trying to sort a 2d dimensional array by the first column(id) and i havent find anything till now This is my code for the 2d array: $username = $_SESSION['username']; $c = 0; $row=1; $col=1; $users_array = array(); $get_from = mysql_query("SELECT id FROM my_activity WHERE from_user='$username'"); while($fetch1 = mysql_fetch_array($get_from)){ $id[$c] = $fetch1[0]; $get_from_user = mysql_query("SELECT * FROM my_activity WHERE id='$id[$c]'"); $get_user_rows = mysql_num_rows($get_from_user); while($guser = mysql_fetch_array($get_from_user)){ $user[$c] = $guser['to_user']; $users_array[$id[$c]][$user[$c]]= $id[$c].".".$user[$c]; $c++; } } $get_to = mysql_query("SELECT * FROM my_activity WHERE to_user='$username'"); while($fetch2 = mysql_fetch_array($get_to)){ $id[$c] = $fetch2[0]; $get_to_user = mysql_query("SELECT from_user FROM my_activity WHERE id='$id[$c]'"); while($tuser = mysql_fetch_array($get_to_user)){ $user[$c] = $tuser[0]; $users_array[$id[$c]][$user[$c]]= $id[$c].".".$user[$c]; $c++; } } This is what i get if i simply loop the array to get the result: Array ( [6] => Array ( [checkdate] => 6.checkdate ) [25] => Array ( [asdsadsad] => 25.asdsadsad ) [7] => Array ( [webuser] => 7.webuser ) [9] => Array ( [newuser] => 9.newuser ) [10] => Array ( [bot77un] => 10.bot77un ) ) I am trying to sort it by the ids 6,25,7,9,10 in DESC
×
×
  • 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.