Coder Social home page Coder Social logo

php "includes" wrongly linked about xvwa HOT 11 CLOSED

1w3j avatar 1w3j commented on July 29, 2024
php "includes" wrongly linked

from xvwa.

Comments (11)

s4n7h0 avatar s4n7h0 commented on July 29, 2024 1

@iqbal98 dirname(FILE) and DIR should return the same value. I'm quite not sure to justify which one is better than the other. I did some tests locally and only noticed the auto setup script had webroot parameter wrongly set. I made those changes and everything works smooth with no errors if you are using auto setup script.

MySQL found with Version: 5.6.30-1 Version: 5.6.27-2
Apache found with Version: 2.4.25-1 Version: 2.4.18-1
MySQL is down. Starting MySQL Service
Apache is down. Starting Apache Service
Enter mysql username : root
Enter mysql password : 
Enter the full web root path : /var/www/html
Cloning latest version of XVWA from GitHub
Cloning into '/var/www/html/xvwa'...
remote: Counting objects: 952, done.
remote: Total 952 (delta 0), reused 0 (delta 0), pack-reused 952
Receiving objects: 100% (952/952), 2.15 MiB | 202.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
Setting XVWA configuration
Creating xvwa database
Enter password: 
XVWA Setup Finished Successfully. Happy hacking and happy learning !

from xvwa.

1w3j avatar 1w3j commented on July 29, 2024

I've read 404Ghost99 question and your reply is not useful for me. systemctl status mysql and apache2 are active and running.
I forgot to mention, the xvwa database is not being created or reloaded (is it related to links issue?)

from xvwa.

s4n7h0 avatar s4n7h0 commented on July 29, 2024

@iqbal98 please mention which line/code you found wrong for bad include. If the config.php settings are correctly set, it should work without causing any error. I have also listed a automatic script that might help you to resolve this issue, please see it here https://github.com/s4n7h0/Script-Bucket/blob/master/Bash/xvwa-setup.sh

Please also note that the script might take absolute path, the config.php should look as below:

<?php
$XVWA_WEBROOT = "";
$host = "localhost";
$dbname = 'xvwa';
$user = "root";
$pass = "";
$conn = mysql_connect($host,$user,$pass);
$conn = mysql_select_db($dbname);
$conn1 = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$conn1->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>

Let me know if you able to solve the issue.

from xvwa.

1w3j avatar 1w3j commented on July 29, 2024

@s4n7h0 I've tried using your script:

MySQL found with Version: 5.7.16-1ubuntu16.04 Version: 5.7.16-0ubuntu0.16.10.1 Version: 5.7.15-0ubuntu2
Apache found with Version: 2.4.18-2ubuntu4
Enter mysql username : myuser
Enter mysql password : mypassword
Enter the full web root path : /var/www/html 
Folder /var/www/html/xvwa already exists. Do you want to clean and build a fresh latest copy ? (Y/N)Y (please note here, there is an error if I input 'y':line 90)
Cleaning up old copy
Cloning latest version of XVWA from GitHub
Cloning into '/var/www/html/xvwa'...
remote: Counting objects: 952, done.
remote: Total 952 (delta 0), reused 0 (delta 0), pack-reused 952
Receiving objects: 100% (952/952), 2.15 MiB | 596.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
Setting XVWA configuration
Creating xvwa database
mysql: [Warning] Using a password on the command line interface can be insecure.
XVWA Setup Finished Successfully. Happy hacking and happy learning !

Then I check my mysql server

mysql -u myuser -p
Enter password: 

mysql> use xvwa;
Database changed
mysql> show tables;
Empty set (0,00 sec)

Tables were not created. Same as if I go to http://localhost/xvwa/setup/
Database keeps empty.
AND the index.php page is a blank page same as setup.

I've changed some code on the php files and I noticed some wrongs on 'include' relative paths.
e.g on header.php:line 18
Before:

include(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'/xvwa/config.php');

After:

include(__DIR__.'/xvwa/config.php');

Please, try to fix 'them'. Or tell me if I did something wrong.
PD: I'm not a php guy at all, but using 'DIR' is more cool than 'dirname('blablabla')'

from xvwa.

s4n7h0 avatar s4n7h0 commented on July 29, 2024

@iqbal98 the database is created only after you setup in using the web interface http://localhost/xvwa/setup/ I agree with your suggestion on changing the DIR. I will make these changes soon.

from xvwa.

1w3j avatar 1w3j commented on July 29, 2024

I know, the thing is I get a blank page as 404Ghost99 question, and when I edit the php script (e.g. header.php on line 18) I can finally see the interface, then I can press the Submit/Reset button but nothing happens. I think the same error is on other php scripts and there it causes no database loading (also, the login button heads me to another blank page resulting on nothing). Do you have the same problems? PD: I manually ran every SQL stmnt for your application to solve the issue for me:)

from xvwa.

s4n7h0 avatar s4n7h0 commented on July 29, 2024

@iqbal98 I usually change the config.php $XVWA_WEBROOT = ""; and use this as prefix for paths I include in other pages. That usually works for me. ;)

from xvwa.

1w3j avatar 1w3j commented on July 29, 2024

using $XVWA_WEBROOT = ""; clones the project on / (root directory). Then I moved that directory to /var/www/html and same linking errors happen.

from xvwa.

s4n7h0 avatar s4n7h0 commented on July 29, 2024

@iqbal98 that's weird. I will run through some test cases over this weekend and fix this issue. I never had this issue with my instance. Also didn't received this issue from other users yet.

from xvwa.

1w3j avatar 1w3j commented on July 29, 2024

Ok. The database was generated now but I have still problems. The error is thrown on include(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'/xvwa/config.php'); "and" every config.php inclusion (that whole path returns something like /var/www/html/..//xvwa/xvwa/config.php and thats why I changed it to: __DIR__.'/config.php' returning the correct path /var/www/html/xvwa/config.php but...).
I used "raveren/kint" debugger and $XVWA_ROOT always ends being null same as $conn and $conn1 except for they simply never appear on the debug. One question. Why do you use two connections? I'm not saying it is wrong, it's just because I'm getting errors on config.php.
PD: Is this issue just for me, srsly? I ran the automate script and changed my php.ini as you indicated.
screenshot from 2017-01-16 22-29-53

from xvwa.

s4n7h0 avatar s4n7h0 commented on July 29, 2024

@iqbal98 some pages were using depreciated functions and I ported those codes to php version now. Please pull the latest commit and try it. Thanks for pointing it out. Please let me know if you find any further issues.

from xvwa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.