10,608 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Adolfo_1

I have problem with this htaccess in STATIC URL RewriteEngine On RewriteRule ^readlex/(.*)$/?$ readlex.php?slug=$1 [NC,L] **DINAMIC URL** work fine only with defined CONSTANT: Example <a href="<?php echo BASE_URL.READ_LEX ?>Le-mura-di-Lucca">Lucca</a> Result = localhost/mysite/readlex/Le-mura-di-Lucca **STATIC URL** not work (??) <a href="localhost/mysite/readlex.php?slug=Le-mura-di-Lucca">Lucca</a> Result = localhost/mysite/readlex.php?slug=Le-mura-di-Lucca">Lucca ***Unfortunately I can't insert the php CONSTANTS in …

Member Avatar for Dani
1
131
Member Avatar for borobhaisab

Hello, I do not understand why the simplehtmldom is failing. This is the code: <?php ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); //--- include_once('simplehtmldom_1_9_1/simple_html_dom.php'); //--- $url = "https://victoriousseo.com/sitemap_index.xml"; $html = new simple_html_dom(); $html->load_file($url); //-- foreach($html->find("a") as $link) { echo $link->href."< br />"; } ?> I got the simplehtmldom.php on the same directory as the …

Member Avatar for Dani
1
1K
Member Avatar for spud91

I have the following code: <?php session_start(); // Starting Session include_once('config.php'); $error=''; // Variable To Store Error Message if (isset($_POST['submit'])) { if (empty($_POST['user']) || empty($_POST['pass'])) { $error = "Please complete both fields"; }else{ // Define $username and $password $user=$_POST['user']; $pass=md5($_POST['pass']); // To protect MySQL injection for Security purpose $user = …

Member Avatar for GESTIC
0
1K
Member Avatar for Richard_Harldsn

I have duplicate H1 tags on all pages of my website's blog, including tags, categories, and more. I have tried using default tools to fix the issue, but have been unsuccessful. I was wondering if any of you have experienced this problem before? My website is https://softwareplanetgroup.co.uk/blog/. Thanks anyway!

Member Avatar for Richard_Harldsn
1
171
Member Avatar for borobhaisab

@dani Checking these 2 working codes of your's out. I got some basic questions. 1 ```` <?php ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); //Dan's Code. //Code from: https://www.daniweb.com/programming/web-development/threads/538868/simplehtmldom-failing#post2291972 //Sitemap Protocol: https://www.sitemaps.org/protocol.html // Initiate ability to manipulate the DOM and load that baby up $doc = new DOMDocument(); $message = file_get_contents('https://www.daniweb.com/programming/web-development/threads/538868/simplehtmldom-failing#post2288453'); // https://www.php.net/manual/en/function.libxml-use-internal-errors.php libxml_use_internal_errors(true); …

Member Avatar for borobhaisab
0
78
Member Avatar for increase

I want to pass two variables in a php url at present I have $line = "<a href=\"$click?$namehref\"><font color='red'>$name</font> </a>"; When I click the link it displays the $click variable, but does not then pass to $namehref which is an mp3 link, what would the syntax be to achieve this.

Member Avatar for Dani
0
246
Member Avatar for IQBAL_13

Thank you for looking at this problem, details are all below. Below is the code <form style="overflow: hidden;" method="post"> <input type="checkbox" aria-label="Checkbox for following text input" name="kursus[]" value="<?php echo $row['IDKursus']; ?>"> <div class="d-flex justify-content-between mt-3"> <button type="submit" class="btn btn-success" name="daftar_kursus">Daftar Kursus</button> <button type="reset" class="btn btn-primary">Reset</button> </div> </form> if (isset($_REQUEST['daftar_kursus'])) { …

Member Avatar for Dani
0
148
Member Avatar for Stefce

iI was searching the online "free/cheap" generators and i found out that they are not so cheap... They advertise the PRO plan for just $3 and when i came to the checkout page it was $1800 So is there other free tool for this job or how do i manually …

Member Avatar for Dani
0
130
Member Avatar for Stefce

I have a domain that looks like this when i visit certain link `https://domain.com/model-profile/index.php?name=abbychampion` the site is written in php but i dont want to show this part `index.php?name=` because for SEO purposes and better human reading. Is this possible to hide ? so the link looks like this `https://domain.com/model-profile/abbychampion`

Member Avatar for Dani
1
350
Member Avatar for ivan3510

Hi! I want to convert numbers to letters, in this way: A=0, B=1, C=2... Z=25, AA=26,AB=27 etc (something like the names of columns in MS Excel). How to do that? Thanks a lot!

Member Avatar for SAbadshah
0
12K
Member Avatar for ___150

Is this code correct? Or should I keep using } else { for (errors) until the end? if ($y = $link->prepare('SELECT id, password FROM usuarios WHERE username = ?')){ $y->bind_param('s', $_POST['username']); $y->execute(); $y->store_result(); if ($y->num_rows > 0){ echo 'Username exists, please choose another!'; } else { if ($y = $link->prepare('SELECT …

Member Avatar for Reverend Jim
0
134
Member Avatar for ___150

Hi,This code creates a friendly link on user mentions in comments... However, it is not case sensitive and vice versa. Examples; @test works @Test doesn't work The regular expression takes both values. But the query is not catching. I figured it would be a case-sensitive collation on the database. But …

Member Avatar for gce517
0
126
Member Avatar for ___150

Hi, Is it possible to convert the first letter after @ to uppercase using preg_replace? I tried; preg_replace('/\@(\w+)/', 'ucfirst("$1")', $str) But nothing changed when I sent it... 😞 Already like that... It worked, but I don't know how to add the @ before the name that will be converted. $str …

Member Avatar for gce517
0
53
Member Avatar for ___150

Hi,This code creates a friendly link on user mentions in comments... However, it is not case sensitive and vice versa. **Examples;** **@test** works **@Test** doesn't work What do I do? text = "@test @Test"; $pattern = "/\@(\w+)/"; preg_match_all($pattern,$text,$matches); if($matches){ $sql = "SELECT * FROM users WHERE username IN ('" .implode("','",$matches[1]). …

Member Avatar for ___150
0
109
Member Avatar for Stefce

I am trying to make to display cells in a database that are not empty, i have URL links with images inside the table and i want to display only the cells that are not empty. For example if there is only 2 pictures added in the database i want …

Member Avatar for gce517
1
94
Member Avatar for Stefce

I am trying to insert into table with PHP and MySQL but the page only refresh it self when i press the button. I haven't done debugging, i have an IF statement that displays any errors that fires if the SQL query have errors. But the thing is even the …

Member Avatar for gce517
1
198
Member Avatar for varcore

i am running ubuntu 22.04 and php 8.1 / MariaDB , i am missing somthing here in my code just can't see it. the premise of the code is to look at the TrolleyID Field and if it's '00000' basically echo's "BAD-READ" else it's 'GOOD-READ' any help would be great …

Member Avatar for Dani
1
100
Member Avatar for borobhaisab

Hi, $page = 10; echo 'page ' .$page; //echoes: 10 echo 'backward ' .$backward = $page--; //echoes: 10 echo "<br>"; echo "<br>"; echo 'forward ' .$forward = $page++; //echoes: 9 echo "<br>"; echo "<br>"; Strange! Why is the decrement failing ? Since $page = 10, then decrementing that ($backward) should …

Member Avatar for Dani
0
65
Member Avatar for borobhaisab

Hello, I know the safest way to write a pagination section with php is to use the http_build_query(). Like so: $i = 0; while($i<$total_pages) { $i++; if($_GET['bool']=='null') { //Page Format: $_GET List. $array = array("tbl"=>"$tbl","col_1"=>"$col_1","bool"=>"$bool","input_1"=>"$input_1","lmt"=>"$limit","pg"=>"$i"); } else { //Page Format: $_GET List. $array = array("tbl"=>"$tbl","col_1"=>"$col_1","col_2"=>"$col_2","bool"=>"$bool","input_1"=>"$input_1","input_2"=>"$input_2","lmt"=>"$limit","pg"=>"$i"); } $serps_url = $_SERVER['PHP_SELF'].'?'.http_build_query($array); if($i==$page) …

Member Avatar for Dani
0
155
Member Avatar for abu taher

I want to make a pdf file in php. I write code like this: <?php require_once __DIR__ . '/vendor/autoload.php'; include('conn.php'); $res = mysqli_query($conn, "select * from smash"); if (mysqli_num_rows($res) > 0) { $html = '<table>'; $html = '<tr><td>ID</td><td>Name</td><td>FatherName</td><td>Address</td><td>Phone</td><td>Class</td><td>Qualification</td><td>Branch</td><td>rollno</td></tr>'; while ($row = mysqli_fetch_assoc($res)) { $html .= '<tr><td>' . $row['id'] . '</td><td>' …

Member Avatar for mtyide
1
515
Member Avatar for dwlamb

I am parsing xml data generated by backup software for SMS and phone logs. Most of the data appears like this: ``` <sms protocol="0" address="##########" date="1495903715000" body="Ok. See you then.;-)" subject="none" ... /> ``` For most bodies of a text message, the data follows the same pattern above: Keyword `body="<string>"`. …

Member Avatar for pritaeas
1
201
Member Avatar for abu taher

I want to auto generate the id number. I write this code. But it's not work. I don't make primary key for id in database. function getData() { $data = array(); $data[1] = $_POST['name']; $data[2] = $_POST['fname']; $data[3] = $_POST['address']; $data[4] = $_POST['phone']; $data[5] = $_POST['class']; $data[6] = $_POST['qualification']; $data[7] …

Member Avatar for abu taher
0
141
Member Avatar for sushu1209

Hi, I need to split the pdf document into two parts,like i have a pdf which consists 100 pages,i need to split the pdf into two parts where first part consits 10 pages and second part consists 1 to 100 pages?how to do that using php?

Member Avatar for Dani
0
6K
Member Avatar for RC_820

hii all, btw i want to make login system, and check if user is multiple login and give notification in current user login, how can i make it ?? can someone please suggest/teach me to make system like that? Previously I've searched for it on google but couldn't find the …

Member Avatar for Dani
1
104
Member Avatar for Jaklins

Hello This is a simple php login script with sessions. It connects to mySQL for usernames and passwords. I’m using a variation of the code from [url]http://www.phpportalen.net/wiki/index.php?page=Enkel+Inloggning+med+Mysql+och+sessioner+-+Komplett+kod[/url] (index.php is the relevant part) Here is my code (my script is called login.php): [code=php] <?php session_start(); // Always at the top include …

Member Avatar for Bharath_6
0
11K
Member Avatar for emsanator

$html = 'Hello there this is image 1 <img src="http://www.example.com/XXX1.jpg" width="653" height="340" alt="xxx" title="xxx"> !! And Now you can see image number 2 <img src="http://www.example.com/XXX2.jpg" width="653" height="340" alt="xxx" title="xxx"> yep.'; $dom = new DOMDocument; $dom->loadHTML($html); $imgs = $dom->getElementsByTagName('img'); $imgURLs = []; foreach ($imgs as $img) { if (!$img->hasAttribute('src')) { continue; …

0
52
Member Avatar for danny4444

Hi there, I am having trouble with a php mail attachment. I have never done this before. I have got to the point where the script sends a blank message with a title... but no attachment and no body of the email is seen. I have opened up the email …

Member Avatar for Rick_15
0
3K
Member Avatar for joshl_1995

Hello Daniweb, I was wondering how come a cURL API I made to call a function from my other website (but on the same hosting plan) no longer works. I even tried making a test API to call in the same directory, eg... :api.php <?php die(json_encode("something")); ?> :testing.php <?php $url …

Member Avatar for Dani
0
3K
Member Avatar for matei_

If you download multiple files with the same name, a number is automatically added to the file name, for example: filename(1), filename(2) etc.. What I am trying to do is when I am creating a name and there is already a same one, the name I create to appear in …

Member Avatar for matei_
0
126
Member Avatar for Raju_3

The End.