Jump to content

CStrauss

Members
  • Posts

    52
  • Joined

  • Last visited

CStrauss's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. yea i sent another message i figured out the problem sorta it never was this way before specially few weeks ago i know its not a server problem but when people sign up for the site they get 0 for normal user level 1 for admin and 2 for mod for some reason it got changed to where you have to be a 1 or 2 post. Never was that way before so the bigger problem is some how thing got changed weather i did something accedently during a 2 am programming session or whatever now i just need to go back and check how people login and trace the way up from there. its kinda of a mess but its a start.On the other note of removing the form and nested form info i didnt know that. I know why thats there mainly for a cheap css style lol but maybe causing another problem i came across dealing with forms. I will deffently try that fist maybe that some how will magiclly fix the person having to be logged in as admin or mod to post stuff but i doubt it but never hurts to trythanks so much justsomeguy for all your help
  2. Okay I written my own script to allow people to upload screen shots of a game we play online. However the strange thing is I seem to be the only one to get it to work when I upload screen shots. The screen shots when taken are saved as jpg format so that is not the problem but when everyone else trys it for some reason triggers the error parts of the code not allowing them to process the screen shots and upload them to the site.Now I have used this script for years and worked fine until I switch hosting company. Then It worked for a bit now all of a sudden everyone gets errors saying the title field is missing or if i comment out that part of valdation code it says the file is field is not filled out and so on. So my thinking could this be something with the server on the host. I know my hosting company recently did some upgrading on the sever a few weeks ago, roughly the same time this problem started, but then again why am I the only one being allowed to upload images to my website and everyone else is getting field validation errors??????Below is the processing code I use to store the information in a database then move the file to a folder on the sever. Can some one look it over and perhaps see something I'm missing. Or if they have had a similar problem before with their hosting company give me ideas of what this abnormally could be. I though at first the person was doing something wrong but then about 10 other people tell me they have the same problem so I know this to be more then user error on their part. <?php myheader(" - Uploading Image"); $userFile = $_FILES['imgFile']['name']; $tempName = $_FILES['imgFile']['tmp_name']; $fileSize = $_FILES['imgFile']['size']; $fileType = $_FILES['imgFile']['type']; $date = date("Y-m-d"); $title = $_POST['title']; $description = $_POST['description']; $username = $_POST['username']; $gallery = $_POST['gallery']; $viewed = 0; $userFile = $username.$userFile; // Check For Required Fields to be filled in before procesing if(empty($title)){ $error = "<p>Error Missing Title Field! Please Use The Browser Back Button And Fill Out All Required Fields.</p>"; include $_SERVER['DOCUMENT_ROOT'].'/html/errors_page.html'; footer($footer); exit(); } if(empty($_FILES['imgFile']['name'])){ $error = "<p>Error Missing Image Field! Please Use The Browser Back Button And Make Sure You Selected An Image To Upload.</p>"; include $_SERVER['DOCUMENT_ROOT'].'/html/errors_page.html'; footer($footer); exit(); } // Check For Correct File Type $UPLOAD_TYPES['JPG'] = 1; $UPLOAD_TYPES['JPEG'] = 1; $UPLOAD_TYPES['GIF'] =1; $arrSegments = split('[.]',$userFile); $strExtension = $arrSegments[count($arrSegments) -1]; if($GLOBALS['UPLOAD_TYPES'][strtoupper($strExtension)] !=1) { $error = "<p>Error! File Type Is Not Correct. Make Sure Your Uploading .jpg or .gif files only or you left this field empty. Please use your browser back button and correct errors.</p>"; include $_SERVER['DOCUMENT_ROOT'].'/html/errors_page.html'; footer($footer); exit(); } // Check File Size if($fileSize > 524288){ $error = "<p>Error! Image size is greater then 512kb. Please reduce file size and try to upload again.</p>"; include $_SERVER['DOCUMENT_ROOT'].'/html/errors_page.html'; footer($footer); exit(); } // End File Size IF //Path to where images are stored $MOVE_TO_PATH = $_SERVER['DOCUMENT_ROOT']. '/gallery/'; //Moves Images to folders if (! move_uploaded_file($tempName, $MOVE_TO_PATH . $userFile)) { $error = "<p>Error! Could Not Upload Image. Please Try Again Later.</p>"; include $_SERVER['DOCUMENT_ROOT'].'/html/errors_page.html'; footer($footer); exit(); } $query = "insert into gallery values(NULL, '$title', '$description', '$date', '$userFile', '$MOVE_TO_PATH', '$username', '$gallery', '$viewed')"; $result = mysql_query($query); if ($result) { if($gallery == "ffxi"){ $message = '<p>Image uploaded successfully. To return to gallery click'. '<a href="screenshots.php"> here</a></p>'; include $_SERVER['DOCUMENT_ROOT'].'/html/message_page.html'; footer($footer); exit(); } if($gallery == "Member"){ $message = '<p>Image uploaded successfully. To return to gallery click'. '<a href="membergallery.php"> here</a></p>'; include $_SERVER['DOCUMENT_ROOT'].'/html/message_page.html'; footer($footer); exit(); } } else { $error = "<p>Error inserting your information into MySQL: ".mysql_error()."</p>"; include $_SERVER['DOCUMENT_ROOT'].'/html/errors_page.html'; footer($footer); exit(); } ?> As you can see its a simple piece of code I have used in the past with no problems. So this is why im so complexed about the problem anyone have any idea please post a reply on what I can do to figure out if this is a sever problem or maybe something im missing in my code i might have missed when adding this code to my existing site. Thanks for the help in advance
  3. Yes I know what that means but it just makes no sense because if I remove my phpbb code (the code in red) in the login box code it works perfectly fine. There is nothing being printed to output at all in that code. all its doing is querying a database and updating data. This all leading me to believe it has something to do with the cookies and something in the phpbb sessions.php file on lines 182 and 183.I did modify that include on the login.php script on the first line that wasnt even suppose to be there but that didnt belong there that part was moved down to the else statment where login failed cause of wrong user name and password. and still had the same problem. It only seems to appear when I have cookies selected which points back to lines 182 and 183. If i remove my phpbb login code it works fine with cookies no warnings no errors. Im not sure about how the ob_start would work. And I don't see how adding code that produces no output but only querys and updates database would cause header errors. There must be something else Im missing?
  4. Hmmmm sounds like its not so much a php coding problem but more along the lines with the way your 4 other table fields are set up. Check to make sure they can accept the right type of data for example varchar, text, ect and make sure the length is set for those fields if length is 0 it probably wont except data. Thats all I can think of for now maybe you can post your table set up how you have your fields define and we can see more of what is going on those 4 tables that are not excepting the data.
  5. Okay I been working on my login script for a few months I got my script working perfectly (so far) to work with an option for members to use the a remember feature. Now I'm working on intergrating my login system with PHPBB login so when a user logs into my site it goes through the login in process from my site and then it checks to see if they are signed up for PHPBB if not it basicly copies their login info from my main login to PHPBB database and logs them in.This works perfectly if they choose the option not to be remember on my login system and basicly use session for this visit to my site. However if they login and check the remember to use cookies it still works as far as loging them in to my site as well as the PHPBB but it gives me a nasty little headers error that points to some cookies in the in the PHPBB files. here is the error message: Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/cstrauss/layout.php:17) in /hsphere/local/home/cstrauss/phpBB2/includes/sessions.php on line 182Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/cstrauss/layout.php:17) in /hsphere/local/home/cstrauss/phpBB2/includes/sessions.php on line 183 However at first after login or in this case since its using cookies everything appears fine until I click on a link or refresh the page then the message appears in my login box where when login displays user name and logout option.I will all the login code as well as the PHPBB code refrenced in the above warning message in hopes someone can help me figure out how to fix. Usually I dont have a problem solving header problems but this one got me puzzled.Login Box Code.Code in red is the phpbb code in question <?php if(isset($_COOKIE['login'])){ $user = $_COOKIE['user']; $password = $_COOKIE['password']; $validate = @mysql_query("SELECT * FROM users WHERE username='$user' AND password = '$password' AND activated = '1'"); if(mysql_num_rows($validate) == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['userid']; $_SESSION['email_address'] = $row['email_address']; $_SESSION['user'] = $row['username']; // PHPBB Variables $password = $row['password']; $activated = $row['activated']; $userName = $_SESSION['user']; if($row['user_level'] == 1){ $_SESSION['user_level'] = true; } // End If $login_time = mysql_query("UPDATE users SET last_login=now(), ip_address = '{$_SERVER['REMOTE_ADDR']}' WHERE userid='{$row['userid']}'"); //include $_SERVER['DOCUMENT_ROOT'].'/inc/quick_stats.php'; } // End While [color="#FF0000"]/*Check phpbb tables for user, update tables and login*/ $phpbb_user = mysql_query("Select * FROM phpbb_users WHERE username = '{$_SESSION['user']}'"); if(mysql_num_rows($phpbb_user)==1){ $phpBB = new PHPBB_Login(); $phpBB->login($_SESSION['userid']); }else{ $userName=$_SESSION['user']; $email_address = $_SESSION['email_address']; $user_id = $_SESSION['userid']; $sql = @mysql_query("INSERT INTO phpbb_users(user_id,username, user_regdate, user_password, user_email)VALUES('$user_id','$userName','".time()."','$password','$email_address')"); $phpBB = new PHPBB_Login(); $phpBB->login($_SESSION['userid']); }[/color] }// End If echo '<form><p>Welcome '.$_SESSION['user'].'</p>'. '<p>To Logout <a href = "logout.php"> click here</a></p>'; if($_SESSION['user_level'] == true){ echo '<p><a href="/controlpanel.php">Administration Panel</a></p></form>'; } }elseif(isset($_SESSION['login'])){ //include $_SERVER['DOCUMENT_ROOT'].'/inc/quick_stats.php'; echo '<form><p>Welcome '.$_SESSION['user'].'</p>'. '<p>To Logout <a href = "logout.php"> click here</a></p>'; if($_SESSION['user_level'] == true){ echo '<p><a href="/controlpanel.php">Administration Panel</a></p></form>'; } }else{ //include $_SERVER['DOCUMENT_ROOT'].'/inc/quick_stats.php'; ?> <form action="/login.php" method="post"> <p>Username:<input type="text" name="username" value="" /></p> <p>Password:<input type="password" name="password" value="" /></p> <p><input type="image" name="imagefield1" id="imagefield1" src="images/subpage1_06.gif" /> <input type="hidden" name="req" value="validate" /> <input type="checkbox" name="remember" checked="checked" />Remember Me! </p> </form><?php } ?> My Login ScriptThis is the script that runs if they are logging in to the site for the first time with remember me set or not. If its not set it works fine with no problems, im assuming because no cookies are set but if remember me is checked the same problem occurs with the the header warnings in my login in box. Again I used red text for the phpbb code if that helps any <?phpinclude $_SERVER['DOCUMENT_ROOT'].'/layout.php';$req = (!isset($_REQUEST['req'])) ? 'default' : $_REQUEST['req'];switch($req){case "validate": $validate = @mysql_query("SELECT * FROM users WHERE username='{$_POST['username']}' AND password = md5('{$_POST['password']}') AND activated = '1'"); if(mysql_num_rows($validate) == 1){ while($row = mysql_fetch_assoc($validate)){ if(isset($_POST['remember'])){ setcookie("login",true,time()+60*60*24*100,"/"); setcookie("user",$row['username'],time()+60*60*24*100,"/"); setcookie("password",$row['password'],time()+60*60*24*100,"/"); //setcookie("admin_access",$row['admin_access'],time()+60*60*24*100,"/"); $_SESSION['login'] = true; $_SESSION['userid'] = $row['userid']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; $_SESSION['user'] = $row['username']; // PHPBB Variables $password = $row['password']; $activated = $row['activated']; $userName = $_SESSION['user']; if($row['user_level'] == 1){ $_SESSION['user_level'] =true; }// End If }else{ $_SESSION['login'] = true; $_SESSION['userid'] = $row['userid']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; $_SESSION['user'] = $row['username']; // PHPBB Variables $password = $row['password']; $activated = $row['activated']; $userName = $_SESSION['user']; if($row['user_level'] == 1){ $_SESSION['user_level'] =true; } // End If } // End Else $login_time = mysql_query("UPDATE users SET last_login=now(), ip_address = '{$_SERVER['REMOTE_ADDR']}' WHERE id='{$row['id']}'"); }// End While [color="#FF0000"]/*Check phpbb tables for user, update tables and login*/ $phpbb_user = mysql_query("Select * FROM phpbb_users WHERE username = '{$_SESSION['user']}'"); if(mysql_num_rows($phpbb_user)==1){ $phpBB = new PHPBB_Login(); $phpBB->login($_SESSION['userid']); }else{ $userName=$_SESSION['user']; $email_address = $_SESSION['email_address']; $user_id = $_SESSION['userid']; $sql = @mysql_query("INSERT INTO phpbb_users(user_id,username, user_regdate, user_password, user_email)VALUES('$user_id','$userName','".time()."','$password','$email_address')"); $phpBB = new PHPBB_Login(); $phpBB->login($_SESSION['userid']); }[/color] header("Location: /index.php"); // echo '<meta http-equiv="Refresh" content="4;url=http://localhost/index.php">'; }else{ myheader(" - Login Failed!"); $page_header = "Login Failed!"; include $_SERVER['DOCUMENT_ROOT'].'/html/login_failed.html'; footer($footer); }break;default:break;}?> The PHPBB Code Refrenced IN The Warning MessageHere is the code from the phpbb sessions file that is refrenced in the warning message the lines in red are the line numbers outputed in the warning message.There is more code before and after this block of code but to save posting space for now i just showed this block if more is needed I can post the full code in another post if that helps. if ( $user_id != ANONYMOUS ) {// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : ( $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; $sql = "UPDATE " . USERS_TABLE . " SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit WHERE user_id = $user_id"; if ( !$db->sql_query($sql) ) { message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql); } $userdata['user_lastvisit'] = $last_visit; $sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : ''; $sessiondata['userid'] = $user_id; } $userdata['session_id'] = $session_id; $userdata['session_ip'] = $user_ip; $userdata['session_user_id'] = $user_id; $userdata['session_logged_in'] = $login; $userdata['session_page'] = $page_id; $userdata['session_start'] = $current_time; $userdata['session_time'] = $current_time; [color="#FF0000"]setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure); setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);[/color] $SID = 'sid=' . $session_id; return $userdata;} If anyone can help me figure out how to fix these header warnings I would appreciate it. I could however surpress the error message because the script seems to work fine as far as loging in to main site and phpbb and adding user to phpbb if they are not in database as well as show user name in login box. But that wouldnt be the most professional thing to do so I'm hoping someone has a solution cause im just about tapped out of ideas thanks for taking the time to read this long post and your help
  6. Strange....it worked lol but seems kinda of silly something so simple causes so much stress lol. Thanks for the help i was going through every property possible in css to try to make it work and all i had to do is add the before and after my links to get it to work. Any how thanks for the help
  7. I been fighting with this for a few days now before i thought it was something with my layout but it seems its the links being placed in between my div tags. The links keep overflowing to the right stretching my div tag out instead of the next links being moved down to the next line when the end of the width of the div tag is reached. To see what I mean here is a picture.I added a border around the div tag so you can see where the links should end and move down to the next line. At first I thought it might be something in the style sheet since im using a template I purchased, but I added normal text in the div tag and it worked just fine so process of elimination says its something with the links and how they are being outputed. So I'm asking if anyone has any solution on how i can correct this so it does not overflow like it is in the picture above.Thank you for your help
  8. If your using a hosting company then you will have to contact them to do this for you, since you manually dont have access to this file on their servers.Now if its a server you have access too then you just need to find the php.ini file open it and change this line to the value you want. ; Maximum allowed size for uploaded files.upload_max_filesize = 2M
  9. This sorta relates to another problem I posted in a diffrent forum topic, But I think alot has to do with the way I set up my database incorrectly. Basicly Im trying to set up my database to work like this store front.Click Here.Now as you can see you click one of the links and it shows more links with sub categories then click on of those to display the items related to that sub cat.Now i never set up a database of this magnitude so im a little lost on how to set up my tables. One tricky part is a single item in the database could relate to many diffrent categories . So product A could be used with Product B And C. Get my point?I been sitting down with a pencil and paper for days trying to figure out the relationship to my tables to achieve the above store front effect. So If anyone can help me get started on how my database should be set up I would appreciate it.Thanks
  10. Stick quotes around what my variables? they are already of type string when they are passed via the link i thought?What im trying to do if click on the link Victoria 3 it passes a varaible $item as Victoria 3 and itemType = 1 then performs a query and searches through the tags field for all items with Victoria 3. then display the item_name of those items.so im not sure what you mean by stick quotes around.
  11. Hmmmm I changed my code as you suggested and that didnt seem to work, your explination makes perfect sence to me but I changed my code replacing:if(stripos($item,$search) !== false){With:if($item==$search){And now I get no results when before I got something regardless they were incorrect. lol neither is acceptable but I rather see something then nothing when putting something together if you know what i mean,Any how here is my database scheme with two rows of sample data maybe it will help me get help.poser_item item_id item_name item_type vendor tags------- ------------ ----------- --------- -----1 Victoria Cloths 1 nobody Victoria,V1,V2,Clothing,Texture2 Victoria 3 Cloths 1 somebody Victoria 3,V3,Clothing,Texture3 Nice Cloths 1 nobody Aiko 3,Victoria 3,V3,A3,Clothing,Texture Thats the basics of my table. Now for my full code: <?phpinclude $_SERVER['DOCUMENT_ROOT'].'/inc/database.php';$req = (!isset($_REQUEST['req'])) ? 'default' : $_REQUEST['req'];switch($req){ // 1=Figures 2=propscase "1": $sql = mysql_query("SELECT * FROM sub_cat_table WHERE itemType=$req ORDER BY sub_catName "); if(!$sql){ echo "Error Performing MySQL Query:".mysql_error(); }else{ while($row=mysql_fetch_assoc($sql)){ stripslashes(extract($row)); echo '<div style="display:inline;"><a href="inventory.php?req=display&itemType='.$itemType.'&item='.$_GET['item'].'&cat='.$sub_catName.'">'.$sub_catName.'</a> </div>'; } } // Display All Items For Selected Item $search_array = array($_GET['item']); echo $search_array[0]; //echo $itemType; // Query Database $sql = mysql_query("SELECT * FROM poser_items WHERE itemType=$itemType");if (!sql) { echo "Error Performing MySQL Query: " . mysql_error();} else { while($row=mysql_fetch_assoc($sql)){ foreach($row as $item){ foreach($search_array as $search){ //if(stripos($item,$search) !== false){ if($item ==$search){ stripslashes(extract($row)); echo "<p>$item_name</p>"; } } } }} break;case "2": break;case "display":break;default:echo "<div style>"; // Generate Inventory Links$sql = mysql_query("SELECT * FROM category_table ORDER BY cat_name");while($row=mysql_fetch_assoc($sql)){ stripslashes(extract($row)); echo '<a href="inventory.php?req='.$itemType.'&item='.$cat_name.'" style="display:inline;">'.$cat_name.'</a> ';} // Display All Items In Inventoryecho "</div>"; break;} // End Switch As you can see the values of the tags(keywords) its searching upon are comming via links. Maybe there is a better way to set up my database to make this easier or im just over thinking or someting. but changing the statment to if($item==$search) gave me zero results. Basicly what im trying to do is create a inventory system of some files i have and use often. so when it first loads its shows a serious of links such as Victoria Victoria 3 Aiko 3 and so on....Then when you click a link it passes some variables in this case the item type and the item name so for example it will pass 1 for the $itemType and Victoria 3 for the $itemThen more links display like this from the case 1:Clothing, Characters, Props ect as links then those values will be passed but i havent gotten that far yet this is where im at in my code where on this page it displays all items that relate to the $item.lol Follow me so far.So do i need to completely modify my code to use the if($item==$search){?Or do you see a better way to achieve what i tried regular expressions and it came up with the same problem the space between the a the 3 in "Victoria 3"
  12. CStrauss

    search criteria

    Well the most common way I see it is a if statement Like this: // Database connection here// Query database$sql = mysql_query("SELECT * FROM some_table WHERE data=$data");if(!$sql){ echo "No Matches Found";} Not sure if that is what your looking for or if your actually pulling data out first then doing a check but if that is the case then you just do an if statment comparing your results to what your searching for and pretty much do the same thing as above code.Hope that helps
  13. okay I have a little problem with trying to get correct information out of my database. I have a field called tags which has keywords basicly for example one row my have this in the tags field.Aiko 3,Victoria,Victoria 3,A3,V3,Clothing,TexturesNow values are passed via links used to query the database and display all the information based on what keywords or (tags) it finds. Here is my code im using. // Display All Items For Selected Item $search_array = array($_GET['item']); // Query Database $sql = mysql_query("SELECT * FROM poser_items WHERE itemType=$itemType");if (!sql) { echo "Error Performing MySQL Query: " . mysql_error();} else { while($row=mysql_fetch_assoc($sql)){ foreach($row as $item){ foreach($search_array as $search){ if(stripos($item,$search) !== false){ stripslashes(extract($row)); echo "<p>$item_name</p>"; } } } }} Now for the most part it works as far as pulling the data out of the database except that for example it treats "Victoria" the same as "Victoria 3".Now what I can conclude is that when its doing when it does the search and its evaluating Victoria 3 it stops after the a then goes on to the next word in this case its 3 and 3 is not a match. Get what im saying.So my question is how can I fix this to include the white space in a word like Victoria 3. Now an easy solution might be to go change all my data and remove the white space. But this is something interesting I might want to learn about for future uses.So what are my best options here to make my search work?
  14. Thanks justsomeguy, nice to see you back its been quiet around here the past few days not seeing any post from you.
×
×
  • Create New...