RBX Automatic messaging bot not working - php

Trying to insert a automatic-messaging system in roblox, but its not working.
(Script was to complicated to post here apparently)
http://pastebin.com/tbFRY1Az
Whenever I go to
mywebsite.com/newMessage.php?id=2262712 and it doesnt work
anybody know what the problem is?

I'm not sure, but Roblox has a message limitation system. This prevents message bots from spamming inboxes. Scroll to the bottom of this Pastebin post and you will see a javascript PM bot. It works to the extent of the anti-spam PM system that Roblox has.

My guess is that php-curl is not installed/enabled
add following lines to the start of the file (after
ini_set('display_errors',1);
error_reporting(E_ALL);
This will probably show any errors occuring(depending on the server config).
If it doesn't display any errors, create a file with this code:
<?php
phpinfo(8);
?>
Then open it in browser, it will display all modules enabled, search for "curl", if it's there, then you have to check your error logs to see what's wrong with the code, if not, then you have to install php-curl to get it to work(or rewrite the code so it uses another method of fetching data).
UPD For some reason you don't have curl_init, add this on line 8(above all curl_setopt's):
$ch = curl_init("https://www.roblox.com/newlogin");
Also, replace
htmlspecialchars($_GET($key));
with
htmlspecialchars($_GET[$key]);

Related

XML Parsing Error: xml processing instruction not at start of external entity

I have a vBulletin 3.8 forum.
When we click Edit button of any post (so the Quick Edit form should displayed), I get this error on the browser's console:
XML Parsing Error: xml processing instruction not at start of external entity
Location: http://www.xxxxx.xx/ajax.php?do=quickedit&p=438
Row number 2, Column 1:
... the Quick Edit form is not appearing the the progress bar displayed permanently.
I have try to disable hooks/ plugins, but the problem still appears.
I have this row on config.php: ini_set("display_errors", false); so I don't think it is a fatal error/ warning by PHP which brokes the xml normal syntax.
I have informed that this appear starts after the move of the site to another server. Does it say something to you?
Any general idea about this error?
EDIT:
Well, I found the reason of this issue, but I don't know how to fix it. Exact the same site on a localhost testing board works perfectly, but on the live server ANY html page/ ajax call etc, has a useless empty line as line #1.
For normal html pages, there is no reason for the browser to return an error, but when we're talking about an ajax call, this empty line at the top of the response, breaks the xml parsing from the browser. So it seems it is a server/ PHP/ Apache setting that applies this empty line. Any idea how to fix it? https://imgur.com/a/4neb0
It might be late for you but any new comers with php/nginx/apache can get an understanding of why.
Answer is simple: When moving the code, you might not be using git/rsync/scp but let me guess, you used zip (and probably Windows/Linux involved).
How to discover it was a two-day journey with many things tried:
We have the same error, we were also moving our servers. We tried:
We thought the server software version was a problem.
We thought the cloud provider OS image was a problem.
We used docker to avoid these problems, but the empty line problem persists.
We thought the code ?> ending was a problem, I went through all of them. But it wasn't.
I finally asked my colleague: How did you get the code? From Git? He said he downloaded from ZIP and then uploaded to server.
I removed code on the server (which extracted from a zip) and used git to download a fresh copy from our github.
Magic, problem solved. The empty line gone.
So I think the problem is with the zipping progress might have changed some file empty lines. Always use git.

php login script error

I have this login script working just fine on one server but not on other and coudn't figure out why.
include_once 'include/processes.php';
$Login_Process = new Login_Process;
$Login_Process->check_status($_SERVER['SCRIPT_NAME']);
and the third line won't display the server status, the code display on my web page, and didn't go to main page. any idea may cause the issue.
thanks.
The third line isn't working, most likely, because you have a Fatal Error being generated somewhere as a result of this line:
$Login_Process = new Login_Process;
Either use ini_set to change the errors being displayed, or set up an error log. You basically need to know what the errors are, and then you can deal with them.
It could be many things, some of which may be the configuration.
The first thing I would check is the PHP version. Make sure that nothing in your scripts or your php.ini file conflict with the version of PHP you're migrating to.
After that, go through the functions you're calling and make sure nothing is deprecated in PHP on the second server.

redirect() function not working for external URL in CodeIgniter

I want to redirect to www.yahoo.com from my codeIgniter application. I write code like this :
redirect("http://www.yahoo.com");
It is working fine in my local computer (Windows vista / WAMP) but when I upload to linux server it just show blank screen and not redirect.
Try using the refresh method:
redirect('http://www.yahoo.com', 'refresh');
Blank screen normally means a fatal error somewhere. Check your logs!
And check your headers too. Curl it or use a HTTP Client to see what is being returned.
Debugging helps with these things. We are just random people on the internet without access to your computer, so without more information (hell you didnt even mention which version of CI you are using) we are all just taking guesses.
you probably want header: header('location: http://www.yahoo.com');
Try enabling error_reporting(E_ALL) to see if there are any errors that indicate output is being sent before those headers (specified by redirect()).
A common issue that I find is that the means of uploading (e.g. deploying over FileZilla) will sometimes insert lines depending on the transfer mode I guess. I've seen those same files I uploaded via FileZilla double spaced entirely. More than likely, you have an empty line at the top of your controller. Best way to find out is to edit that controller on the server (e.g. File Editor or re-download and view it) and see if this is the case.

Specific php question

I am fairly new to creating websites and I have done a website that I did in a sandbox server on my personal computer, it works brilliantly, but as soon as I try to put it on my companies server to go up on the internet it doesn't work anymore. What the site does is it takes fields from an html form and then does a sql search of a database that I set up and works fine. Then after the user is done with the form they hit submit and the sql is run and results are returned to the same page. The form action="" and then the results are returned. I am not sure if the companies server has php installed, but I don't know if that would be a problem or not because the browser should still be able to display the php code. I have no problems with the html form, it is just when I hit submit that the page is returned and nothing is displayed.
Any help is welcome.
"I am not sure if the companies server has php installed, but I don't know if that would be a problem"
It is. Browsers can do nothing with PHP. Maybe you shoud register for a free hosting provider and learn the basics of hosting there.
PHP is a server-side language (i.e., it runs on the server, not the user's machine). Therefore, it must be installed on the company's server for any PHP code to execute properly. Browsers cannot interpret PHP code, and moreover PHP code is executed before the browser even receives any information (PHP: Hypertext Pre-Processor). Check that the server has PHP installed before you continue. (Also be aware of versions and features. For example, to use many new PHP features your server must be running PHP5.)
If you find that PHP is installed: Check your PHP syntax; make sure that no headers are sent after text is sent to the page; and make sure that there are no loops or anything in your code that could cause the script to continuously run without printing to the page.
Also, since your page is returned when you hit 'Submit,' but no new information is shown, make sure that there is not a problem with the MySQL configuration (e.g., incorrect password, query syntax, etc).
First you have to be sure that server has PHP installed.
make a file named phpinfo.php with this line
<?php phpinfo() ?>
and call it.
If it won't print out PHP config, you have to install PHP first.
Otherwise the problem most likely in the form of PHP tags, and you are using <? instead of <?php.
To solve, you can either change tags or set short_open_tag to on in the php.ini
According to your comment
when I hit submit that the page is returned and nothing is displayed
I am going to make an assumption that you are getting a blank page. If that is correct, then I am also going to follow that up with the assumption that PHP is installed, there is an error in your script (my guess is the database connection), and that the error is not being displayed.
Add these lines to the top of your page and post back with the result:
error_reporting(E_ALL);
ini_set('display_errors', '1');
Ya I think there is a problem in your database connection.First run your connect file whether it is showing some error or not.Plase add this line to your page:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
And please modify your php.ini file with this line:
display_errors = on

Why might this work on my server but not my schools?

I created a captcha just now, and it works PERFECTLY on my own server. On the school's server, it doesn't generate an image. Why might this be? The difference in code is one line.
Edit: Originally, it was working, but I deleted the directory by mistake and I do not know why did it suddenly work in the first place.
Update: I var_dumped() everything and everything is being set correctly.
Source code on school server:
Update: I figured it out! I'll post the answer later.
Make sure that GD library is enabled in your school's server.
Also try putting these lines on top of your script to see if there are any errors:
ini_set('display_errors', true);
error_reporting(E_ALL);
It is just useless to direct such kind of questions to SO.
There must be thousands of reasons.
And, of course, without access to your server and environment, nobody can say, just by looking into working code.
The only person who can answer this question is you yourself.
With help of your server, of course.
You must ask your server for errors.
ini_set('display_errors',1);
error_reporting(E_ALL);
but sometimes (in case of parse errors for example) this won't work. In this case you have to either set these params via .htaccess or check web-server's error log.
Also, you have to do something.
At least add some text output in the script to be sure it being executed.
print out variables using var_dump() to ensure thy contain right values.
Add an intentional error to ensure you CAN see them if any.
Do something, don't sit watching code!
Some more info on how to help yourself: http://www.ibm.com/developerworks/library/os-debug/

Categories