Jump to content

ToonMariner

Members
  • Posts

    3,342
  • Joined

  • Last visited

Everything posted by ToonMariner

  1. The only thing I can see wrong in there is here... $sql = mysql_query("INSERT INTO users (username, email, password, signup_date) VALUES('$username', '$email', '$db_password', now())") or die (mysql_error()); you have now())'' try '" . now() ."' and see what happens.
  2. somewhere before your query define $user. Is this taken from a session variable? if so $user = $_SESSION['user'] What ever is holding the value you need assign it to $user and it should be fine.
  3. sha1 will return a string of 20 binary pairs - so 40 characters long. but i believe you can pass a string of 'any' length to sha1 just as you can with md5.
  4. [code]<?php $qry = "SELECt * FROM yrtbl ORDER BY sortfield DESC LIMIT 0,10"; $qry = mysql_query($qry); while ($row = mysql_fetch_assoc($qry)) { echo $row['bittodisplay'] . "<br>"; } ?>[/code]
  5. hi people, small prob but annoying me lots. Cut to the chase.... I instantiate a class... $html = new page_Construct; assign a propery... $html->secure = 1; now later in the script I include loginform.php from within the class $html. before any other code in loginform.php i echo $html->secure and get the following error: Notice: Undefined variable: html in C:\Program Files\Apache Group\Apache2\htdocs\nas\admin\templates\loginform.php on line 3 Notice: Trying to get property of non-object in C:\Program Files\Apache Group\Apache2\htdocs\nas\admin\templates\loginform.php on line 3 The secure level in login form is: prior to including loginform.php i can echo $html->secure successfully in the script that calls loginform.php what am I doing wrong??????
  6. well... infinite loops on a standard page served to a browser will normally time out ater 30s of script parsing (thats the default in the ini file which can be changed - but people don't wait 30 s for a [age anymore!!!!) you can however use them in cron jobs that run in the background on the server for 'constant' data processing, i.e. stockmarket figures others will ,I'm sure, give further examples
  7. Just write your menu in its own file and include it in a template for teh site.... And avoid frontpage like the plague!!!!
  8. Change this... $query = "INSERT INTO my_messages (customer_id, from_customer_id, subject, message, sent_date) VALUES ('{$_GET['cid']',{$_SESSION['customer_id']},'$subject', '$message', NOW())"; to this... $query = "INSERT INTO my_messages (customer_id, from_customer_id, subject, message, sent_date) VALUES (" . $_GET['cid'] . ", " . $_SESSION['customer_id'] . ",'" . $subject . "', '" . $message . "', '" . NOW() . "')"; Now this is my preferred method of generating strings - i like to concatenate as the colours of teh text change in my scripting app so I can see what is where. Your code however seems to be missing just a closing curly brace for the $_GET['cid'] bit - maybe put that in and see how it goes.
  9. What errors are returned?
  10. perhaps you shoudl look at forking your script..... there is a tutorial on forking in teh tutorials section of phpfreaks.
  11. What I think you want to do (change the div content without reloading the page) requires javascript. BUt why bother? just have your link point to a script with some vars passed in the url... I avoid js if at all possible - i try to make my websites as accessible as possible since in the uk you can be prosecuted if visually impaired or blind people cannot access any services you tender on your site..
  12. First off you can remove the value= attribute checkboxes can only be true or false so u don't need that. since they can only have that value you need not use addslashes (unless there is something that a malicious fool would liek to do but difficult to see that happening if you code will only work on true or false! what are you trying to do with the values? if it is to run in a query you can make a string of the array like so.. [code]<?php $i = 0; $qrystr_0 = NULL; foreach ($_POST['del'] as $key => $value) { $qrystr_0 .= $i++ == 0 ? "IN (" . $key : ", " $key; } $qrystr_0 . = ")"; ?>[/code] similar stuff for the 'sen' array... then in your query use .....WHERE `field` $qrystr_0 ....
  13. if you are absolutely desperate to protect the url variables then perhaps have a look at encoding the entire string after the .php? (this way you hide the variable names too which can be useful!) You will need to decrypt the info so have a look at the mycrypt function.
  14. Where on earth have you seen this used in this way before??? I think you have something mixed up, the example you have given has no apparent use what so ever!!!! I don't even think you can use and in this context either (saying that without trying it of course!!)
  15. search engines read the html output from what ever pagethey are on - and as php predominantly outpust html engines read it... to get a good ranking you should read some articles on search engine optimization.
  16. you only need to assign the $mailsend = mail(.... if you are going to test success or failure later on... but thats a side from your issue for now. Where are you running teh script? (your localmachine or a live server?) what is teh smtp setting in php.ini?
  17. Have you made sure you posted those url's correctly? The second scenario has you going to a subdomain (go.domain.com) if that is the case then perhaps the server will not allow session cookies to traverse domains/subdomains.
  18. first off you need to alter the form so that the inputs do not 'overwrite' the previous input name... [code]<?php .... $result = mysql_query("SELECT * FROM *") or die(mysql_error()); for($i = 1; $i <= $number; $i++) { echo "$i)&nbsp;<br> Real Name:&nbsp;<input type=\"text\" name=\"rsid[]\"><br> MSN Identity:&nbsp;<input type=\"text\" name=\"msnid[]\"><br> Member Rank:<select name=\"rank[]\">"; mysql_connect("*", "*", "*") or die(mysql()); mysql_select_db("*") or die(mysql()); mysql_data_seek($result , 0); while($row = mysql_fetch_array( $result )) { echo "<option>$row['rank']</option>"; } echo " </select> <br>"; } ... ?>[/code] So that creates an array of your inputs automatically... to teh insert statement.... [code]<?php if($dbsubmit) { mysql_connect("*", "*", "*") or die(mysql_error()); mysql_select_db("*") or die(mysql_error()); $no_entered = coount($_POST['rsid']); $tempstr = NULL: for ($i = 0; $i < $no_entered; $i++) { if ($i > 0) { $temp .= ", "; } $temp . = "('' , '$_POST['rsdi'][$i]', '$_POST['msndi'][$i]', '$_POST['rank'][$i]')"; } $qry = "INSERT INTO MSN (ID, rsid, msnid, rank) VALUES " . $qry . "; $qry = mysql_query($qry) or die(mysql_error()); echo "CHANGE THIS MESSAGE MAYBE SHOW THE NUMBER OF AFFECTED ROWS!"; } ?> [/code] something liek that will do ya.
  19. try this... [code]<?php $lookfor = array('/\\\\/','/\\/'); $repwith = array('\\',''); $string = preg_replace($lookfor,$repwith,$string); ?>[/code] where $string is the string you want to do the replacement on.
  20. you can do this: [code] <style type="text/css"> a:link{color:<?php echo $linkcolor; ?>}; </style> [/code] But I would look to creating a whole style sheet on teh fly and caching it.
  21. [code]<?php $product_qty = "qty" . $row_products['productID']; ?>[/code]
  22. here is some old code of mine - haven't re-visited for a couple of months now -- its part of a class and this one saves the image into the database but you shoudl be able to pick out the bist you need..... grrrr won't let me post the code... pm me with an email addy and i'll send it.
  23. You couldpossibley write the header with the post info within but that would be hardcoded - no room for any dynamic content within (unless you used php to generate the header string of course) - otherwsie you would need to use a form.
  24. [a href=\"http://uk.php.net/manual/hk/function.number-format.php\" target=\"_blank\"]number format[/a]
  25. IMO opinion it is always best to install manually - you get to know the system much better and can trouble shoot much more readily. Nothing worng with apache 2, php 5 or mysql 5. Especially if you go for the latest STABLE or RECOMMENDED release.
×
×
  • 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.