Jump to content

Nothadoth

Members
  • Posts

    119
  • Joined

  • Last visited

Everything posted by Nothadoth

  1. I can't see any error logs being created. So i'm not really sure. However I tested it in chrome and it works fine - so it must be an issue with IE10. I guess it's not really a problem then, it doesn't effect the end user anyway. Thanks for the help guys.
  2. I am re-designing the theme so I created a new directory to work in and when it is finished ill just transfer the files. I havent modified any files in the old directory but now it is causing the error. An example of this is the following URL - http://eventav.biz/s...&cmd=close&e=20 If I click the form button to change the event status it takes me to the above url but displays the "HTTP 400 Bad Request" error. But if I then just click the url at the top of the browser and click enter then it loads fine and works... I can perform the action on my iphone and it works, but using my laptop or my dads causes the error. PS - To bring this to a moderators attention. I cannot post messages properly on this forum using internet explorer 10. The quick reply box wont allow me to type and when I created this thread I was unable to create a new line. I am having to use Chrome.
  3. Hey guys. I had my site working fine, but now all of a sudden when I click on certain hyperlinks it goes to 'HTTP 400 Bad Request'. But then if I just refresh the page it works fine. Why is this happening? Any clues??????
  4. Hey, I am trying to create a fairly simple website for my dads business. However I require to be able to run multiple php sessions at once and I'm not entirely sure of the best way to do this. Basically there will be different product lists displayed based on the $eventId variable set in the URL. For instance index.php?e=1 shows the products for event 1, and index.php?e=2 shows products for event 2 etc. He wants them to have to require a password for each event. I thought about using something like this: $_SESSION[$eventId]['loggedIn'] Would that sort of thing work? Or is there a better way of creating simultaneous sessions? Much appreciated, Tom
  5. Thanks very much i'll take a look at that. Also, I found that my problem was that the variable I was trying to use contained a speech mark, so I fixed it by using str_replace. Anyway, the jquery looks much tidier thanks.
  6. Hey guys, im not very good with javascript so I used a script from DynamicDrive.com to give me a tooltip on mouse over for a div. It works fine, except for if I want to use a php variable as the tooltip text. Why? Here is the javascript code: var offsetfromcursorX=22 //Customize x offset of tooltip var offsetfromcursorY=20 //Customize y offset of tooltip var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1). document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV document.write('<img id="dhtmlpointer" src="images/tooltiparrow.gif">') //write out pointer image var ie=document.all var ns6=document.getElementById && !document.all var enabletip=false if (ie||ns6) var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "" var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : "" function ietruebody(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function ddrivetip(thetext, thewidth, thecolor){ if (ns6||ie){ if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px" if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor tipobj.innerHTML=thetext enabletip=true return false } } function positiontip(e){ if (enabletip){ var nondefaultpos=false var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft; var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop; //Find out how close the mouse is to the corner of the window var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20 var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20 var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000 //if the horizontal distance isn't enough to accomodate the width of the context menu if (rightedge<tipobj.offsetWidth){ //move the horizontal position of the menu to the left by it's width tipobj.style.left=curX-tipobj.offsetWidth+"px" nondefaultpos=true } else if (curX<leftedge) tipobj.style.left="5px" else{ //position the horizontal position of the menu where the mouse is positioned tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px" pointerobj.style.left=curX+offsetfromcursorX+"px" } //same concept with the vertical position if (bottomedge<tipobj.offsetHeight){ tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px" nondefaultpos=true } else{ tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px" pointerobj.style.top=curY+offsetfromcursorY+"px" } tipobj.style.visibility="visible" if (!nondefaultpos) pointerobj.style.visibility="visible" else pointerobj.style.visibility="hidden" } } function hideddrivetip(){ if (ns6||ie){ enabletip=false tipobj.style.visibility="hidden" pointerobj.style.visibility="hidden" tipobj.style.left="-1000px" tipobj.style.backgroundColor='' tipobj.style.width='' } } document.onmousemove=positiontip Here is the code on my php pageecho "<div onmouseover=\"ddrivetip('Test Description', 300)\" onmouseout=\"hideddrivetip()\"><img src=\"$thumbnail\" alt=\"$pd_name\"></div> "; If I swap "Test Description" with $pd_name or anything else the tooltip does not show up at all. Why not? PS. Sorry about the post! I cannot seam to start a new line on this text editor????? The enter key does nothing. Problem with ie10??
  7. Hi, I have set up my database so that there are 3 sizes (A5, A4, A3). There is a price and quantity for each - so the column names are: a5_price, a5_qty, a4_price, a4_qty, a3_price, a3_qty In a form the user submits the size they want and it returns $size and $qty to add it to the cart. I want to query the database and get the quantity field which contains $size (so a3_qty for example) and then retrieves the current stock. How can I do this? At the moment I tried $sql = "SELECT pd.pd_id, pr.a3_qty, pr.a4_qty, pr.a5_qty, pr.postcard_qty FROM tbl_product pd, tbl_print pr WHERE pd.pd_id = $productId AND pr.pd_id = $productId"; $result = dbQuery($sql); extract($row); if (strstr($a3_qty, $ct_pd_size)) { $currentStock = $a3_qty; } elseif (strstr('$a4_qty', '$ct_pd_size')) { $currentStock = $a4_qty; } elseif (strstr('$a5_qty', '$ct_pd_size')) { $currentStock = $a5_qty; } Obviously that doesnt work as it is searching the contents of the field. How can I make it search the field name and then return the contents? Thank you.
  8. I am looking in to that "many to many" method now. It seams a tidy solution. I'll set about learning this. Thanks
  9. Thanks for the replies. ChristianF: Yeah I could make the database so that each value had its own field. But I figured that this would be too messy. Which is why I decided to store multiple values in a single field. Do you think that it would be better then to just put each value in its own column and have a lot of columns? I'm intersted though. Why exactly do you say that it is such a problem to store data like this in a single column? And why are variable variables so bad to use? Thanks for your help
  10. maxudaskin: Yes I was going to mark as solved. However I was waiting to see if ChristianF (or anyone) happened to know a way around the problem in my last post, since everyone was saying my original method wasn't very good. Never mind.
  11. Thanks for your replies. ChristianF: I did try to use an array. But mysql would not split it. I tried adding the data to the database field pd_color(eg. black,black.jpg,000000). Then i retrieved that as $color = $row['pd_color'] and tried to make an array out of it but it would not split it. I ended up having to use SPLIT_STR() and define each individual part manually.
  12. Yes i looked up variable variables before I started this and from what I saw it looked fine. I cant figure out why it isn't working. So what would you suggest. EDIT: The reason I want to do this is because I am gathering multiple variables from a database that look like this: mens_color, mens_size, mens_price, womens_color, womens_size, womens_price, etc. (there are a fair amount more). The $gender variable is set according to which we want to view. So the data would be returned using ${$gender}_color, etc. It just seams a neater way than doing if ($gender = "mens") { $color = $mens_color } and the same for womens. I would have a long string down the page defining variables.
  13. Hey, I would like to be able to select a variable using another variable. I have tried the code displayed but it does not work. Any ideas? $gender = "mens"; $test_mens_test = "test"; echo $test_{$gender}_test; Thanks
  14. I have solved it. The new mysql version used a longer encryption. The password field I was using before was limited to VARCHAR 32 where the new password string was 41 chars long. So i changed it to VARCHAR 50 just in case and it works fine. I also replaced all PASSWORD() functions with SHA1() as I have researched and found that it is a strong encryption. Hope this helps anyone.
  15. I thought it may have been because of the MySQL version so I ran a MySQL query on the new site with the following: (Username: admin, Password: admin) $sql = "INSERT INTO tbl_user (user_name, user_password, user_regdate) VALUES ('$userName', PASSWORD('$password'), '$config_datetime')"; This returned the password string in the database as: *2470C0C06DEE42FD1618BB99005ADCA Then in the login function it runs the following (and returns "Wrong Username or Password"): if ($userName == '') { $errorMessage = 'You must enter your username'; } else if ($password == '') { $errorMessage = 'You must enter the password'; } else { // check the database and see if the username and password combo do match $sql = "SELECT user_id FROM tbl_user WHERE user_name = '$userName' AND user_password = PASSWORD('$password')"; $result = dbQuery($sql); if (dbNumRows($result) == 1) { $row = dbFetchAssoc($result); $_SESSION['plaincart_user_id'] = $row['user_id']; // log the time when the user last login $sql = "UPDATE tbl_user SET user_last_login = '$config_datetime' WHERE user_id = '{$row['user_id']}'"; dbQuery($sql); // now that the user is verified we move on to the next page // if the user had been in the admin pages before we move to // the last page visited if (isset($_SESSION['login_return_url'])) { header('Location: ' . $_SESSION['login_return_url']); exit; } else { header('Location: index.php'); exit; } } else { $errorMessage = 'Wrong username or password'; } } return $errorMessage; } Im completely confused. If i remove the user_password = PASSWORD('$password') and put the password string from the top of the post in to the Password box then it works fine. So it seams that it is just that the PASSWORD() function is giving the same result on both queries...
  16. I have set up a website for a friend on my own web space. All works fine as he has an admin control panel where he can log in and change what ever he likes. When a user is created for this admin CP, the password is set into the MySQL database using user_password = PASSWORD('$password') This works fine and encrypts it as expected and I am able to login using the password as normal I have now set up his own webspace and exported his database and files to it. Now when I try to login on his new site it does not recognise the password string. Why? All the coding is fine as I have tried changing the password in the database to an unencrypted one and changed the login feature and took the PASSWORD() function away and it works. So it is just that PASSWORD() is not recognising the string that was set on the old site.
  17. I got it to work using what I said in my above post. Thank you for your help.
  18. Ok so I echo'd the code below and changed the date_default_timezone_set to Europe/London and it gave the correct time, and then changed it to Europe/Paris and it displayed a time 1 hour in front. So it seams that code is working. date("m/d/y H:i:s",time()); Now I need to get this date and time in to my database. Using NOW() still gives a time 5 hours behind. If i define the code above as variable $datetimestamp and then use the code below would that work? I would probably have to change the database column to varchar? SET user_last_login = '$datetimestamp'
  19. I logged in and checked the database to see what NOW() had produced and it was still 5 hours behind. No change after the code I posted above.
  20. I ran this in my header: date_default_timezone_set('Europe/London'); echo " " . date("m/d/y",time()); and it echo'd: No time was acctually displayed.
  21. Hey, I am trying to send a time and date to my database. The php code is: SET user_last_login = NOW() This sets it as: 2012-08-02 06:22:34 However this is 5 hours earlier than I want it. How can I change this so that it sets the timezone as GMT (Europe/London). I have tried changing the Global TimeZone in phpMyAdmin, and it says I need SUPER PRIVELIDGES to do so. I have tried date_default_timezone_set('Europe/London') and this also does not work. Any ideas? Thanks
  22. Thanks. I changed the names and it is showing both answers again. How can i make it so that it shows $newrow['$pricetype']; (eg. $newrow['pd_price1'] or $newrow['pd_price2'] etc.) and then I need to assign each to a variable and add them all together for a final price.
  23. I tried changing it to this where pd_price1 was already pre-defined without using a variable for the number and then suddenly it stopped displaying two $pricetype (instead of pd_price1pd_price2 it just shows pd_price1) and just displayed: pd_price119.99. So it seams that once i put a second mysql query inside it and create a new WHILE loop inside it, it stops displaying the second result. . function getOrderAmount($orderId) { // Perform Query $result = mysql_query("SELECT * FROM tbl_order_item WHERE od_id = '$orderId'"); echo $orderId; while ($row = mysql_fetch_assoc($result)) { $pd_id = $row['pd_id']; $type = $row['pd_type']; $pricetype = "pd_price" . $type; echo $pricetype; $result = mysql_query("SELECT * FROM tbl_product WHERE pd_id = '$pd_id'"); while ($row = mysql_fetch_assoc($result)) { echo $row['pd_price1']; } } return $orderAmount; }
  24. Hey. I would like someone to tell me how to code this as I cannot figure it out. I've pretty much taken it down t to scratch as I can't get it to work. I am putting a shopping cart together where each product has 3 different options (eg. single, double, full kit). I have the following database tables (table --> fields) tbl_product --> pd_id, pd_type, od_id tbl_order_item --> pd_id, pd_price1, pd_price2, pd_price3 - pd_id will match pd_id from the tbl_order_item - pd_type is defined as 1, 2, or 3 which will then (hopefully) assign onto "pd_price" . $type; to get the price - od_id is the current order id for the shopping cart and will match to $orderId which is already defined I am trying to run a code to get the final shopping cart price to send to Paypal. Assume there are multiple products (ie. 2 x product id 72 where one is price_1 and one is price_2 (single and double both being ordered). So i need it to basically.... SELECT pd_type FROM tbl_order_item WHERE od_id = $orderId result = $type then... SELECT pd_price.$type FROM tbl_product WHERE pd_id = pd_id Thats for each product in the cart. Then take the pd_price.$type value (eg. ?29.99) for each product and add them together to get a finalised price. Here is what I have.... not much... function getOrderAmount($orderId) { // Perform Query $result = mysql_query("SELECT * FROM tbl_order_item WHERE od_id = '$orderId'"); echo $orderId; while ($row = mysql_fetch_assoc($result)) { $type = $row['pd_type']; $pricetype = "pd_price" . $type; echo $pricetype; } return $orderAmount; } in the above code, assuming my order has two products of the same pd_id where one is pd_price1 and one is price_2, it echos the current orderid (tested and works) and then the following: price_1price_2 So ive managed to get that far. Now i need it to select from the tbl_product table using $pricetype and get the relavant price, then add them all together as $orderAmount. Sorry thats long. Is it possible?
×
×
  • 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.