Search found 904 matches

by hyper
Fri Dec 27, 2019 12:38 pm
Forum: PHP General
Topic: Session Variables Not Working
Replies: 19
Views: 146

Re: Session Variables Not Working

What happened when you ran this:

Code: Select all

<?php
session_start();
var_dump ($_SESSION);
exit();
As the second page?
by hyper
Fri Dec 27, 2019 10:47 am
Forum: PHP General
Topic: Session Variables Not Working
Replies: 19
Views: 146

Re: Session Variables Not Working

In your first listing, put exit(); after the header(...) header( 'Location: '.$_SERVER['HTTP_REFERER']."?note=nologin") ; exit(); } else { ... header( 'Location: new page...') ; exit(); If this doesn't appear to work, try having this at the top of your second page: <? session_start(); var_dump ($_SE...
by hyper
Fri Dec 27, 2019 8:32 am
Forum: PHP coding => General
Topic: Directory Listing and Link Generator
Replies: 2
Views: 99

Re: Directory Listing and Link Generator

You haven't explained the 'only seems to be semi working'.

I suspect that the file location is incorrect; try:

Code: Select all

$dir = $_SERVER['DOCUMENT_ROOT'] . "/assets/files/";
by hyper
Fri Dec 27, 2019 8:19 am
Forum: PHP General
Topic: Session Variables Not Working
Replies: 19
Views: 146

Re: Session Variables Not Working

We need some more code.
by hyper
Thu Dec 26, 2019 4:07 pm
Forum: PHP General
Topic: Session Variables Not Working
Replies: 19
Views: 146

Re: Session Variables Not Working

It looks to me as though you have created an infinite loop?

When you say that
am not getting anything?
Does the page finish loading?

What other code do you have?
by hyper
Tue Dec 24, 2019 9:55 am
Forum: PHP Scripts
Topic: function function_name(parameters)
Replies: 5
Views: 70

Re: function function_name(parameters)

I wasn't sure how to approach an answer for this without making it seem really bad. So please accept this as constructive :) Put your code in blocks using the </> button on the post a reply form; this makes it much easier for us to read your code. It also helps us see if it is one script or several ...
by hyper
Sat Dec 21, 2019 6:39 am
Forum: PHP coding => General
Topic: Problems with understanding mvc
Replies: 1
Views: 78

Re: Problems with understanding mvc

You cannot use

Code: Select all

header('Location: http://www.example.com/');
after using print, echo, print_r, var_dump etc..

Any output will trigger PHP to send the http-headers.
by hyper
Fri Dec 20, 2019 11:18 am
Forum: PHP coding => General
Topic: overview
Replies: 1
Views: 99

Re: overview

The most important thing is your content.

Rather than me try to explain, there is a very good article here called Progressive Enhancement along with some other helper articles which I think is what your question is trying to ask; there is also a forum available.
by hyper
Fri Dec 20, 2019 11:05 am
Forum: PHP General
Topic: Redirect home page
Replies: 1
Views: 38

Re: Redirect home page

What have you tried so far?
by hyper
Fri Dec 20, 2019 11:00 am
Forum: PHP coding => General
Topic: can't remove contact information
Replies: 2
Views: 103

Re: can't remove contact information

You have offered a real life example of why you should check user input here. I'll ask you what would happen if I decided to go to your web site and sit at my browser and enter the following, one after the other: yourweb.com/delete.php?id=1 yourweb.com/delete.php?id=2 yourweb.com/delete.php?id=3 you...
by hyper
Tue Dec 17, 2019 1:49 pm
Forum: PHP coding => General
Topic: PHP array subkey average
Replies: 1
Views: 104

Re: PHP array subkey average

This looks like homework?

That's not a PHP array.

Iterate through the array once converted.
by hyper
Tue Dec 17, 2019 1:43 pm
Forum: PHP coding => General
Topic: Scope of include files?
Replies: 2
Views: 102

Re: Scope of include files?

The variable scope is what it is, variables are available depending on where or how they are introduced. Files which are included are not treated any differently as far as PHP is concerned: file1.php <?php $file1 = 'I am file 1'; include 'file2.php'; echo $file1, $file2; file2.php <?php $file2 = 'I ...
by hyper
Mon Dec 16, 2019 12:57 pm
Forum: PHP coding => General
Topic: hide 0 values
Replies: 2
Views: 100

Re: hide 0 values

You haven't explained what you want hiding, but I'll take a stab that this may be close to what you are after? $value = $_POST[$helper_subcat]; if ($value) { ... } Boiler plate - do NOT use user supplied values without validating them - applies. $value = $_POST[$helper_subcat]; // bad practice
by hyper
Wed Dec 11, 2019 8:42 am
Forum: PHP coding => General
Topic: Decrease stock after purchase happen
Replies: 1
Views: 131

Re: Decrease stock after purchase happen

I understand that you want to decrease stock, but you haven't explained what problem you have in doing so.

Is this a script that you have copied or written yourself?

Is the problem the script?

Is the script doing everything you wanted and now you want add a script to decrease in stock?
by hyper
Tue Dec 10, 2019 2:27 pm
Forum: PHP coding => General
Topic: results of sqlite query displayed in table won't stay on screen
Replies: 2
Views: 92

Re: results of sqlite query displayed in table won't stay on screen

You have changed something, I'll wager the css.

Check the source code through your browser ctrl + u to see if your table is there.
by hyper
Tue Dec 10, 2019 10:33 am
Forum: PHP coding => General
Topic: OK to keep link open?
Replies: 1
Views: 92

Re: OK to keep link open?

As data is likely to be sent every few seconds, it would seem to be more efficient to simply open the link on startup and leave it open indefinitely.
Servers don't work that way, the server receives, processes, sends then closes.
by hyper
Tue Dec 10, 2019 10:28 am
Forum: PHP coding => General
Topic: Undefined variable:
Replies: 8
Views: 215

Re: Undefined variable:

Probably because if there is no file, it uses 'unknown.php' as the filename ? I don't know where in the code it will be as I don't have all the code, I'm just guessing. It may have been something that the original author did at one time and hasn't removed it. I haven't looked at the link you provid...
by hyper
Mon Dec 09, 2019 11:50 am
Forum: PHP Scripts
Topic: function function_name(parameters)
Replies: 5
Views: 70

Re: function function_name(parameters)

OK, so any parameter in a function() needs to be predefined before the function is called. Kind of correct if slightly re-worded: Functions need to be supplied with the correct number of values. Some values can set to a default. function threevalues ($x, %y, $z){ //Must supply function call with th...
by hyper
Mon Dec 09, 2019 10:24 am
Forum: PHP Scripts
Topic: automated betting script
Replies: 3
Views: 58

Re: automated betting script

I will still suggest contacting your bookies if this is the case, as they will probably already have a route that they are happy with.
by hyper
Mon Dec 09, 2019 10:20 am
Forum: PHP coding => General
Topic: Undefined variable:
Replies: 8
Views: 215

Re: Undefined variable:

Probably because if there is no file, it uses 'unknown.php' as the filename?
by hyper
Wed Dec 04, 2019 9:50 am
Forum: PHP Scripts
Topic: function function_name(parameters)
Replies: 5
Views: 70

Re: function function_name(parameters)

What is the correct term to use for the items in the parenthesis? Are they variables, strings, arguments or something else altogether? They are called 'parameters' or 'arguments'. Do items in the parenthesis have to be defined in the function and/or somewhere else in the same script? No, as they ar...
by hyper
Wed Dec 04, 2019 9:22 am
Forum: PHP Scripts
Topic: automated betting script
Replies: 3
Views: 58

Re: automated betting script

I suspect any attempt to do this would ring alarm bells on the chosen site, which may end up in a ban. I would ask why you would want to write a script to do that? It seems to be a convoluted way of doing something. If it is something that you really want to do, then I would suggest that you contact...
by hyper
Mon Dec 02, 2019 9:33 am
Forum: PHP General
Topic: I need PHP to zip certain files on my server
Replies: 4
Views: 163

Re: I need PHP to zip certain files on my server

Have you checked your error log? the answer may be in there?

Have you tried displaying errors when testing? (only do this on a test machine)

It would be easier to help if you posted the code.
by hyper
Thu Nov 28, 2019 11:27 am
Forum: PHP coding => General
Topic: Undefined variable:
Replies: 8
Views: 215

Re: Undefined variable:

I can't be certain as I don't know if $two_letter_country_code is defined in one of your includes? include("ip_files/".$numbers[0].".php"); Anyway, try declaring it in your function call (it's considered a good idea to declare variables before first use): function iptocountry($ip) { $two_letter_coun...
by hyper
Wed Nov 27, 2019 7:03 pm
Forum: PHP coding => General
Topic: multidimensional array ?
Replies: 2
Views: 106

Re: multidimensional array ?

The problem that you have is that it's not clear how the data is structured and it's difficult to get information back from arrays like this. Not knowing how you expect to retrieve the data also increases the problems. A well structured database may be the solution, however, if you re-structure your...