Jump to content

arianhojat

Members
  • Posts

    235
  • Joined

  • Last visited

    Never

Everything posted by arianhojat

  1. i know with cookies you can set it so when user closes browser, the cookie is deleted. but since sessions can use either url or cookies, how do you set tackle that? how would you set the time the session is kept alive? i think if your session just uses cookies then you would set session.cookie_lifetime to 0. session.cookie_lifetime integer session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed." Defaults to 0. See also session_get_cookie_params() and session_set_cookie_params(). Since the cookie is returned by the browser, it is not prolonged to suffice the lifetime. It must be sent manually by setcookie().
  2. poop. maybe ill take the risk only max 1% of people would even know how to do it, and cant do anything malicious in my site.
  3. hmmm maybe my memory is shot but i coulda swore i posted this a couple hours ago. Admins please let me know if this is viewed as a 'hacker' question and maybe that is why it was removed, i assure it is not. I want to be able to NOT let users come into my site if they come anywhere but from certain websites. So the user is anonymous but as long as he browses from site A to mine, then i will let him in. Otherwise I send him to like a "Sorry, it seems you did not come from 'site A'" message. Thanks, Arian
  4. there was a really good one that covered all the basics on phpfreaks (http://www.phpfreaks.com/tutorials/40/3.php), but its not up anymore? so anyone got any other good references with unifying the php/mysql basics like: basic login security, email confirmations, keeping session/cookie info, etc, etc. tutorials that take into account more modern situations/setups would be appreciated. thanks in advance!
  5. doh, aParent.removeChild(a); should be aParent.removeChild(hyperlink1);
  6. I am trying to remove a child element from the document, but keep getting an error: In IE, This error is: 'No Such interface supported' In FF. The error is: 'uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.removeChild]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: file:///W:/ArianTest/HelpDesk/testRemoveChild.html# :: removeTheChild :: line 18" data: no] Line 0' Here is some basic example code, tried 2 ways to remove the hyperlink element. EDIT: 2d way works, but id like to get 1st method working as i have usually used removeChild and wondering why its not working in this case. <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function removeTheChild() { var closeRequestDiv = document.getElementById('closeRequest'); var a = closeRequestDiv.getElementsByTagName('a'); var hyperlink1 = a[0]; alert('html='+ hyperlink1.innerHTML); //just to make sure it pulled a hyperlink node, so should output Close //alert('a.#='+ a.length); var aParent = hyperlink1.parentNode; alert('test1'); aParent.removeChild(a); alert('test2'); //never gets here } function deleteNode(elementId) { var label=document.getElementById(elementId); while( label.hasChildNodes() ) { label.removeChild( label.lastChild ); } } </script> </head> <body> Both dont work:<br/> <a href="#" onclick="removeTheChild()">Remove The Child</a> <br/><br/> <a href="#" onclick="deleteNode('closeRequest')">Remove The Child2</a> <div class="request" id="requestID2793"> <div id="closeRequest"> <a href="#">Close</a> </div> </div> </body> </html>
  7. nvm figured last one out too: "Standard SQL doesn't allow you to refer to a column alias in a WHERE clause"
  8. whoops i think i got it another way of doing it. build whole table this way, i dont think i can dynamically bring in the RequestID like be4. i do get one perplexing error that i mention in below query, can i can get rid of but i want to use an alias: SELECT r.RequestID ,lastRoutedTemp.empnum as lastRouterID//this alias actually doesnt work. not sure why, need to get rid of it and use empnum or ill get "unknown column lastRouterID in where clause." FROM helpdesk.request r LEFT JOIN ( SELECT rr.RequestID, rr.empnum, MAX(rr.DateTimeEntered) FROM routing rr GROUP BY rr.RequestID ORDER BY rr.RequestID ASC, rr.DateTimeEntered DESC ) as lastRoutedTemp ON r.RequestID=lastRoutedTemp.RequestID WHERE Reqempnum=80 AND (r.Closed!=1) AND lastRouterID=314 ORDER BY closed ASC, dateTimeEntered DESC
  9. I am trying to get associated values in another table but am getting an error: 'ERROR 1109 (42S02): Unknown table 'r' in where clause' I know it exists. but not sure why mysql cant refer to outer table reference. SELECT r.RequestID,lastRoutedTemp.empNum FROM helpdesk.request r LEFT JOIN ( SELECT empNum, RequestID FROM helpdesk.routing rr WHERE rr.RequestID=r.RequestID ORDER BY rr.DateTimeEntered DESC LIMIT 1 ) as lastRoutedTemp ON r.RequestID=lastRoutedTemp.RequestID /* //once get above working, i will pull all reqeusts for user 80, which are open, and routed to IT support user 314 WHERE Reqempnum=80 AND (r.Closed!=1) -- AND lastRoutedID=314 */ ORDER BY closed ASC, dateTimeEntered DESC using server version: 4.1.12a-nt on server
  10. all i know is you helped out alot I needed the description of the request too so hence why i thougt i should go route of joining with request, in fact i guess i should have not done a LEFT JOIN, and done a INNER JOIN since all routes rows will have 1 row in request table. yeh sorry actually i made the tables a bit simpler for the original post: DateTimeEntered=DateGotTheRequest Closed=SolvedIt ... WHERE ro2.Closed!=1 // all open tickets now u r right that bascially i am saying here is IS NULL equals open tickets, and IS NOT NULL will be searches for closed tickets. Should I use that IS NULL? or index Closed field and use what i have currently? Thanks alot btw.
  11. I've had same issues with people cutting and pasting stuff from Word/email client into textfields to insert into database. Let me know what works for you. ' " and - always get meessed up
  12. wow awesome, yeh that helps out. Actually I didnt think of a ticket not being assigned to someone as when you enter a ticket, you automatically assign it to someone from the beginning. All i needed was... SELECT ro2.* FROM helpdesk.routing AS ro2 JOIN ( SELECT requestID , MAX(DateTimeEntered) AS DateTimeEntered FROM helpdesk.routing ro1 GROUP BY requestID ) AS rmax ON ro2.requestID = rmax.requestID AND ro2.DateTimeEntered= rmax.DateTimeEntered LEFT JOIN helpdesk.request r ON ro2.requestID=r.requestID WHERE ro2.Closed!=1 // all open tickets i think this is basically the same, ran alot faster for some reason though, maybe cause 1 less subquery i think?
  13. I thought it takes it off the server, somehow server knows who yuo are.? are you sure? i think we tested by turning off Windows Authentication today and it broke our pages.
  14. right now Integrated Windows Authentication is set to on on IIS, and php seems to know who you are when you login, so if u login to the network as user 'user1012', $SERVER['PHP_AUTH_USER'] will hold 'user1012', and from there I put in more info about the user into a session so various pages on the intranet can customize for him then. if IIS, turns this checkbox off, then i cant do this as $SERVER['PHP_AUTH_USER'] will hold no value... So i was wondering if we move to apache on unix or even apache on windows, how will i enabled this Windows authentication feature? does something have to be turned on in apache, so php knows the user? or some new php i have to code in my session.php to make it know who user is logged into network as? Thanks in advance
  15. Hello all, need help for a Query if anyone has a lil time: There are 2 tables for our help desk system, summarized below: requestdescriptions of IT support requests requestIDDescription 1XP got the Blue Screen of Death. 2Keyboard not working. 3Needs photoshop installed. 4Computer not starting. routingwho request is routed to and if they closed it requestIDEmployee_IDDateGotTheRequestDatePassedOnTheRequestSolvedItWhatYouDid 1122006-3-1 12:01:002006-3-1 14:47:000Couldnt solve it, might be hardware issue. 1972006-3-1 14:47:002006-3-2 10:58:000not hardware, passing back to another software guy 1462006-3-2 10:58:002006-3-2 11:34:001Had bad drivers, reinstalled XP 2462006-3-1 7:58:002006-3-5 15:58:000not sure, working on this past few days... passing this to Dave 2972006-3-5 15:58:002006-3-5 17:17:001keyboard not plugged in 3122006-3-12 9:23:002006-3-12 10:24:001put order in for photoshop 4122006-3-17 15:23:002006-3-18 12:24:000checked power supply and motherboard, not sure 4462006-3-18 12:24:00NULLNULLNULL Note: DatePassedOnTheRequest is really when they passe it onto someone else, or closed it. Until they route it to someone else or close it, the DatePassedOnTheRequest, SolvedIt, and WhatYouDid fields are NULL. I want a query for all closed requests and all open ones (and with their descriptions). Now the way i approached this in my head is to get the last route for each request by ORDERing by DateGotTheRequest DESC for each request. but after that i'm stumped as to if i should use a GROUP BY, or just WHEREs. the GROUP BY i tried basically wont work as group BYs only should pull info in common to all rows right? like requestID and Description stay the same for each request. here is a basic query to start me off: SELECT * FROM routing ro JOIN request r ON ro.requestID=r.requestID ORDER BY requestID ASC, DateGotTheRequest DESC which will give This returns a list of all joined rows: requestIDDescriptionEmployee_IDDateGotTheRequestDatePassedOnTheRequestSolvedItWhatYouDid 1XP got the Blue Screen of Death.46 2006-3-2 10:58:002006-3-2 11:34:001Had bad drivers, reinstalled XP 1XP got the Blue Screen of Death.97 2006-3-1 14:47:002006-3-2 10:58:000not hardware, passing back to another software guy 1XP got the Blue Screen of Death.12 2006-3-1 12:01:002006-3-1 14:47:000Couldnt solve it, might be hardware issue. 2Keyboard not working. 97 2006-3-5 15:58:002006-3-5 17:17:001keyboard not plugged in 2Keyboard not working. 46 2006-3-1 7:58:002006-3-5 15:58:000not sure, working on this past few days... passing this to Dave 3Needs photoshop installed. 12 2006-3-12 9:23:002006-3-12 10:24:001put order in for photoshop 4Computer not starting. 46 2006-3-18 12:24:00NULLNULLNULL 4Computer not starting. 12 2006-3-17 15:23:002006-3-18 12:24:000checked power supply and motherboard, not sure I want to then pull these following rows out, I would have thought a GROUP BY but seems not to work as it doesnt pull correct info i want (doesnt seem to pull the 'highest row' which for example: for requestID #1 Employee_ID last routed to should be 46 but i think if GROUP BY requestID is added, the row it gets is the one with Employee_ID 12). requestIDDescriptionEmployee_IDDateGotTheRequestDatePassedOnTheRequestSolvedItWhatYouDid 1XP got the Blue Screen of Death.462006-3-2 10:58:002006-3-2 11:34:00 1Had bad drivers, reinstalled XP 2Keyboard not working.972006-3-5 15:58:002006-3-5 17:17:001keyboard not plugged in 3Needs photoshop installed.122006-3-12 9:23:002006-3-12 10:24:001put order in for photoshop 4Computer not starting.462006-3-18 12:24:00NULLNULLNULL then i want to pull requests WHERE SolvedIt is 1 for my 1st Query(last person it was routed to solved it) requestIDDescriptionEmployee_IDDateGotTheRequestDatePassedOnTheRequestSolvedItWhatYouDid 1XP got the Blue Screen of Death.462006-3-2 10:58:002006-3-2 11:34:001Had bad drivers, reinstalled XP 2Keyboard not working.972006-3-5 15:58:002006-3-5 17:17:001keyboard not plugged in 3Needs photoshop installed.122006-3-12 9:23:002006-3-12 10:24:001put order in for photoshop And unsolved ones WHERE SolvedIt!=1 (last person it was routed to, hasnt closed it) requestIDDescriptionEmployee_IDDateGotTheRequestDatePassedOnTheRequestSolvedItWhatYouDid 4Computer not starting.462006-3-18 12:24:00NULLNULLNULL any ideas?
  16. I was wondering how you should get rid of/keep slashes when you get/post information. Like to me the only reason to check all your POST/GET vars everytime at the beginning of your php page is to stripslashes() if get_magic_quotes_gpc is on, and add slashes back in your Insert/Select queries and leave them be when outputting to html. $textDesc = (get_magic_quotes_gpc()) ? stripslashes($_GET['textDesc']) : $_GET['textDesc']; $Query = "SELECT * FROM table WHERE description LIKE '%". addslashes($textDesc)."%'"; echo htmlspecialchars($textDesc); Or do u add slashes from the start, like so... $textDesc = (get_magic_quotes_gpc()) ? $_GET['textDesc'] : addslashes($_GET['textDesc']); $Query = "SELECT * FROM table WHERE description LIKE '%". $textDesc."%'"; echo htmlspecialchars( stripslashes($textDesc) ); or it doesnt make a difference? Thanks in advance! Ari //then run a SELECT query maybe here, like ... "SELECT * FROM table WHERE description LIKE '%$textDesc%'"; //then if inserting into database use addslashes() back on the variable $textDesc = (get_magic_quotes_gpc()) ? $_GET['textDesc'] : addslashes($_GET['textDesc']); But pretend on the previous page, there is a textbox and the user enters: John's car Since there is a single qoute in that text, then it would add a slash to it and the Search would look like '%\'%' "SELECT ... LIKE '%John's car%' "; But if the user entered both single and double: "John's Car" "SELECT ... LIKE '%\"John\'s Car\"%' "; but i see on a few pages, even Dreamweaver 8 automatically adds this code to top of page $textDesc = (get_magic_quotes_gpc()) ? $_GET['textDesc'] : addslashes($_GET['textDesc']); //then run a SELECT query in Dreamweaver, like ... "SELECT * FROM table WHERE description LIKE '%$textDesc%'";
  17. I need to get to my stock watch list and parse some stock qoutes for my personal watch/alert program I am building, So I have to goto my 8th portfolio... http://finance.yahoo.com/p?v&k=pf_8, but it needs my username/password combo before going in (i already have these of course but want a way to get 'into the' page via php). how can i pass these in, and get the HTML contents of the page, which once in a variable i know how to cleanup and parse? I think i read something about cURL and i was wondering if someone could help me with a quick n; dirty example on what to use. Thanks, Arian
  18. bump why is md5_file() so quick? i change 1 px in an image and its filesize is exactly the same, yet the hash is totally different. i gues i was expecting this, reading about the function itself, but seems like processing the data is really quick (almost like magic haha).
  19. why is md5_file() so quick? i change 1 px in an image and its filesize is exactly the same, yet the hash is totally different. i gues i was expecting this, reading about the function itself, but seems like processing the data is really quick (almost like magic haha).
  20. I am not doing either, md5 encrypts the actually data in the file in my code examples? Not the name of the file correct?
  21. Hello, all thanks for replies... Some quick questions... what exactly is a GUID? Isnt the md5 hash going to become the unique identifer in the system, are you talking about something else? P.S. is it faster to use md5_file() on the filename versus suppling the file's string data to md5()? I see both return a 32 char HEX number. aka $filename = "/uploads/something.jpeg"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); $hash = md5($contents);//not even sure if this is how you would do it on the photo's data if i were to use md5() itself fclose($handle); //versus $filename = "/uploads/something.jpeg"; $hash = md5_file($filename);
×
×
  • 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.