Jump to content

ttocskcaj

Members
  • Posts

    184
  • Joined

  • Last visited

Everything posted by ttocskcaj

  1. file_get_contents() has suddenly stopped working for me. I keep getting this error: Warning: file_get_contents(/Users/ttocskcaj/MineCMS/public/js/jquery.js ) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /Users/ttocskcaj/MineCMS/controllers/m.controller.php on line 44 The file(s) definitely exist, I can use nano to open them, and permissions are 777 on all the files. The lampp error log has nothing. Not even a No such file or directory error as you'd expect. Any ideas what's going on?
  2. Did you replace $result = mysql_query ("Select whatever data from whatever table"); with the right query to get the data you want?
  3. Yea, you're right. I re-read the question and it made more sense this time Ricky, in realpath('.'); the dot refers to the current directory. (Just like ".." is the parent directory). So when you do realpath('.') you're getting a string that is the path to the current directory.
  4. Don't know how I managed that. I use an IDE lol. *bangs head on wall*
  5. Why not use absolute paths? define('BASE_PATH', realpath('.')); BASE_PATH will now equal the absolute path to the script that executed it. For example if BASE_PATH is defined in /var/www/mysite/index.php then it would equal "/var/www/mysite" This works if your entire site is controlled through an index.php file (Like in MVC architecture etc) You have a very confusing looking directory structure.. How about in the index.php (Or whatever file includes all the others) you define a constant with the site root? Then you can use it to include files like this include SITE_ROOT.'/djsonrotation/includes/initialize.php' In this case SITE_ROOT would be /directory/wherever/localhost/looks/for/files It's a lot easier than trying to keep track of all those dots.
  6. echo '<table width="1083" height="313" border="2" cellpadding="1" cellspacing="2" bordercolor="#0066FF">'; $result = mysql_query ("Select whatever data from whatever table"); while ($row = mysql_fetch_array($result)){ echo "<tr>"; // PHP loops through each row from the database and draws an HTML table row for each one. echo "<td>{$row['field1']}</td>"; echo "<td>{$row['field2']}</td>"; echo "<td>{$row['field3']}</td>"; echo "</tr>"; // End of this table row. } echo '</table>'; //We have now looped through each row, so we close the table and we're done.
  7. I noticed that strtolower() wasn't working. My script was adding blank rows to a text file that was supposed to be lowercase emails, so I wrote the following script to confirm it's not working: <?php $var = "Foo"; echo "$var<br />"; echo srttolower($var)."<br />"; $var = strtolower($var); echo "$var<br />"; ?> This page just prints "Foo" once on the screen where I should see Foo foo foo I then checked my error log, and I'm getting Call to undefined function messages for strtolower(). Any ideas?
  8. Yes. That is correct. Why not just try it? if (!is_null($activationCode)){ echo "Not Null"; } else echo "Null";
  9. Ok, Thanks guys. I understand that it's no different from a normal form now. We'll probably implement captcha and some sort of frequency checks.
  10. I guess you're right about it not being different from normal. It's all good to not link to these pages, but it won't take a hacker long to figure out how it works, especially since it's an open source project. When you say authorized, do you mean check if there is a user session and the user is logged in etc? How would you authorize a user that hasn't actually registered yet? It's probably not likely, but someone could mess around and add random users to the database.
  11. Me and one other person have just started developing a forum package, it's the first time that either of us have really used AJAX, but we're both pretty good with PHP. We're trying to work out the whole submitting a registration form using AJAX, we have the page http://www.example.com/account/register When the user visiter goes to this site they're presented with the registration form, as you'd expect. When the form is submitted, AJAX does a POST request thing (Whatever you call it) to the same page, the script on this page checks to see if there's any post data and if there is, it validates it and sends it to the database etc. The problem is, what is there to stop anyone from sending post data to this site and adding random users? The same problem would occur if we were to add functions to delete and change users. Any hackers could send post data and delete users. Are we doing something wrong, or is there something obvious we've missed?
  12. sorry, that should have been $this->view
  13. I made it work. It works when you don't declare the view property at the start of the class. So instead of class controller { public $view; __construct(){ $view = new Smarty(); } } just do class controller { __construct(){ $view = new Smarty(); } } It doesn't work if you make $view private, or protected either. You just have to leave it out.
  14. My bad. header('Location: http://www.mywebsite.com/auto_quote2.php'); The fact that you have a full URL made me think you were redirecting for a second step or something.
  15. It sounds like your trying to move session variables between two different servers. Which I'm pretty sure you can't do. (Well very easily anyway) Better off using cookies.
  16. phpSensei, I don't follow you. I'm just going to assume there's no simple way to do this? I should probably just use an MVC framework
  17. I've never done this MVC stuff before :s This file is supposed to take variable from the URI and create the controller object. https://github.com/ttocskcaj/TTMailer/blob/master/index.php
  18. Parent is here https://github.com/ttocskcaj/TTMailer/blob/master/includes/controller.class.php child is here https://github.com/ttocskcaj/TTMailer/blob/master/public/controllers/index.php
  19. Removing the constructor on the child class gives Call to a member function assign() on a non-object
  20. I'm working on a MVC website, At the moment my controller class has the constructor function __construct(){ $view = new Smarty(); } Every time I make a new controller extending this class I have to do this function __construct(){ parent::__construct(); } so that the view object is created. Is there anyway to do that automatically without having the parent::__construct() line?
  21. The sites are at 2 different sub domains though. Probably easier just to create a class for phpbb's user and group tables
  22. We already have an active forum community on our site. I've just made a seperate admin area on the site (not related to the forum). What I want to do, is use the phpbb database for admins to login to my admin area to. IE if a user has a certain rank on the phpbb forum, they can also use their details to log into the admin site. Is there some php library that lets you do this? Or do I have to write my own. Hope that's clear enough :/
  23. Not sure what I was doing wrong, but I changed it to use cURL and now it works fine :s $survival_curl = curl_init(); curl_setopt($survival_curl, CURLOPT_URL, "http://www.secret.com"); curl_setopt($survival_curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($survival_curl, CURLOPT_POST, true); curl_setopt($survival_curl, CURLOPT_POSTFIELDS, $data); $output_survival = curl_exec($survival_curl); $info_survival = curl_getinfo($survival_curl); curl_close($survival_curl);
  24. There's no errors. I'm pretty sure it's the python that's not working. I just wanted to confirm that that php is fine
  25. I have this code: error_reporting(E_ALL); $post = array(); $post['user'] = "ttocskcaj"; $post['group'] = "Mod"; $ret = ''; $postdata_str = "user=" . $post['user'] . "&group=" . $post['group']; if (($fp = @fsockopen("www.secret.com", 8101, $errno, $errstr)) == false) die("Error $errno: $errstr\n"); fputs($fp, "POST /permissions-proceed HTTP/1.0\r\n"); fputs($fp, "Host: www.secret.com:8101"); fputs($fp, "User-Agent: HTTPTool/1.0\r\n"); fputs($fp, "Content-Length: 256\r\n\r\n"); fputs($fp, "$postdata_str"); while (!feof($fp)) { // receive the results of the request echo "<pre>".fgets($fp, 128)."</pre>"; } fclose($fp); Which is supposed to send a username and a group to a python script where the user is put into that group. It's not working though. I just want to check if everything is alright on this end, before trying to find what's wrong in the python.
×
×
  • 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.