Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. Do I check for 'name' or 'tmp_name' When I run this?
  2. Got it $i=@getimagesize($_FILES['logo']['tmp_name']); if (($i[2]==1) or ($i[2]==2) or ($i[2]==3) or ($i[2]==6)) { Thanks
  3. $i=@getimagesize($_FILES['logo']['tmp_name']); if (($i[2]==1) or ($i[2]==2) or ($i[2]==3)) { # OK } else { # FAILS } I found this example. Is this flawless or is there something else that need's to be done with it?
  4. So something like. <?php $accepted_types = array("gif", "jpg", "jpeg", "bmp"); if (!get_image_size($filename, $accepted_types) { // not allowed }else { // do file stuff } ?> Is that about along the lines of what you mean?
  5. I had a file handling program I built awhile back but ended up losing over time. Now I have this half system to validate filetypes. Is there a good/proven method that is really powerful that anywhere here uses to validate there filetypes. Just a specific method that you have used for a long time, and you know work's really well. I am going to come up with my own again, I just want some idea's on how to formulate it. Thanks?
  6. I have an area on a clients website where people are allowed to upload a max of 4 photo's. I need to let them upload them, and return an error when they are over 4 images so they can not upload anymore than 4. I have this <?php $select4 = "SELECT * FROM user_images WHERE userid = '" . $_SESSION['userinfo']['id'] . "';"; $query4 = mysql_query($select4); if (count(mysql_fetch_array($query4)) <= 3) { // do the image upload }else { echo "You have already reached your max upload number.<br />"; echo "The file has been discarded.<br />"; } ?> This looks logical to me. However they upload 1 image, the other 3 give an error, and they had only uploaded one. Can someone see what I am doing wrong?
  7. Let me rephrase that, guidance sounds a little wierd. I have ran through every free online tutorial I can to the point of formulating what I have. I gained a pretty solid understanding of the processes that the library goes through behind the scenes as well as what I have to do to make most things happen. However there are a few heavier things I can't fully figure out how to get it to do. There are a few fine details I can't get down and it seems not many people have done xml parsing, or done it with this specific library. Not a lot of people comment when it's talked about. Instead of asking for help on a specific part I wanted to ask for some specific advice on how to gain the knowledge needed to finish up parsing this data for my purpose. Tutorials I may not have found, good books I might be able to get something out of. I have access to the safari bookselve unlimited and I have gone through everything I can find on there, and taken everything I can find from there and online tutorials. As well as a little help from a friend and about every 2 steps I get ran up against another wall with something it's not doing that I need. Does anybody know of any good support services for the Expat Library to help me do some of these things I need to do, thanks?
  8. I have been stuck on some xml parsing for awhile, every day I make a little more progress. Does anyone here at all have experience with it, or some personal advice they can share with me while doing XML parsing with Expat library in php. I have been having a lot of problem's, I finally made it to a specific point, but I am back to having problems again. I just need some guidance.
  9. It won't let me download any of them though. Every link that has to do with downloading something is taking me to a page not found on his site, for some reason. Doe's it work for you, if it does can you email them to me. Or do you know where I can get them that will work if none of them are working. I want to try and see what all of those sound like.
  10. Ah, thanks a lot for the download link. I have to get that, thanks again.
  11. Nice, i wish I could get that burnt to a cd. As far as music, that is probably my favorite type of music. The guitar does something for you that no other instrument can. Rock, metal, anything with a guitar. THe main reason I like sabbath. Where did you find that, I had to bookmark it. Do you know who that is, or if they have a cd out or anything. Or is he just someone who plays as a hobby. Edit: the fact that he is so young makes it even more powerful. I can't imagine what he will sound like in 10-15 years.
  12. Uh, I found it. Inside functions.php about 950 lines into the programming I ran across this function. <?php function getNickName() { if($_SESSION['TCHAT_UID'] == 0) return "Guest_".getGuestID(); $q = mysql_query("SELECT nickname FROM userinformation WHERE id='".$_SESSION['TCHAT_UID']."'"); list($nick) = mysql_fetch_row($q); return $nick; } ?> At this point I changed it, and it is retrieving the right one. That was why it wasn't working. Thank you so much for the people who were trying to help me, and helped me out by helping me narrow down the problem. Thanks again for the advice.
  13. Yes, it's a third party chatroom. I was integrating it into the site. I did contact the creator, he actually got it working for me, because itw as originally geared for Mysql 4, he wired it up for 5 instead so I could have it working. He also gave me some feedback on integration. Which was exactly what I did. Ok, if you get any more feedback it's appreciated. For the time being I will try cutting back throught he file's see if I Can find what's missing. I tried digging up the fla file, I don't know much about flash, so I am not sure. Each button in the flash file, just calls a function from the proper php pages. I will check the fla file one more time. Then I Can check the php pages one more time. thanks for all the feedback so far, it helped me isolate the problem to realize it's something to do with the session's table not taking the data. I can look into it better. If anyone has anymore feedback as well it's appreciated. Thanks so far for all the advice, and effort.
  14. Sorry, I fixed that try again. I created it, but didn't click go in phpmyadmin.
  15. That is the login for it. I don't really know what happens. What I can tell, is everytime the page loads it checks the session database, I would guess and does information based on that. There is something now stopping the username/nickname from being passed into the session's table in the database. So when that doesn't do it, then it ends up having it not show up later when the session is called, that is what I don't understand. Everything else make's it into the session except that.
  16. ORDER BY ASC will do it in ascending order ORDER BY DESC will do it in descending order if you put a limit on it, make sure you have the order by BEFORE you put the limit clause.
  17. www.ppassistant.com However that is an old version.  I have been rewriting large sections of it since that release, based on the advice here.  It will be 150% different, and I am still working on something to provide backwards compatibility in the future.  What you see there is just the structure.  I have been working on it in my spare time, off of freelancing hours, in my spare time over the weekend. I will release the new copy in like 2-3 weeks.
  18. Uh, it's not in my database under session. I don't get it <?php function sessionWrite($key, $val) { $value = addslashes($val); $chatInTime = $_SESSION['TCHAT_INTIME']; if(empty($chatInTime)) $chatInTime = time(); $sql = "REPLACE INTO totalchat_users_sessions (sessionID, sessionData, sessionStart, sessionExpire, chatStart, chatExpire, username, userID, roomID) VALUES ('".$key."', '".$value."', '".$_SESSION['SESSION_START_TIME']."', UNIX_TIMESTAMP() + ".SITE_ONLINE_EXPIRE.", FROM_UNIXTIME('".$chatInTime."'), UNIX_TIMESTAMP() + ".CHAT_ONLINE_EXPIRE.", '".$_SESSION['TCHAT_NICKNAME']."', '".intval($_SESSION['TCHAT_UID'])."', '".intval($_SESSION['TCHAT_RID'])."')"; return mysql_query($sql) or die("ERROR: ".mysql_error()." -> ".__LINE__."<br />".$sql); } ?> I didn't touch that file. It's suppose to write the username, as the nickname for the session, and the username is what is suppose to come up later. However it's not even writing the session properly for some reason.
  19. Poco, don't worry about it you trying to help is enough. Crayon - I don't understand it but yes. it makes it to the first page. They go to the chatroom and login and it come's up with the "welcome (nickname here)". Then it seems to lose the data after that. When they click on a chatroom, the chatroom loads but on the right hand side the username doesn't appear beside the icon. Sometimes it doesn't appear, sometimes it registers it as a guest automatically. Then whey they type something it doesn't show up on the screen it just shows > message here in the chatarea instead of nickname> message here I don't understand that part, then if they back out of the chat"room" specifically back to the main page that lists all teh chatroom's. Then at that point it says "welcome (blank space)"; I checked all the file's I altered, I made sure config is at the top of each page. In this system he uses the db to handle sessions, so I am sure that session start isn't needed. He uses another table for sessions. I just understand what is happening to the data, and why it's disappearing like that.
  20. This is very, very strange. I was performing an integration, and everything was going well, until I found out this was messed up. I went through everything you said, as a checklist, it's all working. The first page of the chatroom come's up. Like when they login it says welcome businessman. Then when I go into the chatroom itself, it doesn't list it on the right hand side. THen when you go BACK to the other page, it says "welcome (blank spot here)". I am not totally sure what is happening. I am 100% that it's going into the database, I have 2 accounts on there, one admin, and one nonadmin to test both parts. I have it setup so when they login to the website, it creates the extra information, then when I worked up the chatroom I made it point to that table. This is the advice I was given from the person who built the chatroom. Here is my registration script for the website <?php require_once("#####"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php require_once($docroot . "#####"); ?> <meta name="description" content="######" /> <meta name="keywords" content="" /> <title>#####</title> </head> <body> <div id="bodyWrap"> <div class="pageWrapper"> <div id="header"> <div id="logo"> <h1>Logo ™</h1> </div> <div id="heading"> <div class="head"></div> <?php require_once($docroot . "######"); ?> </div> </div> </div> <div class="pageWrapper" id="main"> <div class="subTitleOuter"> <div class="subTitleInner"> <div class="right"> <h2>Be In The Know</h2> </div> <div class="content"> <h2>Featured</h2> </div> <div class="clear mozclear"></div> </div> </div> <div class="gap"> </div> <div class="subBarOuter"> <div class="subBarInner"> <div class="right"> <?php require_once($docroot . "####"); ?> </div> <div class="content"> <?php require_once($docroot . "#####"); ?> <div class="clear mozclear"></div> </div> </div> <div class="gap"> </div> <div id="mainOuter"> <div id="mainInner"> <?php require_once($docroot . ######"); ?> <div class="right"> </div> <div class="content"> <div class="titleMain"> <a href="/index.php">Home</a> </div> <?php if (isset($_POST['submit'])) { $errorhandler = ""; // register handler variable validateemail($_POST['email']); // email validates if ($_POST['email'] != $_POST['verifyemail']) { // compare email addresses $errorhandler .= "The emails Do Not match.<br />"; } // create array of all variables that have to be filled in $empty = array('First Name' => $_POST['firstname'], 'Last Name' => $_POST['lastname'], 'Password' => $_POST['password'], 'Verify Password' => $_POST['verifypassword'], 'Zip Code' => $_POST['zipcode'], 'Birth Date' => $_POST['birthdate'], 'nickname' => $_POST['nickname']); foreach ($empty as $k=>$v) { // run them through to see if there empty if ($v == "") { // if they are register error messages $errorhandler .= $k . " was left blank, please correct this.<br />"; } } validatedate($_POST['birthdate']); // run my validatedate() function to validate date $emailtest = mysql_real_escape_string($_POST['email']); $selecttest = "SELECT emailaddress FROM userinformation WHERE emailaddress = '$emailtest';"; $querytest = mysql_query($selecttest); if ($rowtest = mysql_fetch_array($querytest)) { $errorhandler .= "The email already exists. Please use a different email address.<br />"; } errorhandler($errorhandler, 1); if ($errorhandler == "") { $emailaddress = deepclean($_POST['email']); $password = deepclean($_POST['password']); $password = md5($password); $firstname = deepclean($_POST['firstname']); $lastname = deepclean($_POST['lastname']); $country = deepclean($_POST['country']); $stateorprovince = deepclean($_POST['stateorprovince']); $county = deepclean($_POST['county']); $zipcode = deepclean($_POST['zipcode']); $gender = deepclean($_POST['gender']); $birthdate = deepclean($_POST['birthdate']); $nickname = deepclean($_POST['nickname']); $validated = "Y"; $insert = "INSERT INTO userinformation (emailaddress, password, firstname, lastname, country, stateorprovince, county, zipcode, gender, birthdate, nickname) VALUES ('$emailaddress', '$password', '$firstname', '$lastname', '$country', '$stateorprovince', '$county', '$zipcode', '$gender', '$birthdate', '$nickname');"; if (mysql_query($insert)) { echo "Account created successfully.<br />"; echo "You can create your profile now by using the following link, or later by<br />"; echo "visiting it in the left navigation area when logged into your account.<br />"; // adding to process chatroom registration $selecte = "SELECT id FROM userinformation WHERE emailaddress = '$emailaddress';"; $querye = mysql_query($selecte); if ($row = mysql_fetch_array($querye)) { echo "<a href=\"#####?id={$row[id]}\" title=\"Create Profile\"> Create Public Profile</a>"; } }else { echo "Problem creating account, please try again later.<br />"; } $show = "no"; } } ?> <?php // form starts here if ($show != "no") { ?> <span id="form"> <p>* = required field</p> <form name="registration" id="registration" action="<?php $self; ?>" method="post"> <label for="email">Email Address:*</label> <input name="email" id="email" type="text" maxlength="200" value="<?php echo $_POST['email']; ?>" /><br /> <label for="verifyemail">Verify Email:*</label> <input name="verifyemail" id="verifyemail" type="text" maxlength="200" value="<?php echo $_POST['verifyemail']; ?>" /><br /> <label for="firstname">First Name:*</label> <input name="firstname" id="firstname" type="text" maxlength="200" value="<?php echo $_POST['firstname']; ?>" /><br /> <label for="lastname">Last Name:*</label> <input name="lastname" id="lastname" type="text" maxlength="200" value="<?php echo $_POST['lastname']; ?>" /><br /> <label for="password">Password:*</label> <input name="password" id="password" type="password" maxlength="200" value="<?php echo $_POST['password']; ?>" /><br /> <label for="verifypassword">Verify Password:*</label> <input name="verifypassword" id="verifypassword" type="password" maxlength="200" value="<?php echo $_POST['verifypassword']; ?>" /><br /> <label for="country">Country:</label> <input name="country" id="country" type="text" maxlength="200" value="<?php echo $_POST['country']; ?>" /><br /> <label for="stateorprovince">State/Province:</label> <input name="stateorprovince" id="stateorprovince" type="text" maxlength="200" value="<?php echo $_POST['stateorprovince']; ?>" /><br /> <label for="county">County:</label> <input name="county" id="county" type="text" maxlength="200" value="<?php echo $_POST['country']; ?>" /><br /> <label for="zipcode">Zip Code:*</label> <input name="zipcode" id="zipcode" type="text" maxlength="200" /><br /> <label for="gender">Gender:*</label> <select name="gender" id="gender"> <option value="M">Male</option> <option value="F">Female</option> </select><br /> <label for="birthdate">Birth Date (mm/dd/yyyy):*</label> <input name="birthdate" id="birthdate" type="text" maxlength="15" value="<?php echo $_POST['birthdate']; ?>" /><br /> <label for="nickname">Nick Name:*</label> <input name="nickname" id="nickname" type="text" maxlength="200" /><br /> <label for="submit"></label> <input name="submit" id="submit" type="submit" value="submit" /> </form> </span> <?php } // form ends here ?> </div> <div class="clear mozclear"></div> </div> </div> <div class="hide" id="nsFooterClear"><!-- for NS4's sake --></div> <?php require_once($docroot . "/master/includes/footer.inc.php"); ?> </div> </div> </body> </html> Ok, and here is the login area for the website. This is what logs them into the website. <?php require_once(".#####"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php require_once($docroot . "######"); ?> <meta name="description" content="#####" /> <meta name="keywords" content="" /> <title>#####</title> </head> <body> <div id="bodyWrap"> <div class="pageWrapper"> <div id="header"> <div id="logo"> <h1>Logo ™</h1> </div> <div id="heading"> <div class="head"></div> <?php require_once($docroot . "#####"); ?> </div> </div> </div> <div class="pageWrapper" id="main"> <div class="subTitleOuter"> <div class="subTitleInner"> <div class="right"> <h2>Be In The Know</h2> </div> <div class="content"> <h2>Featured</h2> </div> <div class="clear mozclear"></div> </div> </div> <div class="gap"> </div> <div class="subBarOuter"> <div class="subBarInner"> <div class="right"> <?php require_once($docroot . "#####"); ?> </div> <div class="content"> <?php require_once($docroot . "/master/includes/featured.inc.php"); ?> <div class="clear mozclear"></div> </div> </div> <div class="gap"> </div> <div id="mainOuter"> <div id="mainInner"> <?php require_once($docroot . "/master/includes/leftstructurenav.inc.php"); ?> <div class="right"> </div> <div class="content"> <div class="titleMain"> <a href="/index.php">Home</a> </div> <?php if (isset($_POST['submit'])) { $errorhandler = ""; // register handler variable // create array of all variables that have to be filled in $empty = array('Email Address' => $_POST['email'], 'Password' => $_POST['password']); foreach ($empty as $k=>$v) { // run them through to see if there empty if ($v == "") { // if they are register error messages $errorhandler .= $k . " was left blank, please correct this.<br />"; } } errorhandler($errorhandler, 1); if ($errorhandler == "") { $email = deepclean($_POST['email']); $password = deepclean($_POST['password']); $password = md5($_POST['password']); $select = "SELECT * FROM userinformation WHERE emailaddress = '$email' AND password = '$password';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { $_SESSION['userinfo']['emailaddress'] = $row['emailaddress']; $_SESSION['userinfo']['id'] = $row['id']; $_SESSION['userinfo']['gender'] = $row['gender']; $_SESSION['userinfo']['logged'] = "yes" echo "You have been successfully logged in"; $show = "no"; }else { echo "Incorrect Login"; } }// end errorhandler eheck } // end submit check ?> <?php // form starts here if ($show != "no") { ?> <span id="form"> <form name="login" id="login" action="<?php $self; ?>" method="post"> <label for="email">Email Address:</label> <input name="email" id="email" type="text" maxlength="200" /><br /> <label for="password">Password:</label> <input name="password" id="password" type="password" maxlength="200" /><br /> <input name="submit" id="submit" type="submit" value="submit" /> </form> </span> <?php } // form ends here ?> </div> <div class="clear mozclear"></div> </div> </div> <div class="hide" id="nsFooterClear"><!-- for NS4's sake --></div> <?php require_once($docroot . "#####"); ?> </div> </div> </body> </html> Ok that is my registration area, and login area. However I don't think that's what it is. I am not 100% what could be causing this. My entire auth script for the chatroom. They go to the chatroom to login, then when they login, it runs I guess the auth function which is <?php if($action == "login" && isset($username)) { $q = mysql_query("SELECT id, emailaddress, is_admin, nickname FROM userinformation WHERE emailaddress = '".$username."' && password = '".md5($pw)."' && validated = 'Y'"); if(mysql_num_rows($q) < 1) echo "&loginStatus=FAILED"; else { // Set login variables list($uid, $email, $is_admin, $nickname) = mysql_fetch_row($q); $_SESSION['TCHAT_IS_IN'] = true; $_SESSION['TCHAT_UID'] = $uid; $_SESSION['TCHAT_NICKNAME'] = $nickname; if($is_admin == "Y") $_SESSION['TCHAT_IS_ADMIN'] = true; else $_SESSION['TCHAT_IS_ADMIN'] = false; // Feed login info to flash echo "&loginStatus=SUCCESS"; echo "&nickname=".$nickname; echo "&isAdmin=".$is_admin; } } ?> I have all the chatroom file's backed up in case if I need to troubleshoot if it's something else. I am not totally sure what's going on. I disabled some of the functions. For instance where they edit, update, add profile. The admins abilities to delete, edit user information. And some other stuff I disabled those functions and fed an error message to flash saying they are disabled. I am doing all that from his actual website administration area. Since he just wanted the chatroom there, he didn't want to have to work through it too. I just don't understand where the information is getting broken. Any advice at this point would be appreciated, because I am totally confused.? Note: The username is the email address. I was integrating it, and my client wanted there email address to be there login name for both the website, and the chatroom. That part works properly it's just the nickname that is messing up it seems.
  21. <?php if($action == "login" && isset($username)) { $q = mysql_query("SELECT id, emailaddress, nickname, is_admin FROM userinformation WHERE emailaddress = '".$username."' && password = '".md5($pw)."' && validated = 'Y'"); if(mysql_num_rows($q) < 1) echo "&loginStatus=FAILED"; else { // Set login variables list($uid, $nickname, $is_admin) = mysql_fetch_row($q); $_SESSION['TCHAT_IS_IN'] = true; $_SESSION['TCHAT_UID'] = $uid; $_SESSION['TCHAT_NICKNAME'] = $nickname; if($is_admin == "Y") $_SESSION['TCHAT_IS_ADMIN'] = true; else $_SESSION['TCHAT_IS_ADMIN'] = false; // Feed login info to flash echo "&loginStatus=SUCCESS"; echo "&nickname=".$nickname; echo "&isAdmin=".$is_admin; } } ?> Sorry I failed to mention, I had tried that. I tried it again just now, but for some reason it's still not working. Any advice?
  22. Oh sorry about that. The current problem is, all the variables are getting passed. The nickname however is coming up blank, it;s not registering the nickname, so it's automatically assuming it's a guest. How can I fix this so the nickname actually does pass to the flash, it was suppose to but when I converted over to another table it doesn't. THe other stuff pass thorugh, is admin, and everything else make it through but it doesn't read the nickname?
  23. I have performed a flash integration. Everything works perfectly, except for one issue I can't seem to get fixed. <?php if($action == "login" && isset($username)) { $q = mysql_query("SELECT id, emailaddress, is_admin FROM userinformation WHERE emailaddress = '".$username."' && password = '".md5($pw)."' && validated = 'Y'"); if(mysql_num_rows($q) < 1) echo "&loginStatus=FAILED"; else { // Set login variables list($uid, $nickname, $is_admin) = mysql_fetch_row($q); $_SESSION['TCHAT_IS_IN'] = true; $_SESSION['TCHAT_UID'] = $uid; $_SESSION['TCHAT_NICKNAME'] = $nickname; if($is_admin == "Y") $_SESSION['TCHAT_IS_ADMIN'] = true; else $_SESSION['TCHAT_IS_ADMIN'] = false; // Feed login info to flash echo "&loginStatus=SUCCESS"; echo "&nickname=".$nickname; echo "&isAdmin=".$is_admin; } } ?> The table has been appropriately created, nickname is also in the table at the bottom, here is the table layout if it helps.
×
×
  • 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.