Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. By using a user_to_groups table design users ===== user_id name username password groups ====== group_id title user_to_groups =========== id user_id group_id So if there are 3 groups - id 1,2, and 3 then I can grant access to any user id by adding a record in the user_to_groups table. Lets give user_id 1 access to groups 1 & 3 user_to_groups =========== 1 1 1 2 1 3
  2. You would need to read the question and submit the answer into the text field. If there is more than one question then you must have the answers ready i.e. store them in an array and get the answer record from the question. Treat cURL as a web browser without a human clicking links or inputting into form fields. However websites will still function as they do in a normal browser, redirecting you if session values aren't set, 404 errors on invalid links, etc. You cannot bypass website security just because you are using cURL. Example using cURL to post into a form where the field names are 'name' & 'answer' <?php $dataArray = array('name' => 'joe', 'answer' => 'slumdog millionaire'); # Convert data array into a query string (ie animal=dog&sport=baseball) foreach($dataArray as $key => $value) { if(strlen(trim($value)) > 0) { $value = is_array($value) ? $value : urlencode($value); $tempString[] = $key . "=" . $value; } else { $tempString[] = $key; } } $queryString = join('&', $tempString); curl_setopt($ch, CURLOPT_POSTFIELDS, $queryString); curl_setopt($ch, CURLOPT_HTTPGET, FALSE); ?>
  3. This is incorrect if ($_POST["$submit"]) Use if ($_POST['submit'])
  4. if(strlen($_SESSION['submitted'][30]['other'])) { echo "choice 1"; } if(strlen($_SESSION['submitted'][31]['other'])) { echo "choice 2"; } If you have many array keys i.e. 30,31,32,33, etc then you may want to run through a loop
  5. What does this mean?
  6. Permissions! The webserver will run as a non-administrative user i.e. apache For programs to run via the CLI through exec the webserver user must have the permissions available.
  7. This is bad practice
  8. I would strongly recommend you going through a few tutorials before asking for help as you are a beginner. Connecting to a database, selecting, inserting and updating records is basic stuff and is covered here: http://devzone.zend.com/node/view/id/627 Once you have aquired the skills then you should have no problem in adapting to your own website.
  9. unable to send emails to hotmail and yahoo accounts This has nothing to do with the mail function. It will probably be reverse DNS on your mailserver or something. Yahoo / Hotmail may reject your messages because the hostname of your mailserver cannot be resolved from it's IP address.
  10. i.e. date_default_timezone_set('America/Los_Angeles');
  11. Waste of memory space using variables for each item in the $_POST, $_GET array. Use the data within the array foreach($_POST as $key => $val) { $_POST[$key] = mysql_real_escape_string($_POST[$key]); } mysql_query("INSERT INTO table SET name='".$_POST['name']."'");
  12. Because you should join tables on foreign keys. If for some reason there were 150 records in the products table and 151 in the description then you arent going to get the correct results. Also if you ordered one table in adifferent way to the other then the products wont match the descriptions.
  13. post the login class $login = new login();
  14. <?php for($i=1;$i<=10;$i++) { echo "<div id='bldlvl".$i."' style='background-color: yellow; width: 100%; clear: both; border-top: 1px gray dashed; display:none;'><p>".$aftermath->listings('buildings',$i,'edit')."</div>"; } ?>
  15. It maybe a tornado and your client is in Oz! What is Free Realty 3.0? What are the errors if any? Do you know if cookies are required to login? Has your client blocked cookies? Post the source code for the login script!
  16. Use a hidden field if using a post method print "<input type=\"hidden\" name=\"rrn\" value=\"$rrn\" />";
  17. None of the files you have posted have anything to do with music playback. The buildMisicPlayer file reads the filenames in your mp3 directory then constructs an xml document. sound.play() is a Javascript function. If this is in your site then your probably looking for an onLoad() event handler within the <body> tag of your html pages
  18. Write a Javascript function that populates the select list using DOM via an onChange event handler on each radio button.
  19. get rid of this: if (isset($_POST['submit'])) { and use a hidden field: <input type="hidden" name="action" value="login" /> if($_POST['action'] && $_POST['action'] == 'login') { // validate username and password }
  20. If a client requires a major modification to the way the system works then this is where you run into issues using off-the-shelf software. You have to fully understand the system to be able to make the required modifications. This scenario is not so bad when it is your own system as you know exactly what to modify and can estimate time to do it. If you need something up and running quick then use Joomla, osCommerce, etc. Once you have time, learn the main parts of the system to give you ideas on how to construct your own version adding the features that most of you clients require.
  21. if($_POST['username'] == "login" && $_POST['pass'] == "login") {
  22. You will only get the final result written. You should open the file once only. Write your header row. Then write to the file within the loop for your database records. Then close the file after the loop. You are also using 2 queries and a nested loop, bad idea. You should write 1 query and join the 2 tables. I am guessing they join via products_id SELECT p.*,pd.products_name,pd.products_description FROM products p, products_description pd WHERE p.products_id=pd.products_id Now your loop //heading to be written once to file $f1 = fopen("g_file.txt", "w+"); fwrite($f1, "id\ttitle\tdescription\tprice\tlink\timage_link\n"); //loop to get data while ($r2 = mysql_fetch_array($result2)) { $y4 = $r2["products_id"]; $y1 = $r2["products_model"]; $y2 = $r2["products_price"]; $y3 = $r2["products_image"]; fwrite($f1, $y4."\t".$y1."\t".$y2."\t".$y3."\n"); } fclose($f1);
  23. Use the header function to redirect, not a meta refresh. header("Location: xyz.php"); exit();
  24. By specifying default parameter values in the method __construct($dir = false, $count = false) Then $x = new ClassGallery() will work
  25. if(preg_match('%The maximum bet is set at <b>\\$([0-9,]+)</b>\\.<br>%', $subject, $regs)) { $result = $regs[0]; } print $result;
×
×
  • 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.