Search found 648 matches

by hyper
Thu Apr 12, 2018 7:53 am
Forum: PHP coding => General
Topic: Best practices for reset
Replies: 9
Views: 131

Re: Best practices for reset

For concept purposes, since I pull all my data from $_POST, how does checking the server method add additional security If you are expecting POST data, and you do not receive it, then you can disregard the form and do something else. It is an opportunity to use a token as the name of the submit but...
by hyper
Wed Apr 11, 2018 11:11 am
Forum: PHP coding => General
Topic: Close button bug
Replies: 4
Views: 35

Re: Close button bug

What errors did you get from the html validator?
by hyper
Wed Apr 11, 2018 11:07 am
Forum: PHP General
Topic: Call to undefined function ereg_replace()
Replies: 1
Views: 26

Re: Call to undefined function ereg_replace()

Fatal error: Uncaught Error: Call to undefined function ereg_replace() in.... The file and line number should be given where you have put the dots following 'in'; look there first. ereg_replace is deprecated so if you do find where it is, you will need to replace it all or create a function which d...
by hyper
Wed Apr 11, 2018 10:26 am
Forum: PHP coding => General
Topic: Best practices for reset
Replies: 9
Views: 131

Re: Best practices for reset

PHP isn't an OOP language, it is procedural; it just has a few ways of using OOP type constructs which largely goes towards making it OOP. Purists, I'm sure would shun the very notion that PHP is anywhere near being an OOP language. Use PHP as you see fit, I'm sure with 35+ years experience you know...
by hyper
Wed Apr 11, 2018 10:12 am
Forum: PHP coding => General
Topic: Close button bug
Replies: 4
Views: 35

Re: Close button bug

I'd start by validating the the source of the whole page first; there's not enough code there to say why ff doesn't like it, but I'm betting that it has a lot to do with the use of inline font tags - used in html 3, deprecated.

Why didn't you use a style sheet?
by hyper
Tue Apr 10, 2018 1:48 pm
Forum: PHP coding => General
Topic: Why Doesn't This Run Index.html ?
Replies: 8
Views: 91

Re: Why Doesn't This Run Index.html ?

The server can only operate in certain areas, known as the server root, in order for a php script to be executed, it must be in this area. If your files end with the extension .html, you need to make sure that the server will serve these as well.
by hyper
Tue Apr 10, 2018 1:43 pm
Forum: PHP coding => General
Topic: User Authentication via posting form data
Replies: 3
Views: 44

Re: User Authentication via posting form data

Ditch it, find something else; it's too far out of date.

It's all mixed up bad code and bad coding practices, I've no idea how it could have been cobbled together and put into a book claiming to work?
by hyper
Tue Apr 10, 2018 11:00 am
Forum: PHP coding => General
Topic: Best practices for reset
Replies: 9
Views: 131

Re: Best practices for reset

the reset button is more like a clear button as it will clear all elements in the form, it does not inform the server, it will only contact the server when the user presses the submit button Here I present a basic form for you to play with and see what happens, it may or may not contain best practi...
by hyper
Tue Apr 10, 2018 6:58 am
Forum: PHP coding => General
Topic: 30 second php question - whats wrong with this most basic class?
Replies: 2
Views: 65

Re: 30 second php question - whats wrong with this most basic class?

Drop the dollar sign after the -> class MyClass { public $prop1 = "I'm a class property!"; public function getProp1() { return $this->prop1; } } $obj = new MyClass; echo $obj->getProp1(); You can also do this: class MyClass { public $prop1 = "I'm a class property!"; public function getProp1() { retu...
by hyper
Tue Apr 10, 2018 6:49 am
Forum: Other Database Engines
Topic: PostreSQL: passing a connection resource
Replies: 3
Views: 55

Re: PostreSQL: passing a connection resource

I'm wondering if a connection resource, as is generated by pg_connect(), can be passed through structures like $_SESSION or maybe $_POST No you can't, PHP loads up, executes your script then closes. This means that your pg_connect() closes and becomes redundant. When a request comes from a users br...
by hyper
Tue Apr 10, 2018 6:39 am
Forum: PHP coding => General
Topic: Why Doesn't This Run Index.html ?
Replies: 8
Views: 91

Re: Why Doesn't This Run Index.html ?

Just need to check a few things:
It ran phpinfo() perfectly.
Are your directories (guest & diana) in the same location as your phpinfo.php file?
by hyper
Mon Apr 09, 2018 12:26 pm
Forum: PHP coding => General
Topic: Best practices for reset
Replies: 9
Views: 131

Re: Best practices for reset

There are a few conceptual ideas that you may need to get used to, leaving aside your question for a moment, a few basic principles may help you: In a way, the server and html form is a bit like what you are used to with mainframes; hopefully this scenario will ring some bells - within your mainfram...
by hyper
Mon Apr 09, 2018 7:48 am
Forum: PHP Installation
Topic: General PHP/Apache Installation
Replies: 15
Views: 17169

Re: General PHP/Apache Installation

It looks like you've stumbled upon an old tutorial (January 2005). Sorry, I don't (read as won't) use windoze, but I can offer two options (more exist, but involve getting deep into the os and will require a new list of expletives) : 1) Try to un-install it and then install it using wamp or xammp. H...
by hyper
Sun Apr 08, 2018 3:34 pm
Forum: PHP coding => General
Topic: Best practices for reset
Replies: 9
Views: 131

Re: Best practices for reset

I presume you are referring to when a user presses F5 to refresh the browser or presses the back key. This is a problematic subject since it depends largely on the browser and the browser version that the user is using as they handle these things in their own sweet way. The way that I deal with it i...
by hyper
Sun Apr 08, 2018 3:07 am
Forum: PHP coding => General
Topic: Array Calculation
Replies: 3
Views: 75

Re: Array Calculation

Considering you didn't acknowledge the previous help you received, what makes you think anyone is prepared to help again :?
by hyper
Tue Apr 03, 2018 9:47 am
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 770

Re: Adding 2 Variables for Total

Well we learn something new everyday :oops: Following a weird thought I had, I now stand corrected on this: if ($a = $b) { # assign $a with the value of $b and return true # this will always execute } else { # this will never execute } If $b evaluates to false, then that will be how the if statement...
by hyper
Tue Apr 03, 2018 7:27 am
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 770

Re: Adding 2 Variables for Total

= is assignment: $a = 6; # Assign the value 6 to the variable $a == is to test for equality: if ($a == 6)... # test $a to see if it evaluates to 6 if ($a = $b) { # assign $a with the value of $b and return true # this will always execute } else { # this will never execute } Is an assignment which re...
by hyper
Mon Apr 02, 2018 1:07 pm
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 770

Re: Adding 2 Variables for Total

I'm trying to show you why it's wrong so that you can avoid it in the future; run the script, see what the difference is and learn why :?
by hyper
Mon Apr 02, 2018 12:47 pm
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 770

Re: Adding 2 Variables for Total

You're missing the point: <?php $a = 1; $b = 2; if ($a = $b){ echo 'Ooops'; # $a does not equal $b } echo ' $a now is assigned with:', $a; $a = 5; $b = 537; if ($a = $b){ echo '<br>Ooops'; # $a does not equal $b } echo ' $a now is assigned with:', $a; $a=1; $b=2; if ($a == $b){ echo '<br>Ooops'; # $...
by hyper
Mon Apr 02, 2018 12:16 pm
Forum: PHP coding => General
Topic: Making a redirect
Replies: 2
Views: 102

Re: Making a redirect

Be careful what you wish for, it's a very unsafe practice so don't do it, create a login method.
by hyper
Mon Apr 02, 2018 12:12 pm
Forum: PHP coding => General
Topic: Adding 2 Variables for Total
Replies: 24
Views: 770

Re: Adding 2 Variables for Total

Code: Select all

if($_POST['txtstate']="Outside of USA")
...

else if(!$_POST['txtstate']="Outside of USA")
Should that be equals? you have used assign; don't know if that's the only problem.
by hyper
Mon Apr 02, 2018 6:26 am
Forum: PHP coding => Mail
Topic: Trouble with Contact Form
Replies: 2
Views: 96

Re: Trouble with Contact Form

If you are sending from a server, you will probably need to specify and return address # Add this to your header string # Putting your reply e-mail address as appropriate "Reply-To: webmaster@example.com\r\n" Many mail servers need to know that it is from its own server to prevent spammers. You migh...
by hyper
Mon Apr 02, 2018 1:46 am
Forum: PHP coding => General
Topic: Hiding password coding in script
Replies: 2
Views: 110

Re: Hiding password coding in script

My question is, if there is some way of coding the password as encrypted text, so that even if someone were to read the file, the password in the if statement would be unreadable? If they have access to your file, they can change it so that they can gain access in any case: #comment out check #if (...