Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. if reg.php is a post form you can do something like this $_POST['submit'] = "submit"; $_POST['name'] = "bob"; include "reg.php"; or change the reg form to check a session and pass the data that way.. or am i missing something ?
  2. Ok.. just say i login and that data is stored in a session.. than data needs to be secure.. to stop others getting the session id.. but we don't unset until the use logs out.. Okay this isn't 100% correct.. the browser holds the session ID ONLY... this session will expire (defined by your server) if you want it more secure you could add a cookie with a random key and have the same random key in the session and then compare them.. theirs a ton of thing you could do but i really don't think its worth it..
  3. if you dealing with auto increment then use mysql_insert_id either that or use limit 1,1 sort by id
  4. Read up on COM's http://uk2.php.net/manual/en/ref.com.php
  5. not sure what your asking but why not use Session ? and yes you can do $_POST['test'] = "blar"; but this will only work on code in the current script (or an included file)
  6. I can't see why its adding two, but the reason they ar e blank is because your not setting the values see comment "//Set Post Values ADD 2 lines below" <title>Add A Manufacturer</title><body bgcolor="#CCCCCC"> <link rel="stylesheet" type="text/css" href="style.css" media="all"> <table width="725" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="FFFFFF" bordercolor="#999999"> <tr> <td> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class=table3> <td><? include("includes/header.php") ?></td> </tr> </table> <?php //Set Post Values ADD 2 lines below $make = $_POST['make']; $view = $_POST['view']; // fixed query for insert, the above one looks like an update $sql = "INSERT INTO $table2 (make, view) VALUES ('$make', '$view')"; $query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error()); ?> <form enctype="multipart/form-data" action="<? echo $PHP_SELF ?>" method="post"> <table wIDth="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class=table3> <td><table wIDth="100%" border="0" cellspacing="1" cellpadding="3" align="center"> <tr class=table1> <td colspan="4" class=table1><div align="center"><b><font size="3" face="Verdana, Arial, Helvetica, sans-serif">ADD MANUFACTURER</font></b></div></td> </tr> <tr class=table1> <td wIDth="18%" class=table1><b>NAME: </b></td> <td width="31%" class=table1><font style="text"> <input type="text" name="make" value="" /> </font></td> <td width="21%" class=table1><b>SHOW: </b></td> <td width="30%" class=table1><font style="text"> <select name="view"> <? // Query to pull information from the Database $result = mysql_query("select * from $table8 order by id ASC"); while ($row = mysql_fetch_object($result)){ ?> <option value="<?php echo $row->view; ?>"> <?php echo $row->view; ?> </option> <?}?> </select> </font></td> </tr> <tr class=table2> <td><b>IMAGES:</b><br> <font size="1">Please select the images (jpeg only):</font></td> <td colspan="3"> 1: Upload <input name="imageOne" type="file" class="bginput" id="imageOne"><br> </td> </tr> <!-- end of new code --> <tr class=table1> <td colspan="4" align="center" valign="top"> <input type="submit" name="submit" value="SUBMIT" > <input type="hidden" name="ID" value="<?php echo $ID; ?>"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </td> </tr> </table> </FORM> <br><table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class=table3> <td><? include("includes/footer.php") ?></td> </tr> </table> </td> </tr> </table>
  7. your probably find an example that 99% of what you want.. AJAX isn't that but don't over use it.. heres a basic one i wrote awhile back.. Dynamic DropDown PHP/AJAX
  8. i don't think you really need to worry about hi-jacking then.. worst case.. someone hi-jacks a open session that allows use for x minutes from another site.. when the session timesout.. its over.. i would probably go for a .htaccess protection to stop other using scraping mysite..
  9. What exactly is the session used for ? if you link to another site then its possible for them to get the session id, but you can improved the security simple example would be also store the IP and compare to the users IP.. it really depends what your using them for..
  10. google ajax auto suggest your find lots of examples
  11. NO. it is not ok.. you should always read the license
  12. Okay.. are using a form/hyperlink what? These going to be visible to the user ? what you doing this ? too little info to give real advice soo.. if your using a form then use an array element!
  13. See Freelance section.. offer something Thats usfull whats not working ?
  14. erm... don't unset it, if you need it! unset on logout.. i guess it depends what its for!
  15. I would normally say "Move to third party scripts".. But you are not allow to change this script
  16. PHP can not access raw post data, your need use perl as well, otherwise your never know the total size of the file your uploading..
  17. i would probably code it like this <?php $network = ($_POST['NetworkName'] != "Any")?"NetworkName = '{$_POST['NetworkName']}' AND ":""; $query = "SELECT * FROM deals WHERE $network PhoneCost BETWEEN 0 AND '{$_POST['PhoneCost']}' AND ContractLength BETWEEN 0 AND '{$_POST['ContractLength']}' AND FreeMins BETWEEN '{$_POST['FreeMins']}' AND 9999 AND FreeTexts BETWEEN '{$_POST['FreeTexts']}' AND 9999"; ?>
  18. also should be <? require('calculation.php'); $alltotal = get_total_price(); echo '<div id ="title">Total Earned for the day: $'.$alltotal.'</div>'; ?>
  19. in darkfreaks defence i have seen LOTS of people attempt shuffle like that.. also please be aware.. that the code you use will allow results like SK###SK and JQ###JQ where as the following code will not..
  20. what error did you get ? if any ?
  21. try this <?php $query = "SELECT * FROM deals WHERE NetworkName = '{$_POST['NetworkName']}' AND PhoneCost BETWEEN 0 AND '{$_POST['PhoneCost']}' AND ContractLength BETWEEN 0 AND '{$_POST['ContractLength']}' AND FreeMins BETWEEN '{$_POST['FreeMins']}' AND 9999 AND FreeTexts BETWEEN '{$_POST['FreeTexts']}' AND 9999"; $result = mysql_query($query) or die(mysql_error()); ?>
  22. darkfreaks remember shuffle will shuffle an array BUT whats does it return!!! shuffle($array); not $randarray=shuffle($array); as it returns a boolean EDIT: oh if you must have different random items then shuffle works well ie <?php $array= array("SK","JQ","RP"); shuffle($array); echo $array[0]; echo $regnumber; echo $array[1]; ?> which i think darkfreaks was aiming for
  23. <?php $array= array("SK","JQ","RP"); $randarray= array_rand($array); $randarray2= array_rand($array); echo $array[$randarray]; sprintf($regnumber); echo $array[$randarray2]; ?>
  24. <?php function get_total_price() { //sum total price for all items in inventory $query = "select SUM(inventory.price*inventory.qty) AS subtotal, SUM(subtotal) AS total FROM inventory"; $result = mysql_query($query) or die(mysql__error()); //Add error handling $row = mysql_fetch_row($result); return $row['total']; } ?>
  25. mysql_escape_string() (string not strings) has been deprecated, use mysql_real_escape_string() mysql_real_escape_string
×
×
  • 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.