emopoops
-
Posts
342 -
Joined
-
Last visited
Never
Posts posted by emopoops
-
-
i have a sign in check thats included in every page that is a members only page which is basically all of my pages. that im working on anyways..
but heres the code..... that works MOST of the time. which doesnt make sense to me and i will explain below what it did.
<?php session_start (); if(!session_is_registered(mysessionvariable) || $_SESSION[mod] == "") //if your variable isn't there, then the session must not be {$_SESSION = array(); session_unset(); session_destroy(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-55, '/'); } $fullurl = 'http://www.socialemo.com'.$_SERVER['PHP_SELF']; ?> <meta http-equiv="refresh" content="1;url=http://www.socialemo.com/home.php?homeredirect= <?php echo $fullurl; ?>"> <?php exit(); } else //otherwise, they are logged in & do check {$checkifrealuser = mysql_num_rows(mysql_query("SELECT id FROM users WHERE username = '$_SESSION[theusername]'")); if($checkifrealuser == 0){session_unset ();session_destroy ();exit("logged out on this computer too");}}
thats the check is does. first of all when a user signs in at my site they are given a session variable(AKA $_SESSION[mod] along with the sessions called mysessionvariable. mod NEVER IS SET TO EQUAL NOTHING it equals like a number or a word or something if u log in. i added the check if $_SESSION[mod] == "" because the other one alone didnt work all the time or something... that seemed to be working until lately i get redirected with the meta thing AND THEN I GO TO THE PAGE I CANT VIEW UNLESS IM SIGNED IN AND I CAN VIEW IT, I DONT GET REDIRECTED.? WTF?!
obviously it didnt destroy my session like it should have when it redirected me.. OR THE CHECK JUST DOESNT WORK? i dont get it.
and the other thing is ill just randomly get the message "logged out on this computer too"
which i made the second part of the script for like someone that deleted there account as was logged in on two computers at the same time... thats why it checks if the session theusername variable is in the database...?
how do i get this thing to work and why is it doing this? do i have to run a check of all of the session variable? or what?
-
yeah just use the replace function replace everything with [
-
use mysql LIKE
-
simple. u use well... u use;;
$numberofrows =mysql_num_rows(ur query here) OR the count(any column) thing in a mysql_query
to see how many rows ur going to have to output.
the u do a $thequery = mysql_query("SELECT specificcategorycolumn FROM table")
and then u do
for($i = 0; $i < $numberofrows; $i++) {$thefielddata = mysql_result($thequery, $i); echo $thefielddata;}
it will start from the first row and go to the last in whatever order u specify in the query aka ORDER BY id DESC or whatever u should know what i mean.
-
no i meant the word. u were all SELECT count(field) as the_word
like dou just make a word up and use it after "as"
?
-
wow thats complicated! i thot it was printf not sprintf
-
ok so count_age is a made up thing. that is how u get the amount from the count?
-
THANK YOU that function is just what i will use. BUT do u or anyone know about the %d\n in the thing from the php manual for that function.
/* this should return the correct numbers of deleted records */ mysql_query('DELETE FROM mytable WHERE id < 10'); printf("Records deleted: %d\n", mysql_affected_rows());
i took it out and it didnt work
-
well i just mad a point about it and someone thinks im a troll because sessions really seems like a unique way to do it if there is like going to be a pray a lot but not in one session. but i explained earlier in my previous previous. etc.. post why u would need to use database or why u would need to use session.s so condescending... i was just explaining more ok.
-
i think i was getting confused on how to output the count. cause usually i use something like $row = mysql_fetch_array($var) for getting data.
but this $row[field] is the row part buildt in or somethin i dont understand where its coming from
-
oh ok well i was just thinking if it was sucessful that meant it actually did something..
well how can i check if it did something? or better yet how can i check if it didnt do anything so i can hold off on putting out the "SUCCESS" echo
-
yeah thats what i was stating the db way
-
how to start.
-
thats the way ive been using it with the comma.
but no i still dont understand how there can be one that is mktime and time() why? its so confusing
-
lol oops. i stil dont get how to use count. i guess im just acustomed to pulling out the lowest field that has like a varchar of 1 cause count makes no sense to me
-
$flush55 = mysql_query("DELETE FROM dumps WHERE id='$flushing' AND time = '$wow'"); $flush2 = mysql_query("DELETE FROM tp WHERE dump = '$flushing'"); if($flush55){echo "SUCCESSFULLY FLUSHED THE DUMP HON!<br>";}
i dont understand because the variables arent the right ones (like i put in fake ones because they are coming from a $_GET POST.. to see if people could mass delete stuff and no matter what it says sucessful, and THERE IS NOTHING BEING DELETED halp!
-
oh ok well i useally just do the mysql_query thing with mysql_num_rows for the count . why is this other way better? i dont understand
-
make sure u dont mess up
-
well anyone figure out th tutorkial i linked to is too complicated and i was lookign for a simple explanation. so not like im assking u to wrtie tutorial on how to use it hon, dont be so condescending.
-
well if its the seconds from the epoch in 1970, then why does i ouput correctly when its in 4829892 form in my database when i do date($variableinmydatabase);
-
this count() thing is this use less system resorces? ive never used it befroe.
-
thank you. i will try changing it. it mos tlilely will work lol!
-
caps because its absolutely rediculous.
i dontunderstand why its not working. there is a column called id and a collumn called to
then there is also. two rows with the field for `to` equal to the number: 1
still doesnt work:
just outputs . this user has no commnets, none. (every single time)
:'(
<?php $testlll = mysql_query("SELECT to FROM cmnts WHERE to = 1"); if(!$testlll){echo "this user has no comments, none.";} else{echo "this user has $testlll comments";} echo $testlll; ?>
and of course $testlll (which i renamed trying to fix it -from $test) is equal to, well. NOTHING!!! whats going on here? do i have to change a table name or something?
i didnt try that because i would have to redo the whole table. theres only one column called to and one column called id (so no dupes)
also im not dumb it used to be $testlll = mysql_num_rows(mysql_query thing but that didnt work either.
-
thanks but how
its not showing right if i do a query. no matter what it echos sucessful wtf?
in PHP Coding Help
Posted
oo ok