-
Who's Online 1 Member, 0 Anonymous, 391 Guests (See full list)
All Activity
- Today
-
Cador5 joined the community
-
Princyweb joined the community
- Yesterday
-
Danbel455 joined the community
-
TheEndlessBoy joined the community
- Last week
-
Andytian8 joined the community
-
Natmilo5 joined the community
-
register_tick_function() and declare(ticks=...)
gizmola replied to rick645's topic in PHP Coding Help
One thing that might be helpful is to use the declare to wrap the block of code you want to have evaluated for statement processing. $count = 0; function statements() { global $count; $count++; echo "Statement Count: $count\n"; } register_tick_function('statements'); declare(ticks=5) { for ($x = 0; $x < 10; $x++) { echo "\$x = $x \n"; } } And you get: $x = 0 $x = 1 $x = 2 $x = 3 $x = 4 Statement Count: 1 $x = 5 $x = 6 $x = 7 $x = 8 $x = 9 Statement Count: 2 -
register_tick_function() and declare(ticks=...)
rick645 replied to rick645's topic in PHP Coding Help
???? -
const LOG_READ_SIZE = 1024; Place that line somewhere in your code that is before you refer to LOG_READ_SIZE and where it will definitely be executed (EG not inside an IF() block.
-
Okay, so the LOG_READ_SIZE = 1024, so how to properly enter that code and where?
-
E_DEPRECATED and E_USER_DEPRECATED are the same thing, with the one difference that the former is used by the engine and the latter is used by trigger_error. So the question is in what environments do you care/not care about getting messages about using deprecated features and functionality?
- 1 reply
-
- 1
-
-
> Because `E_DEPRECATED` can only be triggered by PHP itself, to indicate deprecated functionality in the PHP engine itself. For userland code (_including_ frameworks and libraries!) to trigger deprecation notices, you must use `E_USER_DEPRECATED`. > > BTW, you can add that to the `error_reporting` mask, too: > > ``` ini > error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED > ``` > _Originally posted by @weierophinney in [#98](https://github.com/zendframework/zend-mvc/issues/98#issuecomment-194395567)_ Anyway, it seems to me that by default E_USER_DEPRECATED is disabled. When (at what stage of development) do you usually prefer to keep it disabled? When do you usually prefer to enable it (error_reporting = ~E_USER_DEPRECATED & ...)? Maybe in pre-production/finishing stage?
-
register_tick_function() and declare(ticks=...)
requinix replied to rick645's topic in PHP Coding Help
Sigh. I mean, if you're able to understand ticks from that then congratulations? - Earlier
-
register_tick_function() and declare(ticks=...)
rick645 replied to rick645's topic in PHP Coding Help
$ cat tick3.php <?php declare(ticks=3); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); abs(1); // added abs(1); // added abs(1); // added $ php tick3.php #0 /tmp/tmp.MLb8GRwmkU/tick3.php(6): my_tick_function() #0 /tmp/tmp.MLb8GRwmkU/tick3.php(8): my_tick_function() OK, thanks -
register_tick_function() and declare(ticks=...)
requinix replied to rick645's topic in PHP Coding Help
Yes, granular, as in "highly detailed; having many small and distinct parts". Because you missed the part in my reply where I said "write a bunch of code". You wrote a very small amount and you're not going to see how ticks work unless you write a lot more. -
register_tick_function() and declare(ticks=...)
rick645 replied to rick645's topic in PHP Coding Help
Granular level? ???? I don't understand ???? $ tree ├── tick1.php ├── tick2.php └── tick3.php $ cat tick1.php <?php declare(ticks=1); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); $ cat tick2.php <?php declare(ticks=2); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); $ cat tick3.php <?php declare(ticks=3); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); $ php tick1.php #0 /tmp/tmp.MLb8GRwmkU/tick1.php(5): my_tick_function() $ php tick2.php #0 /tmp/tmp.MLb8GRwmkU/tick2.php(5): my_tick_function() $ php tick3.php $ Why the php tick3.php command does not produce output? -
Not sure , data from an <a> tag into Database :~/
sirsid replied to sirsid's topic in PHP Coding Help
Hello, I got it to Work ! Thank-You Olumide :~) Sid -
Not sure , data from an <a> tag into Database :~/
sirsid replied to sirsid's topic in PHP Coding Help
Hello, I looked into AJAX. I got a query lookup to work. But I Cannot seem to get an INSERT to work using this type of connection mysqli_connect() it does not seem to have a ->save() Does anyone think it is Just the INSERT that is the problem ? or is it the connect t type ? Can anyone help please ? Thank-You. Sid -
register_tick_function() and declare(ticks=...)
requinix replied to rick645's topic in PHP Coding Help
A tick happens every time the engine does something at a fairly granular level. Like executes a statement, but even lower-level than that. The easiest way to understand it is going to be to play with code: set up a ticket handler every 1/2/3/whatever ticks, have it output something, and then write a bunch of code to execute and see what happens. -
https://www.php.net/manual/it/function.register-tick-function.php Specifically https://www.php.net/manual/it/control-structures.declare.php#control-structures.declare.ticks Honestly, it's not very clear. Can someone explain it better?
-
Not sure , data from an <a> tag into Database :~/
sirsid replied to sirsid's topic in PHP Coding Help
Thank-You I shall look into that :~) Sid -
Not sure , data from an <a> tag into Database :~/
Olumide replied to sirsid's topic in PHP Coding Help
AJAX (Asynchronous JavaScript and XML) lets you send data to a PHP script in the background, without the page reloading. This is what happens on sites like Twitter when you click "Like" or on Gmail when you archive an email. Also, you need to create the PHP script that will reads the data and sends back a JSON response for the JavaScript to read. -
Hello, New here, I have an <a> & I would like to send data into my MySQL Database from a .php page , it's a forum type thing , favourite link :~/ What is the Best way to do this ? Can anyone help please ? I should add I do Not wont to Post a Form ! Thank-You Sid
-
You might be able to use the after pseudo element. You set position: relative to the parent element, and then position: absolute on the pseudo element. That technique allows you to move the pseudo element relative to the parent.
-
Thank you gizmola & mac_gyver for your time and help I was aware of the fact that i didnt get anything over, but not sure how to fix that. It works now adding the account number into the url using the $_GET. Yes i am aware of my real url, but thats only for test. Everything will be deleted from that domain when im done
-
Best and correct solution for delete variables?
requinix replied to Ervin's topic in PHP Coding Help
Don't. PHP isn't a low-level language like C. You don't have to manage memory like that. PHP has some very smart internal logic and is perfectly capable of handling creating and destroying variables on your behalf. So let it do what it knows how to do.- 1 reply
-
- 1
-
-
What is the best and correct solution for delete variables? I run script d:\php\php.exe -f script.php on win11. This script run 24h. If the best and correct solution: for ($zanke = 1; ; $zanka++) { set_time_limit (0); $data=file_get_contents("http://localhost:5897/x/query.cgi?q=status"); if(preveri($data)) { shrani($data); poslji($data); } sleep (5); flush(); $data=""; $zanka = 0; } or: for ($zanke = 1; ; $zanka++) { set_time_limit (0); $data=file_get_contents("http://localhost:5897/x/query.cgi?q=status"); if(preveri($data)) { shrani($data); poslji($data); } sleep (5); $vars = array_keys(get_defined_vars()); for ($i = 0; $i < sizeOf($vars); $i++) { unset($$vars[$i]); } unset($vars,$i); ali pa: $vars = array_keys(get_defined_vars()); foreach($vars as $var) { unset(${"$var"}); } $zanka = 0; } Thank you for help!
-
In every case, you are not passing an account #. You should have seen that already in the debugging. You need to pick a method (GET or POST) and stick with it. The most recent code you provided appears to be making a POST request. It appears to me that your bot code retrieves your account# from the system. Since this is not coming from a form, I would suggest you just use a GET request which will make it easier to just setup the URL. With an HTTP GET request, you just add parameters to the url as name=value pairs. Then in PHP, you can get the variable from the $_GET superglobal. As the problem is with your client, and that client is based on MQL4 language, I am just making an educated guess here, based on looking at the Manual page for the webRequest function. From what I read briefly, it's essentially C++ syntax, but something none of us who aren't using the trading product you are using could possibly debug for you. But as I said, I made a guess for you as to what I would change. string url = "https://johnnylai.me/license/customers.php?"; string headers; char post[]; int accountNumber = (int)AccountInfoInteger(ACCOUNT_LOGIN); string paramText = "account_no="+IntegerToString(accountNumber); StringToCharArray(postText, post, 0, WHOLE_ARRAY, CP_UTF8); char result[]; string resultHeaders; int response = WebRequest("GET", url+paramText, headers, 1000, post, result, resultHeaders); Print(__FUNCTION__," > Server response is ", response, " and the error is ", GetLastError()); Print(__FUNCTION__," > ", CharArrayToString(result)); return(INIT_SUCCEEDED); Then your first line of the PHP script would be: $account_no = $_GET['account_no'] ?? 0; If $account_no == 0 when running the script, then the parameter is not working, which so far has been the case in all your testing. If you use my code make sure you understand that the full url to be passed needs to be: https://johnny.../license/customers.php?account_no=274020340 (or whatever the account# is). If the client code works as expected that is what should be available to the php script. You can test that the backend script is working by just pasting the url to your server with the url parameter with one of your valid account #'s. I do have to warn you that you have posted your real url and if these are real account#'s that might be an issue for you.
-
I also found out i forgot to add 3 lines in the MT4 code, so it looks like this now. string url = "https://johnnylai.me/license/customers.php"; string headers; char post[]; int accountNumber = (int)AccountInfoInteger(ACCOUNT_LOGIN); string postText = "account_no="+IntegerToString(accountNumber); StringToCharArray(postText, post, 0, WHOLE_ARRAY, CP_UTF8); char result[]; string resultHeaders; int response = WebRequest("POST", url, headers, 1000, post, result, resultHeaders); Print(__FUNCTION__," > Server response is ", response, " and the error is ", GetLastError()); Print(__FUNCTION__," > ", CharArrayToString(result)); return(INIT_SUCCEEDED);
-
-
have you examined what the $_GET data is? echo '<pre>'; print_r($_GET); echo '</pre>';