mmcdonald 28 Posting Pro

the necessity of domain registration

I don't mean this offencively but this is a very... strange, topic.

A domain name is an address mapped to a webservers IP address. You can host a website without a domain name, people will just have to enter your IP address. I'm not sure what search engines will do about naming your website however...

There have been some famous websites that used nothing but an IP address, but you'll need a VPS or a dedicated server rather than shared hosting (You need to be able to setup and configure virtual host files in the apache2 configuration). They only got away with using an IP address however as the purpose of their existence was related to their IP. Their IP was also memorable.

If you can clarfiy on your question perhaps we can assist you some more?

mmcdonald 28 Posting Pro

G'day daniwebers!

I just ran into this: http://www.daniweb.com/web-development/web-design-html-and-css/threads/463119/responsive-web-designing- and it made me think about a community driven and maintained resource database? Is this something that's been thought of before and swept under the carpet? If so - could we bring it back in to the light?

I'm always crawling the web looking for the next useful tool and if we could construct our own database on DW of recommended resources... it could help a few? It's something I'd use frequently.

Thoughts?

Thanks,
Michael

mmcdonald 28 Posting Pro

Okayyyyyyyy first of all I'm not downloading some random .rar file :)

Second of all yes you are on track. Keep yourself up-to-date with the latest graphics engines jsuch as havok and ensure you're well aware of engine application. It's great that you developed a game on your own - building a portfolio really is the best way to secure yourself an interview with a major games development agency.

Don't rely on your computer science degree however, remember: "Anyone can get a deree". What employers in this industry are really looking for is evidence of your skills, passion, creativity, general knowledge (common sense) and the ability to innovate existing technologies.

You're about to target one of the most highly saturated employment markets making it one of the hardest jobs to secure. To increase your chances of securing a position within the ranks (as a junior) then complete your degree with an Hons 1:1, get yourself a masters degree (or your countries equivilent) and then pack out your portfolio.

Good luck,
Michael

mmcdonald 28 Posting Pro

What error do you get when you put:

$result = mysql_query("SELECT cat.Name, sub.Name FROM sub_categories sub, categories cat WHERE cat.Id = sub.CategoryId AND sub.id=$categoryId") or die($myQuery."<br/><br/>".mysql_error());
??

Only just noticed phorces response - it's good advice. As said in my last post, get yourself better errors and programming will become a million times easier :)

mmcdonald 28 Posting Pro

Get yourself a clearer error dump... try using trigger_error or mysql_error. More info can be found in the official PHP manual.

I would also plead that you use MySQLi or PDO rather than MySQL and look into prepared statements. It makes database driven web applications so much easier to create and maintain whilst also protecting you from SQL Injection attacks.

Either way, try to get a better error report as guided above or carry on as you will and good luck!

mmcdonald 28 Posting Pro

DONT DO A SYSTEM RESTORE. I hope this gets to you quick enough. One of the worst things to do to an infected machine is execute a system restore.

Boot yourself into Safe Mode and start checking your event logs, look for unusual activity. Whilst in safe mode you should also use your AV to run a scan. If you have avast then you should boot into safe mode and execute a full boot scan.

It's not always a virus - have you been playing with any OS critical files or drivers?

A serious question though... why are you relying on Windows Defender? That's one of Microsofts biggest fails alongside Vista and the Microsoft Surface.

mmcdonald 28 Posting Pro

Hi Vivosmith and sorry for the slow reply.

Choosing a career shouldn't depend on your skillset but instread on your end goal - where do you want to be in 20 years time?

Get a pencil and some paper, in the middle draw a line - you're about to utilise the 'rubber band' model. On the left hand side write all of the things pulling you towards MIS and on the right hand side list all of the things pulling you towards finance. When you're done the side with the greatest weight (personally to you) will cause the band to break - this is the option you should choose.

Alternatively, if you feel you can handle the work load, do both. Degrees in finance are often overlooked as the market is saturated (Everyone has a bloody degree!) so what you could do is sit a degree in MIS whilst studying vendor certifications such as AAT and CIMA for finance and finance management in your spare time or visa-versa. You should however note that according to sociologists and some other no-life-boffins, training in multiple skills makes you, in their terms, a 'slasher'. Slashers are supposedly less effective in all of their skills due to their lack of focus on a single trade.

I hope something above helps you to make your decision but you must remember that this is a HUGE decision and will play a key role in the next few decades of your life. The choice must be yours …

mmcdonald 28 Posting Pro

Boo! Meh you knew it was me. After all, I post 99% of the dumass questions around here...

I have a modal that's being a teenager and isn't doing as it's being told: http://i.imgur.com/7PcLQCS.png

As you can see from the image, it's half off of the screen!

Here's the code:
//The button that kick starts the modal magic
<div class="left-trigger" >
    <button class="btn btn-blue" data-toggle="modal" data-target="#supportModal" type="button">Support</button>
</div>

//The modal itself (It's just a series of fields atm for testing :3 )
<div class="modal-scrollable hide" style="z-index: 10050;">

<div id="supportModal" class="modal hide fade modal-overflow in" tabindex="-1" data-width="760" style="display: block; width: 760px; margin-left: -380px; margin-top: 300px;" aria-hidden="false">

                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                                    <h3>Contact Support</h3>
                                </div>

                                <div class="modal-body">
                                    <div class="row-fluid">
                                        <div class="span6">
                                            <h4>Some Input</h4>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                        </div>
                                        <div class="span6">
                                            <h4>Some More Input</h4>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                            <p><input type="text" class="span12 m-wrap"></p>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn blue">Create My Ticket!</button>
                                </div>
                            </div></div>

                            //Add a transparent black bg behind the modal... keepin' it pretty!
                            <div class="modal-backdrop fade in hide" style="z-index: 10049;"></div>

All includes are present and correct as the Modal is fully functional.

Thanks for an help in advance,
Michael

mmcdonald 28 Posting Pro

People with the same issue, resolved by adding position: relative; to the parent <li> of the dropdown :)

mmcdonald 28 Posting Pro

Image of design issue

Hi peeps,

Struggling to locate the source of this issue. The dropdown for ALL of the menu items appears on the far left of the nav and not below te menu item selected. For example, in the image above I clicked programming and the dropdown appeared on the far left. Any ideas?

Michael

mmcdonald 28 Posting Pro

Blikin' hell I totally misunderstood the question haha, sorry!

On form submission you could create a session for each of the fields before processing and then simply unset/destroy the sessions at the end of processing.

I.E:

if(isset($_POST['forum_submit'])){

    //Create session for each field
    $_SESSION['username'] = $_POST['username'];
    $_SESSION['firstname'] = $_POST['firstname'];
    // and so forth...

{

and then for each field:

<input name="username" type="text" value="<?php if(isset($_SESSION['username'])){echo $_SESSION['username'];} ?>">

Therefore if a session exists that holds form data it'll be entered as input field values.

mmcdonald 28 Posting Pro

@almostbob - how is this going to repopulate fields on a page refresh?

mmcdonald 28 Posting Pro

I don't have an exact answer my friend but I might be able to push your search into the right direction. Usually this type of behaviour is down to the clients browser, therefore I would suggest looking at JavaScript which is all executed client side. Perhaps looking into the onkeyup event to detect and collect user data and then store the data in a cookie? It's a rough answer and maybe someone here can really push you in the best direction - that's just my input.

I pulled this answer from a user called arthurr on StackOverflow:

I had similar issue at one of my project so I wrote some js to handle this using cookies. First I found two simple functions to set and get cookies values:

function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name)
{
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1)
  {
  c_start = c_value.indexOf(c_name + "=");
  }
if (c_start == -1)
  {
  c_value = null;
  }
else
  {
  c_start = c_value.indexOf("=", c_start) + 1;
  var c_end = c_value.indexOf(";", c_start);
  if (c_end == -1)
  {
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start,c_end));
}
return c_value;
}

Than I wrote two other functions to set and get input values:

function saveValue(input) {
    var name = input.attr('name');
    var value = input.val();
    setCookie(name,value);
}

function getValue(input) {
    var name = input.attr('name'); …
mmcdonald 28 Posting Pro

Understood, cheers prit!

mmcdonald 28 Posting Pro

Cheers fella, glad I was on the right lines haha +1

Another quick query, if I use $userid as an argument in lots of methods (50+) then is there a viable method of using a 'globalish' variable to set the argument?

Let me clarify...

If I'm going to use the $userid example above identically in lots of methods is there a way to write it once and be done with it for all methods in the class or should I just pass the argument settings in all of the methods individually?

mmcdonald 28 Posting Pro

Or am I being a twat... should I use if(isset($userid)){//code} within the actual method... that would make sense wouldn't it... yes Michael it would.

mmcdonald 28 Posting Pro

I have a hunch that when I write the method I declare the argument like so:

public function getFirstname($userid = $_SESSION['userid']){
    //code
}

then if I leave the argument empty: $user->getFirstname(); it will automatically use the userid session value. However if I write $user->getFirstname("10") it will use 10 for the userid? Is that right?

mmcdonald 28 Posting Pro

Hi all, I'm still playing around with OOP and to be totally honest really enjoying it! I can't believe I haven't made the switch from procedural earlier...

Something I would like to know is, how can I set default arguments for methods / functions?

What i'm getting at is, if I write this: $user->getFirstname() it should automatically se that there are no arguments and therefore use the value of $_SESSION['userid'] as the argument for that method. However if I write $user->getFirstname("10") it should see the argument and use 10 as the userid instead for that particular call on the method.

I'm currently reading through http://php.net/manual/en/functions.arguments.php and I think the answer is there; it's just my lack of understanding as I'm looking at the examples cluelessly.

Cheers,
Michael

mmcdonald 28 Posting Pro

Don't worry peeps it was me being a drip - I grabbed a coffee, munched a lot of biscuits and noticed I was closing the database in my method:

$this->db->disconnect();

Deleting that line (User class line 42) solved the issue. Ta!

mmcdonald 28 Posting Pro

Guess who!

I've made very little progress due to work but I've spent an hour looking into where I left off. Below is what I wrote from scratch over the past hour. Now if half works because if I use the user ubject once it works fine, yet if I enter it more than once it fails (Sorry if I haven't worded that correctly).

The classes
class database{

    protected $_link;

    public function __construct(){
        $this->_link = mysqli_connect('.', '.', '.', '.');
    }

    public function disconnect(){
        mysqli_close($this->_link);
    }

    public function query($string){
        if ((isset($string)) && ($string != null)){
            $result = mysqli_query($this->_link, $string);
            return $result;
        }else{
            return false;
        }
    }

}


class user{

    public $string;
    protected $db;

    public function __construct(){
        $this->db = new database;
    }

    public function getData($values){
        $string = "SELECT `".$values."` FROM `users` WHERE `id` = '77'";
        $result = $this->db->query($string);

        /* create associative array */
        $data = $result->fetch_array(MYSQLI_ASSOC);
        //printf ("%s (%s)\n", $data["fn"], $data["ln"]);
        $result->free(); 
        $this->db->disconnect();

        return $data[''.$values.''];

    }

    public function getFirstname(){
        return $this->getData("fn");
    }

    public function getLastname(){
        return $this->getData("ln");
    }
}
The code THAT WORKS
$db = new database;
$user = new user;

echo $user->getFirstname();
The code DOESNT WORK
$db = new database;
$user = new user;

echo $user->getFirstname()." ".echo $user->getLastname();
Output of code that doesn't work
Michael
Warning: mysqli_query(): Couldn't fetch mysqli in C:\xampp\htdocs\sb\classes.php on line 17

Fatal error: Call to a member function fetch_array() on a non-object in C:\xampp\htdocs\sb\classes.php on line 42

As you can see the first call on the object for the first name works, then …

mmcdonald 28 Posting Pro

Cheers Prit, I have a much clearer understanding.

That happens to be the most unbiased response I've ever had to that question - thanks!

mmcdonald 28 Posting Pro

That's great Pritaeas thank you very much. The way I'm currently approaching my classes is to have a class for each area of the web application. For example:

  1. User Management (Creating, updating and retreiving user data)
  2. Support Management (Creating, updating and retreiving ticket data)
  3. Forum Management (Creating, updating and retreiving thread/topic data)

...and you get the drift. Is that what you mean by a single clear purpose - or are you implying that I should have a class for creating, a class for updating and a class for retreiving?

As for your comments regarding your existing class in your ORM experiment (Which looks great by the way), would you recommend PDO over mysqli? I have read the opinion of many thanks to Google but there are too many conflicting arguments to truly clarify. Would you do the honour and share your opinion? Believe me when I say it'll hold more weight in my judgement!

You have no idea how much your advice is appreciated,
Michael

mmcdonald 28 Posting Pro

It's all working well now so thank you. May I ask, what's the most appropriate way of constructing classes and methods in regards to utilising user information? Should I have a class that would be used to loop user information on a user database and a class to construct their profiles?

Any advice would be appreciated. In the mean time I am going to abuse Google - ta!

mmcdonald 28 Posting Pro

Okay thank you for the information, I'll be looking into all of the above and will post back here with my progress.

Michael

mmcdonald 28 Posting Pro

Thanks for the response Pritaeas, it looks like it's basic PHP training I need not OOP!

I totally understand the requirement for return $this->_result but where would I add the mysqli_fetch_assoc()? In the query method or in the user class construct?

Also, for the fetch, how would I write this? To be totally honest I'm still struggling to appreiciate what properties I'm calling on and from where, also for what reason.

Thanks again,
Michael

mmcdonald 28 Posting Pro

Hi all,

I've literally JUST dived into OOP and it's a totally different world. I've written some pretty awful code just to grasp OOP basics. The following code is all in the same file and runes fine, there are no warnings, errors, notices and so forth yet it doesn't work correctly... I think it's something dead simple and if it is I promise to facepalm as hard as I can.

Thanks for any help in advance.

Code:
<?php

error_reporting(E_ALL);

    class database{

        protected $_link, $_result, $_numRows;

        public function __construct(){
            $this->_link = mysqli_connect('localhost', 'root', '', 'studybubble') or die(mysqli_error());
        }

        public function disconnect(){
            mysqli_close($this->_link);
        }

        public function query($string){
            $this->_result = mysqli_query($this->_link, $string);
            $this->_numRows = mysqli_num_rows($this->_result);
        }

        public function numRows(){
            return $this->numRows();
        }

    }

    class user{

        private $firstname;
        private $lastname;
        private $avatar;

        function __construct(){

            $db = new database;
            $stm = $db->query("SELECT fn, ln, avatar FROM `users` WHERE `authuser` = 'mmcdonald'");

            $this->firstname = $stm['fn'];
            $this->lastname = $stm['ln'];
            $this->avatar = $stm['avatar'];

        }

        public function firstname(){
            return $this->firstname;
        }

        public function lastname(){
            return $this->lastname;
        }

        public function avatar(){
            return $this->avatar;  
        }
    }

    $user = new user;    
    echo 'Firstname: '.$user->firstname().'<br />
          Lastname: '.$user->lastname().'<br />
          Avatar: '.$user->avatar();

?>
The current output:

Firstname:
Lastname:
Avatar:

Again PLEASE ignore the security aspects and optimisation aspetcs and such, they're not my focus in this exercise :) Thanks!
mmcdonald 28 Posting Pro

Ignore this message I failed :3 sorry haha

mmcdonald 28 Posting Pro

Yeah I think I've decided to hire a dev for this little snippet :3 but thanks

mmcdonald 28 Posting Pro

Hello DaniWebers!

I'm absolutely shocking when it comes to JavaScript/JQuery and have run into an occurance when I would like to use it. Now before you slap me on the wrist I DO intend to learn JS in 2014 (Scouts honour!).

I am using this slider: JQuery - Snap To Increments

HTML
<div id="slider-snap-inc" class="slider bg-green"></div>
<div class="slider-value">
    Days: <span id="slider-snap-inc-days"></span> | 
    Cost: <span id="slider-snap-inc-amount"></span> |
    Savings: <span id="slider-snap-inc-savings"></span>
</div>
JS:
// snap inc
$("#slider-snap-inc").slider({
    value: 50,
    min: 50,
    max: 1300,
    step: 50,
    slide: function (event, ui) {
        $("#slider-snap-inc-amount").text("$" + ui.value);
    }
});

The above works great and the value shows in increments just as it should.. but what I would like to do is add another two calculations:

1. Days
The number days selected for premium account upgrade.

2. Savings
The money saved by purchasing more days in one transaction.

A table with the data I need to present, just so you understand a little bit easier: Data I'm Using

How does one go about adding more calculations and outputs to the same slider? I've played around but can only make one of the three work at any one time. Thanks for any assistance.

mmcdonald 28 Posting Pro

@caperjack You're right, but I will always leave a valid response just incase someone reads the discussion in the future who would really like to know the answer.

mmcdonald 28 Posting Pro

Or you could just grow up, go without your social diarrhea for a few hours, get yourself some good grades and then have a great job that allows you to use Facebook because you're so high up the corporate ladder! No? I didn't think so.

Your best bet is to use a proxy or your smartphone. Believe me when I say this... your school technicians are smarter than you. If they don't want you on facebook you're not getting on it. It's that simple - sorry!

Saying that I did bypass my schools security back in the day for my peers at a rate of 50p per session; it was the easiest 'business' I've ever run!

mmcdonald 28 Posting Pro

Mr Green is right.

You will first need a foundation understanding of hardware so look into the CompTIA A+ 801 and 802 exams. Attaining this certification will allow you to call yourself an A+ Technician.

Next you should move to the CCENT -> CCNA -> CCNP certification track. If you're not a fan of Cisco consider the MCSA MCSE route and get yourself the Directory Services certification. There is a lot of work out there for MCSE's at the moment.

The best route imo is to get the A+, then the CompTIA Network+, then a job as a first line support technician. Whilst in this position train towards the CCNA and see if your employer can help you. By the time you're a CCNA technician you could be ready for a promotion to second line support (network level). Keep moving forward with vendor certifictions by EC Council, Microsoft, ComPTIA, Cisco and similar.

Good luck!

mmcdonald 28 Posting Pro

I couldn't agree with Diafol any more, +1. I love PHP, it's fun because it's challenging. It's useful because it works.

I too have very limited experience with Java and it's just a different world in comparison to PHP.

Ultimately it depends on what you'd like to do in the future, PHP and Java, imo, exist for very different reasons.

If you're considering your career then there seems to be a lot more work for certified Java experts who have built themselves a portfolio of their personal projects. Getting employed as a PHP programmer is difficult as it's quite a saturated market in comparison to its demand.

mmcdonald 28 Posting Pro

Could be an issue with a local firewall or something in regards to accessing JQuery. Have you considered adding the .mis.js file locally and trying again? It's a weak reponse and I apologise for that but it's all I can think of at this moment in time.

mmcdonald 28 Posting Pro

Judging by your question - you chose a very... humerous, username.

All you need is a simple shell script if it's on a linux webserver that used the cp command with the -B switch. The -U switch might also be useful. I'm not sure why you're asking this in VB.NET, maybe that's due to my lack of knowledge in the area, but still - everything you want can be achieve on a windows server using a batch script (or powershell, which is simply cmd on steroids) as well as scheduled tasks or on a linux webserver using a shell script that simply does something like:

cp -RUF /home/webserver/public/website.com/public/[source] /sys/backup/[destination]

YOUR PATHS WILL BE DIFFERENT...

You would only need the -R switch if you're copying the contents of a directory rather than the folder itself. -R is recursive. -U only copies the file if the source is newer than the destination. -F switch forces the copy.

Sorry for the sloppy reply in a hurry.

For all of the above you'll need access to the server via SSH or remote desktop, or at least FTP/SFTP access to execute manual backups.

mmcdonald 28 Posting Pro

As far as I'm aware... that's impossible. You could use the GD library but that would be ridiculous as far as I'm concerned. You would need to use JavaScript or HTML5 imo - probably the best way forward. You'd need to pull in your database values as you construct the code for the graph.

http://canvasjs.com/html5-javascript-line-chart/
http://www.jscharts.com/how-to-use-line-graphs

mmcdonald 28 Posting Pro

What do you mean by "The script works"?

mmcdonald 28 Posting Pro

Is it 100% writable? Is there enough space? Does the user you're defining have access to that dir? Does that user have remote access at all?

mmcdonald 28 Posting Pro

Thanks Diafol :) I'm probably going to open a few more topics tomorrow xD

mmcdonald 28 Posting Pro

Hi all - thanks for the insight; I've only just managed to get back to this. This doesn't report any errors but it doesn't give any output at all. How do I actually echo out array values from a method?

<?php

    class user{

        public $get;

        function get(){

            $user = "mmcdonald";

            $link = mysqli_connect("localhost", "root", "", "studybubble");
            $stmt = $mysqli->prepare("SELECT * FROM `users` WHERE `authuser` = ?");
            $stmt->bind_param('s', $_SESSION['auth']);
            $stmt->execute();
            $stmt->store_result();

            $this->get = $stmt->fetch_array(MYSQLI_ASSOC);

        }

    }

    $object = new user;

    // If I wanted the current users first name, fn is the column name in users table
    echo $object->get['fn']; 

    // If I wanted the current users last name
    echo $object->get['ln']; 

    // If I wanted the current users email address
    echo $object->get['authemail']; 

?>

As this topic already suggests - this is my first run into OOP and as much as I love it... I just don't get it yet :3

mmcdonald 28 Posting Pro

Don't I first need to call $this = new action; followed by $this->connect();? I.E. declare the object?

mmcdonald 28 Posting Pro

So ultimately what we've identified here is that for me to successfully use classes I need to look into properties and static. Thanks guys!

Here's a question.

Using the example above, how do I connect to SQL in anthother file? I would imagine I'd write action::connect(); but that would require the cnnect method to be static. Is this the rigth way to do it or is there a better way?

mmcdonald 28 Posting Pro

No problem. For example because this will make the property (variable) available inside the extended classes.....

Okay that makes sense. So by setting it globally in the class rather an a method I can call upon it in any other class too? Useful! I'll check out the links now.

mmcdonald 28 Posting Pro

First, in the connect method where does that config array come from?

This class file (classes.php) is included below config.php in all files, which contains the array.

In the disconnect method, where does the mysqli variable come from?

The $mysqli variable comes from the connect method and is only called after a connection is already open.

In the userInfo method you call the disconnect method statically with the scope resolution operator when it's not declared static.

Could you please explain?

Also you should start using properties.

I have no idea what these are so I'm opening Google now :)

$this refers to the current class.

Thanks! Is this built into PHP then? Can $this only be used within a classes methods?

mmcdonald 28 Posting Pro

@Cereal - thanks for your input. How would this be beneficial? Would you mind explaining why someone would do this? Not being an ass I just want to fully understand what it is you're explaining. Also, why $this? Has this modification changed how I echo $userInfo['value']; in other files?

mmcdonald 28 Posting Pro

Hi all,

I've been playing around with PHP for a while now and never really studied hardcore (Just used it as best as I could on a whim) but I've now decided to sharpen the skill and get much better. I'm playing around with my first class and would like some feedback on its structure and general syntax. Is it a fairly good start? Are there any concerning issues I should be aware of? Thanks in advance! I've commented throughout so people are aware of what they're supposedly looking at.

 <?php

     class action{

        ////////////////////////////////////////////////////////

        private function connect(){

            $mysqli = mysqli_connect($config['host'], $config['user'], $host['password'], $config['db']);

            if (mysqli_connect_errno()) {
                printf("Connect failed: %s\n", mysqli_connect_error());
                exit();
            }

        }

        ////////////////////////////////////////////////////////

        private function disconnect(){

            $thread = $mysqli->thread_id;
            $mysqli->close();
            $mysqli->kill($thread);

        }

        ////////////////////////////////////////////////////////

        public function userInfo(){

            // Make the userInfo array available on a global scope.
            global $userInfo;

            //Lets make sure we are connected to the SQL DB
            if ($mysqli_connection->connect_error) {
               action::connect();
            }

            //Lets be awesome and protect ourself from SQL injections
            $stmt = $mysqli->prepare("SELECT * FROM `users` WHERE `authuser` = ?");
            $stmt->bind_param('s', $_SESSION['auth']);
            $stmt->execute();
            $stmt->store_result();

            //This will allow us to use the array anywhere such as: $userInfo['authuser'];
            $userInfo = $stmt->fetch_array(MYSQLI_ASSOC);

            // Free up resources
            $stmt->free();

            //We need to keep the system optimised by closing our connections!
            action::disconnect();

            }

        ////////////////////////////////////////////////////////

        public function checkAuth(){

            // Do we have the users firstname? We should - but it's best to check
            if(isset($_SESSION['auth'])){
                if ((basename($_SERVER['PHP_SELF']) != "profile.php") && $userInfo['fn'] == null){
                    header('Location: profile.php');
                    exit();  
            }
                // Stop logged in users from viewing …
mmcdonald 28 Posting Pro

Was that the problem... it hit your spam/junk...??

mmcdonald 28 Posting Pro

Deadline: August 31st

mmcdonald 28 Posting Pro

That's a lot of unstructured code that I don't have the time to go through. You really need to check your php error log to se if anythings being recorded. Make sure error reporting is on.

mmcdonald 28 Posting Pro

Output PHP errors and post them here please or get them from your error.log file. If you're local it's php_error_log